mirror of https://github.com/acidanthera/audk.git
OvmfPkg/VirtioFsDxe: add helper for determining file size update
Add the VirtioFsGetFuseSizeUpdate() function, for determining whether an EFI_FILE_PROTOCOL.SetInfo() invocation requests a file size update. Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3097 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20201216211125.19496-46-lersek@redhat.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
This commit is contained in:
parent
647340b0ce
commit
6c33d7b2b1
|
@ -2173,3 +2173,43 @@ VirtioFsFuseDirentPlusToEfiFileInfo (
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Given an EFI_FILE_INFO object received in an EFI_FILE_PROTOCOL.SetInfo()
|
||||||
|
call, determine whether updating the size of the file is necessary, relative
|
||||||
|
to an EFI_FILE_INFO object describing the current state of the file.
|
||||||
|
|
||||||
|
@param[in] Info The EFI_FILE_INFO describing the current state of the
|
||||||
|
file. The caller is responsible for populating Info on
|
||||||
|
input with VirtioFsFuseAttrToEfiFileInfo(), from the
|
||||||
|
current FUSE attributes of the file. The Info->Size and
|
||||||
|
Info->FileName members are ignored.
|
||||||
|
|
||||||
|
@param[in] NewInfo The EFI_FILE_INFO object received in the
|
||||||
|
EFI_FILE_PROTOCOL.SetInfo() call.
|
||||||
|
|
||||||
|
@param[out] Update Set to TRUE on output if the file size needs to be
|
||||||
|
updated. Set to FALSE otherwise.
|
||||||
|
|
||||||
|
@param[out] Size If Update is set to TRUE, then Size provides the new file
|
||||||
|
size to set. Otherwise, Size is not written to.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
VirtioFsGetFuseSizeUpdate (
|
||||||
|
IN EFI_FILE_INFO *Info,
|
||||||
|
IN EFI_FILE_INFO *NewInfo,
|
||||||
|
OUT BOOLEAN *Update,
|
||||||
|
OUT UINT64 *Size
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOLEAN IsDirectory;
|
||||||
|
|
||||||
|
IsDirectory = (BOOLEAN)((Info->Attribute & EFI_FILE_DIRECTORY) != 0);
|
||||||
|
|
||||||
|
if (IsDirectory || Info->FileSize == NewInfo->FileSize) {
|
||||||
|
*Update = FALSE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*Update = TRUE;
|
||||||
|
*Size = NewInfo->FileSize;
|
||||||
|
}
|
||||||
|
|
|
@ -282,6 +282,14 @@ VirtioFsFuseDirentPlusToEfiFileInfo (
|
||||||
IN OUT EFI_FILE_INFO *FileInfo
|
IN OUT EFI_FILE_INFO *FileInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
VirtioFsGetFuseSizeUpdate (
|
||||||
|
IN EFI_FILE_INFO *Info,
|
||||||
|
IN EFI_FILE_INFO *NewInfo,
|
||||||
|
OUT BOOLEAN *Update,
|
||||||
|
OUT UINT64 *Size
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Wrapper functions for FUSE commands (primitives).
|
// Wrapper functions for FUSE commands (primitives).
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue