FB_SETUP(9) | Kernel Developer's Manual | FB_SETUP(9) |
fb_setup
,
fb_queue
, fb_delete
—
kernel messaging mechanism for file system in userland
(FUSE)
#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);
void
fb_delete
(struct
fusebuf *fbuf);
#define FUSEBUFMAXSIZE (4096*1024) #define FUSEBUFSIZE (sizeof(struct fusebuf)) struct fb_hdr { SIMPLEQ_ENTRY(fusebuf) fh_next; size_t fh_len; int 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; union { struct statvfs FD_stat; struct stat FD_attr; struct fb_io FD_io; } FD; uint8_t *fb_dat; }; #define fb_next fb_hdr.fh_next #define fb_len fb_hdr.fh_len #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 FD.FD_stat #define fb_attr FD.FD_attr #define fb_io_fd FD.FD_io.fi_fd #define fb_io_ino FD.FD_io.fi_ino #define fb_io_off FD.FD_io.fi_off #define fb_io_len FD.FD_io.fi_len #define fb_io_mode FD.FD_io.fi_mode #define fb_io_flags FD.FD_io.fi_flags
These functions provide a way to manage the kernel messaging mechanism for fuse(4) file systems. It is based on mbuf(9).
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:
fb_queue
().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_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 stat. Settattr uses FD_stat and encapsulates a struct fb_io in F_databuf with fbtod.
Fusebufs can be deleted with the
fb_delete
()
helper.
errno(2), fuse_main(3), queue(3), statvfs(3), fuse(4), arc4random(9), mbuf(9)
The fb_setup
API first appeared in
OpenBSD 5.4.
November 30, 2017 | OpenBSD-6.8 |