summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/VirtioFsDxe/FuseInit.c
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2020-12-16 22:11:09 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-12-21 17:16:23 +0000
commitd98d7e3005cb5222af490355ec87758db318d7a3 (patch)
treeb5cbfbb0f424985d23432379b4599eea8b413722 /OvmfPkg/VirtioFsDxe/FuseInit.c
parentc4edb49b4f074f8d22a9c5e8f337dc29658de01c (diff)
downloadedk2-d98d7e3005cb5222af490355ec87758db318d7a3.tar.gz
edk2-d98d7e3005cb5222af490355ec87758db318d7a3.tar.bz2
edk2-d98d7e3005cb5222af490355ec87758db318d7a3.zip
OvmfPkg/VirtioFsDxe: add a shared wrapper for FUSE_READ / FUSE_READDIRPLUS
Add the VirtioFsFuseReadFileOrDir() function, for sending the FUSE_READ or FUSE_READDIRPLUS command to the Virtio Filesystem device. Parsing the structured FUSE_READDIRPLUS output is complex, and cannot be integrated into the wrapper function. Given that fact, FUSE_READ and FUSE_READDIRPLUS turn out to need identical low-level handling, except for the opcode. Hence the shared wrapper function. (It's prudent to verify whether the FUSE server supports FUSE_READDIRPLUS, so update the session init code accordingly.) This is the first FUSE request wrapper function that deals with a variable size tail buffer. 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-33-lersek@redhat.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Diffstat (limited to 'OvmfPkg/VirtioFsDxe/FuseInit.c')
-rw-r--r--OvmfPkg/VirtioFsDxe/FuseInit.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/OvmfPkg/VirtioFsDxe/FuseInit.c b/OvmfPkg/VirtioFsDxe/FuseInit.c
index aa19dbdc05..7aa6ee75ca 100644
--- a/OvmfPkg/VirtioFsDxe/FuseInit.c
+++ b/OvmfPkg/VirtioFsDxe/FuseInit.c
@@ -26,7 +26,8 @@
@retval EFI_SUCCESS The FUSE session has been started.
- @retval EFI_UNSUPPORTED FUSE interface version negotiation failed.
+ @retval EFI_UNSUPPORTED FUSE interface version or feature negotiation
+ failed.
@return The "errno" value mapped to an EFI_STATUS code, if
the Virtio Filesystem device explicitly reported an
@@ -97,7 +98,7 @@ VirtioFsFuseInitSession (
InitReq.Major = VIRTIO_FS_FUSE_MAJOR;
InitReq.Minor = VIRTIO_FS_FUSE_MINOR;
InitReq.MaxReadahead = 0;
- InitReq.Flags = 0;
+ InitReq.Flags = VIRTIO_FS_FUSE_INIT_REQ_F_DO_READDIRPLUS;
//
// Submit the request.
@@ -121,10 +122,11 @@ VirtioFsFuseInitSession (
}
//
- // Check FUSE interface version compatibility.
+ // Check FUSE interface version / feature compatibility.
//
if (InitResp.Major < InitReq.Major ||
- (InitResp.Major == InitReq.Major && InitResp.Minor < InitReq.Minor)) {
+ (InitResp.Major == InitReq.Major && InitResp.Minor < InitReq.Minor) ||
+ (InitResp.Flags & VIRTIO_FS_FUSE_INIT_REQ_F_DO_READDIRPLUS) == 0) {
return EFI_UNSUPPORTED;
}