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 */ 201*7124d2bcSAlan 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 303*7124d2bcSAlan 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) 329*7124d2bcSAlan 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 4035fe58019SAttilio Rao enum fuse_opcode { 4045fe58019SAttilio Rao FUSE_LOOKUP = 1, 4055fe58019SAttilio Rao FUSE_FORGET = 2, /* no reply */ 4065fe58019SAttilio Rao FUSE_GETATTR = 3, 4075fe58019SAttilio Rao FUSE_SETATTR = 4, 4085fe58019SAttilio Rao FUSE_READLINK = 5, 4095fe58019SAttilio Rao FUSE_SYMLINK = 6, 4105fe58019SAttilio Rao FUSE_MKNOD = 8, 4115fe58019SAttilio Rao FUSE_MKDIR = 9, 4125fe58019SAttilio Rao FUSE_UNLINK = 10, 4135fe58019SAttilio Rao FUSE_RMDIR = 11, 4145fe58019SAttilio Rao FUSE_RENAME = 12, 4155fe58019SAttilio Rao FUSE_LINK = 13, 4165fe58019SAttilio Rao FUSE_OPEN = 14, 4175fe58019SAttilio Rao FUSE_READ = 15, 4185fe58019SAttilio Rao FUSE_WRITE = 16, 4195fe58019SAttilio Rao FUSE_STATFS = 17, 4205fe58019SAttilio Rao FUSE_RELEASE = 18, 4215fe58019SAttilio Rao FUSE_FSYNC = 20, 4225fe58019SAttilio Rao FUSE_SETXATTR = 21, 4235fe58019SAttilio Rao FUSE_GETXATTR = 22, 4245fe58019SAttilio Rao FUSE_LISTXATTR = 23, 4255fe58019SAttilio Rao FUSE_REMOVEXATTR = 24, 4265fe58019SAttilio Rao FUSE_FLUSH = 25, 4275fe58019SAttilio Rao FUSE_INIT = 26, 4285fe58019SAttilio Rao FUSE_OPENDIR = 27, 4295fe58019SAttilio Rao FUSE_READDIR = 28, 4305fe58019SAttilio Rao FUSE_RELEASEDIR = 29, 4315fe58019SAttilio Rao FUSE_FSYNCDIR = 30, 4325fe58019SAttilio Rao FUSE_GETLK = 31, 4335fe58019SAttilio Rao FUSE_SETLK = 32, 4345fe58019SAttilio Rao FUSE_SETLKW = 33, 4355fe58019SAttilio Rao FUSE_ACCESS = 34, 4365fe58019SAttilio Rao FUSE_CREATE = 35, 4375fe58019SAttilio Rao FUSE_INTERRUPT = 36, 4385fe58019SAttilio Rao FUSE_BMAP = 37, 4395fe58019SAttilio Rao FUSE_DESTROY = 38, 4409c62bc70SAlan Somers FUSE_IOCTL = 39, 4419c62bc70SAlan Somers FUSE_POLL = 40, 4427cbb8e8aSAlan Somers FUSE_NOTIFY_REPLY = 41, 443b160acd1SAlan Somers FUSE_BATCH_FORGET = 42, 444b160acd1SAlan Somers FUSE_FALLOCATE = 43, 445b160acd1SAlan Somers FUSE_READDIRPLUS = 44, 44687ff949aSAlan Somers FUSE_RENAME2 = 45, 44737df9d3bSAlan Somers FUSE_LSEEK = 46, 44892bbfe1fSAlan Somers FUSE_COPY_FILE_RANGE = 47, 4499c62bc70SAlan Somers 4509c62bc70SAlan Somers #ifdef linux 4519c62bc70SAlan Somers /* CUSE specific operations */ 4529c62bc70SAlan Somers CUSE_INIT = 4096, 4539c62bc70SAlan Somers #endif /* linux */ 4549c62bc70SAlan Somers }; 4559c62bc70SAlan Somers 4569c62bc70SAlan Somers enum fuse_notify_code { 4579c62bc70SAlan Somers FUSE_NOTIFY_POLL = 1, 458a4856c96SAlan Somers FUSE_NOTIFY_INVAL_INODE = 2, 459a4856c96SAlan Somers FUSE_NOTIFY_INVAL_ENTRY = 3, 4607cbb8e8aSAlan Somers FUSE_NOTIFY_STORE = 4, 4617cbb8e8aSAlan Somers FUSE_NOTIFY_RETRIEVE = 5, 462b160acd1SAlan Somers FUSE_NOTIFY_DELETE = 6, 4639c62bc70SAlan Somers FUSE_NOTIFY_CODE_MAX, 4645fe58019SAttilio Rao }; 4655fe58019SAttilio Rao 4665fe58019SAttilio Rao /* The read buffer is required to be at least 8k, but may be much larger */ 4675fe58019SAttilio Rao #define FUSE_MIN_READ_BUFFER 8192 4685fe58019SAttilio Rao 46916bd2d47SAlan Somers #define FUSE_COMPAT_ENTRY_OUT_SIZE 120 47016bd2d47SAlan Somers 4715fe58019SAttilio Rao struct fuse_entry_out { 4728f9b3ba7SAlan Somers uint64_t nodeid; /* Inode ID */ 4738f9b3ba7SAlan Somers uint64_t generation; /* Inode generation: nodeid:gen must 4745fe58019SAttilio Rao be unique for the fs's lifetime */ 4758f9b3ba7SAlan Somers uint64_t entry_valid; /* Cache timeout for the name */ 4768f9b3ba7SAlan Somers uint64_t attr_valid; /* Cache timeout for the attributes */ 4778f9b3ba7SAlan Somers uint32_t entry_valid_nsec; 4788f9b3ba7SAlan Somers uint32_t attr_valid_nsec; 4795fe58019SAttilio Rao struct fuse_attr attr; 4805fe58019SAttilio Rao }; 4815fe58019SAttilio Rao 4825fe58019SAttilio Rao struct fuse_forget_in { 4838f9b3ba7SAlan Somers uint64_t nlookup; 4845fe58019SAttilio Rao }; 4855fe58019SAttilio Rao 486b160acd1SAlan Somers struct fuse_forget_one { 4878f9b3ba7SAlan Somers uint64_t nodeid; 4888f9b3ba7SAlan Somers uint64_t nlookup; 489b160acd1SAlan Somers }; 490b160acd1SAlan Somers 491b160acd1SAlan Somers struct fuse_batch_forget_in { 4928f9b3ba7SAlan Somers uint32_t count; 4938f9b3ba7SAlan Somers uint32_t dummy; 494b160acd1SAlan Somers }; 495b160acd1SAlan Somers 49616bd2d47SAlan Somers struct fuse_getattr_in { 4978f9b3ba7SAlan Somers uint32_t getattr_flags; 4988f9b3ba7SAlan Somers uint32_t dummy; 4998f9b3ba7SAlan Somers uint64_t fh; 50016bd2d47SAlan Somers }; 50116bd2d47SAlan Somers 50216bd2d47SAlan Somers #define FUSE_COMPAT_ATTR_OUT_SIZE 96 50316bd2d47SAlan Somers 5045fe58019SAttilio Rao struct fuse_attr_out { 5058f9b3ba7SAlan Somers uint64_t attr_valid; /* Cache timeout for the attributes */ 5068f9b3ba7SAlan Somers uint32_t attr_valid_nsec; 5078f9b3ba7SAlan Somers uint32_t dummy; 5085fe58019SAttilio Rao struct fuse_attr attr; 5095fe58019SAttilio Rao }; 5105fe58019SAttilio Rao 511a4856c96SAlan Somers #define FUSE_COMPAT_MKNOD_IN_SIZE 8 512a4856c96SAlan Somers 5134cbb4f88SAlan Somers struct fuse_mknod_in { 5148f9b3ba7SAlan Somers uint32_t mode; 5158f9b3ba7SAlan Somers uint32_t rdev; 5168f9b3ba7SAlan Somers uint32_t umask; 5178f9b3ba7SAlan Somers uint32_t padding; 5184cbb4f88SAlan Somers }; 5194cbb4f88SAlan Somers 5205fe58019SAttilio Rao struct fuse_mkdir_in { 5218f9b3ba7SAlan Somers uint32_t mode; 5228f9b3ba7SAlan Somers uint32_t umask; 5235fe58019SAttilio Rao }; 5245fe58019SAttilio Rao 5255fe58019SAttilio Rao struct fuse_rename_in { 5268f9b3ba7SAlan Somers uint64_t newdir; 5275fe58019SAttilio Rao }; 5285fe58019SAttilio Rao 52987ff949aSAlan Somers struct fuse_rename2_in { 53087ff949aSAlan Somers uint64_t newdir; 53187ff949aSAlan Somers uint32_t flags; 53287ff949aSAlan Somers uint32_t padding; 53387ff949aSAlan Somers }; 53487ff949aSAlan Somers 5355fe58019SAttilio Rao struct fuse_link_in { 5368f9b3ba7SAlan Somers uint64_t oldnodeid; 5375fe58019SAttilio Rao }; 5385fe58019SAttilio Rao 5395fe58019SAttilio Rao struct fuse_setattr_in { 5408f9b3ba7SAlan Somers uint32_t valid; 5418f9b3ba7SAlan Somers uint32_t padding; 5428f9b3ba7SAlan Somers uint64_t fh; 5438f9b3ba7SAlan Somers uint64_t size; 5448f9b3ba7SAlan Somers uint64_t lock_owner; 5458f9b3ba7SAlan Somers uint64_t atime; 5468f9b3ba7SAlan Somers uint64_t mtime; 54787ff949aSAlan Somers uint64_t ctime; 5488f9b3ba7SAlan Somers uint32_t atimensec; 5498f9b3ba7SAlan Somers uint32_t mtimensec; 55087ff949aSAlan Somers uint32_t ctimensec; 5518f9b3ba7SAlan Somers uint32_t mode; 5528f9b3ba7SAlan Somers uint32_t unused4; 5538f9b3ba7SAlan Somers uint32_t uid; 5548f9b3ba7SAlan Somers uint32_t gid; 5558f9b3ba7SAlan Somers uint32_t unused5; 5565fe58019SAttilio Rao }; 5575fe58019SAttilio Rao 5585fe58019SAttilio Rao struct fuse_open_in { 5598f9b3ba7SAlan Somers uint32_t flags; 5608f9b3ba7SAlan Somers uint32_t unused; 561a4856c96SAlan Somers }; 562a4856c96SAlan Somers 563a4856c96SAlan Somers struct fuse_create_in { 5648f9b3ba7SAlan Somers uint32_t flags; 5658f9b3ba7SAlan Somers uint32_t mode; 5668f9b3ba7SAlan Somers uint32_t umask; 5678f9b3ba7SAlan Somers uint32_t padding; 5685fe58019SAttilio Rao }; 5695fe58019SAttilio Rao 5705fe58019SAttilio Rao struct fuse_open_out { 5718f9b3ba7SAlan Somers uint64_t fh; 5728f9b3ba7SAlan Somers uint32_t open_flags; 5738f9b3ba7SAlan Somers uint32_t padding; 5745fe58019SAttilio Rao }; 5755fe58019SAttilio Rao 5765fe58019SAttilio Rao struct fuse_release_in { 5778f9b3ba7SAlan Somers uint64_t fh; 5788f9b3ba7SAlan Somers uint32_t flags; 5798f9b3ba7SAlan Somers uint32_t release_flags; 5808f9b3ba7SAlan Somers uint64_t lock_owner; 5815fe58019SAttilio Rao }; 5825fe58019SAttilio Rao 5835fe58019SAttilio Rao struct fuse_flush_in { 5848f9b3ba7SAlan Somers uint64_t fh; 5858f9b3ba7SAlan Somers uint32_t unused; 5868f9b3ba7SAlan Somers uint32_t padding; 5878f9b3ba7SAlan Somers uint64_t lock_owner; 5885fe58019SAttilio Rao }; 5895fe58019SAttilio Rao 5905fe58019SAttilio Rao struct fuse_read_in { 5918f9b3ba7SAlan Somers uint64_t fh; 5928f9b3ba7SAlan Somers uint64_t offset; 5938f9b3ba7SAlan Somers uint32_t size; 5948f9b3ba7SAlan Somers uint32_t read_flags; 5958f9b3ba7SAlan Somers uint64_t lock_owner; 5968f9b3ba7SAlan Somers uint32_t flags; 5978f9b3ba7SAlan Somers uint32_t padding; 5985fe58019SAttilio Rao }; 5995fe58019SAttilio Rao 60016bd2d47SAlan Somers #define FUSE_COMPAT_WRITE_IN_SIZE 24 60116bd2d47SAlan Somers 6025fe58019SAttilio Rao struct fuse_write_in { 6038f9b3ba7SAlan Somers uint64_t fh; 6048f9b3ba7SAlan Somers uint64_t offset; 6058f9b3ba7SAlan Somers uint32_t size; 6068f9b3ba7SAlan Somers uint32_t write_flags; 6078f9b3ba7SAlan Somers uint64_t lock_owner; 6088f9b3ba7SAlan Somers uint32_t flags; 6098f9b3ba7SAlan Somers uint32_t padding; 6105fe58019SAttilio Rao }; 6115fe58019SAttilio Rao 6125fe58019SAttilio Rao struct fuse_write_out { 6138f9b3ba7SAlan Somers uint32_t size; 6148f9b3ba7SAlan Somers uint32_t padding; 6155fe58019SAttilio Rao }; 6165fe58019SAttilio Rao 6175fe58019SAttilio Rao #define FUSE_COMPAT_STATFS_SIZE 48 6185fe58019SAttilio Rao 6195fe58019SAttilio Rao struct fuse_statfs_out { 6205fe58019SAttilio Rao struct fuse_kstatfs st; 6215fe58019SAttilio Rao }; 6225fe58019SAttilio Rao 6235fe58019SAttilio Rao struct fuse_fsync_in { 6248f9b3ba7SAlan Somers uint64_t fh; 6258f9b3ba7SAlan Somers uint32_t fsync_flags; 6268f9b3ba7SAlan Somers uint32_t padding; 6275fe58019SAttilio Rao }; 6285fe58019SAttilio Rao 62996192dfcSAlan Somers struct fuse_setxattr_in { 6308f9b3ba7SAlan Somers uint32_t size; 6318f9b3ba7SAlan Somers uint32_t flags; 632493b4a8cSFedor Uporov }; 633493b4a8cSFedor Uporov 63496192dfcSAlan Somers struct fuse_listxattr_in { 6358f9b3ba7SAlan Somers uint32_t size; 6368f9b3ba7SAlan Somers uint32_t padding; 63796192dfcSAlan Somers }; 63896192dfcSAlan Somers 639493b4a8cSFedor Uporov struct fuse_listxattr_out { 6408f9b3ba7SAlan Somers uint32_t size; 6418f9b3ba7SAlan Somers uint32_t padding; 6425fe58019SAttilio Rao }; 6435fe58019SAttilio Rao 6445fe58019SAttilio Rao struct fuse_getxattr_in { 6458f9b3ba7SAlan Somers uint32_t size; 6468f9b3ba7SAlan Somers uint32_t padding; 6475fe58019SAttilio Rao }; 6485fe58019SAttilio Rao 6495fe58019SAttilio Rao struct fuse_getxattr_out { 6508f9b3ba7SAlan Somers uint32_t size; 6518f9b3ba7SAlan Somers uint32_t padding; 6525fe58019SAttilio Rao }; 6535fe58019SAttilio Rao 6545fe58019SAttilio Rao struct fuse_lk_in { 6558f9b3ba7SAlan Somers uint64_t fh; 6568f9b3ba7SAlan Somers uint64_t owner; 6575fe58019SAttilio Rao struct fuse_file_lock lk; 6588f9b3ba7SAlan Somers uint32_t lk_flags; 6598f9b3ba7SAlan Somers uint32_t padding; 6605fe58019SAttilio Rao }; 6615fe58019SAttilio Rao 6625fe58019SAttilio Rao struct fuse_lk_out { 6635fe58019SAttilio Rao struct fuse_file_lock lk; 6645fe58019SAttilio Rao }; 6655fe58019SAttilio Rao 6665fe58019SAttilio Rao struct fuse_access_in { 6678f9b3ba7SAlan Somers uint32_t mask; 6688f9b3ba7SAlan Somers uint32_t padding; 6695fe58019SAttilio Rao }; 6705fe58019SAttilio Rao 6715fe58019SAttilio Rao struct fuse_init_in { 6728f9b3ba7SAlan Somers uint32_t major; 6738f9b3ba7SAlan Somers uint32_t minor; 6748f9b3ba7SAlan Somers uint32_t max_readahead; 6758f9b3ba7SAlan Somers uint32_t flags; 6765fe58019SAttilio Rao }; 6775fe58019SAttilio Rao 67887ff949aSAlan Somers #define FUSE_COMPAT_INIT_OUT_SIZE 8 67987ff949aSAlan Somers #define FUSE_COMPAT_22_INIT_OUT_SIZE 24 68087ff949aSAlan Somers 6815fe58019SAttilio Rao struct fuse_init_out { 6828f9b3ba7SAlan Somers uint32_t major; 6838f9b3ba7SAlan Somers uint32_t minor; 6848f9b3ba7SAlan Somers uint32_t max_readahead; 6858f9b3ba7SAlan Somers uint32_t flags; 6868f9b3ba7SAlan Somers uint16_t max_background; 6878f9b3ba7SAlan Somers uint16_t congestion_threshold; 6888f9b3ba7SAlan Somers uint32_t max_write; 68987ff949aSAlan Somers uint32_t time_gran; 69092bbfe1fSAlan Somers uint16_t max_pages; 69192bbfe1fSAlan Somers uint16_t padding; 69292bbfe1fSAlan Somers uint32_t unused[8]; 6935fe58019SAttilio Rao }; 6945fe58019SAttilio Rao 6959c62bc70SAlan Somers #ifdef linux 6969c62bc70SAlan Somers #define CUSE_INIT_INFO_MAX 4096 6979c62bc70SAlan Somers 6989c62bc70SAlan Somers struct cuse_init_in { 6998f9b3ba7SAlan Somers uint32_t major; 7008f9b3ba7SAlan Somers uint32_t minor; 7018f9b3ba7SAlan Somers uint32_t unused; 7028f9b3ba7SAlan Somers uint32_t flags; 7039c62bc70SAlan Somers }; 7049c62bc70SAlan Somers 7059c62bc70SAlan Somers struct cuse_init_out { 7068f9b3ba7SAlan Somers uint32_t major; 7078f9b3ba7SAlan Somers uint32_t minor; 7088f9b3ba7SAlan Somers uint32_t unused; 7098f9b3ba7SAlan Somers uint32_t flags; 7108f9b3ba7SAlan Somers uint32_t max_read; 7118f9b3ba7SAlan Somers uint32_t max_write; 7128f9b3ba7SAlan Somers uint32_t dev_major; /* chardev major */ 7138f9b3ba7SAlan Somers uint32_t dev_minor; /* chardev minor */ 7148f9b3ba7SAlan Somers uint32_t spare[10]; 7159c62bc70SAlan Somers }; 7169c62bc70SAlan Somers #endif /* linux */ 7179c62bc70SAlan Somers 7185fe58019SAttilio Rao struct fuse_interrupt_in { 7198f9b3ba7SAlan Somers uint64_t unique; 7205fe58019SAttilio Rao }; 7215fe58019SAttilio Rao 7225fe58019SAttilio Rao struct fuse_bmap_in { 7238f9b3ba7SAlan Somers uint64_t block; 7248f9b3ba7SAlan Somers uint32_t blocksize; 7258f9b3ba7SAlan Somers uint32_t padding; 7265fe58019SAttilio Rao }; 7275fe58019SAttilio Rao 7285fe58019SAttilio Rao struct fuse_bmap_out { 7298f9b3ba7SAlan Somers uint64_t block; 7305fe58019SAttilio Rao }; 7315fe58019SAttilio Rao 7329c62bc70SAlan Somers struct fuse_ioctl_in { 7338f9b3ba7SAlan Somers uint64_t fh; 7348f9b3ba7SAlan Somers uint32_t flags; 7358f9b3ba7SAlan Somers uint32_t cmd; 7368f9b3ba7SAlan Somers uint64_t arg; 7378f9b3ba7SAlan Somers uint32_t in_size; 7388f9b3ba7SAlan Somers uint32_t out_size; 7399c62bc70SAlan Somers }; 7409c62bc70SAlan Somers 741b160acd1SAlan Somers struct fuse_ioctl_iovec { 7428f9b3ba7SAlan Somers uint64_t base; 7438f9b3ba7SAlan Somers uint64_t len; 744b160acd1SAlan Somers }; 745b160acd1SAlan Somers 7469c62bc70SAlan Somers struct fuse_ioctl_out { 7478f9b3ba7SAlan Somers int32_t result; 7488f9b3ba7SAlan Somers uint32_t flags; 7498f9b3ba7SAlan Somers uint32_t in_iovs; 7508f9b3ba7SAlan Somers uint32_t out_iovs; 7519c62bc70SAlan Somers }; 7529c62bc70SAlan Somers 7539c62bc70SAlan Somers struct fuse_poll_in { 7548f9b3ba7SAlan Somers uint64_t fh; 7558f9b3ba7SAlan Somers uint64_t kh; 7568f9b3ba7SAlan Somers uint32_t flags; 7578f9b3ba7SAlan Somers uint32_t events; 7589c62bc70SAlan Somers }; 7599c62bc70SAlan Somers 7609c62bc70SAlan Somers struct fuse_poll_out { 7618f9b3ba7SAlan Somers uint32_t revents; 7628f9b3ba7SAlan Somers uint32_t padding; 7639c62bc70SAlan Somers }; 7649c62bc70SAlan Somers 7659c62bc70SAlan Somers struct fuse_notify_poll_wakeup_out { 7668f9b3ba7SAlan Somers uint64_t kh; 7679c62bc70SAlan Somers }; 7689c62bc70SAlan Somers 769b160acd1SAlan Somers struct fuse_fallocate_in { 7708f9b3ba7SAlan Somers uint64_t fh; 7718f9b3ba7SAlan Somers uint64_t offset; 7728f9b3ba7SAlan Somers uint64_t length; 7738f9b3ba7SAlan Somers uint32_t mode; 7748f9b3ba7SAlan Somers uint32_t padding; 775b160acd1SAlan Somers }; 776b160acd1SAlan Somers 7775fe58019SAttilio Rao struct fuse_in_header { 7788f9b3ba7SAlan Somers uint32_t len; 7798f9b3ba7SAlan Somers uint32_t opcode; 7808f9b3ba7SAlan Somers uint64_t unique; 7818f9b3ba7SAlan Somers uint64_t nodeid; 7828f9b3ba7SAlan Somers uint32_t uid; 7838f9b3ba7SAlan Somers uint32_t gid; 7848f9b3ba7SAlan Somers uint32_t pid; 7858f9b3ba7SAlan Somers uint32_t padding; 7865fe58019SAttilio Rao }; 7875fe58019SAttilio Rao 7885fe58019SAttilio Rao struct fuse_out_header { 7898f9b3ba7SAlan Somers uint32_t len; 7908f9b3ba7SAlan Somers int32_t error; 7918f9b3ba7SAlan Somers uint64_t unique; 7925fe58019SAttilio Rao }; 7935fe58019SAttilio Rao 7945fe58019SAttilio Rao struct fuse_dirent { 7958f9b3ba7SAlan Somers uint64_t ino; 7968f9b3ba7SAlan Somers uint64_t off; 7978f9b3ba7SAlan Somers uint32_t namelen; 7988f9b3ba7SAlan Somers uint32_t type; 799b160acd1SAlan Somers char name[]; 8005fe58019SAttilio Rao }; 8015fe58019SAttilio Rao 8025fe58019SAttilio Rao #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) 80387ff949aSAlan Somers #define FUSE_DIRENT_ALIGN(x) \ 80487ff949aSAlan Somers (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1)) 8055fe58019SAttilio Rao #define FUSE_DIRENT_SIZE(d) \ 8065fe58019SAttilio Rao FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) 80716bd2d47SAlan Somers 808b160acd1SAlan Somers struct fuse_direntplus { 809b160acd1SAlan Somers struct fuse_entry_out entry_out; 810b160acd1SAlan Somers struct fuse_dirent dirent; 811b160acd1SAlan Somers }; 812b160acd1SAlan Somers 813b160acd1SAlan Somers #define FUSE_NAME_OFFSET_DIRENTPLUS \ 814b160acd1SAlan Somers offsetof(struct fuse_direntplus, dirent.name) 815b160acd1SAlan Somers #define FUSE_DIRENTPLUS_SIZE(d) \ 816b160acd1SAlan Somers FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen) 817b160acd1SAlan Somers 818a4856c96SAlan Somers struct fuse_notify_inval_inode_out { 8198f9b3ba7SAlan Somers uint64_t ino; 8208f9b3ba7SAlan Somers int64_t off; 8218f9b3ba7SAlan Somers int64_t len; 822a4856c96SAlan Somers }; 823a4856c96SAlan Somers 824a4856c96SAlan Somers struct fuse_notify_inval_entry_out { 8258f9b3ba7SAlan Somers uint64_t parent; 8268f9b3ba7SAlan Somers uint32_t namelen; 8278f9b3ba7SAlan Somers uint32_t padding; 828a4856c96SAlan Somers }; 829a4856c96SAlan Somers 830b160acd1SAlan Somers struct fuse_notify_delete_out { 8318f9b3ba7SAlan Somers uint64_t parent; 8328f9b3ba7SAlan Somers uint64_t child; 8338f9b3ba7SAlan Somers uint32_t namelen; 8348f9b3ba7SAlan Somers uint32_t padding; 835b160acd1SAlan Somers }; 836b160acd1SAlan Somers 837ecb48915SAlan Somers struct fuse_notify_store_out { 8388f9b3ba7SAlan Somers uint64_t nodeid; 8398f9b3ba7SAlan Somers uint64_t offset; 8408f9b3ba7SAlan Somers uint32_t size; 8418f9b3ba7SAlan Somers uint32_t padding; 842ecb48915SAlan Somers }; 843ecb48915SAlan Somers 844ecb48915SAlan Somers struct fuse_notify_retrieve_out { 8458f9b3ba7SAlan Somers uint64_t notify_unique; 8468f9b3ba7SAlan Somers uint64_t nodeid; 8478f9b3ba7SAlan Somers uint64_t offset; 8488f9b3ba7SAlan Somers uint32_t size; 8498f9b3ba7SAlan Somers uint32_t padding; 850ecb48915SAlan Somers }; 851ecb48915SAlan Somers 852ecb48915SAlan Somers /* Matches the size of fuse_write_in */ 853ecb48915SAlan Somers struct fuse_notify_retrieve_in { 8548f9b3ba7SAlan Somers uint64_t dummy1; 8558f9b3ba7SAlan Somers uint64_t offset; 8568f9b3ba7SAlan Somers uint32_t size; 8578f9b3ba7SAlan Somers uint32_t dummy2; 8588f9b3ba7SAlan Somers uint64_t dummy3; 8598f9b3ba7SAlan Somers uint64_t dummy4; 860ecb48915SAlan Somers }; 861ecb48915SAlan Somers 86237df9d3bSAlan Somers struct fuse_lseek_in { 86337df9d3bSAlan Somers uint64_t fh; 86437df9d3bSAlan Somers uint64_t offset; 86537df9d3bSAlan Somers uint32_t whence; 86637df9d3bSAlan Somers uint32_t padding; 86737df9d3bSAlan Somers }; 86837df9d3bSAlan Somers 86937df9d3bSAlan Somers struct fuse_lseek_out { 87037df9d3bSAlan Somers uint64_t offset; 87137df9d3bSAlan Somers }; 87237df9d3bSAlan Somers 87392bbfe1fSAlan Somers struct fuse_copy_file_range_in { 87492bbfe1fSAlan Somers uint64_t fh_in; 87592bbfe1fSAlan Somers uint64_t off_in; 87692bbfe1fSAlan Somers uint64_t nodeid_out; 87792bbfe1fSAlan Somers uint64_t fh_out; 87892bbfe1fSAlan Somers uint64_t off_out; 87992bbfe1fSAlan Somers uint64_t len; 88092bbfe1fSAlan Somers uint64_t flags; 88192bbfe1fSAlan Somers }; 88292bbfe1fSAlan Somers 88316bd2d47SAlan Somers #endif /* _FUSE_FUSE_KERNEL_H */ 884