1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 2607ca46eSDavid Howells /* 37e98d530SMiklos Szeredi This file defines the kernel interface of FUSE 4607ca46eSDavid Howells Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> 5607ca46eSDavid Howells 6607ca46eSDavid Howells This program can be distributed under the terms of the GNU GPL. 7607ca46eSDavid Howells See the file COPYING. 87e98d530SMiklos Szeredi 97e98d530SMiklos Szeredi This -- and only this -- header file may also be distributed under 107e98d530SMiklos Szeredi the terms of the BSD Licence as follows: 117e98d530SMiklos Szeredi 127e98d530SMiklos Szeredi Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved. 137e98d530SMiklos Szeredi 147e98d530SMiklos Szeredi Redistribution and use in source and binary forms, with or without 157e98d530SMiklos Szeredi modification, are permitted provided that the following conditions 167e98d530SMiklos Szeredi are met: 177e98d530SMiklos Szeredi 1. Redistributions of source code must retain the above copyright 187e98d530SMiklos Szeredi notice, this list of conditions and the following disclaimer. 197e98d530SMiklos Szeredi 2. Redistributions in binary form must reproduce the above copyright 207e98d530SMiklos Szeredi notice, this list of conditions and the following disclaimer in the 217e98d530SMiklos Szeredi documentation and/or other materials provided with the distribution. 227e98d530SMiklos Szeredi 237e98d530SMiklos Szeredi THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 247e98d530SMiklos Szeredi ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 257e98d530SMiklos Szeredi IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 267e98d530SMiklos Szeredi ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 277e98d530SMiklos Szeredi FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 287e98d530SMiklos Szeredi DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 297e98d530SMiklos Szeredi OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 307e98d530SMiklos Szeredi HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 317e98d530SMiklos Szeredi LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 327e98d530SMiklos Szeredi OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 337e98d530SMiklos Szeredi SUCH DAMAGE. 34607ca46eSDavid Howells */ 35607ca46eSDavid Howells 36607ca46eSDavid Howells /* 37607ca46eSDavid Howells * This file defines the kernel interface of FUSE 38607ca46eSDavid Howells * 39607ca46eSDavid Howells * Protocol changelog: 40607ca46eSDavid Howells * 41607ca46eSDavid Howells * 7.9: 42607ca46eSDavid Howells * - new fuse_getattr_in input argument of GETATTR 43607ca46eSDavid Howells * - add lk_flags in fuse_lk_in 44607ca46eSDavid Howells * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in 45607ca46eSDavid Howells * - add blksize field to fuse_attr 46607ca46eSDavid Howells * - add file flags field to fuse_read_in and fuse_write_in 477142fd1bSAlan Somers * - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in 48607ca46eSDavid Howells * 49607ca46eSDavid Howells * 7.10 50607ca46eSDavid Howells * - add nonseekable open flag 51607ca46eSDavid Howells * 52607ca46eSDavid Howells * 7.11 53607ca46eSDavid Howells * - add IOCTL message 54607ca46eSDavid Howells * - add unsolicited notification support 55607ca46eSDavid Howells * - add POLL message and NOTIFY_POLL notification 56607ca46eSDavid Howells * 57607ca46eSDavid Howells * 7.12 5868065b84SAlan Somers * - add umask flag to input argument of create, mknod and mkdir 59607ca46eSDavid Howells * - add notification messages for invalidation of inodes and 60607ca46eSDavid Howells * directory entries 61607ca46eSDavid Howells * 62607ca46eSDavid Howells * 7.13 63607ca46eSDavid Howells * - make max number of background requests and congestion threshold 64607ca46eSDavid Howells * tunables 65607ca46eSDavid Howells * 66607ca46eSDavid Howells * 7.14 67607ca46eSDavid Howells * - add splice support to fuse device 68607ca46eSDavid Howells * 69607ca46eSDavid Howells * 7.15 70607ca46eSDavid Howells * - add store notify 71607ca46eSDavid Howells * - add retrieve notify 72607ca46eSDavid Howells * 73607ca46eSDavid Howells * 7.16 74607ca46eSDavid Howells * - add BATCH_FORGET request 75607ca46eSDavid Howells * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct 76607ca46eSDavid Howells * fuse_ioctl_iovec' instead of ambiguous 'struct iovec' 77607ca46eSDavid Howells * - add FUSE_IOCTL_32BIT flag 78607ca46eSDavid Howells * 79607ca46eSDavid Howells * 7.17 80607ca46eSDavid Howells * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK 81607ca46eSDavid Howells * 82607ca46eSDavid Howells * 7.18 83607ca46eSDavid Howells * - add FUSE_IOCTL_DIR flag 84607ca46eSDavid Howells * - add FUSE_NOTIFY_DELETE 85607ca46eSDavid Howells * 86607ca46eSDavid Howells * 7.19 87607ca46eSDavid Howells * - add FUSE_FALLOCATE 88607ca46eSDavid Howells * 89607ca46eSDavid Howells * 7.20 90607ca46eSDavid Howells * - add FUSE_AUTO_INVAL_DATA 9123c153e5SMiklos Szeredi * 9223c153e5SMiklos Szeredi * 7.21 9323c153e5SMiklos Szeredi * - add FUSE_READDIRPLUS 940415d291SEnke Chen * - send the requested events in POLL request 9560b9df7aSMiklos Szeredi * 9660b9df7aSMiklos Szeredi * 7.22 9760b9df7aSMiklos Szeredi * - add FUSE_ASYNC_DIO 984d99ff8fSPavel Emelyanov * 994d99ff8fSPavel Emelyanov * 7.23 1004d99ff8fSPavel Emelyanov * - add FUSE_WRITEBACK_CACHE 101e27c9d38SMiklos Szeredi * - add time_gran to fuse_init_out 102e27c9d38SMiklos Szeredi * - add reserved space to fuse_init_out 103ab9e13f7SMaxim Patlasov * - add FATTR_CTIME 104ab9e13f7SMaxim Patlasov * - add ctime and ctimensec to fuse_setattr_in 1051560c974SMiklos Szeredi * - add FUSE_RENAME2 request 106d7afaec0SAndrew Gallagher * - add FUSE_NO_OPEN_SUPPORT flag 1070b5da8dbSRavishankar N * 1080b5da8dbSRavishankar N * 7.24 1090b5da8dbSRavishankar N * - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support 1105c672ab3SMiklos Szeredi * 1115c672ab3SMiklos Szeredi * 7.25 1125c672ab3SMiklos Szeredi * - add FUSE_PARALLEL_DIROPS 1135e940c1dSMiklos Szeredi * 1145e940c1dSMiklos Szeredi * 7.26 1155e940c1dSMiklos Szeredi * - add FUSE_HANDLE_KILLPRIV 11660bcc88aSSeth Forshee * - add FUSE_POSIX_ACL 1173b7008b2SSzymon Lukasz * 1183b7008b2SSzymon Lukasz * 7.27 1193b7008b2SSzymon Lukasz * - add FUSE_ABORT_ERROR 12088bc7d50SNiels de Vos * 12188bc7d50SNiels de Vos * 7.28 12288bc7d50SNiels de Vos * - add FUSE_COPY_FILE_RANGE 1236433b899SMiklos Szeredi * - add FOPEN_CACHE_DIR 1245da784ccSConstantine Shulyupin * - add FUSE_MAX_PAGES, add max_pages to init_out 1255571f1e6SDan Schatzberg * - add FUSE_CACHE_SYMLINKS 126d9a9ea94SChad Austin * 127d9a9ea94SChad Austin * 7.29 128d9a9ea94SChad Austin * - add FUSE_NO_OPENDIR_SUPPORT flag 129ad2ba64dSKirill Smelkov * 130ad2ba64dSKirill Smelkov * 7.30 131ad2ba64dSKirill Smelkov * - add FUSE_EXPLICIT_INVAL_DATA 1326407f44aSIan Abbott * - add FUSE_IOCTL_COMPAT_X32 1334a2abf99SMiklos Szeredi * 1344a2abf99SMiklos Szeredi * 7.31 1354a2abf99SMiklos Szeredi * - add FUSE_WRITE_KILL_PRIV flag 136607ca46eSDavid Howells */ 137607ca46eSDavid Howells 138607ca46eSDavid Howells #ifndef _LINUX_FUSE_H 139607ca46eSDavid Howells #define _LINUX_FUSE_H 140607ca46eSDavid Howells 1414c82456eSMiklos Szeredi #ifdef __KERNEL__ 142607ca46eSDavid Howells #include <linux/types.h> 1437e98d530SMiklos Szeredi #else 1447e98d530SMiklos Szeredi #include <stdint.h> 1457e98d530SMiklos Szeredi #endif 146607ca46eSDavid Howells 147607ca46eSDavid Howells /* 148607ca46eSDavid Howells * Version negotiation: 149607ca46eSDavid Howells * 150607ca46eSDavid Howells * Both the kernel and userspace send the version they support in the 151607ca46eSDavid Howells * INIT request and reply respectively. 152607ca46eSDavid Howells * 153607ca46eSDavid Howells * If the major versions match then both shall use the smallest 154607ca46eSDavid Howells * of the two minor versions for communication. 155607ca46eSDavid Howells * 156607ca46eSDavid Howells * If the kernel supports a larger major version, then userspace shall 157607ca46eSDavid Howells * reply with the major version it supports, ignore the rest of the 158607ca46eSDavid Howells * INIT message and expect a new INIT message from the kernel with a 159607ca46eSDavid Howells * matching major version. 160607ca46eSDavid Howells * 161607ca46eSDavid Howells * If the library supports a larger major version, then it shall fall 162607ca46eSDavid Howells * back to the major protocol version sent by the kernel for 163607ca46eSDavid Howells * communication and reply with that major version (and an arbitrary 164607ca46eSDavid Howells * supported minor version). 165607ca46eSDavid Howells */ 166607ca46eSDavid Howells 167607ca46eSDavid Howells /** Version number of this interface */ 168607ca46eSDavid Howells #define FUSE_KERNEL_VERSION 7 169607ca46eSDavid Howells 170607ca46eSDavid Howells /** Minor version number of this interface */ 1714a2abf99SMiklos Szeredi #define FUSE_KERNEL_MINOR_VERSION 31 172607ca46eSDavid Howells 173607ca46eSDavid Howells /** The node ID of the root inode */ 174607ca46eSDavid Howells #define FUSE_ROOT_ID 1 175607ca46eSDavid Howells 176607ca46eSDavid Howells /* Make sure all structures are padded to 64bit boundary, so 32bit 177607ca46eSDavid Howells userspace works under 64bit kernels */ 178607ca46eSDavid Howells 179607ca46eSDavid Howells struct fuse_attr { 1804c82456eSMiklos Szeredi uint64_t ino; 1814c82456eSMiklos Szeredi uint64_t size; 1824c82456eSMiklos Szeredi uint64_t blocks; 1834c82456eSMiklos Szeredi uint64_t atime; 1844c82456eSMiklos Szeredi uint64_t mtime; 1854c82456eSMiklos Szeredi uint64_t ctime; 1864c82456eSMiklos Szeredi uint32_t atimensec; 1874c82456eSMiklos Szeredi uint32_t mtimensec; 1884c82456eSMiklos Szeredi uint32_t ctimensec; 1894c82456eSMiklos Szeredi uint32_t mode; 1904c82456eSMiklos Szeredi uint32_t nlink; 1914c82456eSMiklos Szeredi uint32_t uid; 1924c82456eSMiklos Szeredi uint32_t gid; 1934c82456eSMiklos Szeredi uint32_t rdev; 1944c82456eSMiklos Szeredi uint32_t blksize; 1954c82456eSMiklos Szeredi uint32_t padding; 196607ca46eSDavid Howells }; 197607ca46eSDavid Howells 198607ca46eSDavid Howells struct fuse_kstatfs { 1994c82456eSMiklos Szeredi uint64_t blocks; 2004c82456eSMiklos Szeredi uint64_t bfree; 2014c82456eSMiklos Szeredi uint64_t bavail; 2024c82456eSMiklos Szeredi uint64_t files; 2034c82456eSMiklos Szeredi uint64_t ffree; 2044c82456eSMiklos Szeredi uint32_t bsize; 2054c82456eSMiklos Szeredi uint32_t namelen; 2064c82456eSMiklos Szeredi uint32_t frsize; 2074c82456eSMiklos Szeredi uint32_t padding; 2084c82456eSMiklos Szeredi uint32_t spare[6]; 209607ca46eSDavid Howells }; 210607ca46eSDavid Howells 211607ca46eSDavid Howells struct fuse_file_lock { 2124c82456eSMiklos Szeredi uint64_t start; 2134c82456eSMiklos Szeredi uint64_t end; 2144c82456eSMiklos Szeredi uint32_t type; 2154c82456eSMiklos Szeredi uint32_t pid; /* tgid */ 216607ca46eSDavid Howells }; 217607ca46eSDavid Howells 218607ca46eSDavid Howells /** 219607ca46eSDavid Howells * Bitmasks for fuse_setattr_in.valid 220607ca46eSDavid Howells */ 221607ca46eSDavid Howells #define FATTR_MODE (1 << 0) 222607ca46eSDavid Howells #define FATTR_UID (1 << 1) 223607ca46eSDavid Howells #define FATTR_GID (1 << 2) 224607ca46eSDavid Howells #define FATTR_SIZE (1 << 3) 225607ca46eSDavid Howells #define FATTR_ATIME (1 << 4) 226607ca46eSDavid Howells #define FATTR_MTIME (1 << 5) 227607ca46eSDavid Howells #define FATTR_FH (1 << 6) 228607ca46eSDavid Howells #define FATTR_ATIME_NOW (1 << 7) 229607ca46eSDavid Howells #define FATTR_MTIME_NOW (1 << 8) 230607ca46eSDavid Howells #define FATTR_LOCKOWNER (1 << 9) 231ab9e13f7SMaxim Patlasov #define FATTR_CTIME (1 << 10) 232607ca46eSDavid Howells 233607ca46eSDavid Howells /** 234607ca46eSDavid Howells * Flags returned by the OPEN request 235607ca46eSDavid Howells * 236607ca46eSDavid Howells * FOPEN_DIRECT_IO: bypass page cache for this open file 237607ca46eSDavid Howells * FOPEN_KEEP_CACHE: don't invalidate the data cache on open 238607ca46eSDavid Howells * FOPEN_NONSEEKABLE: the file is not seekable 2396433b899SMiklos Szeredi * FOPEN_CACHE_DIR: allow caching this directory 240bbd84f33SKirill Smelkov * FOPEN_STREAM: the file is stream-like (no file position at all) 241607ca46eSDavid Howells */ 242607ca46eSDavid Howells #define FOPEN_DIRECT_IO (1 << 0) 243607ca46eSDavid Howells #define FOPEN_KEEP_CACHE (1 << 1) 244607ca46eSDavid Howells #define FOPEN_NONSEEKABLE (1 << 2) 2456433b899SMiklos Szeredi #define FOPEN_CACHE_DIR (1 << 3) 246bbd84f33SKirill Smelkov #define FOPEN_STREAM (1 << 4) 247607ca46eSDavid Howells 248607ca46eSDavid Howells /** 249607ca46eSDavid Howells * INIT request/reply flags 250607ca46eSDavid Howells * 251607ca46eSDavid Howells * FUSE_ASYNC_READ: asynchronous read requests 252607ca46eSDavid Howells * FUSE_POSIX_LOCKS: remote locking for POSIX file locks 253607ca46eSDavid Howells * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported) 254607ca46eSDavid Howells * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem 255607ca46eSDavid Howells * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." 256607ca46eSDavid Howells * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB 257607ca46eSDavid Howells * FUSE_DONT_MASK: don't apply umask to file mode on create operations 258607ca46eSDavid Howells * FUSE_SPLICE_WRITE: kernel supports splice write on the device 259607ca46eSDavid Howells * FUSE_SPLICE_MOVE: kernel supports splice move on the device 260607ca46eSDavid Howells * FUSE_SPLICE_READ: kernel supports splice read on the device 261607ca46eSDavid Howells * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks 262607ca46eSDavid Howells * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories 263607ca46eSDavid Howells * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages 264634734b6SEric Wong * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one) 265634734b6SEric Wong * FUSE_READDIRPLUS_AUTO: adaptive readdirplus 26660b9df7aSMiklos Szeredi * FUSE_ASYNC_DIO: asynchronous direct I/O submission 2674d99ff8fSPavel Emelyanov * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes 268d7afaec0SAndrew Gallagher * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens 2695c672ab3SMiklos Szeredi * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir 2705e940c1dSMiklos Szeredi * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc 27160bcc88aSSeth Forshee * FUSE_POSIX_ACL: filesystem supports posix acls 2723b7008b2SSzymon Lukasz * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED 2735da784ccSConstantine Shulyupin * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages 2745571f1e6SDan Schatzberg * FUSE_CACHE_SYMLINKS: cache READLINK responses 275d9a9ea94SChad Austin * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir 276ad2ba64dSKirill Smelkov * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request 277607ca46eSDavid Howells */ 278607ca46eSDavid Howells #define FUSE_ASYNC_READ (1 << 0) 279607ca46eSDavid Howells #define FUSE_POSIX_LOCKS (1 << 1) 280607ca46eSDavid Howells #define FUSE_FILE_OPS (1 << 2) 281607ca46eSDavid Howells #define FUSE_ATOMIC_O_TRUNC (1 << 3) 282607ca46eSDavid Howells #define FUSE_EXPORT_SUPPORT (1 << 4) 283607ca46eSDavid Howells #define FUSE_BIG_WRITES (1 << 5) 284607ca46eSDavid Howells #define FUSE_DONT_MASK (1 << 6) 285607ca46eSDavid Howells #define FUSE_SPLICE_WRITE (1 << 7) 286607ca46eSDavid Howells #define FUSE_SPLICE_MOVE (1 << 8) 287607ca46eSDavid Howells #define FUSE_SPLICE_READ (1 << 9) 288607ca46eSDavid Howells #define FUSE_FLOCK_LOCKS (1 << 10) 289607ca46eSDavid Howells #define FUSE_HAS_IOCTL_DIR (1 << 11) 290607ca46eSDavid Howells #define FUSE_AUTO_INVAL_DATA (1 << 12) 2910b05b183SAnand V. Avati #define FUSE_DO_READDIRPLUS (1 << 13) 292634734b6SEric Wong #define FUSE_READDIRPLUS_AUTO (1 << 14) 29360b9df7aSMiklos Szeredi #define FUSE_ASYNC_DIO (1 << 15) 2944d99ff8fSPavel Emelyanov #define FUSE_WRITEBACK_CACHE (1 << 16) 295d7afaec0SAndrew Gallagher #define FUSE_NO_OPEN_SUPPORT (1 << 17) 2965c672ab3SMiklos Szeredi #define FUSE_PARALLEL_DIROPS (1 << 18) 2975e940c1dSMiklos Szeredi #define FUSE_HANDLE_KILLPRIV (1 << 19) 29860bcc88aSSeth Forshee #define FUSE_POSIX_ACL (1 << 20) 2993b7008b2SSzymon Lukasz #define FUSE_ABORT_ERROR (1 << 21) 3005da784ccSConstantine Shulyupin #define FUSE_MAX_PAGES (1 << 22) 3015571f1e6SDan Schatzberg #define FUSE_CACHE_SYMLINKS (1 << 23) 302d9a9ea94SChad Austin #define FUSE_NO_OPENDIR_SUPPORT (1 << 24) 303ad2ba64dSKirill Smelkov #define FUSE_EXPLICIT_INVAL_DATA (1 << 25) 304607ca46eSDavid Howells 305607ca46eSDavid Howells /** 306607ca46eSDavid Howells * CUSE INIT request/reply flags 307607ca46eSDavid Howells * 308607ca46eSDavid Howells * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl 309607ca46eSDavid Howells */ 310607ca46eSDavid Howells #define CUSE_UNRESTRICTED_IOCTL (1 << 0) 311607ca46eSDavid Howells 312607ca46eSDavid Howells /** 313607ca46eSDavid Howells * Release flags 314607ca46eSDavid Howells */ 315607ca46eSDavid Howells #define FUSE_RELEASE_FLUSH (1 << 0) 316607ca46eSDavid Howells #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1) 317607ca46eSDavid Howells 318607ca46eSDavid Howells /** 319607ca46eSDavid Howells * Getattr flags 320607ca46eSDavid Howells */ 321607ca46eSDavid Howells #define FUSE_GETATTR_FH (1 << 0) 322607ca46eSDavid Howells 323607ca46eSDavid Howells /** 324607ca46eSDavid Howells * Lock flags 325607ca46eSDavid Howells */ 326607ca46eSDavid Howells #define FUSE_LK_FLOCK (1 << 0) 327607ca46eSDavid Howells 328607ca46eSDavid Howells /** 329607ca46eSDavid Howells * WRITE flags 330607ca46eSDavid Howells * 331607ca46eSDavid Howells * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed 332607ca46eSDavid Howells * FUSE_WRITE_LOCKOWNER: lock_owner field is valid 3334a2abf99SMiklos Szeredi * FUSE_WRITE_KILL_PRIV: kill suid and sgid bits 334607ca46eSDavid Howells */ 335607ca46eSDavid Howells #define FUSE_WRITE_CACHE (1 << 0) 336607ca46eSDavid Howells #define FUSE_WRITE_LOCKOWNER (1 << 1) 3374a2abf99SMiklos Szeredi #define FUSE_WRITE_KILL_PRIV (1 << 2) 338607ca46eSDavid Howells 339607ca46eSDavid Howells /** 340607ca46eSDavid Howells * Read flags 341607ca46eSDavid Howells */ 342607ca46eSDavid Howells #define FUSE_READ_LOCKOWNER (1 << 1) 343607ca46eSDavid Howells 344607ca46eSDavid Howells /** 345607ca46eSDavid Howells * Ioctl flags 346607ca46eSDavid Howells * 347607ca46eSDavid Howells * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine 348607ca46eSDavid Howells * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed 349607ca46eSDavid Howells * FUSE_IOCTL_RETRY: retry with new iovecs 350607ca46eSDavid Howells * FUSE_IOCTL_32BIT: 32bit ioctl 351607ca46eSDavid Howells * FUSE_IOCTL_DIR: is a directory 3526407f44aSIan Abbott * FUSE_IOCTL_COMPAT_X32: x32 compat ioctl on 64bit machine (64bit time_t) 353607ca46eSDavid Howells * 354607ca46eSDavid Howells * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs 355607ca46eSDavid Howells */ 356607ca46eSDavid Howells #define FUSE_IOCTL_COMPAT (1 << 0) 357607ca46eSDavid Howells #define FUSE_IOCTL_UNRESTRICTED (1 << 1) 358607ca46eSDavid Howells #define FUSE_IOCTL_RETRY (1 << 2) 359607ca46eSDavid Howells #define FUSE_IOCTL_32BIT (1 << 3) 360607ca46eSDavid Howells #define FUSE_IOCTL_DIR (1 << 4) 3616407f44aSIan Abbott #define FUSE_IOCTL_COMPAT_X32 (1 << 5) 362607ca46eSDavid Howells 363607ca46eSDavid Howells #define FUSE_IOCTL_MAX_IOV 256 364607ca46eSDavid Howells 365607ca46eSDavid Howells /** 366607ca46eSDavid Howells * Poll flags 367607ca46eSDavid Howells * 368607ca46eSDavid Howells * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify 369607ca46eSDavid Howells */ 370607ca46eSDavid Howells #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) 371607ca46eSDavid Howells 372154603feSAlan Somers /** 373154603feSAlan Somers * Fsync flags 374154603feSAlan Somers * 375154603feSAlan Somers * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata 376154603feSAlan Somers */ 377154603feSAlan Somers #define FUSE_FSYNC_FDATASYNC (1 << 0) 378154603feSAlan Somers 379607ca46eSDavid Howells enum fuse_opcode { 380607ca46eSDavid Howells FUSE_LOOKUP = 1, 381607ca46eSDavid Howells FUSE_FORGET = 2, /* no reply */ 382607ca46eSDavid Howells FUSE_GETATTR = 3, 383607ca46eSDavid Howells FUSE_SETATTR = 4, 384607ca46eSDavid Howells FUSE_READLINK = 5, 385607ca46eSDavid Howells FUSE_SYMLINK = 6, 386607ca46eSDavid Howells FUSE_MKNOD = 8, 387607ca46eSDavid Howells FUSE_MKDIR = 9, 388607ca46eSDavid Howells FUSE_UNLINK = 10, 389607ca46eSDavid Howells FUSE_RMDIR = 11, 390607ca46eSDavid Howells FUSE_RENAME = 12, 391607ca46eSDavid Howells FUSE_LINK = 13, 392607ca46eSDavid Howells FUSE_OPEN = 14, 393607ca46eSDavid Howells FUSE_READ = 15, 394607ca46eSDavid Howells FUSE_WRITE = 16, 395607ca46eSDavid Howells FUSE_STATFS = 17, 396607ca46eSDavid Howells FUSE_RELEASE = 18, 397607ca46eSDavid Howells FUSE_FSYNC = 20, 398607ca46eSDavid Howells FUSE_SETXATTR = 21, 399607ca46eSDavid Howells FUSE_GETXATTR = 22, 400607ca46eSDavid Howells FUSE_LISTXATTR = 23, 401607ca46eSDavid Howells FUSE_REMOVEXATTR = 24, 402607ca46eSDavid Howells FUSE_FLUSH = 25, 403607ca46eSDavid Howells FUSE_INIT = 26, 404607ca46eSDavid Howells FUSE_OPENDIR = 27, 405607ca46eSDavid Howells FUSE_READDIR = 28, 406607ca46eSDavid Howells FUSE_RELEASEDIR = 29, 407607ca46eSDavid Howells FUSE_FSYNCDIR = 30, 408607ca46eSDavid Howells FUSE_GETLK = 31, 409607ca46eSDavid Howells FUSE_SETLK = 32, 410607ca46eSDavid Howells FUSE_SETLKW = 33, 411607ca46eSDavid Howells FUSE_ACCESS = 34, 412607ca46eSDavid Howells FUSE_CREATE = 35, 413607ca46eSDavid Howells FUSE_INTERRUPT = 36, 414607ca46eSDavid Howells FUSE_BMAP = 37, 415607ca46eSDavid Howells FUSE_DESTROY = 38, 416607ca46eSDavid Howells FUSE_IOCTL = 39, 417607ca46eSDavid Howells FUSE_POLL = 40, 418607ca46eSDavid Howells FUSE_NOTIFY_REPLY = 41, 419607ca46eSDavid Howells FUSE_BATCH_FORGET = 42, 420607ca46eSDavid Howells FUSE_FALLOCATE = 43, 4210b05b183SAnand V. Avati FUSE_READDIRPLUS = 44, 4221560c974SMiklos Szeredi FUSE_RENAME2 = 45, 4230b5da8dbSRavishankar N FUSE_LSEEK = 46, 42488bc7d50SNiels de Vos FUSE_COPY_FILE_RANGE = 47, 425607ca46eSDavid Howells 426607ca46eSDavid Howells /* CUSE specific operations */ 427607ca46eSDavid Howells CUSE_INIT = 4096, 428*501ae8ecSMichael S. Tsirkin 429*501ae8ecSMichael S. Tsirkin /* Reserved opcodes: helpful to detect structure endian-ness */ 430*501ae8ecSMichael S. Tsirkin CUSE_INIT_BSWAP_RESERVED = 1048576, /* CUSE_INIT << 8 */ 431*501ae8ecSMichael S. Tsirkin FUSE_INIT_BSWAP_RESERVED = 436207616, /* FUSE_INIT << 24 */ 432607ca46eSDavid Howells }; 433607ca46eSDavid Howells 434607ca46eSDavid Howells enum fuse_notify_code { 435607ca46eSDavid Howells FUSE_NOTIFY_POLL = 1, 436607ca46eSDavid Howells FUSE_NOTIFY_INVAL_INODE = 2, 437607ca46eSDavid Howells FUSE_NOTIFY_INVAL_ENTRY = 3, 438607ca46eSDavid Howells FUSE_NOTIFY_STORE = 4, 439607ca46eSDavid Howells FUSE_NOTIFY_RETRIEVE = 5, 440607ca46eSDavid Howells FUSE_NOTIFY_DELETE = 6, 441607ca46eSDavid Howells FUSE_NOTIFY_CODE_MAX, 442607ca46eSDavid Howells }; 443607ca46eSDavid Howells 444607ca46eSDavid Howells /* The read buffer is required to be at least 8k, but may be much larger */ 445607ca46eSDavid Howells #define FUSE_MIN_READ_BUFFER 8192 446607ca46eSDavid Howells 447607ca46eSDavid Howells #define FUSE_COMPAT_ENTRY_OUT_SIZE 120 448607ca46eSDavid Howells 449607ca46eSDavid Howells struct fuse_entry_out { 4504c82456eSMiklos Szeredi uint64_t nodeid; /* Inode ID */ 4514c82456eSMiklos Szeredi uint64_t generation; /* Inode generation: nodeid:gen must 452607ca46eSDavid Howells be unique for the fs's lifetime */ 4534c82456eSMiklos Szeredi uint64_t entry_valid; /* Cache timeout for the name */ 4544c82456eSMiklos Szeredi uint64_t attr_valid; /* Cache timeout for the attributes */ 4554c82456eSMiklos Szeredi uint32_t entry_valid_nsec; 4564c82456eSMiklos Szeredi uint32_t attr_valid_nsec; 457607ca46eSDavid Howells struct fuse_attr attr; 458607ca46eSDavid Howells }; 459607ca46eSDavid Howells 460607ca46eSDavid Howells struct fuse_forget_in { 4614c82456eSMiklos Szeredi uint64_t nlookup; 462607ca46eSDavid Howells }; 463607ca46eSDavid Howells 464607ca46eSDavid Howells struct fuse_forget_one { 4654c82456eSMiklos Szeredi uint64_t nodeid; 4664c82456eSMiklos Szeredi uint64_t nlookup; 467607ca46eSDavid Howells }; 468607ca46eSDavid Howells 469607ca46eSDavid Howells struct fuse_batch_forget_in { 4704c82456eSMiklos Szeredi uint32_t count; 4714c82456eSMiklos Szeredi uint32_t dummy; 472607ca46eSDavid Howells }; 473607ca46eSDavid Howells 474607ca46eSDavid Howells struct fuse_getattr_in { 4754c82456eSMiklos Szeredi uint32_t getattr_flags; 4764c82456eSMiklos Szeredi uint32_t dummy; 4774c82456eSMiklos Szeredi uint64_t fh; 478607ca46eSDavid Howells }; 479607ca46eSDavid Howells 480607ca46eSDavid Howells #define FUSE_COMPAT_ATTR_OUT_SIZE 96 481607ca46eSDavid Howells 482607ca46eSDavid Howells struct fuse_attr_out { 4834c82456eSMiklos Szeredi uint64_t attr_valid; /* Cache timeout for the attributes */ 4844c82456eSMiklos Szeredi uint32_t attr_valid_nsec; 4854c82456eSMiklos Szeredi uint32_t dummy; 486607ca46eSDavid Howells struct fuse_attr attr; 487607ca46eSDavid Howells }; 488607ca46eSDavid Howells 489607ca46eSDavid Howells #define FUSE_COMPAT_MKNOD_IN_SIZE 8 490607ca46eSDavid Howells 491607ca46eSDavid Howells struct fuse_mknod_in { 4924c82456eSMiklos Szeredi uint32_t mode; 4934c82456eSMiklos Szeredi uint32_t rdev; 4944c82456eSMiklos Szeredi uint32_t umask; 4954c82456eSMiklos Szeredi uint32_t padding; 496607ca46eSDavid Howells }; 497607ca46eSDavid Howells 498607ca46eSDavid Howells struct fuse_mkdir_in { 4994c82456eSMiklos Szeredi uint32_t mode; 5004c82456eSMiklos Szeredi uint32_t umask; 501607ca46eSDavid Howells }; 502607ca46eSDavid Howells 503607ca46eSDavid Howells struct fuse_rename_in { 5044c82456eSMiklos Szeredi uint64_t newdir; 505607ca46eSDavid Howells }; 506607ca46eSDavid Howells 5071560c974SMiklos Szeredi struct fuse_rename2_in { 5081560c974SMiklos Szeredi uint64_t newdir; 5091560c974SMiklos Szeredi uint32_t flags; 5101560c974SMiklos Szeredi uint32_t padding; 5111560c974SMiklos Szeredi }; 5121560c974SMiklos Szeredi 513607ca46eSDavid Howells struct fuse_link_in { 5144c82456eSMiklos Szeredi uint64_t oldnodeid; 515607ca46eSDavid Howells }; 516607ca46eSDavid Howells 517607ca46eSDavid Howells struct fuse_setattr_in { 5184c82456eSMiklos Szeredi uint32_t valid; 5194c82456eSMiklos Szeredi uint32_t padding; 5204c82456eSMiklos Szeredi uint64_t fh; 5214c82456eSMiklos Szeredi uint64_t size; 5224c82456eSMiklos Szeredi uint64_t lock_owner; 5234c82456eSMiklos Szeredi uint64_t atime; 5244c82456eSMiklos Szeredi uint64_t mtime; 525ab9e13f7SMaxim Patlasov uint64_t ctime; 5264c82456eSMiklos Szeredi uint32_t atimensec; 5274c82456eSMiklos Szeredi uint32_t mtimensec; 528ab9e13f7SMaxim Patlasov uint32_t ctimensec; 5294c82456eSMiklos Szeredi uint32_t mode; 5304c82456eSMiklos Szeredi uint32_t unused4; 5314c82456eSMiklos Szeredi uint32_t uid; 5324c82456eSMiklos Szeredi uint32_t gid; 5334c82456eSMiklos Szeredi uint32_t unused5; 534607ca46eSDavid Howells }; 535607ca46eSDavid Howells 536607ca46eSDavid Howells struct fuse_open_in { 5374c82456eSMiklos Szeredi uint32_t flags; 5384c82456eSMiklos Szeredi uint32_t unused; 539607ca46eSDavid Howells }; 540607ca46eSDavid Howells 541607ca46eSDavid Howells struct fuse_create_in { 5424c82456eSMiklos Szeredi uint32_t flags; 5434c82456eSMiklos Szeredi uint32_t mode; 5444c82456eSMiklos Szeredi uint32_t umask; 5454c82456eSMiklos Szeredi uint32_t padding; 546607ca46eSDavid Howells }; 547607ca46eSDavid Howells 548607ca46eSDavid Howells struct fuse_open_out { 5494c82456eSMiklos Szeredi uint64_t fh; 5504c82456eSMiklos Szeredi uint32_t open_flags; 5514c82456eSMiklos Szeredi uint32_t padding; 552607ca46eSDavid Howells }; 553607ca46eSDavid Howells 554607ca46eSDavid Howells struct fuse_release_in { 5554c82456eSMiklos Szeredi uint64_t fh; 5564c82456eSMiklos Szeredi uint32_t flags; 5574c82456eSMiklos Szeredi uint32_t release_flags; 5584c82456eSMiklos Szeredi uint64_t lock_owner; 559607ca46eSDavid Howells }; 560607ca46eSDavid Howells 561607ca46eSDavid Howells struct fuse_flush_in { 5624c82456eSMiklos Szeredi uint64_t fh; 5634c82456eSMiklos Szeredi uint32_t unused; 5644c82456eSMiklos Szeredi uint32_t padding; 5654c82456eSMiklos Szeredi uint64_t lock_owner; 566607ca46eSDavid Howells }; 567607ca46eSDavid Howells 568607ca46eSDavid Howells struct fuse_read_in { 5694c82456eSMiklos Szeredi uint64_t fh; 5704c82456eSMiklos Szeredi uint64_t offset; 5714c82456eSMiklos Szeredi uint32_t size; 5724c82456eSMiklos Szeredi uint32_t read_flags; 5734c82456eSMiklos Szeredi uint64_t lock_owner; 5744c82456eSMiklos Szeredi uint32_t flags; 5754c82456eSMiklos Szeredi uint32_t padding; 576607ca46eSDavid Howells }; 577607ca46eSDavid Howells 578607ca46eSDavid Howells #define FUSE_COMPAT_WRITE_IN_SIZE 24 579607ca46eSDavid Howells 580607ca46eSDavid Howells struct fuse_write_in { 5814c82456eSMiklos Szeredi uint64_t fh; 5824c82456eSMiklos Szeredi uint64_t offset; 5834c82456eSMiklos Szeredi uint32_t size; 5844c82456eSMiklos Szeredi uint32_t write_flags; 5854c82456eSMiklos Szeredi uint64_t lock_owner; 5864c82456eSMiklos Szeredi uint32_t flags; 5874c82456eSMiklos Szeredi uint32_t padding; 588607ca46eSDavid Howells }; 589607ca46eSDavid Howells 590607ca46eSDavid Howells struct fuse_write_out { 5914c82456eSMiklos Szeredi uint32_t size; 5924c82456eSMiklos Szeredi uint32_t padding; 593607ca46eSDavid Howells }; 594607ca46eSDavid Howells 595607ca46eSDavid Howells #define FUSE_COMPAT_STATFS_SIZE 48 596607ca46eSDavid Howells 597607ca46eSDavid Howells struct fuse_statfs_out { 598607ca46eSDavid Howells struct fuse_kstatfs st; 599607ca46eSDavid Howells }; 600607ca46eSDavid Howells 601607ca46eSDavid Howells struct fuse_fsync_in { 6024c82456eSMiklos Szeredi uint64_t fh; 6034c82456eSMiklos Szeredi uint32_t fsync_flags; 6044c82456eSMiklos Szeredi uint32_t padding; 605607ca46eSDavid Howells }; 606607ca46eSDavid Howells 607607ca46eSDavid Howells struct fuse_setxattr_in { 6084c82456eSMiklos Szeredi uint32_t size; 6094c82456eSMiklos Szeredi uint32_t flags; 610607ca46eSDavid Howells }; 611607ca46eSDavid Howells 612607ca46eSDavid Howells struct fuse_getxattr_in { 6134c82456eSMiklos Szeredi uint32_t size; 6144c82456eSMiklos Szeredi uint32_t padding; 615607ca46eSDavid Howells }; 616607ca46eSDavid Howells 617607ca46eSDavid Howells struct fuse_getxattr_out { 6184c82456eSMiklos Szeredi uint32_t size; 6194c82456eSMiklos Szeredi uint32_t padding; 620607ca46eSDavid Howells }; 621607ca46eSDavid Howells 622607ca46eSDavid Howells struct fuse_lk_in { 6234c82456eSMiklos Szeredi uint64_t fh; 6244c82456eSMiklos Szeredi uint64_t owner; 625607ca46eSDavid Howells struct fuse_file_lock lk; 6264c82456eSMiklos Szeredi uint32_t lk_flags; 6274c82456eSMiklos Szeredi uint32_t padding; 628607ca46eSDavid Howells }; 629607ca46eSDavid Howells 630607ca46eSDavid Howells struct fuse_lk_out { 631607ca46eSDavid Howells struct fuse_file_lock lk; 632607ca46eSDavid Howells }; 633607ca46eSDavid Howells 634607ca46eSDavid Howells struct fuse_access_in { 6354c82456eSMiklos Szeredi uint32_t mask; 6364c82456eSMiklos Szeredi uint32_t padding; 637607ca46eSDavid Howells }; 638607ca46eSDavid Howells 639607ca46eSDavid Howells struct fuse_init_in { 6404c82456eSMiklos Szeredi uint32_t major; 6414c82456eSMiklos Szeredi uint32_t minor; 6424c82456eSMiklos Szeredi uint32_t max_readahead; 6434c82456eSMiklos Szeredi uint32_t flags; 644607ca46eSDavid Howells }; 645607ca46eSDavid Howells 646e27c9d38SMiklos Szeredi #define FUSE_COMPAT_INIT_OUT_SIZE 8 647e27c9d38SMiklos Szeredi #define FUSE_COMPAT_22_INIT_OUT_SIZE 24 648e27c9d38SMiklos Szeredi 649607ca46eSDavid Howells struct fuse_init_out { 6504c82456eSMiklos Szeredi uint32_t major; 6514c82456eSMiklos Szeredi uint32_t minor; 6524c82456eSMiklos Szeredi uint32_t max_readahead; 6534c82456eSMiklos Szeredi uint32_t flags; 6544c82456eSMiklos Szeredi uint16_t max_background; 6554c82456eSMiklos Szeredi uint16_t congestion_threshold; 6564c82456eSMiklos Szeredi uint32_t max_write; 657e27c9d38SMiklos Szeredi uint32_t time_gran; 6585da784ccSConstantine Shulyupin uint16_t max_pages; 6595da784ccSConstantine Shulyupin uint16_t padding; 6605da784ccSConstantine Shulyupin uint32_t unused[8]; 661607ca46eSDavid Howells }; 662607ca46eSDavid Howells 663607ca46eSDavid Howells #define CUSE_INIT_INFO_MAX 4096 664607ca46eSDavid Howells 665607ca46eSDavid Howells struct cuse_init_in { 6664c82456eSMiklos Szeredi uint32_t major; 6674c82456eSMiklos Szeredi uint32_t minor; 6684c82456eSMiklos Szeredi uint32_t unused; 6694c82456eSMiklos Szeredi uint32_t flags; 670607ca46eSDavid Howells }; 671607ca46eSDavid Howells 672607ca46eSDavid Howells struct cuse_init_out { 6734c82456eSMiklos Szeredi uint32_t major; 6744c82456eSMiklos Szeredi uint32_t minor; 6754c82456eSMiklos Szeredi uint32_t unused; 6764c82456eSMiklos Szeredi uint32_t flags; 6774c82456eSMiklos Szeredi uint32_t max_read; 6784c82456eSMiklos Szeredi uint32_t max_write; 6794c82456eSMiklos Szeredi uint32_t dev_major; /* chardev major */ 6804c82456eSMiklos Szeredi uint32_t dev_minor; /* chardev minor */ 6814c82456eSMiklos Szeredi uint32_t spare[10]; 682607ca46eSDavid Howells }; 683607ca46eSDavid Howells 684607ca46eSDavid Howells struct fuse_interrupt_in { 6854c82456eSMiklos Szeredi uint64_t unique; 686607ca46eSDavid Howells }; 687607ca46eSDavid Howells 688607ca46eSDavid Howells struct fuse_bmap_in { 6894c82456eSMiklos Szeredi uint64_t block; 6904c82456eSMiklos Szeredi uint32_t blocksize; 6914c82456eSMiklos Szeredi uint32_t padding; 692607ca46eSDavid Howells }; 693607ca46eSDavid Howells 694607ca46eSDavid Howells struct fuse_bmap_out { 6954c82456eSMiklos Szeredi uint64_t block; 696607ca46eSDavid Howells }; 697607ca46eSDavid Howells 698607ca46eSDavid Howells struct fuse_ioctl_in { 6994c82456eSMiklos Szeredi uint64_t fh; 7004c82456eSMiklos Szeredi uint32_t flags; 7014c82456eSMiklos Szeredi uint32_t cmd; 7024c82456eSMiklos Szeredi uint64_t arg; 7034c82456eSMiklos Szeredi uint32_t in_size; 7044c82456eSMiklos Szeredi uint32_t out_size; 705607ca46eSDavid Howells }; 706607ca46eSDavid Howells 707607ca46eSDavid Howells struct fuse_ioctl_iovec { 7084c82456eSMiklos Szeredi uint64_t base; 7094c82456eSMiklos Szeredi uint64_t len; 710607ca46eSDavid Howells }; 711607ca46eSDavid Howells 712607ca46eSDavid Howells struct fuse_ioctl_out { 7134c82456eSMiklos Szeredi int32_t result; 7144c82456eSMiklos Szeredi uint32_t flags; 7154c82456eSMiklos Szeredi uint32_t in_iovs; 7164c82456eSMiklos Szeredi uint32_t out_iovs; 717607ca46eSDavid Howells }; 718607ca46eSDavid Howells 719607ca46eSDavid Howells struct fuse_poll_in { 7204c82456eSMiklos Szeredi uint64_t fh; 7214c82456eSMiklos Szeredi uint64_t kh; 7224c82456eSMiklos Szeredi uint32_t flags; 7234c82456eSMiklos Szeredi uint32_t events; 724607ca46eSDavid Howells }; 725607ca46eSDavid Howells 726607ca46eSDavid Howells struct fuse_poll_out { 7274c82456eSMiklos Szeredi uint32_t revents; 7284c82456eSMiklos Szeredi uint32_t padding; 729607ca46eSDavid Howells }; 730607ca46eSDavid Howells 731607ca46eSDavid Howells struct fuse_notify_poll_wakeup_out { 7324c82456eSMiklos Szeredi uint64_t kh; 733607ca46eSDavid Howells }; 734607ca46eSDavid Howells 735607ca46eSDavid Howells struct fuse_fallocate_in { 7364c82456eSMiklos Szeredi uint64_t fh; 7374c82456eSMiklos Szeredi uint64_t offset; 7384c82456eSMiklos Szeredi uint64_t length; 7394c82456eSMiklos Szeredi uint32_t mode; 7404c82456eSMiklos Szeredi uint32_t padding; 741607ca46eSDavid Howells }; 742607ca46eSDavid Howells 743607ca46eSDavid Howells struct fuse_in_header { 7444c82456eSMiklos Szeredi uint32_t len; 7454c82456eSMiklos Szeredi uint32_t opcode; 7464c82456eSMiklos Szeredi uint64_t unique; 7474c82456eSMiklos Szeredi uint64_t nodeid; 7484c82456eSMiklos Szeredi uint32_t uid; 7494c82456eSMiklos Szeredi uint32_t gid; 7504c82456eSMiklos Szeredi uint32_t pid; 7514c82456eSMiklos Szeredi uint32_t padding; 752607ca46eSDavid Howells }; 753607ca46eSDavid Howells 754607ca46eSDavid Howells struct fuse_out_header { 7554c82456eSMiklos Szeredi uint32_t len; 7564c82456eSMiklos Szeredi int32_t error; 7574c82456eSMiklos Szeredi uint64_t unique; 758607ca46eSDavid Howells }; 759607ca46eSDavid Howells 760607ca46eSDavid Howells struct fuse_dirent { 7614c82456eSMiklos Szeredi uint64_t ino; 7624c82456eSMiklos Szeredi uint64_t off; 7634c82456eSMiklos Szeredi uint32_t namelen; 7644c82456eSMiklos Szeredi uint32_t type; 765607ca46eSDavid Howells char name[]; 766607ca46eSDavid Howells }; 767607ca46eSDavid Howells 768607ca46eSDavid Howells #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) 7694c82456eSMiklos Szeredi #define FUSE_DIRENT_ALIGN(x) \ 7704c82456eSMiklos Szeredi (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1)) 771607ca46eSDavid Howells #define FUSE_DIRENT_SIZE(d) \ 772607ca46eSDavid Howells FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) 773607ca46eSDavid Howells 7740b05b183SAnand V. Avati struct fuse_direntplus { 7750b05b183SAnand V. Avati struct fuse_entry_out entry_out; 7760b05b183SAnand V. Avati struct fuse_dirent dirent; 7770b05b183SAnand V. Avati }; 7780b05b183SAnand V. Avati 7790b05b183SAnand V. Avati #define FUSE_NAME_OFFSET_DIRENTPLUS \ 7800b05b183SAnand V. Avati offsetof(struct fuse_direntplus, dirent.name) 7810b05b183SAnand V. Avati #define FUSE_DIRENTPLUS_SIZE(d) \ 7820b05b183SAnand V. Avati FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen) 7830b05b183SAnand V. Avati 784607ca46eSDavid Howells struct fuse_notify_inval_inode_out { 7854c82456eSMiklos Szeredi uint64_t ino; 7864c82456eSMiklos Szeredi int64_t off; 7874c82456eSMiklos Szeredi int64_t len; 788607ca46eSDavid Howells }; 789607ca46eSDavid Howells 790607ca46eSDavid Howells struct fuse_notify_inval_entry_out { 7914c82456eSMiklos Szeredi uint64_t parent; 7924c82456eSMiklos Szeredi uint32_t namelen; 7934c82456eSMiklos Szeredi uint32_t padding; 794607ca46eSDavid Howells }; 795607ca46eSDavid Howells 796607ca46eSDavid Howells struct fuse_notify_delete_out { 7974c82456eSMiklos Szeredi uint64_t parent; 7984c82456eSMiklos Szeredi uint64_t child; 7994c82456eSMiklos Szeredi uint32_t namelen; 8004c82456eSMiklos Szeredi uint32_t padding; 801607ca46eSDavid Howells }; 802607ca46eSDavid Howells 803607ca46eSDavid Howells struct fuse_notify_store_out { 8044c82456eSMiklos Szeredi uint64_t nodeid; 8054c82456eSMiklos Szeredi uint64_t offset; 8064c82456eSMiklos Szeredi uint32_t size; 8074c82456eSMiklos Szeredi uint32_t padding; 808607ca46eSDavid Howells }; 809607ca46eSDavid Howells 810607ca46eSDavid Howells struct fuse_notify_retrieve_out { 8114c82456eSMiklos Szeredi uint64_t notify_unique; 8124c82456eSMiklos Szeredi uint64_t nodeid; 8134c82456eSMiklos Szeredi uint64_t offset; 8144c82456eSMiklos Szeredi uint32_t size; 8154c82456eSMiklos Szeredi uint32_t padding; 816607ca46eSDavid Howells }; 817607ca46eSDavid Howells 818607ca46eSDavid Howells /* Matches the size of fuse_write_in */ 819607ca46eSDavid Howells struct fuse_notify_retrieve_in { 8204c82456eSMiklos Szeredi uint64_t dummy1; 8214c82456eSMiklos Szeredi uint64_t offset; 8224c82456eSMiklos Szeredi uint32_t size; 8234c82456eSMiklos Szeredi uint32_t dummy2; 8244c82456eSMiklos Szeredi uint64_t dummy3; 8254c82456eSMiklos Szeredi uint64_t dummy4; 826607ca46eSDavid Howells }; 827607ca46eSDavid Howells 82800c570f4SMiklos Szeredi /* Device ioctls: */ 82900c570f4SMiklos Szeredi #define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t) 83000c570f4SMiklos Szeredi 8310b5da8dbSRavishankar N struct fuse_lseek_in { 8320b5da8dbSRavishankar N uint64_t fh; 8330b5da8dbSRavishankar N uint64_t offset; 8340b5da8dbSRavishankar N uint32_t whence; 8350b5da8dbSRavishankar N uint32_t padding; 8360b5da8dbSRavishankar N }; 8370b5da8dbSRavishankar N 8380b5da8dbSRavishankar N struct fuse_lseek_out { 8390b5da8dbSRavishankar N uint64_t offset; 8400b5da8dbSRavishankar N }; 8410b5da8dbSRavishankar N 84288bc7d50SNiels de Vos struct fuse_copy_file_range_in { 84388bc7d50SNiels de Vos uint64_t fh_in; 84488bc7d50SNiels de Vos uint64_t off_in; 84588bc7d50SNiels de Vos uint64_t nodeid_out; 84688bc7d50SNiels de Vos uint64_t fh_out; 84788bc7d50SNiels de Vos uint64_t off_out; 84888bc7d50SNiels de Vos uint64_t len; 84988bc7d50SNiels de Vos uint64_t flags; 85088bc7d50SNiels de Vos }; 85188bc7d50SNiels de Vos 852607ca46eSDavid Howells #endif /* _LINUX_FUSE_H */ 853