FUSEBUF(9) | Kernel Developer's Manual | FUSEBUF(9) |
fusebuf
—
#include <sys/fusebuf.h>
struct fusebuf *
fb_setup
(size_t
size, ino_t inode,
int type,
struct proc *p);
int
fb_queue
(dev_t
dev, struct fusebuf
*fbuf);
#define FUSEBUFSIZE 4096 #define FUSEFDSIZE sizeof(((struct fusebuf *)0)->F_dat.FD) #define FUSELEN (FUSEBUFSIZE - sizeof(struct fb_hdr) - \ sizeof(union uFD)) struct fb_hdr { SIMPLEQ_ENTRY(fusebuf) fh_next; size_t fh_len; size_t fh_resid; uint32_t fh_err; int fh_type; ino_t fh_ino; uint64_t fh_uuid; }; struct fb_io { uint64_t fi_fd; ino_t fi_ino; off_t fi_off; size_t fi_len; mode_t fi_mode; uint32_t fi_flags; }; struct fusebuf { struct fb_hdr fb_hdr; struct { union uFD { struct statvfs FD_stat; struct vattr FD_vattr; struct fb_io FD_io; } FD; char F_databuf[FUSELEN]; } F_dat; }; #define fb_next fb_hdr.fh_next #define fb_len fb_hdr.fh_len #define fb_resid fb_hdr.fh_resid #define fb_err fb_hdr.fh_err #define fb_type fb_hdr.fh_type #define fb_ino fb_hdr.fh_ino #define fb_uuid fb_hdr.fh_uuid #define fb_stat F_dat.FD.FD_stat #define fb_vattr F_dat.FD.FD_vattr #define fb_io_fd F_dat.FD.FD_io.fi_fd #define fb_io_ino F_dat.FD.FD_io.fi_ino #define fb_io_off F_dat.FD.FD_io.fi_off #define fb_io_len F_dat.FD.FD_io.fi_len #define fb_io_mode F_dat.FD.FD_io.fi_mode #define fb_io_flags F_dat.FD.FD_io.fi_flags #define fb_dat F_dat.F_databuf
Each FUSE operation fits in a fusebuf
except for read, write, and readdirs, which are split into several fusebufs
with a changing value in fb_io_off for each. The size
of a fusebuf is FUSEBUFSIZE.
A fusebuf structure is defined as an fb_hdr followed by a structure containing a union and a buffer F_Dat. The header contains the following elements:
The fh_type variable can take the following values:
FBT_LOOKUP
FBT_GETATTR
FBT_SETATTR
FBT_READLINK
FBT_SYMLINK
FBT_MKNOD
FBT_MKDIR
FBT_UNLINK
FBT_RMDIR
FBT_RENAME
FBT_LINK
FBT_OPEN
FBT_READ
FBT_WRITE
FBT_STATFS
FBT_RELEASE
FBT_FSYNC
FBT_FLUSH
FBT_INIT
FBT_OPENDIR
FBT_READDIR
FBT_RELEASEDIR
FBT_FSYNCDIR
FBT_ACCESS
FBT_CREATE
FBT_DESTROY
All the data needed by the FUSE clients is contained in the F_dat structure. This structure contains a union FD of frequently used type and a buffer F_databuf to send data to libfuse. The union contains the following elements:
Setattr uses a struct fb_io and a struct vattr. Settattr uses FD_stat and encapsulates a struct fb_io in F_databuf with fbtod.
fusebuf
API first appeared in
OpenBSD 5.4.July 5, 2013 | OpenBSD-5.4 |