192bbfe1fSAlan Somers /*- 292bbfe1fSAlan Somers * SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 392bbfe1fSAlan Somers * 45fe58019SAttilio Rao * This file defines the kernel interface of FUSE 59c62bc70SAlan Somers * Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> 65fe58019SAttilio Rao * 75fe58019SAttilio Rao * This program can be distributed under the terms of the GNU GPL. 85fe58019SAttilio Rao * See the file COPYING. 95fe58019SAttilio Rao * 105fe58019SAttilio Rao * This -- and only this -- header file may also be distributed under 115fe58019SAttilio Rao * the terms of the BSD Licence as follows: 125fe58019SAttilio Rao * 135fe58019SAttilio Rao * Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved. 145fe58019SAttilio Rao * 155fe58019SAttilio Rao * Redistribution and use in source and binary forms, with or without 165fe58019SAttilio Rao * modification, are permitted provided that the following conditions 175fe58019SAttilio Rao * are met: 185fe58019SAttilio Rao * 1. Redistributions of source code must retain the above copyright 195fe58019SAttilio Rao * notice, this list of conditions and the following disclaimer. 205fe58019SAttilio Rao * 2. Redistributions in binary form must reproduce the above copyright 215fe58019SAttilio Rao * notice, this list of conditions and the following disclaimer in the 225fe58019SAttilio Rao * documentation and/or other materials provided with the distribution. 235fe58019SAttilio Rao * 245fe58019SAttilio Rao * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 255fe58019SAttilio Rao * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 265fe58019SAttilio Rao * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 275fe58019SAttilio Rao * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 285fe58019SAttilio Rao * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 295fe58019SAttilio Rao * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 305fe58019SAttilio Rao * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 315fe58019SAttilio Rao * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 325fe58019SAttilio Rao * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 335fe58019SAttilio Rao * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 345fe58019SAttilio Rao * SUCH DAMAGE. 355fe58019SAttilio Rao * 365fe58019SAttilio Rao * $FreeBSD$ 375fe58019SAttilio Rao */ 385fe58019SAttilio Rao 3916bd2d47SAlan Somers /* 4016bd2d47SAlan Somers * This file defines the kernel interface of FUSE 4116bd2d47SAlan Somers * 4216bd2d47SAlan Somers * Protocol changelog: 4316bd2d47SAlan Somers * 44a3a1ce37SAlan Somers * 7.1: 45a3a1ce37SAlan Somers * - add the following messages: 46a3a1ce37SAlan Somers * FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK, 47a3a1ce37SAlan Somers * FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE, 48a3a1ce37SAlan Somers * FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR, 49a3a1ce37SAlan Somers * FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR, 50a3a1ce37SAlan Somers * FUSE_RELEASEDIR 51a3a1ce37SAlan Somers * - add padding to messages to accommodate 32-bit servers on 64-bit kernels 52a3a1ce37SAlan Somers * 53a3a1ce37SAlan Somers * 7.2: 54a3a1ce37SAlan Somers * - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags 55a3a1ce37SAlan Somers * - add FUSE_FSYNCDIR message 56a3a1ce37SAlan Somers * 57a3a1ce37SAlan Somers * 7.3: 58a3a1ce37SAlan Somers * - add FUSE_ACCESS message 59a3a1ce37SAlan Somers * - add FUSE_CREATE message 60a3a1ce37SAlan Somers * - add filehandle to fuse_setattr_in 61a3a1ce37SAlan Somers * 62a3a1ce37SAlan Somers * 7.4: 63a3a1ce37SAlan Somers * - add frsize to fuse_kstatfs 64a3a1ce37SAlan Somers * - clean up request size limit checking 65a3a1ce37SAlan Somers * 66a3a1ce37SAlan Somers * 7.5: 67a3a1ce37SAlan Somers * - add flags and max_write to fuse_init_out 68a3a1ce37SAlan Somers * 69a3a1ce37SAlan Somers * 7.6: 70a3a1ce37SAlan Somers * - add max_readahead to fuse_init_in and fuse_init_out 71a3a1ce37SAlan Somers * 72a3a1ce37SAlan Somers * 7.7: 73a3a1ce37SAlan Somers * - add FUSE_INTERRUPT message 74a3a1ce37SAlan Somers * - add POSIX file lock support 75a3a1ce37SAlan Somers * 76a3a1ce37SAlan Somers * 7.8: 77a3a1ce37SAlan Somers * - add lock_owner and flags fields to fuse_release_in 78a3a1ce37SAlan Somers * - add FUSE_BMAP message 79a3a1ce37SAlan Somers * - add FUSE_DESTROY message 80a3a1ce37SAlan Somers * 8116bd2d47SAlan Somers * 7.9: 8216bd2d47SAlan Somers * - new fuse_getattr_in input argument of GETATTR 8316bd2d47SAlan Somers * - add lk_flags in fuse_lk_in 8416bd2d47SAlan Somers * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in 8516bd2d47SAlan Somers * - add blksize field to fuse_attr 8616bd2d47SAlan Somers * - add file flags field to fuse_read_in and fuse_write_in 87a3a1ce37SAlan Somers * - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in 883f105d16SAlan Somers * 893f105d16SAlan Somers * 7.10 903f105d16SAlan Somers * - add nonseekable open flag 919c62bc70SAlan Somers * 929c62bc70SAlan Somers * 7.11 939c62bc70SAlan Somers * - add IOCTL message 949c62bc70SAlan Somers * - add unsolicited notification support 95a3a1ce37SAlan Somers * - add POLL message and NOTIFY_POLL notification 96a4856c96SAlan Somers * 97a4856c96SAlan Somers * 7.12 98a3a1ce37SAlan Somers * - add umask flag to input argument of create, mknod and mkdir 99a4856c96SAlan Somers * - add notification messages for invalidation of inodes and 100a4856c96SAlan Somers * directory entries 1012ffddc5eSAlan Somers * 1022ffddc5eSAlan Somers * 7.13 1032ffddc5eSAlan Somers * - make max number of background requests and congestion threshold 1042ffddc5eSAlan Somers * tunables 105bb23d439SAlan Somers * 106bb23d439SAlan Somers * 7.14 107bb23d439SAlan Somers * - add splice support to fuse device 1087cbb8e8aSAlan Somers * 1097cbb8e8aSAlan Somers * 7.15 1107cbb8e8aSAlan Somers * - add store notify 1117cbb8e8aSAlan Somers * - add retrieve notify 112b160acd1SAlan Somers * 113b160acd1SAlan Somers * 7.16 114b160acd1SAlan Somers * - add BATCH_FORGET request 115b160acd1SAlan Somers * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct 116b160acd1SAlan Somers * fuse_ioctl_iovec' instead of ambiguous 'struct iovec' 117b160acd1SAlan Somers * - add FUSE_IOCTL_32BIT flag 118b160acd1SAlan Somers * 119b160acd1SAlan Somers * 7.17 120b160acd1SAlan Somers * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK 121b160acd1SAlan Somers * 122b160acd1SAlan Somers * 7.18 123b160acd1SAlan Somers * - add FUSE_IOCTL_DIR flag 124b160acd1SAlan Somers * - add FUSE_NOTIFY_DELETE 125b160acd1SAlan Somers * 126b160acd1SAlan Somers * 7.19 127b160acd1SAlan Somers * - add FUSE_FALLOCATE 128b160acd1SAlan Somers * 129b160acd1SAlan Somers * 7.20 130b160acd1SAlan Somers * - add FUSE_AUTO_INVAL_DATA 131a3a1ce37SAlan Somers * 132b160acd1SAlan Somers * 7.21 133b160acd1SAlan Somers * - add FUSE_READDIRPLUS 134b160acd1SAlan Somers * - send the requested events in POLL request 13587ff949aSAlan Somers * 13687ff949aSAlan Somers * 7.22 13787ff949aSAlan Somers * - add FUSE_ASYNC_DIO 13887ff949aSAlan Somers * 13987ff949aSAlan Somers * 7.23 14087ff949aSAlan Somers * - add FUSE_WRITEBACK_CACHE 14187ff949aSAlan Somers * - add time_gran to fuse_init_out 14287ff949aSAlan Somers * - add reserved space to fuse_init_out 14387ff949aSAlan Somers * - add FATTR_CTIME 14487ff949aSAlan Somers * - add ctime and ctimensec to fuse_setattr_in 14587ff949aSAlan Somers * - add FUSE_RENAME2 request 14687ff949aSAlan Somers * - add FUSE_NO_OPEN_SUPPORT flag 14737df9d3bSAlan Somers * 14837df9d3bSAlan Somers * 7.24 14937df9d3bSAlan Somers * - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support 15092bbfe1fSAlan Somers * 15192bbfe1fSAlan Somers * 7.25 15292bbfe1fSAlan Somers * - add FUSE_PARALLEL_DIROPS 15392bbfe1fSAlan Somers * 15492bbfe1fSAlan Somers * 7.26 15592bbfe1fSAlan Somers * - add FUSE_HANDLE_KILLPRIV 15692bbfe1fSAlan Somers * - add FUSE_POSIX_ACL 15792bbfe1fSAlan Somers * 15892bbfe1fSAlan Somers * 7.27 15992bbfe1fSAlan Somers * - add FUSE_ABORT_ERROR 16092bbfe1fSAlan Somers * 16192bbfe1fSAlan Somers * 7.28 16292bbfe1fSAlan Somers * - add FUSE_COPY_FILE_RANGE 16392bbfe1fSAlan Somers * - add FOPEN_CACHE_DIR 16492bbfe1fSAlan Somers * - add FUSE_MAX_PAGES, add max_pages to init_out 16592bbfe1fSAlan Somers * - add FUSE_CACHE_SYMLINKS 16616bd2d47SAlan Somers */ 16716bd2d47SAlan Somers 16816bd2d47SAlan Somers #ifndef _FUSE_FUSE_KERNEL_H 16916bd2d47SAlan Somers #define _FUSE_FUSE_KERNEL_H 17016bd2d47SAlan Somers 171b160acd1SAlan Somers #ifdef __linux__ 172b160acd1SAlan Somers #include <linux/types.h> 173b160acd1SAlan Somers #else 1745fe58019SAttilio Rao #include <sys/types.h> 1755fe58019SAttilio Rao #endif 1765fe58019SAttilio Rao 177a3a1ce37SAlan Somers /* 178a3a1ce37SAlan Somers * Version negotiation: 179a3a1ce37SAlan Somers * 180a3a1ce37SAlan Somers * Both the kernel and userspace send the version they support in the 181a3a1ce37SAlan Somers * INIT request and reply respectively. 182a3a1ce37SAlan Somers * 183a3a1ce37SAlan Somers * If the major versions match then both shall use the smallest 184a3a1ce37SAlan Somers * of the two minor versions for communication. 185a3a1ce37SAlan Somers * 186a3a1ce37SAlan Somers * If the kernel supports a larger major version, then userspace shall 187a3a1ce37SAlan Somers * reply with the major version it supports, ignore the rest of the 188a3a1ce37SAlan Somers * INIT message and expect a new INIT message from the kernel with a 189a3a1ce37SAlan Somers * matching major version. 190a3a1ce37SAlan Somers * 191a3a1ce37SAlan Somers * If the library supports a larger major version, then it shall fall 192a3a1ce37SAlan Somers * back to the major protocol version sent by the kernel for 193a3a1ce37SAlan Somers * communication and reply with that major version (and an arbitrary 194a3a1ce37SAlan Somers * supported minor version). 195a3a1ce37SAlan Somers */ 196a3a1ce37SAlan Somers 1975fe58019SAttilio Rao /** Version number of this interface */ 1985fe58019SAttilio Rao #define FUSE_KERNEL_VERSION 7 1995fe58019SAttilio Rao 2005fe58019SAttilio Rao /** Minor version number of this interface */ 2017124d2bcSAlan Somers #define FUSE_KERNEL_MINOR_VERSION 29 2025fe58019SAttilio Rao 2035fe58019SAttilio Rao /** The node ID of the root inode */ 2045fe58019SAttilio Rao #define FUSE_ROOT_ID 1 2055fe58019SAttilio Rao 2065fe58019SAttilio Rao /* Make sure all structures are padded to 64bit boundary, so 32bit 2075fe58019SAttilio Rao userspace works under 64bit kernels */ 2085fe58019SAttilio Rao 2095fe58019SAttilio Rao struct fuse_attr { 2108f9b3ba7SAlan Somers uint64_t ino; 2118f9b3ba7SAlan Somers uint64_t size; 2128f9b3ba7SAlan Somers uint64_t blocks; 2138f9b3ba7SAlan Somers uint64_t atime; 2148f9b3ba7SAlan Somers uint64_t mtime; 2158f9b3ba7SAlan Somers uint64_t ctime; 2168f9b3ba7SAlan Somers uint32_t atimensec; 2178f9b3ba7SAlan Somers uint32_t mtimensec; 2188f9b3ba7SAlan Somers uint32_t ctimensec; 2198f9b3ba7SAlan Somers uint32_t mode; 2208f9b3ba7SAlan Somers uint32_t nlink; 2218f9b3ba7SAlan Somers uint32_t uid; 2228f9b3ba7SAlan Somers uint32_t gid; 2238f9b3ba7SAlan Somers uint32_t rdev; 2248f9b3ba7SAlan Somers uint32_t blksize; 2258f9b3ba7SAlan Somers uint32_t padding; 2265fe58019SAttilio Rao }; 2275fe58019SAttilio Rao 2285fe58019SAttilio Rao struct fuse_kstatfs { 2298f9b3ba7SAlan Somers uint64_t blocks; 2308f9b3ba7SAlan Somers uint64_t bfree; 2318f9b3ba7SAlan Somers uint64_t bavail; 2328f9b3ba7SAlan Somers uint64_t files; 2338f9b3ba7SAlan Somers uint64_t ffree; 2348f9b3ba7SAlan Somers uint32_t bsize; 2358f9b3ba7SAlan Somers uint32_t namelen; 2368f9b3ba7SAlan Somers uint32_t frsize; 2378f9b3ba7SAlan Somers uint32_t padding; 2388f9b3ba7SAlan Somers uint32_t spare[6]; 2395fe58019SAttilio Rao }; 2405fe58019SAttilio Rao 2415fe58019SAttilio Rao struct fuse_file_lock { 2428f9b3ba7SAlan Somers uint64_t start; 2438f9b3ba7SAlan Somers uint64_t end; 2448f9b3ba7SAlan Somers uint32_t type; 2458f9b3ba7SAlan Somers uint32_t pid; /* tgid */ 2465fe58019SAttilio Rao }; 2475fe58019SAttilio Rao 2485fe58019SAttilio Rao /** 2495fe58019SAttilio Rao * Bitmasks for fuse_setattr_in.valid 2505fe58019SAttilio Rao */ 2515fe58019SAttilio Rao #define FATTR_MODE (1 << 0) 2525fe58019SAttilio Rao #define FATTR_UID (1 << 1) 2535fe58019SAttilio Rao #define FATTR_GID (1 << 2) 2545fe58019SAttilio Rao #define FATTR_SIZE (1 << 3) 2555fe58019SAttilio Rao #define FATTR_ATIME (1 << 4) 2565fe58019SAttilio Rao #define FATTR_MTIME (1 << 5) 2575fe58019SAttilio Rao #define FATTR_FH (1 << 6) 25816bd2d47SAlan Somers #define FATTR_ATIME_NOW (1 << 7) 25916bd2d47SAlan Somers #define FATTR_MTIME_NOW (1 << 8) 26016bd2d47SAlan Somers #define FATTR_LOCKOWNER (1 << 9) 26187ff949aSAlan Somers #define FATTR_CTIME (1 << 10) 2625fe58019SAttilio Rao 2635fe58019SAttilio Rao /** 2645fe58019SAttilio Rao * Flags returned by the OPEN request 2655fe58019SAttilio Rao * 2665fe58019SAttilio Rao * FOPEN_DIRECT_IO: bypass page cache for this open file 2675fe58019SAttilio Rao * FOPEN_KEEP_CACHE: don't invalidate the data cache on open 2683f105d16SAlan Somers * FOPEN_NONSEEKABLE: the file is not seekable 26992bbfe1fSAlan Somers * FOPEN_CACHE_DIR: allow caching this directory 2705fe58019SAttilio Rao */ 2715fe58019SAttilio Rao #define FOPEN_DIRECT_IO (1 << 0) 2725fe58019SAttilio Rao #define FOPEN_KEEP_CACHE (1 << 1) 2733f105d16SAlan Somers #define FOPEN_NONSEEKABLE (1 << 2) 27492bbfe1fSAlan Somers #define FOPEN_CACHE_DIR (1 << 3) 2755fe58019SAttilio Rao 2765fe58019SAttilio Rao /** 2775fe58019SAttilio Rao * INIT request/reply flags 27816bd2d47SAlan Somers * 279b160acd1SAlan Somers * FUSE_ASYNC_READ: asynchronous read requests 280b160acd1SAlan Somers * FUSE_POSIX_LOCKS: remote locking for POSIX file locks 281b160acd1SAlan Somers * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported) 282b160acd1SAlan Somers * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem 28316bd2d47SAlan Somers * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." 284b160acd1SAlan Somers * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB 285a4856c96SAlan Somers * FUSE_DONT_MASK: don't apply umask to file mode on create operations 286b160acd1SAlan Somers * FUSE_SPLICE_WRITE: kernel supports splice write on the device 287b160acd1SAlan Somers * FUSE_SPLICE_MOVE: kernel supports splice move on the device 288b160acd1SAlan Somers * FUSE_SPLICE_READ: kernel supports splice read on the device 289b160acd1SAlan Somers * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks 290b160acd1SAlan Somers * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories 291b160acd1SAlan Somers * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages 292b160acd1SAlan Somers * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one) 293b160acd1SAlan Somers * FUSE_READDIRPLUS_AUTO: adaptive readdirplus 29487ff949aSAlan Somers * FUSE_ASYNC_DIO: asynchronous direct I/O submission 29587ff949aSAlan Somers * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes 29687ff949aSAlan Somers * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens 29792bbfe1fSAlan Somers * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir 29892bbfe1fSAlan Somers * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc 29992bbfe1fSAlan Somers * FUSE_POSIX_ACL: filesystem supports posix acls 30092bbfe1fSAlan Somers * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED 30192bbfe1fSAlan Somers * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages 30292bbfe1fSAlan Somers * FUSE_CACHE_SYMLINKS: cache READLINK responses 3037124d2bcSAlan Somers * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir 3045fe58019SAttilio Rao */ 3055fe58019SAttilio Rao #define FUSE_ASYNC_READ (1 << 0) 3065fe58019SAttilio Rao #define FUSE_POSIX_LOCKS (1 << 1) 30716bd2d47SAlan Somers #define FUSE_FILE_OPS (1 << 2) 30816bd2d47SAlan Somers #define FUSE_ATOMIC_O_TRUNC (1 << 3) 30916bd2d47SAlan Somers #define FUSE_EXPORT_SUPPORT (1 << 4) 31016bd2d47SAlan Somers #define FUSE_BIG_WRITES (1 << 5) 311a4856c96SAlan Somers #define FUSE_DONT_MASK (1 << 6) 312b160acd1SAlan Somers #define FUSE_SPLICE_WRITE (1 << 7) 313b160acd1SAlan Somers #define FUSE_SPLICE_MOVE (1 << 8) 314b160acd1SAlan Somers #define FUSE_SPLICE_READ (1 << 9) 315b160acd1SAlan Somers #define FUSE_FLOCK_LOCKS (1 << 10) 316b160acd1SAlan Somers #define FUSE_HAS_IOCTL_DIR (1 << 11) 317b160acd1SAlan Somers #define FUSE_AUTO_INVAL_DATA (1 << 12) 318b160acd1SAlan Somers #define FUSE_DO_READDIRPLUS (1 << 13) 319b160acd1SAlan Somers #define FUSE_READDIRPLUS_AUTO (1 << 14) 32087ff949aSAlan Somers #define FUSE_ASYNC_DIO (1 << 15) 32187ff949aSAlan Somers #define FUSE_WRITEBACK_CACHE (1 << 16) 32287ff949aSAlan Somers #define FUSE_NO_OPEN_SUPPORT (1 << 17) 32392bbfe1fSAlan Somers #define FUSE_PARALLEL_DIROPS (1 << 18) 32492bbfe1fSAlan Somers #define FUSE_HANDLE_KILLPRIV (1 << 19) 32592bbfe1fSAlan Somers #define FUSE_POSIX_ACL (1 << 20) 32692bbfe1fSAlan Somers #define FUSE_ABORT_ERROR (1 << 21) 32792bbfe1fSAlan Somers #define FUSE_MAX_PAGES (1 << 22) 32892bbfe1fSAlan Somers #define FUSE_CACHE_SYMLINKS (1 << 23) 3297124d2bcSAlan Somers #define FUSE_NO_OPENDIR_SUPPORT (1 << 24) 3305fe58019SAttilio Rao 3319c62bc70SAlan Somers #ifdef linux 3329c62bc70SAlan Somers /** 3339c62bc70SAlan Somers * CUSE INIT request/reply flags 3349c62bc70SAlan Somers * 3359c62bc70SAlan Somers * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl 3369c62bc70SAlan Somers */ 3379c62bc70SAlan Somers #define CUSE_UNRESTRICTED_IOCTL (1 << 0) 3389c62bc70SAlan Somers #endif /* linux */ 3399c62bc70SAlan Somers 3405fe58019SAttilio Rao /** 3415fe58019SAttilio Rao * Release flags 3425fe58019SAttilio Rao */ 3435fe58019SAttilio Rao #define FUSE_RELEASE_FLUSH (1 << 0) 344b160acd1SAlan Somers #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1) 3455fe58019SAttilio Rao 34616bd2d47SAlan Somers /** 34716bd2d47SAlan Somers * Getattr flags 34816bd2d47SAlan Somers */ 34916bd2d47SAlan Somers #define FUSE_GETATTR_FH (1 << 0) 35016bd2d47SAlan Somers 35116bd2d47SAlan Somers /** 35216bd2d47SAlan Somers * Lock flags 35316bd2d47SAlan Somers */ 35416bd2d47SAlan Somers #define FUSE_LK_FLOCK (1 << 0) 35516bd2d47SAlan Somers 35616bd2d47SAlan Somers /** 35716bd2d47SAlan Somers * WRITE flags 35816bd2d47SAlan Somers * 35916bd2d47SAlan Somers * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed 36016bd2d47SAlan Somers * FUSE_WRITE_LOCKOWNER: lock_owner field is valid 36116bd2d47SAlan Somers */ 36216bd2d47SAlan Somers #define FUSE_WRITE_CACHE (1 << 0) 36316bd2d47SAlan Somers #define FUSE_WRITE_LOCKOWNER (1 << 1) 36416bd2d47SAlan Somers 36516bd2d47SAlan Somers /** 36616bd2d47SAlan Somers * Read flags 36716bd2d47SAlan Somers */ 36816bd2d47SAlan Somers #define FUSE_READ_LOCKOWNER (1 << 1) 36916bd2d47SAlan Somers 3709c62bc70SAlan Somers /** 3719c62bc70SAlan Somers * Ioctl flags 3729c62bc70SAlan Somers * 3739c62bc70SAlan Somers * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine 3749c62bc70SAlan Somers * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed 3759c62bc70SAlan Somers * FUSE_IOCTL_RETRY: retry with new iovecs 376b160acd1SAlan Somers * FUSE_IOCTL_32BIT: 32bit ioctl 377b160acd1SAlan Somers * FUSE_IOCTL_DIR: is a directory 3789c62bc70SAlan Somers * 3799c62bc70SAlan Somers * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs 3809c62bc70SAlan Somers */ 3819c62bc70SAlan Somers #define FUSE_IOCTL_COMPAT (1 << 0) 3829c62bc70SAlan Somers #define FUSE_IOCTL_UNRESTRICTED (1 << 1) 3839c62bc70SAlan Somers #define FUSE_IOCTL_RETRY (1 << 2) 384b160acd1SAlan Somers #define FUSE_IOCTL_32BIT (1 << 3) 385b160acd1SAlan Somers #define FUSE_IOCTL_DIR (1 << 4) 3869c62bc70SAlan Somers 3879c62bc70SAlan Somers #define FUSE_IOCTL_MAX_IOV 256 3889c62bc70SAlan Somers 3899c62bc70SAlan Somers /** 3909c62bc70SAlan Somers * Poll flags 3919c62bc70SAlan Somers * 3929c62bc70SAlan Somers * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify 3939c62bc70SAlan Somers */ 3949c62bc70SAlan Somers #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) 3959c62bc70SAlan Somers 396a3a1ce37SAlan Somers /** 397a3a1ce37SAlan Somers * Fsync flags 398a3a1ce37SAlan Somers * 399a3a1ce37SAlan Somers * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata 400a3a1ce37SAlan Somers */ 401a3a1ce37SAlan Somers #define FUSE_FSYNC_FDATASYNC (1 << 0) 402a3a1ce37SAlan Somers 403*89d57b94SAlan Somers /** 404*89d57b94SAlan Somers * Fallocate flags. 405*89d57b94SAlan Somers */ 406*89d57b94SAlan Somers #define FUSE_FALLOC_FL_KEEP_SIZE 0x1 407*89d57b94SAlan Somers #define FUSE_FALLOC_FL_PUNCH_HOLE 0x2 408*89d57b94SAlan Somers 4095fe58019SAttilio Rao enum fuse_opcode { 4105fe58019SAttilio Rao FUSE_LOOKUP = 1, 4115fe58019SAttilio Rao FUSE_FORGET = 2, /* no reply */ 4125fe58019SAttilio Rao FUSE_GETATTR = 3, 4135fe58019SAttilio Rao FUSE_SETATTR = 4, 4145fe58019SAttilio Rao FUSE_READLINK = 5, 4155fe58019SAttilio Rao FUSE_SYMLINK = 6, 4165fe58019SAttilio Rao FUSE_MKNOD = 8, 4175fe58019SAttilio Rao FUSE_MKDIR = 9, 4185fe58019SAttilio Rao FUSE_UNLINK = 10, 4195fe58019SAttilio Rao FUSE_RMDIR = 11, 4205fe58019SAttilio Rao FUSE_RENAME = 12, 4215fe58019SAttilio Rao FUSE_LINK = 13, 4225fe58019SAttilio Rao FUSE_OPEN = 14, 4235fe58019SAttilio Rao FUSE_READ = 15, 4245fe58019SAttilio Rao FUSE_WRITE = 16, 4255fe58019SAttilio Rao FUSE_STATFS = 17, 4265fe58019SAttilio Rao FUSE_RELEASE = 18, 4275fe58019SAttilio Rao FUSE_FSYNC = 20, 4285fe58019SAttilio Rao FUSE_SETXATTR = 21, 4295fe58019SAttilio Rao FUSE_GETXATTR = 22, 4305fe58019SAttilio Rao FUSE_LISTXATTR = 23, 4315fe58019SAttilio Rao FUSE_REMOVEXATTR = 24, 4325fe58019SAttilio Rao FUSE_FLUSH = 25, 4335fe58019SAttilio Rao FUSE_INIT = 26, 4345fe58019SAttilio Rao FUSE_OPENDIR = 27, 4355fe58019SAttilio Rao FUSE_READDIR = 28, 4365fe58019SAttilio Rao FUSE_RELEASEDIR = 29, 4375fe58019SAttilio Rao FUSE_FSYNCDIR = 30, 4385fe58019SAttilio Rao FUSE_GETLK = 31, 4395fe58019SAttilio Rao FUSE_SETLK = 32, 4405fe58019SAttilio Rao FUSE_SETLKW = 33, 4415fe58019SAttilio Rao FUSE_ACCESS = 34, 4425fe58019SAttilio Rao FUSE_CREATE = 35, 4435fe58019SAttilio Rao FUSE_INTERRUPT = 36, 4445fe58019SAttilio Rao FUSE_BMAP = 37, 4455fe58019SAttilio Rao FUSE_DESTROY = 38, 4469c62bc70SAlan Somers FUSE_IOCTL = 39, 4479c62bc70SAlan Somers FUSE_POLL = 40, 4487cbb8e8aSAlan Somers FUSE_NOTIFY_REPLY = 41, 449b160acd1SAlan Somers FUSE_BATCH_FORGET = 42, 450b160acd1SAlan Somers FUSE_FALLOCATE = 43, 451b160acd1SAlan Somers FUSE_READDIRPLUS = 44, 45287ff949aSAlan Somers FUSE_RENAME2 = 45, 45337df9d3bSAlan Somers FUSE_LSEEK = 46, 45492bbfe1fSAlan Somers FUSE_COPY_FILE_RANGE = 47, 4559c62bc70SAlan Somers 4569c62bc70SAlan Somers #ifdef linux 4579c62bc70SAlan Somers /* CUSE specific operations */ 4589c62bc70SAlan Somers CUSE_INIT = 4096, 4599c62bc70SAlan Somers #endif /* linux */ 4609c62bc70SAlan Somers }; 4619c62bc70SAlan Somers 4629c62bc70SAlan Somers enum fuse_notify_code { 4639c62bc70SAlan Somers FUSE_NOTIFY_POLL = 1, 464a4856c96SAlan Somers FUSE_NOTIFY_INVAL_INODE = 2, 465a4856c96SAlan Somers FUSE_NOTIFY_INVAL_ENTRY = 3, 4667cbb8e8aSAlan Somers FUSE_NOTIFY_STORE = 4, 4677cbb8e8aSAlan Somers FUSE_NOTIFY_RETRIEVE = 5, 468b160acd1SAlan Somers FUSE_NOTIFY_DELETE = 6, 4699c62bc70SAlan Somers FUSE_NOTIFY_CODE_MAX, 4705fe58019SAttilio Rao }; 4715fe58019SAttilio Rao 4725fe58019SAttilio Rao /* The read buffer is required to be at least 8k, but may be much larger */ 4735fe58019SAttilio Rao #define FUSE_MIN_READ_BUFFER 8192 4745fe58019SAttilio Rao 47516bd2d47SAlan Somers #define FUSE_COMPAT_ENTRY_OUT_SIZE 120 47616bd2d47SAlan Somers 4775fe58019SAttilio Rao struct fuse_entry_out { 4788f9b3ba7SAlan Somers uint64_t nodeid; /* Inode ID */ 4798f9b3ba7SAlan Somers uint64_t generation; /* Inode generation: nodeid:gen must 4805fe58019SAttilio Rao be unique for the fs's lifetime */ 4818f9b3ba7SAlan Somers uint64_t entry_valid; /* Cache timeout for the name */ 4828f9b3ba7SAlan Somers uint64_t attr_valid; /* Cache timeout for the attributes */ 4838f9b3ba7SAlan Somers uint32_t entry_valid_nsec; 4848f9b3ba7SAlan Somers uint32_t attr_valid_nsec; 4855fe58019SAttilio Rao struct fuse_attr attr; 4865fe58019SAttilio Rao }; 4875fe58019SAttilio Rao 4885fe58019SAttilio Rao struct fuse_forget_in { 4898f9b3ba7SAlan Somers uint64_t nlookup; 4905fe58019SAttilio Rao }; 4915fe58019SAttilio Rao 492b160acd1SAlan Somers struct fuse_forget_one { 4938f9b3ba7SAlan Somers uint64_t nodeid; 4948f9b3ba7SAlan Somers uint64_t nlookup; 495b160acd1SAlan Somers }; 496b160acd1SAlan Somers 497b160acd1SAlan Somers struct fuse_batch_forget_in { 4988f9b3ba7SAlan Somers uint32_t count; 4998f9b3ba7SAlan Somers uint32_t dummy; 500b160acd1SAlan Somers }; 501b160acd1SAlan Somers 50216bd2d47SAlan Somers struct fuse_getattr_in { 5038f9b3ba7SAlan Somers uint32_t getattr_flags; 5048f9b3ba7SAlan Somers uint32_t dummy; 5058f9b3ba7SAlan Somers uint64_t fh; 50616bd2d47SAlan Somers }; 50716bd2d47SAlan Somers 50816bd2d47SAlan Somers #define FUSE_COMPAT_ATTR_OUT_SIZE 96 50916bd2d47SAlan Somers 5105fe58019SAttilio Rao struct fuse_attr_out { 5118f9b3ba7SAlan Somers uint64_t attr_valid; /* Cache timeout for the attributes */ 5128f9b3ba7SAlan Somers uint32_t attr_valid_nsec; 5138f9b3ba7SAlan Somers uint32_t dummy; 5145fe58019SAttilio Rao struct fuse_attr attr; 5155fe58019SAttilio Rao }; 5165fe58019SAttilio Rao 517a4856c96SAlan Somers #define FUSE_COMPAT_MKNOD_IN_SIZE 8 518a4856c96SAlan Somers 5194cbb4f88SAlan Somers struct fuse_mknod_in { 5208f9b3ba7SAlan Somers uint32_t mode; 5218f9b3ba7SAlan Somers uint32_t rdev; 5228f9b3ba7SAlan Somers uint32_t umask; 5238f9b3ba7SAlan Somers uint32_t padding; 5244cbb4f88SAlan Somers }; 5254cbb4f88SAlan Somers 5265fe58019SAttilio Rao struct fuse_mkdir_in { 5278f9b3ba7SAlan Somers uint32_t mode; 5288f9b3ba7SAlan Somers uint32_t umask; 5295fe58019SAttilio Rao }; 5305fe58019SAttilio Rao 5315fe58019SAttilio Rao struct fuse_rename_in { 5328f9b3ba7SAlan Somers uint64_t newdir; 5335fe58019SAttilio Rao }; 5345fe58019SAttilio Rao 53587ff949aSAlan Somers struct fuse_rename2_in { 53687ff949aSAlan Somers uint64_t newdir; 53787ff949aSAlan Somers uint32_t flags; 53887ff949aSAlan Somers uint32_t padding; 53987ff949aSAlan Somers }; 54087ff949aSAlan Somers 5415fe58019SAttilio Rao struct fuse_link_in { 5428f9b3ba7SAlan Somers uint64_t oldnodeid; 5435fe58019SAttilio Rao }; 5445fe58019SAttilio Rao 5455fe58019SAttilio Rao struct fuse_setattr_in { 5468f9b3ba7SAlan Somers uint32_t valid; 5478f9b3ba7SAlan Somers uint32_t padding; 5488f9b3ba7SAlan Somers uint64_t fh; 5498f9b3ba7SAlan Somers uint64_t size; 5508f9b3ba7SAlan Somers uint64_t lock_owner; 5518f9b3ba7SAlan Somers uint64_t atime; 5528f9b3ba7SAlan Somers uint64_t mtime; 55387ff949aSAlan Somers uint64_t ctime; 5548f9b3ba7SAlan Somers uint32_t atimensec; 5558f9b3ba7SAlan Somers uint32_t mtimensec; 55687ff949aSAlan Somers uint32_t ctimensec; 5578f9b3ba7SAlan Somers uint32_t mode; 5588f9b3ba7SAlan Somers uint32_t unused4; 5598f9b3ba7SAlan Somers uint32_t uid; 5608f9b3ba7SAlan Somers uint32_t gid; 5618f9b3ba7SAlan Somers uint32_t unused5; 5625fe58019SAttilio Rao }; 5635fe58019SAttilio Rao 5645fe58019SAttilio Rao struct fuse_open_in { 5658f9b3ba7SAlan Somers uint32_t flags; 5668f9b3ba7SAlan Somers uint32_t unused; 567a4856c96SAlan Somers }; 568a4856c96SAlan Somers 569a4856c96SAlan Somers struct fuse_create_in { 5708f9b3ba7SAlan Somers uint32_t flags; 5718f9b3ba7SAlan Somers uint32_t mode; 5728f9b3ba7SAlan Somers uint32_t umask; 5738f9b3ba7SAlan Somers uint32_t padding; 5745fe58019SAttilio Rao }; 5755fe58019SAttilio Rao 5765fe58019SAttilio Rao struct fuse_open_out { 5778f9b3ba7SAlan Somers uint64_t fh; 5788f9b3ba7SAlan Somers uint32_t open_flags; 5798f9b3ba7SAlan Somers uint32_t padding; 5805fe58019SAttilio Rao }; 5815fe58019SAttilio Rao 5825fe58019SAttilio Rao struct fuse_release_in { 5838f9b3ba7SAlan Somers uint64_t fh; 5848f9b3ba7SAlan Somers uint32_t flags; 5858f9b3ba7SAlan Somers uint32_t release_flags; 5868f9b3ba7SAlan Somers uint64_t lock_owner; 5875fe58019SAttilio Rao }; 5885fe58019SAttilio Rao 5895fe58019SAttilio Rao struct fuse_flush_in { 5908f9b3ba7SAlan Somers uint64_t fh; 5918f9b3ba7SAlan Somers uint32_t unused; 5928f9b3ba7SAlan Somers uint32_t padding; 5938f9b3ba7SAlan Somers uint64_t lock_owner; 5945fe58019SAttilio Rao }; 5955fe58019SAttilio Rao 5965fe58019SAttilio Rao struct fuse_read_in { 5978f9b3ba7SAlan Somers uint64_t fh; 5988f9b3ba7SAlan Somers uint64_t offset; 5998f9b3ba7SAlan Somers uint32_t size; 6008f9b3ba7SAlan Somers uint32_t read_flags; 6018f9b3ba7SAlan Somers uint64_t lock_owner; 6028f9b3ba7SAlan Somers uint32_t flags; 6038f9b3ba7SAlan Somers uint32_t padding; 6045fe58019SAttilio Rao }; 6055fe58019SAttilio Rao 60616bd2d47SAlan Somers #define FUSE_COMPAT_WRITE_IN_SIZE 24 60716bd2d47SAlan Somers 6085fe58019SAttilio Rao struct fuse_write_in { 6098f9b3ba7SAlan Somers uint64_t fh; 6108f9b3ba7SAlan Somers uint64_t offset; 6118f9b3ba7SAlan Somers uint32_t size; 6128f9b3ba7SAlan Somers uint32_t write_flags; 6138f9b3ba7SAlan Somers uint64_t lock_owner; 6148f9b3ba7SAlan Somers uint32_t flags; 6158f9b3ba7SAlan Somers uint32_t padding; 6165fe58019SAttilio Rao }; 6175fe58019SAttilio Rao 6185fe58019SAttilio Rao struct fuse_write_out { 6198f9b3ba7SAlan Somers uint32_t size; 6208f9b3ba7SAlan Somers uint32_t padding; 6215fe58019SAttilio Rao }; 6225fe58019SAttilio Rao 6235fe58019SAttilio Rao #define FUSE_COMPAT_STATFS_SIZE 48 6245fe58019SAttilio Rao 6255fe58019SAttilio Rao struct fuse_statfs_out { 6265fe58019SAttilio Rao struct fuse_kstatfs st; 6275fe58019SAttilio Rao }; 6285fe58019SAttilio Rao 6295fe58019SAttilio Rao struct fuse_fsync_in { 6308f9b3ba7SAlan Somers uint64_t fh; 6318f9b3ba7SAlan Somers uint32_t fsync_flags; 6328f9b3ba7SAlan Somers uint32_t padding; 6335fe58019SAttilio Rao }; 6345fe58019SAttilio Rao 63596192dfcSAlan Somers struct fuse_setxattr_in { 6368f9b3ba7SAlan Somers uint32_t size; 6378f9b3ba7SAlan Somers uint32_t flags; 638493b4a8cSFedor Uporov }; 639493b4a8cSFedor Uporov 64096192dfcSAlan Somers struct fuse_listxattr_in { 6418f9b3ba7SAlan Somers uint32_t size; 6428f9b3ba7SAlan Somers uint32_t padding; 64396192dfcSAlan Somers }; 64496192dfcSAlan Somers 645493b4a8cSFedor Uporov struct fuse_listxattr_out { 6468f9b3ba7SAlan Somers uint32_t size; 6478f9b3ba7SAlan Somers uint32_t padding; 6485fe58019SAttilio Rao }; 6495fe58019SAttilio Rao 6505fe58019SAttilio Rao struct fuse_getxattr_in { 6518f9b3ba7SAlan Somers uint32_t size; 6528f9b3ba7SAlan Somers uint32_t padding; 6535fe58019SAttilio Rao }; 6545fe58019SAttilio Rao 6555fe58019SAttilio Rao struct fuse_getxattr_out { 6568f9b3ba7SAlan Somers uint32_t size; 6578f9b3ba7SAlan Somers uint32_t padding; 6585fe58019SAttilio Rao }; 6595fe58019SAttilio Rao 6605fe58019SAttilio Rao struct fuse_lk_in { 6618f9b3ba7SAlan Somers uint64_t fh; 6628f9b3ba7SAlan Somers uint64_t owner; 6635fe58019SAttilio Rao struct fuse_file_lock lk; 6648f9b3ba7SAlan Somers uint32_t lk_flags; 6658f9b3ba7SAlan Somers uint32_t padding; 6665fe58019SAttilio Rao }; 6675fe58019SAttilio Rao 6685fe58019SAttilio Rao struct fuse_lk_out { 6695fe58019SAttilio Rao struct fuse_file_lock lk; 6705fe58019SAttilio Rao }; 6715fe58019SAttilio Rao 6725fe58019SAttilio Rao struct fuse_access_in { 6738f9b3ba7SAlan Somers uint32_t mask; 6748f9b3ba7SAlan Somers uint32_t padding; 6755fe58019SAttilio Rao }; 6765fe58019SAttilio Rao 6775fe58019SAttilio Rao struct fuse_init_in { 6788f9b3ba7SAlan Somers uint32_t major; 6798f9b3ba7SAlan Somers uint32_t minor; 6808f9b3ba7SAlan Somers uint32_t max_readahead; 6818f9b3ba7SAlan Somers uint32_t flags; 6825fe58019SAttilio Rao }; 6835fe58019SAttilio Rao 68487ff949aSAlan Somers #define FUSE_COMPAT_INIT_OUT_SIZE 8 68587ff949aSAlan Somers #define FUSE_COMPAT_22_INIT_OUT_SIZE 24 68687ff949aSAlan Somers 6875fe58019SAttilio Rao struct fuse_init_out { 6888f9b3ba7SAlan Somers uint32_t major; 6898f9b3ba7SAlan Somers uint32_t minor; 6908f9b3ba7SAlan Somers uint32_t max_readahead; 6918f9b3ba7SAlan Somers uint32_t flags; 6928f9b3ba7SAlan Somers uint16_t max_background; 6938f9b3ba7SAlan Somers uint16_t congestion_threshold; 6948f9b3ba7SAlan Somers uint32_t max_write; 69587ff949aSAlan Somers uint32_t time_gran; 69692bbfe1fSAlan Somers uint16_t max_pages; 69792bbfe1fSAlan Somers uint16_t padding; 69892bbfe1fSAlan Somers uint32_t unused[8]; 6995fe58019SAttilio Rao }; 7005fe58019SAttilio Rao 7019c62bc70SAlan Somers #ifdef linux 7029c62bc70SAlan Somers #define CUSE_INIT_INFO_MAX 4096 7039c62bc70SAlan Somers 7049c62bc70SAlan Somers struct cuse_init_in { 7058f9b3ba7SAlan Somers uint32_t major; 7068f9b3ba7SAlan Somers uint32_t minor; 7078f9b3ba7SAlan Somers uint32_t unused; 7088f9b3ba7SAlan Somers uint32_t flags; 7099c62bc70SAlan Somers }; 7109c62bc70SAlan Somers 7119c62bc70SAlan Somers struct cuse_init_out { 7128f9b3ba7SAlan Somers uint32_t major; 7138f9b3ba7SAlan Somers uint32_t minor; 7148f9b3ba7SAlan Somers uint32_t unused; 7158f9b3ba7SAlan Somers uint32_t flags; 7168f9b3ba7SAlan Somers uint32_t max_read; 7178f9b3ba7SAlan Somers uint32_t max_write; 7188f9b3ba7SAlan Somers uint32_t dev_major; /* chardev major */ 7198f9b3ba7SAlan Somers uint32_t dev_minor; /* chardev minor */ 7208f9b3ba7SAlan Somers uint32_t spare[10]; 7219c62bc70SAlan Somers }; 7229c62bc70SAlan Somers #endif /* linux */ 7239c62bc70SAlan Somers 7245fe58019SAttilio Rao struct fuse_interrupt_in { 7258f9b3ba7SAlan Somers uint64_t unique; 7265fe58019SAttilio Rao }; 7275fe58019SAttilio Rao 7285fe58019SAttilio Rao struct fuse_bmap_in { 7298f9b3ba7SAlan Somers uint64_t block; 7308f9b3ba7SAlan Somers uint32_t blocksize; 7318f9b3ba7SAlan Somers uint32_t padding; 7325fe58019SAttilio Rao }; 7335fe58019SAttilio Rao 7345fe58019SAttilio Rao struct fuse_bmap_out { 7358f9b3ba7SAlan Somers uint64_t block; 7365fe58019SAttilio Rao }; 7375fe58019SAttilio Rao 7389c62bc70SAlan Somers struct fuse_ioctl_in { 7398f9b3ba7SAlan Somers uint64_t fh; 7408f9b3ba7SAlan Somers uint32_t flags; 7418f9b3ba7SAlan Somers uint32_t cmd; 7428f9b3ba7SAlan Somers uint64_t arg; 7438f9b3ba7SAlan Somers uint32_t in_size; 7448f9b3ba7SAlan Somers uint32_t out_size; 7459c62bc70SAlan Somers }; 7469c62bc70SAlan Somers 747b160acd1SAlan Somers struct fuse_ioctl_iovec { 7488f9b3ba7SAlan Somers uint64_t base; 7498f9b3ba7SAlan Somers uint64_t len; 750b160acd1SAlan Somers }; 751b160acd1SAlan Somers 7529c62bc70SAlan Somers struct fuse_ioctl_out { 7538f9b3ba7SAlan Somers int32_t result; 7548f9b3ba7SAlan Somers uint32_t flags; 7558f9b3ba7SAlan Somers uint32_t in_iovs; 7568f9b3ba7SAlan Somers uint32_t out_iovs; 7579c62bc70SAlan Somers }; 7589c62bc70SAlan Somers 7599c62bc70SAlan Somers struct fuse_poll_in { 7608f9b3ba7SAlan Somers uint64_t fh; 7618f9b3ba7SAlan Somers uint64_t kh; 7628f9b3ba7SAlan Somers uint32_t flags; 7638f9b3ba7SAlan Somers uint32_t events; 7649c62bc70SAlan Somers }; 7659c62bc70SAlan Somers 7669c62bc70SAlan Somers struct fuse_poll_out { 7678f9b3ba7SAlan Somers uint32_t revents; 7688f9b3ba7SAlan Somers uint32_t padding; 7699c62bc70SAlan Somers }; 7709c62bc70SAlan Somers 7719c62bc70SAlan Somers struct fuse_notify_poll_wakeup_out { 7728f9b3ba7SAlan Somers uint64_t kh; 7739c62bc70SAlan Somers }; 7749c62bc70SAlan Somers 775b160acd1SAlan Somers struct fuse_fallocate_in { 7768f9b3ba7SAlan Somers uint64_t fh; 7778f9b3ba7SAlan Somers uint64_t offset; 7788f9b3ba7SAlan Somers uint64_t length; 7798f9b3ba7SAlan Somers uint32_t mode; 7808f9b3ba7SAlan Somers uint32_t padding; 781b160acd1SAlan Somers }; 782b160acd1SAlan Somers 7835fe58019SAttilio Rao struct fuse_in_header { 7848f9b3ba7SAlan Somers uint32_t len; 7858f9b3ba7SAlan Somers uint32_t opcode; 7868f9b3ba7SAlan Somers uint64_t unique; 7878f9b3ba7SAlan Somers uint64_t nodeid; 7888f9b3ba7SAlan Somers uint32_t uid; 7898f9b3ba7SAlan Somers uint32_t gid; 7908f9b3ba7SAlan Somers uint32_t pid; 7918f9b3ba7SAlan Somers uint32_t padding; 7925fe58019SAttilio Rao }; 7935fe58019SAttilio Rao 7945fe58019SAttilio Rao struct fuse_out_header { 7958f9b3ba7SAlan Somers uint32_t len; 7968f9b3ba7SAlan Somers int32_t error; 7978f9b3ba7SAlan Somers uint64_t unique; 7985fe58019SAttilio Rao }; 7995fe58019SAttilio Rao 8005fe58019SAttilio Rao struct fuse_dirent { 8018f9b3ba7SAlan Somers uint64_t ino; 8028f9b3ba7SAlan Somers uint64_t off; 8038f9b3ba7SAlan Somers uint32_t namelen; 8048f9b3ba7SAlan Somers uint32_t type; 805b160acd1SAlan Somers char name[]; 8065fe58019SAttilio Rao }; 8075fe58019SAttilio Rao 8085fe58019SAttilio Rao #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) 80987ff949aSAlan Somers #define FUSE_DIRENT_ALIGN(x) \ 81087ff949aSAlan Somers (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1)) 8115fe58019SAttilio Rao #define FUSE_DIRENT_SIZE(d) \ 8125fe58019SAttilio Rao FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) 81316bd2d47SAlan Somers 814b160acd1SAlan Somers struct fuse_direntplus { 815b160acd1SAlan Somers struct fuse_entry_out entry_out; 816b160acd1SAlan Somers struct fuse_dirent dirent; 817b160acd1SAlan Somers }; 818b160acd1SAlan Somers 819b160acd1SAlan Somers #define FUSE_NAME_OFFSET_DIRENTPLUS \ 820b160acd1SAlan Somers offsetof(struct fuse_direntplus, dirent.name) 821b160acd1SAlan Somers #define FUSE_DIRENTPLUS_SIZE(d) \ 822b160acd1SAlan Somers FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen) 823b160acd1SAlan Somers 824a4856c96SAlan Somers struct fuse_notify_inval_inode_out { 8258f9b3ba7SAlan Somers uint64_t ino; 8268f9b3ba7SAlan Somers int64_t off; 8278f9b3ba7SAlan Somers int64_t len; 828a4856c96SAlan Somers }; 829a4856c96SAlan Somers 830a4856c96SAlan Somers struct fuse_notify_inval_entry_out { 8318f9b3ba7SAlan Somers uint64_t parent; 8328f9b3ba7SAlan Somers uint32_t namelen; 8338f9b3ba7SAlan Somers uint32_t padding; 834a4856c96SAlan Somers }; 835a4856c96SAlan Somers 836b160acd1SAlan Somers struct fuse_notify_delete_out { 8378f9b3ba7SAlan Somers uint64_t parent; 8388f9b3ba7SAlan Somers uint64_t child; 8398f9b3ba7SAlan Somers uint32_t namelen; 8408f9b3ba7SAlan Somers uint32_t padding; 841b160acd1SAlan Somers }; 842b160acd1SAlan Somers 843ecb48915SAlan Somers struct fuse_notify_store_out { 8448f9b3ba7SAlan Somers uint64_t nodeid; 8458f9b3ba7SAlan Somers uint64_t offset; 8468f9b3ba7SAlan Somers uint32_t size; 8478f9b3ba7SAlan Somers uint32_t padding; 848ecb48915SAlan Somers }; 849ecb48915SAlan Somers 850ecb48915SAlan Somers struct fuse_notify_retrieve_out { 8518f9b3ba7SAlan Somers uint64_t notify_unique; 8528f9b3ba7SAlan Somers uint64_t nodeid; 8538f9b3ba7SAlan Somers uint64_t offset; 8548f9b3ba7SAlan Somers uint32_t size; 8558f9b3ba7SAlan Somers uint32_t padding; 856ecb48915SAlan Somers }; 857ecb48915SAlan Somers 858ecb48915SAlan Somers /* Matches the size of fuse_write_in */ 859ecb48915SAlan Somers struct fuse_notify_retrieve_in { 8608f9b3ba7SAlan Somers uint64_t dummy1; 8618f9b3ba7SAlan Somers uint64_t offset; 8628f9b3ba7SAlan Somers uint32_t size; 8638f9b3ba7SAlan Somers uint32_t dummy2; 8648f9b3ba7SAlan Somers uint64_t dummy3; 8658f9b3ba7SAlan Somers uint64_t dummy4; 866ecb48915SAlan Somers }; 867ecb48915SAlan Somers 86837df9d3bSAlan Somers struct fuse_lseek_in { 86937df9d3bSAlan Somers uint64_t fh; 87037df9d3bSAlan Somers uint64_t offset; 87137df9d3bSAlan Somers uint32_t whence; 87237df9d3bSAlan Somers uint32_t padding; 87337df9d3bSAlan Somers }; 87437df9d3bSAlan Somers 87537df9d3bSAlan Somers struct fuse_lseek_out { 87637df9d3bSAlan Somers uint64_t offset; 87737df9d3bSAlan Somers }; 87837df9d3bSAlan Somers 87992bbfe1fSAlan Somers struct fuse_copy_file_range_in { 88092bbfe1fSAlan Somers uint64_t fh_in; 88192bbfe1fSAlan Somers uint64_t off_in; 88292bbfe1fSAlan Somers uint64_t nodeid_out; 88392bbfe1fSAlan Somers uint64_t fh_out; 88492bbfe1fSAlan Somers uint64_t off_out; 88592bbfe1fSAlan Somers uint64_t len; 88692bbfe1fSAlan Somers uint64_t flags; 88792bbfe1fSAlan Somers }; 88892bbfe1fSAlan Somers 88916bd2d47SAlan Somers #endif /* _FUSE_FUSE_KERNEL_H */ 890