1*a62a9e19SDr. David Alan Gilbert /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 2*a62a9e19SDr. David Alan Gilbert /* 3*a62a9e19SDr. David Alan Gilbert This file defines the kernel interface of FUSE 4*a62a9e19SDr. David Alan Gilbert Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> 5*a62a9e19SDr. David Alan Gilbert 6*a62a9e19SDr. David Alan Gilbert This program can be distributed under the terms of the GNU GPL. 7*a62a9e19SDr. David Alan Gilbert See the file COPYING. 8*a62a9e19SDr. David Alan Gilbert 9*a62a9e19SDr. David Alan Gilbert This -- and only this -- header file may also be distributed under 10*a62a9e19SDr. David Alan Gilbert the terms of the BSD Licence as follows: 11*a62a9e19SDr. David Alan Gilbert 12*a62a9e19SDr. David Alan Gilbert Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved. 13*a62a9e19SDr. David Alan Gilbert 14*a62a9e19SDr. David Alan Gilbert Redistribution and use in source and binary forms, with or without 15*a62a9e19SDr. David Alan Gilbert modification, are permitted provided that the following conditions 16*a62a9e19SDr. David Alan Gilbert are met: 17*a62a9e19SDr. David Alan Gilbert 1. Redistributions of source code must retain the above copyright 18*a62a9e19SDr. David Alan Gilbert notice, this list of conditions and the following disclaimer. 19*a62a9e19SDr. David Alan Gilbert 2. Redistributions in binary form must reproduce the above copyright 20*a62a9e19SDr. David Alan Gilbert notice, this list of conditions and the following disclaimer in the 21*a62a9e19SDr. David Alan Gilbert documentation and/or other materials provided with the distribution. 22*a62a9e19SDr. David Alan Gilbert 23*a62a9e19SDr. David Alan Gilbert THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 24*a62a9e19SDr. David Alan Gilbert ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25*a62a9e19SDr. David Alan Gilbert IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26*a62a9e19SDr. David Alan Gilbert ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 27*a62a9e19SDr. David Alan Gilbert FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28*a62a9e19SDr. David Alan Gilbert DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29*a62a9e19SDr. David Alan Gilbert OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30*a62a9e19SDr. David Alan Gilbert HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31*a62a9e19SDr. David Alan Gilbert LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32*a62a9e19SDr. David Alan Gilbert OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33*a62a9e19SDr. David Alan Gilbert SUCH DAMAGE. 34*a62a9e19SDr. David Alan Gilbert */ 35*a62a9e19SDr. David Alan Gilbert 36*a62a9e19SDr. David Alan Gilbert /* 37*a62a9e19SDr. David Alan Gilbert * This file defines the kernel interface of FUSE 38*a62a9e19SDr. David Alan Gilbert * 39*a62a9e19SDr. David Alan Gilbert * Protocol changelog: 40*a62a9e19SDr. David Alan Gilbert * 41*a62a9e19SDr. David Alan Gilbert * 7.1: 42*a62a9e19SDr. David Alan Gilbert * - add the following messages: 43*a62a9e19SDr. David Alan Gilbert * FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK, 44*a62a9e19SDr. David Alan Gilbert * FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE, 45*a62a9e19SDr. David Alan Gilbert * FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR, 46*a62a9e19SDr. David Alan Gilbert * FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR, 47*a62a9e19SDr. David Alan Gilbert * FUSE_RELEASEDIR 48*a62a9e19SDr. David Alan Gilbert * - add padding to messages to accommodate 32-bit servers on 64-bit kernels 49*a62a9e19SDr. David Alan Gilbert * 50*a62a9e19SDr. David Alan Gilbert * 7.2: 51*a62a9e19SDr. David Alan Gilbert * - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags 52*a62a9e19SDr. David Alan Gilbert * - add FUSE_FSYNCDIR message 53*a62a9e19SDr. David Alan Gilbert * 54*a62a9e19SDr. David Alan Gilbert * 7.3: 55*a62a9e19SDr. David Alan Gilbert * - add FUSE_ACCESS message 56*a62a9e19SDr. David Alan Gilbert * - add FUSE_CREATE message 57*a62a9e19SDr. David Alan Gilbert * - add filehandle to fuse_setattr_in 58*a62a9e19SDr. David Alan Gilbert * 59*a62a9e19SDr. David Alan Gilbert * 7.4: 60*a62a9e19SDr. David Alan Gilbert * - add frsize to fuse_kstatfs 61*a62a9e19SDr. David Alan Gilbert * - clean up request size limit checking 62*a62a9e19SDr. David Alan Gilbert * 63*a62a9e19SDr. David Alan Gilbert * 7.5: 64*a62a9e19SDr. David Alan Gilbert * - add flags and max_write to fuse_init_out 65*a62a9e19SDr. David Alan Gilbert * 66*a62a9e19SDr. David Alan Gilbert * 7.6: 67*a62a9e19SDr. David Alan Gilbert * - add max_readahead to fuse_init_in and fuse_init_out 68*a62a9e19SDr. David Alan Gilbert * 69*a62a9e19SDr. David Alan Gilbert * 7.7: 70*a62a9e19SDr. David Alan Gilbert * - add FUSE_INTERRUPT message 71*a62a9e19SDr. David Alan Gilbert * - add POSIX file lock support 72*a62a9e19SDr. David Alan Gilbert * 73*a62a9e19SDr. David Alan Gilbert * 7.8: 74*a62a9e19SDr. David Alan Gilbert * - add lock_owner and flags fields to fuse_release_in 75*a62a9e19SDr. David Alan Gilbert * - add FUSE_BMAP message 76*a62a9e19SDr. David Alan Gilbert * - add FUSE_DESTROY message 77*a62a9e19SDr. David Alan Gilbert * 78*a62a9e19SDr. David Alan Gilbert * 7.9: 79*a62a9e19SDr. David Alan Gilbert * - new fuse_getattr_in input argument of GETATTR 80*a62a9e19SDr. David Alan Gilbert * - add lk_flags in fuse_lk_in 81*a62a9e19SDr. David Alan Gilbert * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in 82*a62a9e19SDr. David Alan Gilbert * - add blksize field to fuse_attr 83*a62a9e19SDr. David Alan Gilbert * - add file flags field to fuse_read_in and fuse_write_in 84*a62a9e19SDr. David Alan Gilbert * - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in 85*a62a9e19SDr. David Alan Gilbert * 86*a62a9e19SDr. David Alan Gilbert * 7.10 87*a62a9e19SDr. David Alan Gilbert * - add nonseekable open flag 88*a62a9e19SDr. David Alan Gilbert * 89*a62a9e19SDr. David Alan Gilbert * 7.11 90*a62a9e19SDr. David Alan Gilbert * - add IOCTL message 91*a62a9e19SDr. David Alan Gilbert * - add unsolicited notification support 92*a62a9e19SDr. David Alan Gilbert * - add POLL message and NOTIFY_POLL notification 93*a62a9e19SDr. David Alan Gilbert * 94*a62a9e19SDr. David Alan Gilbert * 7.12 95*a62a9e19SDr. David Alan Gilbert * - add umask flag to input argument of create, mknod and mkdir 96*a62a9e19SDr. David Alan Gilbert * - add notification messages for invalidation of inodes and 97*a62a9e19SDr. David Alan Gilbert * directory entries 98*a62a9e19SDr. David Alan Gilbert * 99*a62a9e19SDr. David Alan Gilbert * 7.13 100*a62a9e19SDr. David Alan Gilbert * - make max number of background requests and congestion threshold 101*a62a9e19SDr. David Alan Gilbert * tunables 102*a62a9e19SDr. David Alan Gilbert * 103*a62a9e19SDr. David Alan Gilbert * 7.14 104*a62a9e19SDr. David Alan Gilbert * - add splice support to fuse device 105*a62a9e19SDr. David Alan Gilbert * 106*a62a9e19SDr. David Alan Gilbert * 7.15 107*a62a9e19SDr. David Alan Gilbert * - add store notify 108*a62a9e19SDr. David Alan Gilbert * - add retrieve notify 109*a62a9e19SDr. David Alan Gilbert * 110*a62a9e19SDr. David Alan Gilbert * 7.16 111*a62a9e19SDr. David Alan Gilbert * - add BATCH_FORGET request 112*a62a9e19SDr. David Alan Gilbert * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct 113*a62a9e19SDr. David Alan Gilbert * fuse_ioctl_iovec' instead of ambiguous 'struct iovec' 114*a62a9e19SDr. David Alan Gilbert * - add FUSE_IOCTL_32BIT flag 115*a62a9e19SDr. David Alan Gilbert * 116*a62a9e19SDr. David Alan Gilbert * 7.17 117*a62a9e19SDr. David Alan Gilbert * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK 118*a62a9e19SDr. David Alan Gilbert * 119*a62a9e19SDr. David Alan Gilbert * 7.18 120*a62a9e19SDr. David Alan Gilbert * - add FUSE_IOCTL_DIR flag 121*a62a9e19SDr. David Alan Gilbert * - add FUSE_NOTIFY_DELETE 122*a62a9e19SDr. David Alan Gilbert * 123*a62a9e19SDr. David Alan Gilbert * 7.19 124*a62a9e19SDr. David Alan Gilbert * - add FUSE_FALLOCATE 125*a62a9e19SDr. David Alan Gilbert * 126*a62a9e19SDr. David Alan Gilbert * 7.20 127*a62a9e19SDr. David Alan Gilbert * - add FUSE_AUTO_INVAL_DATA 128*a62a9e19SDr. David Alan Gilbert * 129*a62a9e19SDr. David Alan Gilbert * 7.21 130*a62a9e19SDr. David Alan Gilbert * - add FUSE_READDIRPLUS 131*a62a9e19SDr. David Alan Gilbert * - send the requested events in POLL request 132*a62a9e19SDr. David Alan Gilbert * 133*a62a9e19SDr. David Alan Gilbert * 7.22 134*a62a9e19SDr. David Alan Gilbert * - add FUSE_ASYNC_DIO 135*a62a9e19SDr. David Alan Gilbert * 136*a62a9e19SDr. David Alan Gilbert * 7.23 137*a62a9e19SDr. David Alan Gilbert * - add FUSE_WRITEBACK_CACHE 138*a62a9e19SDr. David Alan Gilbert * - add time_gran to fuse_init_out 139*a62a9e19SDr. David Alan Gilbert * - add reserved space to fuse_init_out 140*a62a9e19SDr. David Alan Gilbert * - add FATTR_CTIME 141*a62a9e19SDr. David Alan Gilbert * - add ctime and ctimensec to fuse_setattr_in 142*a62a9e19SDr. David Alan Gilbert * - add FUSE_RENAME2 request 143*a62a9e19SDr. David Alan Gilbert * - add FUSE_NO_OPEN_SUPPORT flag 144*a62a9e19SDr. David Alan Gilbert * 145*a62a9e19SDr. David Alan Gilbert * 7.24 146*a62a9e19SDr. David Alan Gilbert * - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support 147*a62a9e19SDr. David Alan Gilbert * 148*a62a9e19SDr. David Alan Gilbert * 7.25 149*a62a9e19SDr. David Alan Gilbert * - add FUSE_PARALLEL_DIROPS 150*a62a9e19SDr. David Alan Gilbert * 151*a62a9e19SDr. David Alan Gilbert * 7.26 152*a62a9e19SDr. David Alan Gilbert * - add FUSE_HANDLE_KILLPRIV 153*a62a9e19SDr. David Alan Gilbert * - add FUSE_POSIX_ACL 154*a62a9e19SDr. David Alan Gilbert * 155*a62a9e19SDr. David Alan Gilbert * 7.27 156*a62a9e19SDr. David Alan Gilbert * - add FUSE_ABORT_ERROR 157*a62a9e19SDr. David Alan Gilbert * 158*a62a9e19SDr. David Alan Gilbert * 7.28 159*a62a9e19SDr. David Alan Gilbert * - add FUSE_COPY_FILE_RANGE 160*a62a9e19SDr. David Alan Gilbert * - add FOPEN_CACHE_DIR 161*a62a9e19SDr. David Alan Gilbert * - add FUSE_MAX_PAGES, add max_pages to init_out 162*a62a9e19SDr. David Alan Gilbert * - add FUSE_CACHE_SYMLINKS 163*a62a9e19SDr. David Alan Gilbert * 164*a62a9e19SDr. David Alan Gilbert * 7.29 165*a62a9e19SDr. David Alan Gilbert * - add FUSE_NO_OPENDIR_SUPPORT flag 166*a62a9e19SDr. David Alan Gilbert * 167*a62a9e19SDr. David Alan Gilbert * 7.30 168*a62a9e19SDr. David Alan Gilbert * - add FUSE_EXPLICIT_INVAL_DATA 169*a62a9e19SDr. David Alan Gilbert * - add FUSE_IOCTL_COMPAT_X32 170*a62a9e19SDr. David Alan Gilbert * 171*a62a9e19SDr. David Alan Gilbert * 7.31 172*a62a9e19SDr. David Alan Gilbert * - add FUSE_WRITE_KILL_PRIV flag 173*a62a9e19SDr. David Alan Gilbert * - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING 174*a62a9e19SDr. David Alan Gilbert * - add map_alignment to fuse_init_out, add FUSE_MAP_ALIGNMENT flag 175*a62a9e19SDr. David Alan Gilbert */ 176*a62a9e19SDr. David Alan Gilbert 177*a62a9e19SDr. David Alan Gilbert #ifndef _LINUX_FUSE_H 178*a62a9e19SDr. David Alan Gilbert #define _LINUX_FUSE_H 179*a62a9e19SDr. David Alan Gilbert 180*a62a9e19SDr. David Alan Gilbert #include <stdint.h> 181*a62a9e19SDr. David Alan Gilbert 182*a62a9e19SDr. David Alan Gilbert /* 183*a62a9e19SDr. David Alan Gilbert * Version negotiation: 184*a62a9e19SDr. David Alan Gilbert * 185*a62a9e19SDr. David Alan Gilbert * Both the kernel and userspace send the version they support in the 186*a62a9e19SDr. David Alan Gilbert * INIT request and reply respectively. 187*a62a9e19SDr. David Alan Gilbert * 188*a62a9e19SDr. David Alan Gilbert * If the major versions match then both shall use the smallest 189*a62a9e19SDr. David Alan Gilbert * of the two minor versions for communication. 190*a62a9e19SDr. David Alan Gilbert * 191*a62a9e19SDr. David Alan Gilbert * If the kernel supports a larger major version, then userspace shall 192*a62a9e19SDr. David Alan Gilbert * reply with the major version it supports, ignore the rest of the 193*a62a9e19SDr. David Alan Gilbert * INIT message and expect a new INIT message from the kernel with a 194*a62a9e19SDr. David Alan Gilbert * matching major version. 195*a62a9e19SDr. David Alan Gilbert * 196*a62a9e19SDr. David Alan Gilbert * If the library supports a larger major version, then it shall fall 197*a62a9e19SDr. David Alan Gilbert * back to the major protocol version sent by the kernel for 198*a62a9e19SDr. David Alan Gilbert * communication and reply with that major version (and an arbitrary 199*a62a9e19SDr. David Alan Gilbert * supported minor version). 200*a62a9e19SDr. David Alan Gilbert */ 201*a62a9e19SDr. David Alan Gilbert 202*a62a9e19SDr. David Alan Gilbert /** Version number of this interface */ 203*a62a9e19SDr. David Alan Gilbert #define FUSE_KERNEL_VERSION 7 204*a62a9e19SDr. David Alan Gilbert 205*a62a9e19SDr. David Alan Gilbert /** Minor version number of this interface */ 206*a62a9e19SDr. David Alan Gilbert #define FUSE_KERNEL_MINOR_VERSION 31 207*a62a9e19SDr. David Alan Gilbert 208*a62a9e19SDr. David Alan Gilbert /** The node ID of the root inode */ 209*a62a9e19SDr. David Alan Gilbert #define FUSE_ROOT_ID 1 210*a62a9e19SDr. David Alan Gilbert 211*a62a9e19SDr. David Alan Gilbert /* Make sure all structures are padded to 64bit boundary, so 32bit 212*a62a9e19SDr. David Alan Gilbert userspace works under 64bit kernels */ 213*a62a9e19SDr. David Alan Gilbert 214*a62a9e19SDr. David Alan Gilbert struct fuse_attr { 215*a62a9e19SDr. David Alan Gilbert uint64_t ino; 216*a62a9e19SDr. David Alan Gilbert uint64_t size; 217*a62a9e19SDr. David Alan Gilbert uint64_t blocks; 218*a62a9e19SDr. David Alan Gilbert uint64_t atime; 219*a62a9e19SDr. David Alan Gilbert uint64_t mtime; 220*a62a9e19SDr. David Alan Gilbert uint64_t ctime; 221*a62a9e19SDr. David Alan Gilbert uint32_t atimensec; 222*a62a9e19SDr. David Alan Gilbert uint32_t mtimensec; 223*a62a9e19SDr. David Alan Gilbert uint32_t ctimensec; 224*a62a9e19SDr. David Alan Gilbert uint32_t mode; 225*a62a9e19SDr. David Alan Gilbert uint32_t nlink; 226*a62a9e19SDr. David Alan Gilbert uint32_t uid; 227*a62a9e19SDr. David Alan Gilbert uint32_t gid; 228*a62a9e19SDr. David Alan Gilbert uint32_t rdev; 229*a62a9e19SDr. David Alan Gilbert uint32_t blksize; 230*a62a9e19SDr. David Alan Gilbert uint32_t padding; 231*a62a9e19SDr. David Alan Gilbert }; 232*a62a9e19SDr. David Alan Gilbert 233*a62a9e19SDr. David Alan Gilbert struct fuse_kstatfs { 234*a62a9e19SDr. David Alan Gilbert uint64_t blocks; 235*a62a9e19SDr. David Alan Gilbert uint64_t bfree; 236*a62a9e19SDr. David Alan Gilbert uint64_t bavail; 237*a62a9e19SDr. David Alan Gilbert uint64_t files; 238*a62a9e19SDr. David Alan Gilbert uint64_t ffree; 239*a62a9e19SDr. David Alan Gilbert uint32_t bsize; 240*a62a9e19SDr. David Alan Gilbert uint32_t namelen; 241*a62a9e19SDr. David Alan Gilbert uint32_t frsize; 242*a62a9e19SDr. David Alan Gilbert uint32_t padding; 243*a62a9e19SDr. David Alan Gilbert uint32_t spare[6]; 244*a62a9e19SDr. David Alan Gilbert }; 245*a62a9e19SDr. David Alan Gilbert 246*a62a9e19SDr. David Alan Gilbert struct fuse_file_lock { 247*a62a9e19SDr. David Alan Gilbert uint64_t start; 248*a62a9e19SDr. David Alan Gilbert uint64_t end; 249*a62a9e19SDr. David Alan Gilbert uint32_t type; 250*a62a9e19SDr. David Alan Gilbert uint32_t pid; /* tgid */ 251*a62a9e19SDr. David Alan Gilbert }; 252*a62a9e19SDr. David Alan Gilbert 253*a62a9e19SDr. David Alan Gilbert /** 254*a62a9e19SDr. David Alan Gilbert * Bitmasks for fuse_setattr_in.valid 255*a62a9e19SDr. David Alan Gilbert */ 256*a62a9e19SDr. David Alan Gilbert #define FATTR_MODE (1 << 0) 257*a62a9e19SDr. David Alan Gilbert #define FATTR_UID (1 << 1) 258*a62a9e19SDr. David Alan Gilbert #define FATTR_GID (1 << 2) 259*a62a9e19SDr. David Alan Gilbert #define FATTR_SIZE (1 << 3) 260*a62a9e19SDr. David Alan Gilbert #define FATTR_ATIME (1 << 4) 261*a62a9e19SDr. David Alan Gilbert #define FATTR_MTIME (1 << 5) 262*a62a9e19SDr. David Alan Gilbert #define FATTR_FH (1 << 6) 263*a62a9e19SDr. David Alan Gilbert #define FATTR_ATIME_NOW (1 << 7) 264*a62a9e19SDr. David Alan Gilbert #define FATTR_MTIME_NOW (1 << 8) 265*a62a9e19SDr. David Alan Gilbert #define FATTR_LOCKOWNER (1 << 9) 266*a62a9e19SDr. David Alan Gilbert #define FATTR_CTIME (1 << 10) 267*a62a9e19SDr. David Alan Gilbert 268*a62a9e19SDr. David Alan Gilbert /** 269*a62a9e19SDr. David Alan Gilbert * Flags returned by the OPEN request 270*a62a9e19SDr. David Alan Gilbert * 271*a62a9e19SDr. David Alan Gilbert * FOPEN_DIRECT_IO: bypass page cache for this open file 272*a62a9e19SDr. David Alan Gilbert * FOPEN_KEEP_CACHE: don't invalidate the data cache on open 273*a62a9e19SDr. David Alan Gilbert * FOPEN_NONSEEKABLE: the file is not seekable 274*a62a9e19SDr. David Alan Gilbert * FOPEN_CACHE_DIR: allow caching this directory 275*a62a9e19SDr. David Alan Gilbert * FOPEN_STREAM: the file is stream-like (no file position at all) 276*a62a9e19SDr. David Alan Gilbert */ 277*a62a9e19SDr. David Alan Gilbert #define FOPEN_DIRECT_IO (1 << 0) 278*a62a9e19SDr. David Alan Gilbert #define FOPEN_KEEP_CACHE (1 << 1) 279*a62a9e19SDr. David Alan Gilbert #define FOPEN_NONSEEKABLE (1 << 2) 280*a62a9e19SDr. David Alan Gilbert #define FOPEN_CACHE_DIR (1 << 3) 281*a62a9e19SDr. David Alan Gilbert #define FOPEN_STREAM (1 << 4) 282*a62a9e19SDr. David Alan Gilbert 283*a62a9e19SDr. David Alan Gilbert /** 284*a62a9e19SDr. David Alan Gilbert * INIT request/reply flags 285*a62a9e19SDr. David Alan Gilbert * 286*a62a9e19SDr. David Alan Gilbert * FUSE_ASYNC_READ: asynchronous read requests 287*a62a9e19SDr. David Alan Gilbert * FUSE_POSIX_LOCKS: remote locking for POSIX file locks 288*a62a9e19SDr. David Alan Gilbert * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported) 289*a62a9e19SDr. David Alan Gilbert * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem 290*a62a9e19SDr. David Alan Gilbert * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." 291*a62a9e19SDr. David Alan Gilbert * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB 292*a62a9e19SDr. David Alan Gilbert * FUSE_DONT_MASK: don't apply umask to file mode on create operations 293*a62a9e19SDr. David Alan Gilbert * FUSE_SPLICE_WRITE: kernel supports splice write on the device 294*a62a9e19SDr. David Alan Gilbert * FUSE_SPLICE_MOVE: kernel supports splice move on the device 295*a62a9e19SDr. David Alan Gilbert * FUSE_SPLICE_READ: kernel supports splice read on the device 296*a62a9e19SDr. David Alan Gilbert * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks 297*a62a9e19SDr. David Alan Gilbert * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories 298*a62a9e19SDr. David Alan Gilbert * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages 299*a62a9e19SDr. David Alan Gilbert * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one) 300*a62a9e19SDr. David Alan Gilbert * FUSE_READDIRPLUS_AUTO: adaptive readdirplus 301*a62a9e19SDr. David Alan Gilbert * FUSE_ASYNC_DIO: asynchronous direct I/O submission 302*a62a9e19SDr. David Alan Gilbert * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes 303*a62a9e19SDr. David Alan Gilbert * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens 304*a62a9e19SDr. David Alan Gilbert * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir 305*a62a9e19SDr. David Alan Gilbert * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc 306*a62a9e19SDr. David Alan Gilbert * FUSE_POSIX_ACL: filesystem supports posix acls 307*a62a9e19SDr. David Alan Gilbert * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED 308*a62a9e19SDr. David Alan Gilbert * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages 309*a62a9e19SDr. David Alan Gilbert * FUSE_CACHE_SYMLINKS: cache READLINK responses 310*a62a9e19SDr. David Alan Gilbert * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir 311*a62a9e19SDr. David Alan Gilbert * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request 312*a62a9e19SDr. David Alan Gilbert * FUSE_MAP_ALIGNMENT: map_alignment field is valid 313*a62a9e19SDr. David Alan Gilbert */ 314*a62a9e19SDr. David Alan Gilbert #define FUSE_ASYNC_READ (1 << 0) 315*a62a9e19SDr. David Alan Gilbert #define FUSE_POSIX_LOCKS (1 << 1) 316*a62a9e19SDr. David Alan Gilbert #define FUSE_FILE_OPS (1 << 2) 317*a62a9e19SDr. David Alan Gilbert #define FUSE_ATOMIC_O_TRUNC (1 << 3) 318*a62a9e19SDr. David Alan Gilbert #define FUSE_EXPORT_SUPPORT (1 << 4) 319*a62a9e19SDr. David Alan Gilbert #define FUSE_BIG_WRITES (1 << 5) 320*a62a9e19SDr. David Alan Gilbert #define FUSE_DONT_MASK (1 << 6) 321*a62a9e19SDr. David Alan Gilbert #define FUSE_SPLICE_WRITE (1 << 7) 322*a62a9e19SDr. David Alan Gilbert #define FUSE_SPLICE_MOVE (1 << 8) 323*a62a9e19SDr. David Alan Gilbert #define FUSE_SPLICE_READ (1 << 9) 324*a62a9e19SDr. David Alan Gilbert #define FUSE_FLOCK_LOCKS (1 << 10) 325*a62a9e19SDr. David Alan Gilbert #define FUSE_HAS_IOCTL_DIR (1 << 11) 326*a62a9e19SDr. David Alan Gilbert #define FUSE_AUTO_INVAL_DATA (1 << 12) 327*a62a9e19SDr. David Alan Gilbert #define FUSE_DO_READDIRPLUS (1 << 13) 328*a62a9e19SDr. David Alan Gilbert #define FUSE_READDIRPLUS_AUTO (1 << 14) 329*a62a9e19SDr. David Alan Gilbert #define FUSE_ASYNC_DIO (1 << 15) 330*a62a9e19SDr. David Alan Gilbert #define FUSE_WRITEBACK_CACHE (1 << 16) 331*a62a9e19SDr. David Alan Gilbert #define FUSE_NO_OPEN_SUPPORT (1 << 17) 332*a62a9e19SDr. David Alan Gilbert #define FUSE_PARALLEL_DIROPS (1 << 18) 333*a62a9e19SDr. David Alan Gilbert #define FUSE_HANDLE_KILLPRIV (1 << 19) 334*a62a9e19SDr. David Alan Gilbert #define FUSE_POSIX_ACL (1 << 20) 335*a62a9e19SDr. David Alan Gilbert #define FUSE_ABORT_ERROR (1 << 21) 336*a62a9e19SDr. David Alan Gilbert #define FUSE_MAX_PAGES (1 << 22) 337*a62a9e19SDr. David Alan Gilbert #define FUSE_CACHE_SYMLINKS (1 << 23) 338*a62a9e19SDr. David Alan Gilbert #define FUSE_NO_OPENDIR_SUPPORT (1 << 24) 339*a62a9e19SDr. David Alan Gilbert #define FUSE_EXPLICIT_INVAL_DATA (1 << 25) 340*a62a9e19SDr. David Alan Gilbert #define FUSE_MAP_ALIGNMENT (1 << 26) 341*a62a9e19SDr. David Alan Gilbert 342*a62a9e19SDr. David Alan Gilbert /** 343*a62a9e19SDr. David Alan Gilbert * CUSE INIT request/reply flags 344*a62a9e19SDr. David Alan Gilbert * 345*a62a9e19SDr. David Alan Gilbert * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl 346*a62a9e19SDr. David Alan Gilbert */ 347*a62a9e19SDr. David Alan Gilbert #define CUSE_UNRESTRICTED_IOCTL (1 << 0) 348*a62a9e19SDr. David Alan Gilbert 349*a62a9e19SDr. David Alan Gilbert /** 350*a62a9e19SDr. David Alan Gilbert * Release flags 351*a62a9e19SDr. David Alan Gilbert */ 352*a62a9e19SDr. David Alan Gilbert #define FUSE_RELEASE_FLUSH (1 << 0) 353*a62a9e19SDr. David Alan Gilbert #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1) 354*a62a9e19SDr. David Alan Gilbert 355*a62a9e19SDr. David Alan Gilbert /** 356*a62a9e19SDr. David Alan Gilbert * Getattr flags 357*a62a9e19SDr. David Alan Gilbert */ 358*a62a9e19SDr. David Alan Gilbert #define FUSE_GETATTR_FH (1 << 0) 359*a62a9e19SDr. David Alan Gilbert 360*a62a9e19SDr. David Alan Gilbert /** 361*a62a9e19SDr. David Alan Gilbert * Lock flags 362*a62a9e19SDr. David Alan Gilbert */ 363*a62a9e19SDr. David Alan Gilbert #define FUSE_LK_FLOCK (1 << 0) 364*a62a9e19SDr. David Alan Gilbert 365*a62a9e19SDr. David Alan Gilbert /** 366*a62a9e19SDr. David Alan Gilbert * WRITE flags 367*a62a9e19SDr. David Alan Gilbert * 368*a62a9e19SDr. David Alan Gilbert * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed 369*a62a9e19SDr. David Alan Gilbert * FUSE_WRITE_LOCKOWNER: lock_owner field is valid 370*a62a9e19SDr. David Alan Gilbert * FUSE_WRITE_KILL_PRIV: kill suid and sgid bits 371*a62a9e19SDr. David Alan Gilbert */ 372*a62a9e19SDr. David Alan Gilbert #define FUSE_WRITE_CACHE (1 << 0) 373*a62a9e19SDr. David Alan Gilbert #define FUSE_WRITE_LOCKOWNER (1 << 1) 374*a62a9e19SDr. David Alan Gilbert #define FUSE_WRITE_KILL_PRIV (1 << 2) 375*a62a9e19SDr. David Alan Gilbert 376*a62a9e19SDr. David Alan Gilbert /** 377*a62a9e19SDr. David Alan Gilbert * Read flags 378*a62a9e19SDr. David Alan Gilbert */ 379*a62a9e19SDr. David Alan Gilbert #define FUSE_READ_LOCKOWNER (1 << 1) 380*a62a9e19SDr. David Alan Gilbert 381*a62a9e19SDr. David Alan Gilbert /** 382*a62a9e19SDr. David Alan Gilbert * Ioctl flags 383*a62a9e19SDr. David Alan Gilbert * 384*a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine 385*a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed 386*a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_RETRY: retry with new iovecs 387*a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_32BIT: 32bit ioctl 388*a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_DIR: is a directory 389*a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_COMPAT_X32: x32 compat ioctl on 64bit machine (64bit time_t) 390*a62a9e19SDr. David Alan Gilbert * 391*a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs 392*a62a9e19SDr. David Alan Gilbert */ 393*a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_COMPAT (1 << 0) 394*a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_UNRESTRICTED (1 << 1) 395*a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_RETRY (1 << 2) 396*a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_32BIT (1 << 3) 397*a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_DIR (1 << 4) 398*a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_COMPAT_X32 (1 << 5) 399*a62a9e19SDr. David Alan Gilbert 400*a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_MAX_IOV 256 401*a62a9e19SDr. David Alan Gilbert 402*a62a9e19SDr. David Alan Gilbert /** 403*a62a9e19SDr. David Alan Gilbert * Poll flags 404*a62a9e19SDr. David Alan Gilbert * 405*a62a9e19SDr. David Alan Gilbert * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify 406*a62a9e19SDr. David Alan Gilbert */ 407*a62a9e19SDr. David Alan Gilbert #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) 408*a62a9e19SDr. David Alan Gilbert 409*a62a9e19SDr. David Alan Gilbert /** 410*a62a9e19SDr. David Alan Gilbert * Fsync flags 411*a62a9e19SDr. David Alan Gilbert * 412*a62a9e19SDr. David Alan Gilbert * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata 413*a62a9e19SDr. David Alan Gilbert */ 414*a62a9e19SDr. David Alan Gilbert #define FUSE_FSYNC_FDATASYNC (1 << 0) 415*a62a9e19SDr. David Alan Gilbert 416*a62a9e19SDr. David Alan Gilbert enum fuse_opcode { 417*a62a9e19SDr. David Alan Gilbert FUSE_LOOKUP = 1, 418*a62a9e19SDr. David Alan Gilbert FUSE_FORGET = 2, /* no reply */ 419*a62a9e19SDr. David Alan Gilbert FUSE_GETATTR = 3, 420*a62a9e19SDr. David Alan Gilbert FUSE_SETATTR = 4, 421*a62a9e19SDr. David Alan Gilbert FUSE_READLINK = 5, 422*a62a9e19SDr. David Alan Gilbert FUSE_SYMLINK = 6, 423*a62a9e19SDr. David Alan Gilbert FUSE_MKNOD = 8, 424*a62a9e19SDr. David Alan Gilbert FUSE_MKDIR = 9, 425*a62a9e19SDr. David Alan Gilbert FUSE_UNLINK = 10, 426*a62a9e19SDr. David Alan Gilbert FUSE_RMDIR = 11, 427*a62a9e19SDr. David Alan Gilbert FUSE_RENAME = 12, 428*a62a9e19SDr. David Alan Gilbert FUSE_LINK = 13, 429*a62a9e19SDr. David Alan Gilbert FUSE_OPEN = 14, 430*a62a9e19SDr. David Alan Gilbert FUSE_READ = 15, 431*a62a9e19SDr. David Alan Gilbert FUSE_WRITE = 16, 432*a62a9e19SDr. David Alan Gilbert FUSE_STATFS = 17, 433*a62a9e19SDr. David Alan Gilbert FUSE_RELEASE = 18, 434*a62a9e19SDr. David Alan Gilbert FUSE_FSYNC = 20, 435*a62a9e19SDr. David Alan Gilbert FUSE_SETXATTR = 21, 436*a62a9e19SDr. David Alan Gilbert FUSE_GETXATTR = 22, 437*a62a9e19SDr. David Alan Gilbert FUSE_LISTXATTR = 23, 438*a62a9e19SDr. David Alan Gilbert FUSE_REMOVEXATTR = 24, 439*a62a9e19SDr. David Alan Gilbert FUSE_FLUSH = 25, 440*a62a9e19SDr. David Alan Gilbert FUSE_INIT = 26, 441*a62a9e19SDr. David Alan Gilbert FUSE_OPENDIR = 27, 442*a62a9e19SDr. David Alan Gilbert FUSE_READDIR = 28, 443*a62a9e19SDr. David Alan Gilbert FUSE_RELEASEDIR = 29, 444*a62a9e19SDr. David Alan Gilbert FUSE_FSYNCDIR = 30, 445*a62a9e19SDr. David Alan Gilbert FUSE_GETLK = 31, 446*a62a9e19SDr. David Alan Gilbert FUSE_SETLK = 32, 447*a62a9e19SDr. David Alan Gilbert FUSE_SETLKW = 33, 448*a62a9e19SDr. David Alan Gilbert FUSE_ACCESS = 34, 449*a62a9e19SDr. David Alan Gilbert FUSE_CREATE = 35, 450*a62a9e19SDr. David Alan Gilbert FUSE_INTERRUPT = 36, 451*a62a9e19SDr. David Alan Gilbert FUSE_BMAP = 37, 452*a62a9e19SDr. David Alan Gilbert FUSE_DESTROY = 38, 453*a62a9e19SDr. David Alan Gilbert FUSE_IOCTL = 39, 454*a62a9e19SDr. David Alan Gilbert FUSE_POLL = 40, 455*a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_REPLY = 41, 456*a62a9e19SDr. David Alan Gilbert FUSE_BATCH_FORGET = 42, 457*a62a9e19SDr. David Alan Gilbert FUSE_FALLOCATE = 43, 458*a62a9e19SDr. David Alan Gilbert FUSE_READDIRPLUS = 44, 459*a62a9e19SDr. David Alan Gilbert FUSE_RENAME2 = 45, 460*a62a9e19SDr. David Alan Gilbert FUSE_LSEEK = 46, 461*a62a9e19SDr. David Alan Gilbert FUSE_COPY_FILE_RANGE = 47, 462*a62a9e19SDr. David Alan Gilbert FUSE_SETUPMAPPING = 48, 463*a62a9e19SDr. David Alan Gilbert FUSE_REMOVEMAPPING = 49, 464*a62a9e19SDr. David Alan Gilbert 465*a62a9e19SDr. David Alan Gilbert /* CUSE specific operations */ 466*a62a9e19SDr. David Alan Gilbert CUSE_INIT = 4096, 467*a62a9e19SDr. David Alan Gilbert 468*a62a9e19SDr. David Alan Gilbert /* Reserved opcodes: helpful to detect structure endian-ness */ 469*a62a9e19SDr. David Alan Gilbert CUSE_INIT_BSWAP_RESERVED = 1048576, /* CUSE_INIT << 8 */ 470*a62a9e19SDr. David Alan Gilbert FUSE_INIT_BSWAP_RESERVED = 436207616, /* FUSE_INIT << 24 */ 471*a62a9e19SDr. David Alan Gilbert }; 472*a62a9e19SDr. David Alan Gilbert 473*a62a9e19SDr. David Alan Gilbert enum fuse_notify_code { 474*a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_POLL = 1, 475*a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_INVAL_INODE = 2, 476*a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_INVAL_ENTRY = 3, 477*a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_STORE = 4, 478*a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_RETRIEVE = 5, 479*a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_DELETE = 6, 480*a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_CODE_MAX, 481*a62a9e19SDr. David Alan Gilbert }; 482*a62a9e19SDr. David Alan Gilbert 483*a62a9e19SDr. David Alan Gilbert /* The read buffer is required to be at least 8k, but may be much larger */ 484*a62a9e19SDr. David Alan Gilbert #define FUSE_MIN_READ_BUFFER 8192 485*a62a9e19SDr. David Alan Gilbert 486*a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_ENTRY_OUT_SIZE 120 487*a62a9e19SDr. David Alan Gilbert 488*a62a9e19SDr. David Alan Gilbert struct fuse_entry_out { 489*a62a9e19SDr. David Alan Gilbert uint64_t nodeid; /* Inode ID */ 490*a62a9e19SDr. David Alan Gilbert uint64_t generation; /* Inode generation: nodeid:gen must 491*a62a9e19SDr. David Alan Gilbert be unique for the fs's lifetime */ 492*a62a9e19SDr. David Alan Gilbert uint64_t entry_valid; /* Cache timeout for the name */ 493*a62a9e19SDr. David Alan Gilbert uint64_t attr_valid; /* Cache timeout for the attributes */ 494*a62a9e19SDr. David Alan Gilbert uint32_t entry_valid_nsec; 495*a62a9e19SDr. David Alan Gilbert uint32_t attr_valid_nsec; 496*a62a9e19SDr. David Alan Gilbert struct fuse_attr attr; 497*a62a9e19SDr. David Alan Gilbert }; 498*a62a9e19SDr. David Alan Gilbert 499*a62a9e19SDr. David Alan Gilbert struct fuse_forget_in { 500*a62a9e19SDr. David Alan Gilbert uint64_t nlookup; 501*a62a9e19SDr. David Alan Gilbert }; 502*a62a9e19SDr. David Alan Gilbert 503*a62a9e19SDr. David Alan Gilbert struct fuse_forget_one { 504*a62a9e19SDr. David Alan Gilbert uint64_t nodeid; 505*a62a9e19SDr. David Alan Gilbert uint64_t nlookup; 506*a62a9e19SDr. David Alan Gilbert }; 507*a62a9e19SDr. David Alan Gilbert 508*a62a9e19SDr. David Alan Gilbert struct fuse_batch_forget_in { 509*a62a9e19SDr. David Alan Gilbert uint32_t count; 510*a62a9e19SDr. David Alan Gilbert uint32_t dummy; 511*a62a9e19SDr. David Alan Gilbert }; 512*a62a9e19SDr. David Alan Gilbert 513*a62a9e19SDr. David Alan Gilbert struct fuse_getattr_in { 514*a62a9e19SDr. David Alan Gilbert uint32_t getattr_flags; 515*a62a9e19SDr. David Alan Gilbert uint32_t dummy; 516*a62a9e19SDr. David Alan Gilbert uint64_t fh; 517*a62a9e19SDr. David Alan Gilbert }; 518*a62a9e19SDr. David Alan Gilbert 519*a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_ATTR_OUT_SIZE 96 520*a62a9e19SDr. David Alan Gilbert 521*a62a9e19SDr. David Alan Gilbert struct fuse_attr_out { 522*a62a9e19SDr. David Alan Gilbert uint64_t attr_valid; /* Cache timeout for the attributes */ 523*a62a9e19SDr. David Alan Gilbert uint32_t attr_valid_nsec; 524*a62a9e19SDr. David Alan Gilbert uint32_t dummy; 525*a62a9e19SDr. David Alan Gilbert struct fuse_attr attr; 526*a62a9e19SDr. David Alan Gilbert }; 527*a62a9e19SDr. David Alan Gilbert 528*a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_MKNOD_IN_SIZE 8 529*a62a9e19SDr. David Alan Gilbert 530*a62a9e19SDr. David Alan Gilbert struct fuse_mknod_in { 531*a62a9e19SDr. David Alan Gilbert uint32_t mode; 532*a62a9e19SDr. David Alan Gilbert uint32_t rdev; 533*a62a9e19SDr. David Alan Gilbert uint32_t umask; 534*a62a9e19SDr. David Alan Gilbert uint32_t padding; 535*a62a9e19SDr. David Alan Gilbert }; 536*a62a9e19SDr. David Alan Gilbert 537*a62a9e19SDr. David Alan Gilbert struct fuse_mkdir_in { 538*a62a9e19SDr. David Alan Gilbert uint32_t mode; 539*a62a9e19SDr. David Alan Gilbert uint32_t umask; 540*a62a9e19SDr. David Alan Gilbert }; 541*a62a9e19SDr. David Alan Gilbert 542*a62a9e19SDr. David Alan Gilbert struct fuse_rename_in { 543*a62a9e19SDr. David Alan Gilbert uint64_t newdir; 544*a62a9e19SDr. David Alan Gilbert }; 545*a62a9e19SDr. David Alan Gilbert 546*a62a9e19SDr. David Alan Gilbert struct fuse_rename2_in { 547*a62a9e19SDr. David Alan Gilbert uint64_t newdir; 548*a62a9e19SDr. David Alan Gilbert uint32_t flags; 549*a62a9e19SDr. David Alan Gilbert uint32_t padding; 550*a62a9e19SDr. David Alan Gilbert }; 551*a62a9e19SDr. David Alan Gilbert 552*a62a9e19SDr. David Alan Gilbert struct fuse_link_in { 553*a62a9e19SDr. David Alan Gilbert uint64_t oldnodeid; 554*a62a9e19SDr. David Alan Gilbert }; 555*a62a9e19SDr. David Alan Gilbert 556*a62a9e19SDr. David Alan Gilbert struct fuse_setattr_in { 557*a62a9e19SDr. David Alan Gilbert uint32_t valid; 558*a62a9e19SDr. David Alan Gilbert uint32_t padding; 559*a62a9e19SDr. David Alan Gilbert uint64_t fh; 560*a62a9e19SDr. David Alan Gilbert uint64_t size; 561*a62a9e19SDr. David Alan Gilbert uint64_t lock_owner; 562*a62a9e19SDr. David Alan Gilbert uint64_t atime; 563*a62a9e19SDr. David Alan Gilbert uint64_t mtime; 564*a62a9e19SDr. David Alan Gilbert uint64_t ctime; 565*a62a9e19SDr. David Alan Gilbert uint32_t atimensec; 566*a62a9e19SDr. David Alan Gilbert uint32_t mtimensec; 567*a62a9e19SDr. David Alan Gilbert uint32_t ctimensec; 568*a62a9e19SDr. David Alan Gilbert uint32_t mode; 569*a62a9e19SDr. David Alan Gilbert uint32_t unused4; 570*a62a9e19SDr. David Alan Gilbert uint32_t uid; 571*a62a9e19SDr. David Alan Gilbert uint32_t gid; 572*a62a9e19SDr. David Alan Gilbert uint32_t unused5; 573*a62a9e19SDr. David Alan Gilbert }; 574*a62a9e19SDr. David Alan Gilbert 575*a62a9e19SDr. David Alan Gilbert struct fuse_open_in { 576*a62a9e19SDr. David Alan Gilbert uint32_t flags; 577*a62a9e19SDr. David Alan Gilbert uint32_t unused; 578*a62a9e19SDr. David Alan Gilbert }; 579*a62a9e19SDr. David Alan Gilbert 580*a62a9e19SDr. David Alan Gilbert struct fuse_create_in { 581*a62a9e19SDr. David Alan Gilbert uint32_t flags; 582*a62a9e19SDr. David Alan Gilbert uint32_t mode; 583*a62a9e19SDr. David Alan Gilbert uint32_t umask; 584*a62a9e19SDr. David Alan Gilbert uint32_t padding; 585*a62a9e19SDr. David Alan Gilbert }; 586*a62a9e19SDr. David Alan Gilbert 587*a62a9e19SDr. David Alan Gilbert struct fuse_open_out { 588*a62a9e19SDr. David Alan Gilbert uint64_t fh; 589*a62a9e19SDr. David Alan Gilbert uint32_t open_flags; 590*a62a9e19SDr. David Alan Gilbert uint32_t padding; 591*a62a9e19SDr. David Alan Gilbert }; 592*a62a9e19SDr. David Alan Gilbert 593*a62a9e19SDr. David Alan Gilbert struct fuse_release_in { 594*a62a9e19SDr. David Alan Gilbert uint64_t fh; 595*a62a9e19SDr. David Alan Gilbert uint32_t flags; 596*a62a9e19SDr. David Alan Gilbert uint32_t release_flags; 597*a62a9e19SDr. David Alan Gilbert uint64_t lock_owner; 598*a62a9e19SDr. David Alan Gilbert }; 599*a62a9e19SDr. David Alan Gilbert 600*a62a9e19SDr. David Alan Gilbert struct fuse_flush_in { 601*a62a9e19SDr. David Alan Gilbert uint64_t fh; 602*a62a9e19SDr. David Alan Gilbert uint32_t unused; 603*a62a9e19SDr. David Alan Gilbert uint32_t padding; 604*a62a9e19SDr. David Alan Gilbert uint64_t lock_owner; 605*a62a9e19SDr. David Alan Gilbert }; 606*a62a9e19SDr. David Alan Gilbert 607*a62a9e19SDr. David Alan Gilbert struct fuse_read_in { 608*a62a9e19SDr. David Alan Gilbert uint64_t fh; 609*a62a9e19SDr. David Alan Gilbert uint64_t offset; 610*a62a9e19SDr. David Alan Gilbert uint32_t size; 611*a62a9e19SDr. David Alan Gilbert uint32_t read_flags; 612*a62a9e19SDr. David Alan Gilbert uint64_t lock_owner; 613*a62a9e19SDr. David Alan Gilbert uint32_t flags; 614*a62a9e19SDr. David Alan Gilbert uint32_t padding; 615*a62a9e19SDr. David Alan Gilbert }; 616*a62a9e19SDr. David Alan Gilbert 617*a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_WRITE_IN_SIZE 24 618*a62a9e19SDr. David Alan Gilbert 619*a62a9e19SDr. David Alan Gilbert struct fuse_write_in { 620*a62a9e19SDr. David Alan Gilbert uint64_t fh; 621*a62a9e19SDr. David Alan Gilbert uint64_t offset; 622*a62a9e19SDr. David Alan Gilbert uint32_t size; 623*a62a9e19SDr. David Alan Gilbert uint32_t write_flags; 624*a62a9e19SDr. David Alan Gilbert uint64_t lock_owner; 625*a62a9e19SDr. David Alan Gilbert uint32_t flags; 626*a62a9e19SDr. David Alan Gilbert uint32_t padding; 627*a62a9e19SDr. David Alan Gilbert }; 628*a62a9e19SDr. David Alan Gilbert 629*a62a9e19SDr. David Alan Gilbert struct fuse_write_out { 630*a62a9e19SDr. David Alan Gilbert uint32_t size; 631*a62a9e19SDr. David Alan Gilbert uint32_t padding; 632*a62a9e19SDr. David Alan Gilbert }; 633*a62a9e19SDr. David Alan Gilbert 634*a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_STATFS_SIZE 48 635*a62a9e19SDr. David Alan Gilbert 636*a62a9e19SDr. David Alan Gilbert struct fuse_statfs_out { 637*a62a9e19SDr. David Alan Gilbert struct fuse_kstatfs st; 638*a62a9e19SDr. David Alan Gilbert }; 639*a62a9e19SDr. David Alan Gilbert 640*a62a9e19SDr. David Alan Gilbert struct fuse_fsync_in { 641*a62a9e19SDr. David Alan Gilbert uint64_t fh; 642*a62a9e19SDr. David Alan Gilbert uint32_t fsync_flags; 643*a62a9e19SDr. David Alan Gilbert uint32_t padding; 644*a62a9e19SDr. David Alan Gilbert }; 645*a62a9e19SDr. David Alan Gilbert 646*a62a9e19SDr. David Alan Gilbert struct fuse_setxattr_in { 647*a62a9e19SDr. David Alan Gilbert uint32_t size; 648*a62a9e19SDr. David Alan Gilbert uint32_t flags; 649*a62a9e19SDr. David Alan Gilbert }; 650*a62a9e19SDr. David Alan Gilbert 651*a62a9e19SDr. David Alan Gilbert struct fuse_getxattr_in { 652*a62a9e19SDr. David Alan Gilbert uint32_t size; 653*a62a9e19SDr. David Alan Gilbert uint32_t padding; 654*a62a9e19SDr. David Alan Gilbert }; 655*a62a9e19SDr. David Alan Gilbert 656*a62a9e19SDr. David Alan Gilbert struct fuse_getxattr_out { 657*a62a9e19SDr. David Alan Gilbert uint32_t size; 658*a62a9e19SDr. David Alan Gilbert uint32_t padding; 659*a62a9e19SDr. David Alan Gilbert }; 660*a62a9e19SDr. David Alan Gilbert 661*a62a9e19SDr. David Alan Gilbert struct fuse_lk_in { 662*a62a9e19SDr. David Alan Gilbert uint64_t fh; 663*a62a9e19SDr. David Alan Gilbert uint64_t owner; 664*a62a9e19SDr. David Alan Gilbert struct fuse_file_lock lk; 665*a62a9e19SDr. David Alan Gilbert uint32_t lk_flags; 666*a62a9e19SDr. David Alan Gilbert uint32_t padding; 667*a62a9e19SDr. David Alan Gilbert }; 668*a62a9e19SDr. David Alan Gilbert 669*a62a9e19SDr. David Alan Gilbert struct fuse_lk_out { 670*a62a9e19SDr. David Alan Gilbert struct fuse_file_lock lk; 671*a62a9e19SDr. David Alan Gilbert }; 672*a62a9e19SDr. David Alan Gilbert 673*a62a9e19SDr. David Alan Gilbert struct fuse_access_in { 674*a62a9e19SDr. David Alan Gilbert uint32_t mask; 675*a62a9e19SDr. David Alan Gilbert uint32_t padding; 676*a62a9e19SDr. David Alan Gilbert }; 677*a62a9e19SDr. David Alan Gilbert 678*a62a9e19SDr. David Alan Gilbert struct fuse_init_in { 679*a62a9e19SDr. David Alan Gilbert uint32_t major; 680*a62a9e19SDr. David Alan Gilbert uint32_t minor; 681*a62a9e19SDr. David Alan Gilbert uint32_t max_readahead; 682*a62a9e19SDr. David Alan Gilbert uint32_t flags; 683*a62a9e19SDr. David Alan Gilbert }; 684*a62a9e19SDr. David Alan Gilbert 685*a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_INIT_OUT_SIZE 8 686*a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_22_INIT_OUT_SIZE 24 687*a62a9e19SDr. David Alan Gilbert 688*a62a9e19SDr. David Alan Gilbert struct fuse_init_out { 689*a62a9e19SDr. David Alan Gilbert uint32_t major; 690*a62a9e19SDr. David Alan Gilbert uint32_t minor; 691*a62a9e19SDr. David Alan Gilbert uint32_t max_readahead; 692*a62a9e19SDr. David Alan Gilbert uint32_t flags; 693*a62a9e19SDr. David Alan Gilbert uint16_t max_background; 694*a62a9e19SDr. David Alan Gilbert uint16_t congestion_threshold; 695*a62a9e19SDr. David Alan Gilbert uint32_t max_write; 696*a62a9e19SDr. David Alan Gilbert uint32_t time_gran; 697*a62a9e19SDr. David Alan Gilbert uint16_t max_pages; 698*a62a9e19SDr. David Alan Gilbert uint16_t map_alignment; 699*a62a9e19SDr. David Alan Gilbert uint32_t unused[8]; 700*a62a9e19SDr. David Alan Gilbert }; 701*a62a9e19SDr. David Alan Gilbert 702*a62a9e19SDr. David Alan Gilbert #define CUSE_INIT_INFO_MAX 4096 703*a62a9e19SDr. David Alan Gilbert 704*a62a9e19SDr. David Alan Gilbert struct cuse_init_in { 705*a62a9e19SDr. David Alan Gilbert uint32_t major; 706*a62a9e19SDr. David Alan Gilbert uint32_t minor; 707*a62a9e19SDr. David Alan Gilbert uint32_t unused; 708*a62a9e19SDr. David Alan Gilbert uint32_t flags; 709*a62a9e19SDr. David Alan Gilbert }; 710*a62a9e19SDr. David Alan Gilbert 711*a62a9e19SDr. David Alan Gilbert struct cuse_init_out { 712*a62a9e19SDr. David Alan Gilbert uint32_t major; 713*a62a9e19SDr. David Alan Gilbert uint32_t minor; 714*a62a9e19SDr. David Alan Gilbert uint32_t unused; 715*a62a9e19SDr. David Alan Gilbert uint32_t flags; 716*a62a9e19SDr. David Alan Gilbert uint32_t max_read; 717*a62a9e19SDr. David Alan Gilbert uint32_t max_write; 718*a62a9e19SDr. David Alan Gilbert uint32_t dev_major; /* chardev major */ 719*a62a9e19SDr. David Alan Gilbert uint32_t dev_minor; /* chardev minor */ 720*a62a9e19SDr. David Alan Gilbert uint32_t spare[10]; 721*a62a9e19SDr. David Alan Gilbert }; 722*a62a9e19SDr. David Alan Gilbert 723*a62a9e19SDr. David Alan Gilbert struct fuse_interrupt_in { 724*a62a9e19SDr. David Alan Gilbert uint64_t unique; 725*a62a9e19SDr. David Alan Gilbert }; 726*a62a9e19SDr. David Alan Gilbert 727*a62a9e19SDr. David Alan Gilbert struct fuse_bmap_in { 728*a62a9e19SDr. David Alan Gilbert uint64_t block; 729*a62a9e19SDr. David Alan Gilbert uint32_t blocksize; 730*a62a9e19SDr. David Alan Gilbert uint32_t padding; 731*a62a9e19SDr. David Alan Gilbert }; 732*a62a9e19SDr. David Alan Gilbert 733*a62a9e19SDr. David Alan Gilbert struct fuse_bmap_out { 734*a62a9e19SDr. David Alan Gilbert uint64_t block; 735*a62a9e19SDr. David Alan Gilbert }; 736*a62a9e19SDr. David Alan Gilbert 737*a62a9e19SDr. David Alan Gilbert struct fuse_ioctl_in { 738*a62a9e19SDr. David Alan Gilbert uint64_t fh; 739*a62a9e19SDr. David Alan Gilbert uint32_t flags; 740*a62a9e19SDr. David Alan Gilbert uint32_t cmd; 741*a62a9e19SDr. David Alan Gilbert uint64_t arg; 742*a62a9e19SDr. David Alan Gilbert uint32_t in_size; 743*a62a9e19SDr. David Alan Gilbert uint32_t out_size; 744*a62a9e19SDr. David Alan Gilbert }; 745*a62a9e19SDr. David Alan Gilbert 746*a62a9e19SDr. David Alan Gilbert struct fuse_ioctl_iovec { 747*a62a9e19SDr. David Alan Gilbert uint64_t base; 748*a62a9e19SDr. David Alan Gilbert uint64_t len; 749*a62a9e19SDr. David Alan Gilbert }; 750*a62a9e19SDr. David Alan Gilbert 751*a62a9e19SDr. David Alan Gilbert struct fuse_ioctl_out { 752*a62a9e19SDr. David Alan Gilbert int32_t result; 753*a62a9e19SDr. David Alan Gilbert uint32_t flags; 754*a62a9e19SDr. David Alan Gilbert uint32_t in_iovs; 755*a62a9e19SDr. David Alan Gilbert uint32_t out_iovs; 756*a62a9e19SDr. David Alan Gilbert }; 757*a62a9e19SDr. David Alan Gilbert 758*a62a9e19SDr. David Alan Gilbert struct fuse_poll_in { 759*a62a9e19SDr. David Alan Gilbert uint64_t fh; 760*a62a9e19SDr. David Alan Gilbert uint64_t kh; 761*a62a9e19SDr. David Alan Gilbert uint32_t flags; 762*a62a9e19SDr. David Alan Gilbert uint32_t events; 763*a62a9e19SDr. David Alan Gilbert }; 764*a62a9e19SDr. David Alan Gilbert 765*a62a9e19SDr. David Alan Gilbert struct fuse_poll_out { 766*a62a9e19SDr. David Alan Gilbert uint32_t revents; 767*a62a9e19SDr. David Alan Gilbert uint32_t padding; 768*a62a9e19SDr. David Alan Gilbert }; 769*a62a9e19SDr. David Alan Gilbert 770*a62a9e19SDr. David Alan Gilbert struct fuse_notify_poll_wakeup_out { 771*a62a9e19SDr. David Alan Gilbert uint64_t kh; 772*a62a9e19SDr. David Alan Gilbert }; 773*a62a9e19SDr. David Alan Gilbert 774*a62a9e19SDr. David Alan Gilbert struct fuse_fallocate_in { 775*a62a9e19SDr. David Alan Gilbert uint64_t fh; 776*a62a9e19SDr. David Alan Gilbert uint64_t offset; 777*a62a9e19SDr. David Alan Gilbert uint64_t length; 778*a62a9e19SDr. David Alan Gilbert uint32_t mode; 779*a62a9e19SDr. David Alan Gilbert uint32_t padding; 780*a62a9e19SDr. David Alan Gilbert }; 781*a62a9e19SDr. David Alan Gilbert 782*a62a9e19SDr. David Alan Gilbert struct fuse_in_header { 783*a62a9e19SDr. David Alan Gilbert uint32_t len; 784*a62a9e19SDr. David Alan Gilbert uint32_t opcode; 785*a62a9e19SDr. David Alan Gilbert uint64_t unique; 786*a62a9e19SDr. David Alan Gilbert uint64_t nodeid; 787*a62a9e19SDr. David Alan Gilbert uint32_t uid; 788*a62a9e19SDr. David Alan Gilbert uint32_t gid; 789*a62a9e19SDr. David Alan Gilbert uint32_t pid; 790*a62a9e19SDr. David Alan Gilbert uint32_t padding; 791*a62a9e19SDr. David Alan Gilbert }; 792*a62a9e19SDr. David Alan Gilbert 793*a62a9e19SDr. David Alan Gilbert struct fuse_out_header { 794*a62a9e19SDr. David Alan Gilbert uint32_t len; 795*a62a9e19SDr. David Alan Gilbert int32_t error; 796*a62a9e19SDr. David Alan Gilbert uint64_t unique; 797*a62a9e19SDr. David Alan Gilbert }; 798*a62a9e19SDr. David Alan Gilbert 799*a62a9e19SDr. David Alan Gilbert struct fuse_dirent { 800*a62a9e19SDr. David Alan Gilbert uint64_t ino; 801*a62a9e19SDr. David Alan Gilbert uint64_t off; 802*a62a9e19SDr. David Alan Gilbert uint32_t namelen; 803*a62a9e19SDr. David Alan Gilbert uint32_t type; 804*a62a9e19SDr. David Alan Gilbert char name[]; 805*a62a9e19SDr. David Alan Gilbert }; 806*a62a9e19SDr. David Alan Gilbert 807*a62a9e19SDr. David Alan Gilbert #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) 808*a62a9e19SDr. David Alan Gilbert #define FUSE_DIRENT_ALIGN(x) \ 809*a62a9e19SDr. David Alan Gilbert (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1)) 810*a62a9e19SDr. David Alan Gilbert #define FUSE_DIRENT_SIZE(d) \ 811*a62a9e19SDr. David Alan Gilbert FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) 812*a62a9e19SDr. David Alan Gilbert 813*a62a9e19SDr. David Alan Gilbert struct fuse_direntplus { 814*a62a9e19SDr. David Alan Gilbert struct fuse_entry_out entry_out; 815*a62a9e19SDr. David Alan Gilbert struct fuse_dirent dirent; 816*a62a9e19SDr. David Alan Gilbert }; 817*a62a9e19SDr. David Alan Gilbert 818*a62a9e19SDr. David Alan Gilbert #define FUSE_NAME_OFFSET_DIRENTPLUS \ 819*a62a9e19SDr. David Alan Gilbert offsetof(struct fuse_direntplus, dirent.name) 820*a62a9e19SDr. David Alan Gilbert #define FUSE_DIRENTPLUS_SIZE(d) \ 821*a62a9e19SDr. David Alan Gilbert FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen) 822*a62a9e19SDr. David Alan Gilbert 823*a62a9e19SDr. David Alan Gilbert struct fuse_notify_inval_inode_out { 824*a62a9e19SDr. David Alan Gilbert uint64_t ino; 825*a62a9e19SDr. David Alan Gilbert int64_t off; 826*a62a9e19SDr. David Alan Gilbert int64_t len; 827*a62a9e19SDr. David Alan Gilbert }; 828*a62a9e19SDr. David Alan Gilbert 829*a62a9e19SDr. David Alan Gilbert struct fuse_notify_inval_entry_out { 830*a62a9e19SDr. David Alan Gilbert uint64_t parent; 831*a62a9e19SDr. David Alan Gilbert uint32_t namelen; 832*a62a9e19SDr. David Alan Gilbert uint32_t padding; 833*a62a9e19SDr. David Alan Gilbert }; 834*a62a9e19SDr. David Alan Gilbert 835*a62a9e19SDr. David Alan Gilbert struct fuse_notify_delete_out { 836*a62a9e19SDr. David Alan Gilbert uint64_t parent; 837*a62a9e19SDr. David Alan Gilbert uint64_t child; 838*a62a9e19SDr. David Alan Gilbert uint32_t namelen; 839*a62a9e19SDr. David Alan Gilbert uint32_t padding; 840*a62a9e19SDr. David Alan Gilbert }; 841*a62a9e19SDr. David Alan Gilbert 842*a62a9e19SDr. David Alan Gilbert struct fuse_notify_store_out { 843*a62a9e19SDr. David Alan Gilbert uint64_t nodeid; 844*a62a9e19SDr. David Alan Gilbert uint64_t offset; 845*a62a9e19SDr. David Alan Gilbert uint32_t size; 846*a62a9e19SDr. David Alan Gilbert uint32_t padding; 847*a62a9e19SDr. David Alan Gilbert }; 848*a62a9e19SDr. David Alan Gilbert 849*a62a9e19SDr. David Alan Gilbert struct fuse_notify_retrieve_out { 850*a62a9e19SDr. David Alan Gilbert uint64_t notify_unique; 851*a62a9e19SDr. David Alan Gilbert uint64_t nodeid; 852*a62a9e19SDr. David Alan Gilbert uint64_t offset; 853*a62a9e19SDr. David Alan Gilbert uint32_t size; 854*a62a9e19SDr. David Alan Gilbert uint32_t padding; 855*a62a9e19SDr. David Alan Gilbert }; 856*a62a9e19SDr. David Alan Gilbert 857*a62a9e19SDr. David Alan Gilbert /* Matches the size of fuse_write_in */ 858*a62a9e19SDr. David Alan Gilbert struct fuse_notify_retrieve_in { 859*a62a9e19SDr. David Alan Gilbert uint64_t dummy1; 860*a62a9e19SDr. David Alan Gilbert uint64_t offset; 861*a62a9e19SDr. David Alan Gilbert uint32_t size; 862*a62a9e19SDr. David Alan Gilbert uint32_t dummy2; 863*a62a9e19SDr. David Alan Gilbert uint64_t dummy3; 864*a62a9e19SDr. David Alan Gilbert uint64_t dummy4; 865*a62a9e19SDr. David Alan Gilbert }; 866*a62a9e19SDr. David Alan Gilbert 867*a62a9e19SDr. David Alan Gilbert /* Device ioctls: */ 868*a62a9e19SDr. David Alan Gilbert #define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t) 869*a62a9e19SDr. David Alan Gilbert 870*a62a9e19SDr. David Alan Gilbert struct fuse_lseek_in { 871*a62a9e19SDr. David Alan Gilbert uint64_t fh; 872*a62a9e19SDr. David Alan Gilbert uint64_t offset; 873*a62a9e19SDr. David Alan Gilbert uint32_t whence; 874*a62a9e19SDr. David Alan Gilbert uint32_t padding; 875*a62a9e19SDr. David Alan Gilbert }; 876*a62a9e19SDr. David Alan Gilbert 877*a62a9e19SDr. David Alan Gilbert struct fuse_lseek_out { 878*a62a9e19SDr. David Alan Gilbert uint64_t offset; 879*a62a9e19SDr. David Alan Gilbert }; 880*a62a9e19SDr. David Alan Gilbert 881*a62a9e19SDr. David Alan Gilbert struct fuse_copy_file_range_in { 882*a62a9e19SDr. David Alan Gilbert uint64_t fh_in; 883*a62a9e19SDr. David Alan Gilbert uint64_t off_in; 884*a62a9e19SDr. David Alan Gilbert uint64_t nodeid_out; 885*a62a9e19SDr. David Alan Gilbert uint64_t fh_out; 886*a62a9e19SDr. David Alan Gilbert uint64_t off_out; 887*a62a9e19SDr. David Alan Gilbert uint64_t len; 888*a62a9e19SDr. David Alan Gilbert uint64_t flags; 889*a62a9e19SDr. David Alan Gilbert }; 890*a62a9e19SDr. David Alan Gilbert 891*a62a9e19SDr. David Alan Gilbert #endif /* _LINUX_FUSE_H */ 892