/*-1* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)2*3* This file defines the kernel interface of FUSE4* Copyright (C) 2001-2008 Miklos Szeredi <[email protected]>5*6* This program can be distributed under the terms of the GNU GPL.7* See the file COPYING.8*9* This -- and only this -- header file may also be distributed under10* the terms of the BSD Licence as follows:11*12* Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved.13*14* Redistribution and use in source and binary forms, with or without15* modification, are permitted provided that the following conditions16* are met:17* 1. Redistributions of source code must retain the above copyright18* notice, this list of conditions and the following disclaimer.19* 2. Redistributions in binary form must reproduce the above copyright20* notice, this list of conditions and the following disclaimer in the21* documentation and/or other materials provided with the distribution.22*23* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND24* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE25* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE26* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE27* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL28* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS29* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)30* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT31* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY32* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF33* SUCH DAMAGE.34*/3536/*37* This file defines the kernel interface of FUSE38*39* Protocol changelog:40*41* 7.1:42* - add the following messages:43* FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK,44* FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE,45* FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR,46* FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR,47* FUSE_RELEASEDIR48* - add padding to messages to accommodate 32-bit servers on 64-bit kernels49*50* 7.2:51* - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags52* - add FUSE_FSYNCDIR message53*54* 7.3:55* - add FUSE_ACCESS message56* - add FUSE_CREATE message57* - add filehandle to fuse_setattr_in58*59* 7.4:60* - add frsize to fuse_kstatfs61* - clean up request size limit checking62*63* 7.5:64* - add flags and max_write to fuse_init_out65*66* 7.6:67* - add max_readahead to fuse_init_in and fuse_init_out68*69* 7.7:70* - add FUSE_INTERRUPT message71* - add POSIX file lock support72*73* 7.8:74* - add lock_owner and flags fields to fuse_release_in75* - add FUSE_BMAP message76* - add FUSE_DESTROY message77*78* 7.9:79* - new fuse_getattr_in input argument of GETATTR80* - add lk_flags in fuse_lk_in81* - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in82* - add blksize field to fuse_attr83* - add file flags field to fuse_read_in and fuse_write_in84* - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in85*86* 7.1087* - add nonseekable open flag88*89* 7.1190* - add IOCTL message91* - add unsolicited notification support92* - add POLL message and NOTIFY_POLL notification93*94* 7.1295* - add umask flag to input argument of create, mknod and mkdir96* - add notification messages for invalidation of inodes and97* directory entries98*99* 7.13100* - make max number of background requests and congestion threshold101* tunables102*103* 7.14104* - add splice support to fuse device105*106* 7.15107* - add store notify108* - add retrieve notify109*110* 7.16111* - add BATCH_FORGET request112* - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct113* fuse_ioctl_iovec' instead of ambiguous 'struct iovec'114* - add FUSE_IOCTL_32BIT flag115*116* 7.17117* - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK118*119* 7.18120* - add FUSE_IOCTL_DIR flag121* - add FUSE_NOTIFY_DELETE122*123* 7.19124* - add FUSE_FALLOCATE125*126* 7.20127* - add FUSE_AUTO_INVAL_DATA128*129* 7.21130* - add FUSE_READDIRPLUS131* - send the requested events in POLL request132*133* 7.22134* - add FUSE_ASYNC_DIO135*136* 7.23137* - add FUSE_WRITEBACK_CACHE138* - add time_gran to fuse_init_out139* - add reserved space to fuse_init_out140* - add FATTR_CTIME141* - add ctime and ctimensec to fuse_setattr_in142* - add FUSE_RENAME2 request143* - add FUSE_NO_OPEN_SUPPORT flag144*145* 7.24146* - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support147*148* 7.25149* - add FUSE_PARALLEL_DIROPS150*151* 7.26152* - add FUSE_HANDLE_KILLPRIV153* - add FUSE_POSIX_ACL154*155* 7.27156* - add FUSE_ABORT_ERROR157*158* 7.28159* - add FUSE_COPY_FILE_RANGE160* - add FOPEN_CACHE_DIR161* - add FUSE_MAX_PAGES, add max_pages to init_out162* - add FUSE_CACHE_SYMLINKS163*164* 7.29165* - add FUSE_NO_OPENDIR_SUPPORT flag166*167* 7.30168* - add FUSE_EXPLICIT_INVAL_DATA169* - add FUSE_IOCTL_COMPAT_X32170*171* 7.31172* - add FUSE_WRITE_KILL_PRIV flag173* - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING174* - add map_alignment to fuse_init_out, add FUSE_MAP_ALIGNMENT flag175*176* 7.32177* - add flags to fuse_attr, add FUSE_ATTR_SUBMOUNT, add FUSE_SUBMOUNTS178*179* 7.33180* - add FUSE_HANDLE_KILLPRIV_V2, FUSE_WRITE_KILL_SUIDGID, FATTR_KILL_SUIDGID181* - add FUSE_OPEN_KILL_SUIDGID182* - extend fuse_setxattr_in, add FUSE_SETXATTR_EXT183* - add FUSE_SETXATTR_ACL_KILL_SGID184*185* 7.34186* - add FUSE_SYNCFS187*188* 7.35189* - add FOPEN_NOFLUSH190*/191192#ifndef _FUSE_FUSE_KERNEL_H193#define _FUSE_FUSE_KERNEL_H194195#ifdef __linux__196#include <linux/types.h>197#else198#include <sys/types.h>199#endif200201/*202* Version negotiation:203*204* Both the kernel and userspace send the version they support in the205* INIT request and reply respectively.206*207* If the major versions match then both shall use the smallest208* of the two minor versions for communication.209*210* If the kernel supports a larger major version, then userspace shall211* reply with the major version it supports, ignore the rest of the212* INIT message and expect a new INIT message from the kernel with a213* matching major version.214*215* If the library supports a larger major version, then it shall fall216* back to the major protocol version sent by the kernel for217* communication and reply with that major version (and an arbitrary218* supported minor version).219*/220221/** Version number of this interface */222#define FUSE_KERNEL_VERSION 7223224/** Minor version number of this interface */225#define FUSE_KERNEL_MINOR_VERSION 35226227/** The node ID of the root inode */228#define FUSE_ROOT_ID 1229230/* Make sure all structures are padded to 64bit boundary, so 32bit231userspace works under 64bit kernels */232233struct fuse_attr {234uint64_t ino;235uint64_t size;236uint64_t blocks;237uint64_t atime;238uint64_t mtime;239uint64_t ctime;240uint32_t atimensec;241uint32_t mtimensec;242uint32_t ctimensec;243uint32_t mode;244uint32_t nlink;245uint32_t uid;246uint32_t gid;247uint32_t rdev;248uint32_t blksize;249uint32_t flags;250};251252struct fuse_kstatfs {253uint64_t blocks;254uint64_t bfree;255uint64_t bavail;256uint64_t files;257uint64_t ffree;258uint32_t bsize;259uint32_t namelen;260uint32_t frsize;261uint32_t padding;262uint32_t spare[6];263};264265struct fuse_file_lock {266uint64_t start;267uint64_t end;268uint32_t type;269uint32_t pid; /* tgid */270};271272/**273* Bitmasks for fuse_setattr_in.valid274*/275#define FATTR_MODE (1 << 0)276#define FATTR_UID (1 << 1)277#define FATTR_GID (1 << 2)278#define FATTR_SIZE (1 << 3)279#define FATTR_ATIME (1 << 4)280#define FATTR_MTIME (1 << 5)281#define FATTR_FH (1 << 6)282#define FATTR_ATIME_NOW (1 << 7)283#define FATTR_MTIME_NOW (1 << 8)284#define FATTR_LOCKOWNER (1 << 9)285#define FATTR_CTIME (1 << 10)286#define FATTR_KILL_SUIDGID (1 << 11)287288/**289* Flags returned by the OPEN request290*291* FOPEN_DIRECT_IO: bypass page cache for this open file292* FOPEN_KEEP_CACHE: don't invalidate the data cache on open293* FOPEN_NONSEEKABLE: the file is not seekable294* FOPEN_CACHE_DIR: allow caching this directory295* FOPEN_STREAM: the file is stream-like (no file position at all)296* FOPEN_NOFLUSH: don't flush data cache on close (unless FUSE_WRITEBACK_CACHE)297*/298#define FOPEN_DIRECT_IO (1 << 0)299#define FOPEN_KEEP_CACHE (1 << 1)300#define FOPEN_NONSEEKABLE (1 << 2)301#define FOPEN_CACHE_DIR (1 << 3)302#define FOPEN_STREAM (1 << 4)303#define FOPEN_NOFLUSH (1 << 5)304305/**306* INIT request/reply flags307*308* FUSE_ASYNC_READ: asynchronous read requests309* FUSE_POSIX_LOCKS: remote locking for POSIX file locks310* FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)311* FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem312* FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."313* FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB314* FUSE_DONT_MASK: don't apply umask to file mode on create operations315* FUSE_SPLICE_WRITE: kernel supports splice write on the device316* FUSE_SPLICE_MOVE: kernel supports splice move on the device317* FUSE_SPLICE_READ: kernel supports splice read on the device318* FUSE_FLOCK_LOCKS: remote locking for BSD style file locks319* FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories320* FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages321* FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)322* FUSE_READDIRPLUS_AUTO: adaptive readdirplus323* FUSE_ASYNC_DIO: asynchronous direct I/O submission324* FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes325* FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens326* FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir327* FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc328* FUSE_POSIX_ACL: filesystem supports posix acls329* FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED330* FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages331* FUSE_CACHE_SYMLINKS: cache READLINK responses332* FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir333* FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request334* FUSE_MAP_ALIGNMENT: init_out.map_alignment contains log2(byte alignment) for335* foffset and moffset fields in struct336* fuse_setupmapping_out and fuse_removemapping_one.337* FUSE_SUBMOUNTS: kernel supports auto-mounting directory submounts338* FUSE_HANDLE_KILLPRIV_V2: fs kills suid/sgid/cap on write/chown/trunc.339* Upon write/truncate suid/sgid is only killed if caller340* does not have CAP_FSETID. Additionally upon341* write/truncate sgid is killed only if file has group342* execute permission. (Same as Linux VFS behavior).343* FUSE_SETXATTR_EXT: Server supports extended struct fuse_setxattr_in344*/345#define FUSE_ASYNC_READ (1 << 0)346#define FUSE_POSIX_LOCKS (1 << 1)347#define FUSE_FILE_OPS (1 << 2)348#define FUSE_ATOMIC_O_TRUNC (1 << 3)349#define FUSE_EXPORT_SUPPORT (1 << 4)350#define FUSE_BIG_WRITES (1 << 5)351#define FUSE_DONT_MASK (1 << 6)352#define FUSE_SPLICE_WRITE (1 << 7)353#define FUSE_SPLICE_MOVE (1 << 8)354#define FUSE_SPLICE_READ (1 << 9)355#define FUSE_FLOCK_LOCKS (1 << 10)356#define FUSE_HAS_IOCTL_DIR (1 << 11)357#define FUSE_AUTO_INVAL_DATA (1 << 12)358#define FUSE_DO_READDIRPLUS (1 << 13)359#define FUSE_READDIRPLUS_AUTO (1 << 14)360#define FUSE_ASYNC_DIO (1 << 15)361#define FUSE_WRITEBACK_CACHE (1 << 16)362#define FUSE_NO_OPEN_SUPPORT (1 << 17)363#define FUSE_PARALLEL_DIROPS (1 << 18)364#define FUSE_HANDLE_KILLPRIV (1 << 19)365#define FUSE_POSIX_ACL (1 << 20)366#define FUSE_ABORT_ERROR (1 << 21)367#define FUSE_MAX_PAGES (1 << 22)368#define FUSE_CACHE_SYMLINKS (1 << 23)369#define FUSE_NO_OPENDIR_SUPPORT (1 << 24)370#define FUSE_EXPLICIT_INVAL_DATA (1 << 25)371#define FUSE_MAP_ALIGNMENT (1 << 26)372#define FUSE_SUBMOUNTS (1 << 27)373#define FUSE_HANDLE_KILLPRIV_V2 (1 << 28)374#define FUSE_SETXATTR_EXT (1 << 29)375376#ifdef linux377/**378* CUSE INIT request/reply flags379*380* CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl381*/382#define CUSE_UNRESTRICTED_IOCTL (1 << 0)383#endif /* linux */384385/**386* Release flags387*/388#define FUSE_RELEASE_FLUSH (1 << 0)389#define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1)390391/**392* Getattr flags393*/394#define FUSE_GETATTR_FH (1 << 0)395396/**397* Lock flags398*/399#define FUSE_LK_FLOCK (1 << 0)400401/**402* WRITE flags403*404* FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed405* FUSE_WRITE_LOCKOWNER: lock_owner field is valid406* FUSE_WRITE_KILL_SUIDGID: kill suid and sgid bits407*/408#define FUSE_WRITE_CACHE (1 << 0)409#define FUSE_WRITE_LOCKOWNER (1 << 1)410#define FUSE_WRITE_KILL_SUIDGID (1 << 2)411412/* Obsolete alias; this flag implies killing suid/sgid only. */413#define FUSE_WRITE_KILL_PRIV FUSE_WRITE_KILL_SUIDGID414415/**416* Read flags417*/418#define FUSE_READ_LOCKOWNER (1 << 1)419420/**421* Ioctl flags422*423* FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine424* FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed425* FUSE_IOCTL_RETRY: retry with new iovecs426* FUSE_IOCTL_32BIT: 32bit ioctl427* FUSE_IOCTL_DIR: is a directory428* FUSE_IOCTL_COMPAT_X32: x32 compat ioctl on 64bit machine (64bit time_t)429*430* FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs431*/432#define FUSE_IOCTL_COMPAT (1 << 0)433#define FUSE_IOCTL_UNRESTRICTED (1 << 1)434#define FUSE_IOCTL_RETRY (1 << 2)435#define FUSE_IOCTL_32BIT (1 << 3)436#define FUSE_IOCTL_DIR (1 << 4)437#define FUSE_IOCTL_COMPAT_X32 (1 << 5)438439#define FUSE_IOCTL_MAX_IOV 256440441/**442* Poll flags443*444* FUSE_POLL_SCHEDULE_NOTIFY: request poll notify445*/446#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)447448/**449* Fsync flags450*451* FUSE_FSYNC_FDATASYNC: Sync data only, not metadata452*/453#define FUSE_FSYNC_FDATASYNC (1 << 0)454455/**456* Fallocate flags.457*/458#define FUSE_FALLOC_FL_KEEP_SIZE 0x1459#define FUSE_FALLOC_FL_PUNCH_HOLE 0x2460461/**462* fuse_attr flags463*464* FUSE_ATTR_SUBMOUNT: Object is a submount root465*/466#define FUSE_ATTR_SUBMOUNT (1 << 0)467468/**469* Open flags470* FUSE_OPEN_KILL_SUIDGID: Kill suid and sgid if executable471*/472#define FUSE_OPEN_KILL_SUIDGID (1 << 0)473474/**475* setxattr flags476* FUSE_SETXATTR_ACL_KILL_SGID: Clear SGID when system.posix_acl_access is set477*/478#define FUSE_SETXATTR_ACL_KILL_SGID (1 << 0)479480enum fuse_opcode {481FUSE_LOOKUP = 1,482FUSE_FORGET = 2, /* no reply */483FUSE_GETATTR = 3,484FUSE_SETATTR = 4,485FUSE_READLINK = 5,486FUSE_SYMLINK = 6,487FUSE_MKNOD = 8,488FUSE_MKDIR = 9,489FUSE_UNLINK = 10,490FUSE_RMDIR = 11,491FUSE_RENAME = 12,492FUSE_LINK = 13,493FUSE_OPEN = 14,494FUSE_READ = 15,495FUSE_WRITE = 16,496FUSE_STATFS = 17,497FUSE_RELEASE = 18,498FUSE_FSYNC = 20,499FUSE_SETXATTR = 21,500FUSE_GETXATTR = 22,501FUSE_LISTXATTR = 23,502FUSE_REMOVEXATTR = 24,503FUSE_FLUSH = 25,504FUSE_INIT = 26,505FUSE_OPENDIR = 27,506FUSE_READDIR = 28,507FUSE_RELEASEDIR = 29,508FUSE_FSYNCDIR = 30,509FUSE_GETLK = 31,510FUSE_SETLK = 32,511FUSE_SETLKW = 33,512FUSE_ACCESS = 34,513FUSE_CREATE = 35,514FUSE_INTERRUPT = 36,515FUSE_BMAP = 37,516FUSE_DESTROY = 38,517FUSE_IOCTL = 39,518FUSE_POLL = 40,519FUSE_NOTIFY_REPLY = 41,520FUSE_BATCH_FORGET = 42,521FUSE_FALLOCATE = 43,522FUSE_READDIRPLUS = 44,523FUSE_RENAME2 = 45,524FUSE_LSEEK = 46,525FUSE_COPY_FILE_RANGE = 47,526FUSE_SETUPMAPPING = 48,527FUSE_REMOVEMAPPING = 49,528FUSE_SYNCFS = 50,529530#ifdef linux531/* CUSE specific operations */532CUSE_INIT = 4096,533/* Reserved opcodes: helpful to detect structure endian-ness */534CUSE_INIT_BSWAP_RESERVED = 1048576, /* CUSE_INIT << 8 */535FUSE_INIT_BSWAP_RESERVED = 436207616, /* FUSE_INIT << 24 */536#endif /* linux */537};538539enum fuse_notify_code {540FUSE_NOTIFY_POLL = 1,541FUSE_NOTIFY_INVAL_INODE = 2,542FUSE_NOTIFY_INVAL_ENTRY = 3,543FUSE_NOTIFY_STORE = 4,544FUSE_NOTIFY_RETRIEVE = 5,545FUSE_NOTIFY_DELETE = 6,546FUSE_NOTIFY_CODE_MAX,547};548549/* The read buffer is required to be at least 8k, but may be much larger */550#define FUSE_MIN_READ_BUFFER 8192551552#define FUSE_COMPAT_ENTRY_OUT_SIZE 120553554struct fuse_entry_out {555uint64_t nodeid; /* Inode ID */556uint64_t generation; /* Inode generation: nodeid:gen must557be unique for the fs's lifetime */558uint64_t entry_valid; /* Cache timeout for the name */559uint64_t attr_valid; /* Cache timeout for the attributes */560uint32_t entry_valid_nsec;561uint32_t attr_valid_nsec;562struct fuse_attr attr;563};564565struct fuse_forget_in {566uint64_t nlookup;567};568569struct fuse_forget_one {570uint64_t nodeid;571uint64_t nlookup;572};573574struct fuse_batch_forget_in {575uint32_t count;576uint32_t dummy;577};578579struct fuse_getattr_in {580uint32_t getattr_flags;581uint32_t dummy;582uint64_t fh;583};584585#define FUSE_COMPAT_ATTR_OUT_SIZE 96586587struct fuse_attr_out {588uint64_t attr_valid; /* Cache timeout for the attributes */589uint32_t attr_valid_nsec;590uint32_t dummy;591struct fuse_attr attr;592};593594#define FUSE_COMPAT_MKNOD_IN_SIZE 8595596struct fuse_mknod_in {597uint32_t mode;598uint32_t rdev;599uint32_t umask;600uint32_t padding;601};602603struct fuse_mkdir_in {604uint32_t mode;605uint32_t umask;606};607608struct fuse_rename_in {609uint64_t newdir;610};611612struct fuse_rename2_in {613uint64_t newdir;614uint32_t flags;615uint32_t padding;616};617618struct fuse_link_in {619uint64_t oldnodeid;620};621622struct fuse_setattr_in {623uint32_t valid;624uint32_t padding;625uint64_t fh;626uint64_t size;627uint64_t lock_owner;628uint64_t atime;629uint64_t mtime;630uint64_t ctime;631uint32_t atimensec;632uint32_t mtimensec;633uint32_t ctimensec;634uint32_t mode;635uint32_t unused4;636uint32_t uid;637uint32_t gid;638uint32_t unused5;639};640641struct fuse_open_in {642uint32_t flags;643uint32_t open_flags; /* FUSE_OPEN_... */644};645646struct fuse_create_in {647uint32_t flags;648uint32_t mode;649uint32_t umask;650uint32_t open_flags; /* FUSE_OPEN_... */651};652653struct fuse_open_out {654uint64_t fh;655uint32_t open_flags;656uint32_t padding;657};658659struct fuse_release_in {660uint64_t fh;661uint32_t flags;662uint32_t release_flags;663uint64_t lock_owner;664};665666struct fuse_flush_in {667uint64_t fh;668uint32_t unused;669uint32_t padding;670uint64_t lock_owner;671};672673struct fuse_read_in {674uint64_t fh;675uint64_t offset;676uint32_t size;677uint32_t read_flags;678uint64_t lock_owner;679uint32_t flags;680uint32_t padding;681};682683#define FUSE_COMPAT_WRITE_IN_SIZE 24684685struct fuse_write_in {686uint64_t fh;687uint64_t offset;688uint32_t size;689uint32_t write_flags;690uint64_t lock_owner;691uint32_t flags;692uint32_t padding;693};694695struct fuse_write_out {696uint32_t size;697uint32_t padding;698};699700#define FUSE_COMPAT_STATFS_SIZE 48701702struct fuse_statfs_out {703struct fuse_kstatfs st;704};705706struct fuse_fsync_in {707uint64_t fh;708uint32_t fsync_flags;709uint32_t padding;710};711712#define FUSE_COMPAT_SETXATTR_IN_SIZE 8713714struct fuse_setxattr_in {715uint32_t size;716uint32_t flags;717uint32_t setxattr_flags;718uint32_t padding;719};720721struct fuse_listxattr_in {722uint32_t size;723uint32_t padding;724};725726struct fuse_listxattr_out {727uint32_t size;728uint32_t padding;729};730731struct fuse_getxattr_in {732uint32_t size;733uint32_t padding;734};735736struct fuse_getxattr_out {737uint32_t size;738uint32_t padding;739};740741struct fuse_lk_in {742uint64_t fh;743uint64_t owner;744struct fuse_file_lock lk;745uint32_t lk_flags;746uint32_t padding;747};748749struct fuse_lk_out {750struct fuse_file_lock lk;751};752753struct fuse_access_in {754uint32_t mask;755uint32_t padding;756};757758struct fuse_init_in {759uint32_t major;760uint32_t minor;761uint32_t max_readahead;762uint32_t flags;763};764765#define FUSE_COMPAT_INIT_OUT_SIZE 8766#define FUSE_COMPAT_22_INIT_OUT_SIZE 24767768struct fuse_init_out {769uint32_t major;770uint32_t minor;771uint32_t max_readahead;772uint32_t flags;773uint16_t max_background;774uint16_t congestion_threshold;775uint32_t max_write;776uint32_t time_gran;777uint16_t max_pages;778uint16_t map_alignment;779uint32_t unused[8];780};781782#ifdef linux783#define CUSE_INIT_INFO_MAX 4096784785struct cuse_init_in {786uint32_t major;787uint32_t minor;788uint32_t unused;789uint32_t flags;790};791792struct cuse_init_out {793uint32_t major;794uint32_t minor;795uint32_t unused;796uint32_t flags;797uint32_t max_read;798uint32_t max_write;799uint32_t dev_major; /* chardev major */800uint32_t dev_minor; /* chardev minor */801uint32_t spare[10];802};803#endif /* linux */804805struct fuse_interrupt_in {806uint64_t unique;807};808809struct fuse_bmap_in {810uint64_t block;811uint32_t blocksize;812uint32_t padding;813};814815struct fuse_bmap_out {816uint64_t block;817};818819struct fuse_ioctl_in {820uint64_t fh;821uint32_t flags;822uint32_t cmd;823uint64_t arg;824uint32_t in_size;825uint32_t out_size;826};827828struct fuse_ioctl_iovec {829uint64_t base;830uint64_t len;831};832833struct fuse_ioctl_out {834int32_t result;835uint32_t flags;836uint32_t in_iovs;837uint32_t out_iovs;838};839840struct fuse_poll_in {841uint64_t fh;842uint64_t kh;843uint32_t flags;844uint32_t events;845};846847struct fuse_poll_out {848uint32_t revents;849uint32_t padding;850};851852struct fuse_notify_poll_wakeup_out {853uint64_t kh;854};855856struct fuse_fallocate_in {857uint64_t fh;858uint64_t offset;859uint64_t length;860uint32_t mode;861uint32_t padding;862};863864struct fuse_in_header {865uint32_t len;866uint32_t opcode;867uint64_t unique;868uint64_t nodeid;869uint32_t uid;870uint32_t gid;871uint32_t pid;872uint32_t padding;873};874875struct fuse_out_header {876uint32_t len;877int32_t error;878uint64_t unique;879};880881struct fuse_dirent {882uint64_t ino;883uint64_t off;884uint32_t namelen;885uint32_t type;886char name[];887};888889#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)890#define FUSE_DIRENT_ALIGN(x) \891(((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))892#define FUSE_DIRENT_SIZE(d) \893FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)894895struct fuse_direntplus {896struct fuse_entry_out entry_out;897struct fuse_dirent dirent;898};899900#define FUSE_NAME_OFFSET_DIRENTPLUS \901offsetof(struct fuse_direntplus, dirent.name)902#define FUSE_DIRENTPLUS_SIZE(d) \903FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)904905struct fuse_notify_inval_inode_out {906uint64_t ino;907int64_t off;908int64_t len;909};910911struct fuse_notify_inval_entry_out {912uint64_t parent;913uint32_t namelen;914uint32_t padding;915};916917struct fuse_notify_delete_out {918uint64_t parent;919uint64_t child;920uint32_t namelen;921uint32_t padding;922};923924struct fuse_notify_store_out {925uint64_t nodeid;926uint64_t offset;927uint32_t size;928uint32_t padding;929};930931struct fuse_notify_retrieve_out {932uint64_t notify_unique;933uint64_t nodeid;934uint64_t offset;935uint32_t size;936uint32_t padding;937};938939/* Matches the size of fuse_write_in */940struct fuse_notify_retrieve_in {941uint64_t dummy1;942uint64_t offset;943uint32_t size;944uint32_t dummy2;945uint64_t dummy3;946uint64_t dummy4;947};948949/* Device ioctls: */950#define FUSE_DEV_IOC_MAGIC 229951#define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t)952953struct fuse_lseek_in {954uint64_t fh;955uint64_t offset;956uint32_t whence;957uint32_t padding;958};959960struct fuse_lseek_out {961uint64_t offset;962};963964struct fuse_copy_file_range_in {965uint64_t fh_in;966uint64_t off_in;967uint64_t nodeid_out;968uint64_t fh_out;969uint64_t off_out;970uint64_t len;971uint64_t flags;972};973974#define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0)975#define FUSE_SETUPMAPPING_FLAG_READ (1ull << 1)976struct fuse_setupmapping_in {977/* An already open handle */978uint64_t fh;979/* Offset into the file to start the mapping */980uint64_t foffset;981/* Length of mapping required */982uint64_t len;983/* Flags, FUSE_SETUPMAPPING_FLAG_* */984uint64_t flags;985/* Offset in Memory Window */986uint64_t moffset;987};988989struct fuse_removemapping_in {990/* number of fuse_removemapping_one follows */991uint32_t count;992};993994struct fuse_removemapping_one {995/* Offset into the dax window start the unmapping */996uint64_t moffset;997/* Length of mapping required */998uint64_t len;999};10001001#define FUSE_REMOVEMAPPING_MAX_ENTRY \1002(PAGE_SIZE / sizeof(struct fuse_removemapping_one))10031004struct fuse_syncfs_in {1005uint64_t padding;1006};10071008#endif /* _FUSE_FUSE_KERNEL_H */100910101011