OvmfPkg/VirtioFsDxe: introduce the basic FUSE request/response headers
Introduce the VIRTIO_FS_FUSE_REQUEST and VIRTIO_FS_FUSE_RESPONSE structures, which are the common headers for the various FUSE request/response structures. Introduce the VirtioFsFuseNewRequest() helper function for populating VIRTIO_FS_FUSE_REQUEST, from parameters and from a VIRTIO_FS-level request counter. Introduce the VirtioFsFuseCheckResponse() helper function for verifying most FUSE response types that begin with the VIRTIO_FS_FUSE_RESPONSE header. 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-7-lersek@redhat.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
This commit is contained in:
committed by
mergify[bot]
parent
6578cacb46
commit
6a2dc768f0
@@ -49,4 +49,53 @@ typedef struct {
|
||||
} VIRTIO_FS_CONFIG;
|
||||
#pragma pack ()
|
||||
|
||||
//
|
||||
// FUSE-related definitions follow.
|
||||
//
|
||||
// From virtio-v1.1-cs01-87fa6b5d8155, 5.11 File System Device: "[...] The
|
||||
// driver acts as the FUSE client mounting the file system. The virtio file
|
||||
// system device provides the mechanism for transporting FUSE requests [...]"
|
||||
//
|
||||
// Unfortunately, the documentation of the FUSE wire protocol is lacking. The
|
||||
// Virtio spec (as of this writing) simply defers to
|
||||
// "include/uapi/linux/fuse.h" in the Linux kernel source -- see the reference
|
||||
// in virtio spec file "introduction.tex", at commit 87fa6b5d8155.
|
||||
//
|
||||
// Of course, "include/uapi/linux/fuse.h" is a moving target (the virtio spec
|
||||
// does not specify a particular FUSE interface version). The OvmfPkg code
|
||||
// targets version 7.31, because that's the lowest version that the QEMU
|
||||
// virtio-fs daemon supports at this time -- see QEMU commit 72c42e2d6551
|
||||
// ("virtiofsd: Trim out compatibility code", 2020-01-23).
|
||||
//
|
||||
// Correspondingly, Linux's "include/uapi/linux/fuse.h" is consulted as checked
|
||||
// out at commit (c6ff213fe5b8^) = d78092e4937d ("fuse: fix page dereference
|
||||
// after free", 2020-09-18); that is, right before commit c6ff213fe5b8 ("fuse:
|
||||
// add submount support to <uapi/linux/fuse.h>", 2020-09-18) introduces FUSE
|
||||
// interface version 7.32.
|
||||
//
|
||||
#define VIRTIO_FS_FUSE_MAJOR 7
|
||||
#define VIRTIO_FS_FUSE_MINOR 31
|
||||
|
||||
#pragma pack (1)
|
||||
//
|
||||
// Request-response headers common to all request types.
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 Len;
|
||||
UINT32 Opcode;
|
||||
UINT64 Unique;
|
||||
UINT64 NodeId;
|
||||
UINT32 Uid;
|
||||
UINT32 Gid;
|
||||
UINT32 Pid;
|
||||
UINT32 Padding;
|
||||
} VIRTIO_FS_FUSE_REQUEST;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Len;
|
||||
INT32 Error;
|
||||
UINT64 Unique;
|
||||
} VIRTIO_FS_FUSE_RESPONSE;
|
||||
#pragma pack ()
|
||||
|
||||
#endif // VIRTIO_FS_H_
|
||||
|
Reference in New Issue
Block a user