OvmfPkg/VirtioFsDxe: implement the wrapper function for FUSE_WRITE

Add the VirtioFsFuseWrite() function, for sending the FUSE_WRITE command
to the Virtio Filesystem device.

(For avoiding oversized FUSE_WRITE commands, save the maximum write buffer
size that is advertized by the FUSE server, in the session init code.)

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-39-lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
This commit is contained in:
Laszlo Ersek
2020-12-16 22:11:15 +01:00
committed by mergify[bot]
parent 867cb9f60c
commit 6f7bc7196f
5 changed files with 196 additions and 2 deletions

View File

@@ -22,7 +22,10 @@
@param[in,out] VirtioFs The Virtio Filesystem device to send the FUSE_INIT
request to. The FUSE request counter
"VirtioFs->RequestId" is set to 1 on output.
"VirtioFs->RequestId" is set to 1 on output. The
maximum write buffer size exposed in the FUSE_INIT
response is saved in "VirtioFs->MaxWrite", on
output.
@retval EFI_SUCCESS The FUSE session has been started.
@@ -126,9 +129,14 @@ VirtioFsFuseInitSession (
//
if (InitResp.Major < InitReq.Major ||
(InitResp.Major == InitReq.Major && InitResp.Minor < InitReq.Minor) ||
(InitResp.Flags & VIRTIO_FS_FUSE_INIT_REQ_F_DO_READDIRPLUS) == 0) {
(InitResp.Flags & VIRTIO_FS_FUSE_INIT_REQ_F_DO_READDIRPLUS) == 0 ||
InitResp.MaxWrite < SIZE_4KB) {
return EFI_UNSUPPORTED;
}
//
// Save the maximum write buffer size for FUSE_WRITE requests.
//
VirtioFs->MaxWrite = InitResp.MaxWrite;
return EFI_SUCCESS;
}