1a62a9e19SDr. David Alan Gilbert /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 2a62a9e19SDr. David Alan Gilbert /* 3a62a9e19SDr. David Alan Gilbert This file defines the kernel interface of FUSE 4a62a9e19SDr. David Alan Gilbert Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> 5a62a9e19SDr. David Alan Gilbert 6a62a9e19SDr. David Alan Gilbert This program can be distributed under the terms of the GNU GPL. 7a62a9e19SDr. David Alan Gilbert See the file COPYING. 8a62a9e19SDr. David Alan Gilbert 9a62a9e19SDr. David Alan Gilbert This -- and only this -- header file may also be distributed under 10a62a9e19SDr. David Alan Gilbert the terms of the BSD Licence as follows: 11a62a9e19SDr. David Alan Gilbert 12a62a9e19SDr. David Alan Gilbert Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved. 13a62a9e19SDr. David Alan Gilbert 14a62a9e19SDr. David Alan Gilbert Redistribution and use in source and binary forms, with or without 15a62a9e19SDr. David Alan Gilbert modification, are permitted provided that the following conditions 16a62a9e19SDr. David Alan Gilbert are met: 17a62a9e19SDr. David Alan Gilbert 1. Redistributions of source code must retain the above copyright 18a62a9e19SDr. David Alan Gilbert notice, this list of conditions and the following disclaimer. 19a62a9e19SDr. David Alan Gilbert 2. Redistributions in binary form must reproduce the above copyright 20a62a9e19SDr. David Alan Gilbert notice, this list of conditions and the following disclaimer in the 21a62a9e19SDr. David Alan Gilbert documentation and/or other materials provided with the distribution. 22a62a9e19SDr. David Alan Gilbert 23a62a9e19SDr. David Alan Gilbert THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 24a62a9e19SDr. David Alan Gilbert ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25a62a9e19SDr. David Alan Gilbert IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26a62a9e19SDr. David Alan Gilbert ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 27a62a9e19SDr. David Alan Gilbert FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28a62a9e19SDr. David Alan Gilbert DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29a62a9e19SDr. David Alan Gilbert OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30a62a9e19SDr. David Alan Gilbert HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31a62a9e19SDr. David Alan Gilbert LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32a62a9e19SDr. David Alan Gilbert OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33a62a9e19SDr. David Alan Gilbert SUCH DAMAGE. 34a62a9e19SDr. David Alan Gilbert */ 35a62a9e19SDr. David Alan Gilbert 36a62a9e19SDr. David Alan Gilbert /* 37a62a9e19SDr. David Alan Gilbert * This file defines the kernel interface of FUSE 38a62a9e19SDr. David Alan Gilbert * 39a62a9e19SDr. David Alan Gilbert * Protocol changelog: 40a62a9e19SDr. David Alan Gilbert * 41a62a9e19SDr. David Alan Gilbert * 7.1: 42a62a9e19SDr. David Alan Gilbert * - add the following messages: 43a62a9e19SDr. David Alan Gilbert * FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK, 44a62a9e19SDr. David Alan Gilbert * FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE, 45a62a9e19SDr. David Alan Gilbert * FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR, 46a62a9e19SDr. David Alan Gilbert * FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR, 47a62a9e19SDr. David Alan Gilbert * FUSE_RELEASEDIR 48a62a9e19SDr. David Alan Gilbert * - add padding to messages to accommodate 32-bit servers on 64-bit kernels 49a62a9e19SDr. David Alan Gilbert * 50a62a9e19SDr. David Alan Gilbert * 7.2: 51a62a9e19SDr. David Alan Gilbert * - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags 52a62a9e19SDr. David Alan Gilbert * - add FUSE_FSYNCDIR message 53a62a9e19SDr. David Alan Gilbert * 54a62a9e19SDr. David Alan Gilbert * 7.3: 55a62a9e19SDr. David Alan Gilbert * - add FUSE_ACCESS message 56a62a9e19SDr. David Alan Gilbert * - add FUSE_CREATE message 57a62a9e19SDr. David Alan Gilbert * - add filehandle to fuse_setattr_in 58a62a9e19SDr. David Alan Gilbert * 59a62a9e19SDr. David Alan Gilbert * 7.4: 60a62a9e19SDr. David Alan Gilbert * - add frsize to fuse_kstatfs 61a62a9e19SDr. David Alan Gilbert * - clean up request size limit checking 62a62a9e19SDr. David Alan Gilbert * 63a62a9e19SDr. David Alan Gilbert * 7.5: 64a62a9e19SDr. David Alan Gilbert * - add flags and max_write to fuse_init_out 65a62a9e19SDr. David Alan Gilbert * 66a62a9e19SDr. David Alan Gilbert * 7.6: 67a62a9e19SDr. David Alan Gilbert * - add max_readahead to fuse_init_in and fuse_init_out 68a62a9e19SDr. David Alan Gilbert * 69a62a9e19SDr. David Alan Gilbert * 7.7: 70a62a9e19SDr. David Alan Gilbert * - add FUSE_INTERRUPT message 71a62a9e19SDr. David Alan Gilbert * - add POSIX file lock support 72a62a9e19SDr. David Alan Gilbert * 73a62a9e19SDr. David Alan Gilbert * 7.8: 74a62a9e19SDr. David Alan Gilbert * - add lock_owner and flags fields to fuse_release_in 75a62a9e19SDr. David Alan Gilbert * - add FUSE_BMAP message 76a62a9e19SDr. David Alan Gilbert * - add FUSE_DESTROY message 77a62a9e19SDr. David Alan Gilbert * 78a62a9e19SDr. David Alan Gilbert * 7.9: 79a62a9e19SDr. David Alan Gilbert * - new fuse_getattr_in input argument of GETATTR 80a62a9e19SDr. David Alan Gilbert * - add lk_flags in fuse_lk_in 81a62a9e19SDr. David Alan Gilbert * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in 82a62a9e19SDr. David Alan Gilbert * - add blksize field to fuse_attr 83a62a9e19SDr. David Alan Gilbert * - add file flags field to fuse_read_in and fuse_write_in 84a62a9e19SDr. David Alan Gilbert * - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in 85a62a9e19SDr. David Alan Gilbert * 86a62a9e19SDr. David Alan Gilbert * 7.10 87a62a9e19SDr. David Alan Gilbert * - add nonseekable open flag 88a62a9e19SDr. David Alan Gilbert * 89a62a9e19SDr. David Alan Gilbert * 7.11 90a62a9e19SDr. David Alan Gilbert * - add IOCTL message 91a62a9e19SDr. David Alan Gilbert * - add unsolicited notification support 92a62a9e19SDr. David Alan Gilbert * - add POLL message and NOTIFY_POLL notification 93a62a9e19SDr. David Alan Gilbert * 94a62a9e19SDr. David Alan Gilbert * 7.12 95a62a9e19SDr. David Alan Gilbert * - add umask flag to input argument of create, mknod and mkdir 96a62a9e19SDr. David Alan Gilbert * - add notification messages for invalidation of inodes and 97a62a9e19SDr. David Alan Gilbert * directory entries 98a62a9e19SDr. David Alan Gilbert * 99a62a9e19SDr. David Alan Gilbert * 7.13 100a62a9e19SDr. David Alan Gilbert * - make max number of background requests and congestion threshold 101a62a9e19SDr. David Alan Gilbert * tunables 102a62a9e19SDr. David Alan Gilbert * 103a62a9e19SDr. David Alan Gilbert * 7.14 104a62a9e19SDr. David Alan Gilbert * - add splice support to fuse device 105a62a9e19SDr. David Alan Gilbert * 106a62a9e19SDr. David Alan Gilbert * 7.15 107a62a9e19SDr. David Alan Gilbert * - add store notify 108a62a9e19SDr. David Alan Gilbert * - add retrieve notify 109a62a9e19SDr. David Alan Gilbert * 110a62a9e19SDr. David Alan Gilbert * 7.16 111a62a9e19SDr. David Alan Gilbert * - add BATCH_FORGET request 112a62a9e19SDr. David Alan Gilbert * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct 113a62a9e19SDr. David Alan Gilbert * fuse_ioctl_iovec' instead of ambiguous 'struct iovec' 114a62a9e19SDr. David Alan Gilbert * - add FUSE_IOCTL_32BIT flag 115a62a9e19SDr. David Alan Gilbert * 116a62a9e19SDr. David Alan Gilbert * 7.17 117a62a9e19SDr. David Alan Gilbert * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK 118a62a9e19SDr. David Alan Gilbert * 119a62a9e19SDr. David Alan Gilbert * 7.18 120a62a9e19SDr. David Alan Gilbert * - add FUSE_IOCTL_DIR flag 121a62a9e19SDr. David Alan Gilbert * - add FUSE_NOTIFY_DELETE 122a62a9e19SDr. David Alan Gilbert * 123a62a9e19SDr. David Alan Gilbert * 7.19 124a62a9e19SDr. David Alan Gilbert * - add FUSE_FALLOCATE 125a62a9e19SDr. David Alan Gilbert * 126a62a9e19SDr. David Alan Gilbert * 7.20 127a62a9e19SDr. David Alan Gilbert * - add FUSE_AUTO_INVAL_DATA 128a62a9e19SDr. David Alan Gilbert * 129a62a9e19SDr. David Alan Gilbert * 7.21 130a62a9e19SDr. David Alan Gilbert * - add FUSE_READDIRPLUS 131a62a9e19SDr. David Alan Gilbert * - send the requested events in POLL request 132a62a9e19SDr. David Alan Gilbert * 133a62a9e19SDr. David Alan Gilbert * 7.22 134a62a9e19SDr. David Alan Gilbert * - add FUSE_ASYNC_DIO 135a62a9e19SDr. David Alan Gilbert * 136a62a9e19SDr. David Alan Gilbert * 7.23 137a62a9e19SDr. David Alan Gilbert * - add FUSE_WRITEBACK_CACHE 138a62a9e19SDr. David Alan Gilbert * - add time_gran to fuse_init_out 139a62a9e19SDr. David Alan Gilbert * - add reserved space to fuse_init_out 140a62a9e19SDr. David Alan Gilbert * - add FATTR_CTIME 141a62a9e19SDr. David Alan Gilbert * - add ctime and ctimensec to fuse_setattr_in 142a62a9e19SDr. David Alan Gilbert * - add FUSE_RENAME2 request 143a62a9e19SDr. David Alan Gilbert * - add FUSE_NO_OPEN_SUPPORT flag 144a62a9e19SDr. David Alan Gilbert * 145a62a9e19SDr. David Alan Gilbert * 7.24 146a62a9e19SDr. David Alan Gilbert * - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support 147a62a9e19SDr. David Alan Gilbert * 148a62a9e19SDr. David Alan Gilbert * 7.25 149a62a9e19SDr. David Alan Gilbert * - add FUSE_PARALLEL_DIROPS 150a62a9e19SDr. David Alan Gilbert * 151a62a9e19SDr. David Alan Gilbert * 7.26 152a62a9e19SDr. David Alan Gilbert * - add FUSE_HANDLE_KILLPRIV 153a62a9e19SDr. David Alan Gilbert * - add FUSE_POSIX_ACL 154a62a9e19SDr. David Alan Gilbert * 155a62a9e19SDr. David Alan Gilbert * 7.27 156a62a9e19SDr. David Alan Gilbert * - add FUSE_ABORT_ERROR 157a62a9e19SDr. David Alan Gilbert * 158a62a9e19SDr. David Alan Gilbert * 7.28 159a62a9e19SDr. David Alan Gilbert * - add FUSE_COPY_FILE_RANGE 160a62a9e19SDr. David Alan Gilbert * - add FOPEN_CACHE_DIR 161a62a9e19SDr. David Alan Gilbert * - add FUSE_MAX_PAGES, add max_pages to init_out 162a62a9e19SDr. David Alan Gilbert * - add FUSE_CACHE_SYMLINKS 163a62a9e19SDr. David Alan Gilbert * 164a62a9e19SDr. David Alan Gilbert * 7.29 165a62a9e19SDr. David Alan Gilbert * - add FUSE_NO_OPENDIR_SUPPORT flag 166a62a9e19SDr. David Alan Gilbert * 167a62a9e19SDr. David Alan Gilbert * 7.30 168a62a9e19SDr. David Alan Gilbert * - add FUSE_EXPLICIT_INVAL_DATA 169a62a9e19SDr. David Alan Gilbert * - add FUSE_IOCTL_COMPAT_X32 170a62a9e19SDr. David Alan Gilbert * 171a62a9e19SDr. David Alan Gilbert * 7.31 172a62a9e19SDr. David Alan Gilbert * - add FUSE_WRITE_KILL_PRIV flag 173a62a9e19SDr. David Alan Gilbert * - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING 174a62a9e19SDr. David Alan Gilbert * - add map_alignment to fuse_init_out, add FUSE_MAP_ALIGNMENT flag 17553ba2eeeSMatthew Rosato * 17653ba2eeeSMatthew Rosato * 7.32 17753ba2eeeSMatthew Rosato * - add flags to fuse_attr, add FUSE_ATTR_SUBMOUNT, add FUSE_SUBMOUNTS 178b3c818a4SEric Farman * 179b3c818a4SEric Farman * 7.33 180b3c818a4SEric Farman * - add FUSE_HANDLE_KILLPRIV_V2, FUSE_WRITE_KILL_SUIDGID, FATTR_KILL_SUIDGID 181b3c818a4SEric Farman * - add FUSE_OPEN_KILL_SUIDGID 182278f064eSEduardo Habkost * - extend fuse_setxattr_in, add FUSE_SETXATTR_EXT 183278f064eSEduardo Habkost * - add FUSE_SETXATTR_ACL_KILL_SGID 18443709a0cSPaolo Bonzini * 18543709a0cSPaolo Bonzini * 7.34 18643709a0cSPaolo Bonzini * - add FUSE_SYNCFS 187ef17dd6aSVivek Goyal * 188ef17dd6aSVivek Goyal * 7.35 189ef17dd6aSVivek Goyal * - add FOPEN_NOFLUSH 190ef17dd6aSVivek Goyal * 191ef17dd6aSVivek Goyal * 7.36 192ef17dd6aSVivek Goyal * - extend fuse_init_in with reserved fields, add FUSE_INIT_EXT init flag 193ef17dd6aSVivek Goyal * - add flags2 to fuse_init_in and fuse_init_out 194ef17dd6aSVivek Goyal * - add FUSE_SECURITY_CTX init flag 195ef17dd6aSVivek Goyal * - add security context to create, mkdir, symlink, and mknod requests 196ef17dd6aSVivek Goyal * - add FUSE_HAS_INODE_DAX, FUSE_ATTR_DAX 19793e0932bSPeter Xu * 19893e0932bSPeter Xu * 7.37 19993e0932bSPeter Xu * - add FUSE_TMPFILE 20093d7620cSAvihai Horon * 20193d7620cSAvihai Horon * 7.38 20293d7620cSAvihai Horon * - add FUSE_EXPIRE_ONLY flag to fuse_notify_inval_entry 20393d7620cSAvihai Horon * - add FOPEN_PARALLEL_DIRECT_WRITES 204c5c0fdbeSDavid 'Digit' Turner * - add total_extlen to fuse_in_header 205c5c0fdbeSDavid 'Digit' Turner * - add FUSE_MAX_NR_SECCTX 206c5c0fdbeSDavid 'Digit' Turner * - add extension header 207c5c0fdbeSDavid 'Digit' Turner * - add FUSE_EXT_GROUPS 208c5c0fdbeSDavid 'Digit' Turner * - add FUSE_CREATE_SUPP_GROUP 209da3c22c7SThomas Huth * - add FUSE_HAS_EXPIRE_ONLY 210da3c22c7SThomas Huth * 211da3c22c7SThomas Huth * 7.39 2125817db68STianrui Zhao * - add FUSE_DIRECT_IO_ALLOW_MMAP 213da3c22c7SThomas Huth * - add FUSE_STATX and related structures 214ab0c7fb2SPaolo Bonzini * 215ab0c7fb2SPaolo Bonzini * 7.40 216ab0c7fb2SPaolo Bonzini * - add max_stack_depth to fuse_init_out, add FUSE_PASSTHROUGH init flag 217ab0c7fb2SPaolo Bonzini * - add backing_id to fuse_open_out, add FOPEN_PASSTHROUGH open flag 218ab0c7fb2SPaolo Bonzini * - add FUSE_NO_EXPORT_SUPPORT init flag 219ab0c7fb2SPaolo Bonzini * - add FUSE_NOTIFY_RESEND, add FUSE_HAS_RESEND init flag 220*0d2eeef7SBibo Mao * 221*0d2eeef7SBibo Mao * 7.41 222*0d2eeef7SBibo Mao * - add FUSE_ALLOW_IDMAP 223a62a9e19SDr. David Alan Gilbert */ 224a62a9e19SDr. David Alan Gilbert 225a62a9e19SDr. David Alan Gilbert #ifndef _LINUX_FUSE_H 226a62a9e19SDr. David Alan Gilbert #define _LINUX_FUSE_H 227a62a9e19SDr. David Alan Gilbert 228a62a9e19SDr. David Alan Gilbert #include <stdint.h> 229a62a9e19SDr. David Alan Gilbert 230a62a9e19SDr. David Alan Gilbert /* 231a62a9e19SDr. David Alan Gilbert * Version negotiation: 232a62a9e19SDr. David Alan Gilbert * 233a62a9e19SDr. David Alan Gilbert * Both the kernel and userspace send the version they support in the 234a62a9e19SDr. David Alan Gilbert * INIT request and reply respectively. 235a62a9e19SDr. David Alan Gilbert * 236a62a9e19SDr. David Alan Gilbert * If the major versions match then both shall use the smallest 237a62a9e19SDr. David Alan Gilbert * of the two minor versions for communication. 238a62a9e19SDr. David Alan Gilbert * 239a62a9e19SDr. David Alan Gilbert * If the kernel supports a larger major version, then userspace shall 240a62a9e19SDr. David Alan Gilbert * reply with the major version it supports, ignore the rest of the 241a62a9e19SDr. David Alan Gilbert * INIT message and expect a new INIT message from the kernel with a 242a62a9e19SDr. David Alan Gilbert * matching major version. 243a62a9e19SDr. David Alan Gilbert * 244a62a9e19SDr. David Alan Gilbert * If the library supports a larger major version, then it shall fall 245a62a9e19SDr. David Alan Gilbert * back to the major protocol version sent by the kernel for 246a62a9e19SDr. David Alan Gilbert * communication and reply with that major version (and an arbitrary 247a62a9e19SDr. David Alan Gilbert * supported minor version). 248a62a9e19SDr. David Alan Gilbert */ 249a62a9e19SDr. David Alan Gilbert 250a62a9e19SDr. David Alan Gilbert /** Version number of this interface */ 251a62a9e19SDr. David Alan Gilbert #define FUSE_KERNEL_VERSION 7 252a62a9e19SDr. David Alan Gilbert 253a62a9e19SDr. David Alan Gilbert /** Minor version number of this interface */ 254*0d2eeef7SBibo Mao #define FUSE_KERNEL_MINOR_VERSION 41 255a62a9e19SDr. David Alan Gilbert 256a62a9e19SDr. David Alan Gilbert /** The node ID of the root inode */ 257a62a9e19SDr. David Alan Gilbert #define FUSE_ROOT_ID 1 258a62a9e19SDr. David Alan Gilbert 259a62a9e19SDr. David Alan Gilbert /* Make sure all structures are padded to 64bit boundary, so 32bit 260a62a9e19SDr. David Alan Gilbert userspace works under 64bit kernels */ 261a62a9e19SDr. David Alan Gilbert 262a62a9e19SDr. David Alan Gilbert struct fuse_attr { 263a62a9e19SDr. David Alan Gilbert uint64_t ino; 264a62a9e19SDr. David Alan Gilbert uint64_t size; 265a62a9e19SDr. David Alan Gilbert uint64_t blocks; 266a62a9e19SDr. David Alan Gilbert uint64_t atime; 267a62a9e19SDr. David Alan Gilbert uint64_t mtime; 268a62a9e19SDr. David Alan Gilbert uint64_t ctime; 269a62a9e19SDr. David Alan Gilbert uint32_t atimensec; 270a62a9e19SDr. David Alan Gilbert uint32_t mtimensec; 271a62a9e19SDr. David Alan Gilbert uint32_t ctimensec; 272a62a9e19SDr. David Alan Gilbert uint32_t mode; 273a62a9e19SDr. David Alan Gilbert uint32_t nlink; 274a62a9e19SDr. David Alan Gilbert uint32_t uid; 275a62a9e19SDr. David Alan Gilbert uint32_t gid; 276a62a9e19SDr. David Alan Gilbert uint32_t rdev; 277a62a9e19SDr. David Alan Gilbert uint32_t blksize; 27853ba2eeeSMatthew Rosato uint32_t flags; 279a62a9e19SDr. David Alan Gilbert }; 280a62a9e19SDr. David Alan Gilbert 281da3c22c7SThomas Huth /* 282da3c22c7SThomas Huth * The following structures are bit-for-bit compatible with the statx(2) ABI in 283da3c22c7SThomas Huth * Linux. 284da3c22c7SThomas Huth */ 285da3c22c7SThomas Huth struct fuse_sx_time { 286da3c22c7SThomas Huth int64_t tv_sec; 287da3c22c7SThomas Huth uint32_t tv_nsec; 288da3c22c7SThomas Huth int32_t __reserved; 289da3c22c7SThomas Huth }; 290da3c22c7SThomas Huth 291da3c22c7SThomas Huth struct fuse_statx { 292da3c22c7SThomas Huth uint32_t mask; 293da3c22c7SThomas Huth uint32_t blksize; 294da3c22c7SThomas Huth uint64_t attributes; 295da3c22c7SThomas Huth uint32_t nlink; 296da3c22c7SThomas Huth uint32_t uid; 297da3c22c7SThomas Huth uint32_t gid; 298da3c22c7SThomas Huth uint16_t mode; 299da3c22c7SThomas Huth uint16_t __spare0[1]; 300da3c22c7SThomas Huth uint64_t ino; 301da3c22c7SThomas Huth uint64_t size; 302da3c22c7SThomas Huth uint64_t blocks; 303da3c22c7SThomas Huth uint64_t attributes_mask; 304da3c22c7SThomas Huth struct fuse_sx_time atime; 305da3c22c7SThomas Huth struct fuse_sx_time btime; 306da3c22c7SThomas Huth struct fuse_sx_time ctime; 307da3c22c7SThomas Huth struct fuse_sx_time mtime; 308da3c22c7SThomas Huth uint32_t rdev_major; 309da3c22c7SThomas Huth uint32_t rdev_minor; 310da3c22c7SThomas Huth uint32_t dev_major; 311da3c22c7SThomas Huth uint32_t dev_minor; 312da3c22c7SThomas Huth uint64_t __spare2[14]; 313da3c22c7SThomas Huth }; 314da3c22c7SThomas Huth 315a62a9e19SDr. David Alan Gilbert struct fuse_kstatfs { 316a62a9e19SDr. David Alan Gilbert uint64_t blocks; 317a62a9e19SDr. David Alan Gilbert uint64_t bfree; 318a62a9e19SDr. David Alan Gilbert uint64_t bavail; 319a62a9e19SDr. David Alan Gilbert uint64_t files; 320a62a9e19SDr. David Alan Gilbert uint64_t ffree; 321a62a9e19SDr. David Alan Gilbert uint32_t bsize; 322a62a9e19SDr. David Alan Gilbert uint32_t namelen; 323a62a9e19SDr. David Alan Gilbert uint32_t frsize; 324a62a9e19SDr. David Alan Gilbert uint32_t padding; 325a62a9e19SDr. David Alan Gilbert uint32_t spare[6]; 326a62a9e19SDr. David Alan Gilbert }; 327a62a9e19SDr. David Alan Gilbert 328a62a9e19SDr. David Alan Gilbert struct fuse_file_lock { 329a62a9e19SDr. David Alan Gilbert uint64_t start; 330a62a9e19SDr. David Alan Gilbert uint64_t end; 331a62a9e19SDr. David Alan Gilbert uint32_t type; 332a62a9e19SDr. David Alan Gilbert uint32_t pid; /* tgid */ 333a62a9e19SDr. David Alan Gilbert }; 334a62a9e19SDr. David Alan Gilbert 335a62a9e19SDr. David Alan Gilbert /** 336a62a9e19SDr. David Alan Gilbert * Bitmasks for fuse_setattr_in.valid 337a62a9e19SDr. David Alan Gilbert */ 338a62a9e19SDr. David Alan Gilbert #define FATTR_MODE (1 << 0) 339a62a9e19SDr. David Alan Gilbert #define FATTR_UID (1 << 1) 340a62a9e19SDr. David Alan Gilbert #define FATTR_GID (1 << 2) 341a62a9e19SDr. David Alan Gilbert #define FATTR_SIZE (1 << 3) 342a62a9e19SDr. David Alan Gilbert #define FATTR_ATIME (1 << 4) 343a62a9e19SDr. David Alan Gilbert #define FATTR_MTIME (1 << 5) 344a62a9e19SDr. David Alan Gilbert #define FATTR_FH (1 << 6) 345a62a9e19SDr. David Alan Gilbert #define FATTR_ATIME_NOW (1 << 7) 346a62a9e19SDr. David Alan Gilbert #define FATTR_MTIME_NOW (1 << 8) 347a62a9e19SDr. David Alan Gilbert #define FATTR_LOCKOWNER (1 << 9) 348a62a9e19SDr. David Alan Gilbert #define FATTR_CTIME (1 << 10) 349b3c818a4SEric Farman #define FATTR_KILL_SUIDGID (1 << 11) 350a62a9e19SDr. David Alan Gilbert 351a62a9e19SDr. David Alan Gilbert /** 352a62a9e19SDr. David Alan Gilbert * Flags returned by the OPEN request 353a62a9e19SDr. David Alan Gilbert * 354a62a9e19SDr. David Alan Gilbert * FOPEN_DIRECT_IO: bypass page cache for this open file 355a62a9e19SDr. David Alan Gilbert * FOPEN_KEEP_CACHE: don't invalidate the data cache on open 356a62a9e19SDr. David Alan Gilbert * FOPEN_NONSEEKABLE: the file is not seekable 357a62a9e19SDr. David Alan Gilbert * FOPEN_CACHE_DIR: allow caching this directory 358a62a9e19SDr. David Alan Gilbert * FOPEN_STREAM: the file is stream-like (no file position at all) 359ef17dd6aSVivek Goyal * FOPEN_NOFLUSH: don't flush data cache on close (unless FUSE_WRITEBACK_CACHE) 36093d7620cSAvihai Horon * FOPEN_PARALLEL_DIRECT_WRITES: Allow concurrent direct writes on the same inode 361ab0c7fb2SPaolo Bonzini * FOPEN_PASSTHROUGH: passthrough read/write io for this open file 362a62a9e19SDr. David Alan Gilbert */ 363a62a9e19SDr. David Alan Gilbert #define FOPEN_DIRECT_IO (1 << 0) 364a62a9e19SDr. David Alan Gilbert #define FOPEN_KEEP_CACHE (1 << 1) 365a62a9e19SDr. David Alan Gilbert #define FOPEN_NONSEEKABLE (1 << 2) 366a62a9e19SDr. David Alan Gilbert #define FOPEN_CACHE_DIR (1 << 3) 367a62a9e19SDr. David Alan Gilbert #define FOPEN_STREAM (1 << 4) 368ef17dd6aSVivek Goyal #define FOPEN_NOFLUSH (1 << 5) 36993d7620cSAvihai Horon #define FOPEN_PARALLEL_DIRECT_WRITES (1 << 6) 370ab0c7fb2SPaolo Bonzini #define FOPEN_PASSTHROUGH (1 << 7) 371a62a9e19SDr. David Alan Gilbert 372a62a9e19SDr. David Alan Gilbert /** 373a62a9e19SDr. David Alan Gilbert * INIT request/reply flags 374a62a9e19SDr. David Alan Gilbert * 375a62a9e19SDr. David Alan Gilbert * FUSE_ASYNC_READ: asynchronous read requests 376a62a9e19SDr. David Alan Gilbert * FUSE_POSIX_LOCKS: remote locking for POSIX file locks 377a62a9e19SDr. David Alan Gilbert * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported) 378a62a9e19SDr. David Alan Gilbert * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem 379a62a9e19SDr. David Alan Gilbert * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." 380a62a9e19SDr. David Alan Gilbert * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB 381a62a9e19SDr. David Alan Gilbert * FUSE_DONT_MASK: don't apply umask to file mode on create operations 382a62a9e19SDr. David Alan Gilbert * FUSE_SPLICE_WRITE: kernel supports splice write on the device 383a62a9e19SDr. David Alan Gilbert * FUSE_SPLICE_MOVE: kernel supports splice move on the device 384a62a9e19SDr. David Alan Gilbert * FUSE_SPLICE_READ: kernel supports splice read on the device 385a62a9e19SDr. David Alan Gilbert * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks 386a62a9e19SDr. David Alan Gilbert * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories 387a62a9e19SDr. David Alan Gilbert * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages 388a62a9e19SDr. David Alan Gilbert * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one) 389a62a9e19SDr. David Alan Gilbert * FUSE_READDIRPLUS_AUTO: adaptive readdirplus 390a62a9e19SDr. David Alan Gilbert * FUSE_ASYNC_DIO: asynchronous direct I/O submission 391a62a9e19SDr. David Alan Gilbert * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes 392a62a9e19SDr. David Alan Gilbert * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens 393a62a9e19SDr. David Alan Gilbert * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir 394a62a9e19SDr. David Alan Gilbert * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc 395a62a9e19SDr. David Alan Gilbert * FUSE_POSIX_ACL: filesystem supports posix acls 396a62a9e19SDr. David Alan Gilbert * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED 397a62a9e19SDr. David Alan Gilbert * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages 398a62a9e19SDr. David Alan Gilbert * FUSE_CACHE_SYMLINKS: cache READLINK responses 399a62a9e19SDr. David Alan Gilbert * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir 400a62a9e19SDr. David Alan Gilbert * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request 40153ba2eeeSMatthew Rosato * FUSE_MAP_ALIGNMENT: init_out.map_alignment contains log2(byte alignment) for 40253ba2eeeSMatthew Rosato * foffset and moffset fields in struct 40353ba2eeeSMatthew Rosato * fuse_setupmapping_out and fuse_removemapping_one. 40453ba2eeeSMatthew Rosato * FUSE_SUBMOUNTS: kernel supports auto-mounting directory submounts 405b3c818a4SEric Farman * FUSE_HANDLE_KILLPRIV_V2: fs kills suid/sgid/cap on write/chown/trunc. 406b3c818a4SEric Farman * Upon write/truncate suid/sgid is only killed if caller 407b3c818a4SEric Farman * does not have CAP_FSETID. Additionally upon 408b3c818a4SEric Farman * write/truncate sgid is killed only if file has group 409b3c818a4SEric Farman * execute permission. (Same as Linux VFS behavior). 410278f064eSEduardo Habkost * FUSE_SETXATTR_EXT: Server supports extended struct fuse_setxattr_in 411ef17dd6aSVivek Goyal * FUSE_INIT_EXT: extended fuse_init_in request 412ef17dd6aSVivek Goyal * FUSE_INIT_RESERVED: reserved, do not use 413ef17dd6aSVivek Goyal * FUSE_SECURITY_CTX: add security context to create, mkdir, symlink, and 414ef17dd6aSVivek Goyal * mknod 415ef17dd6aSVivek Goyal * FUSE_HAS_INODE_DAX: use per inode DAX 416c5c0fdbeSDavid 'Digit' Turner * FUSE_CREATE_SUPP_GROUP: add supplementary group info to create, mkdir, 417c5c0fdbeSDavid 'Digit' Turner * symlink and mknod (single group that matches parent) 418da3c22c7SThomas Huth * FUSE_HAS_EXPIRE_ONLY: kernel supports expiry-only entry invalidation 4195817db68STianrui Zhao * FUSE_DIRECT_IO_ALLOW_MMAP: allow shared mmap in FOPEN_DIRECT_IO mode. 420ab0c7fb2SPaolo Bonzini * FUSE_NO_EXPORT_SUPPORT: explicitly disable export support 421ab0c7fb2SPaolo Bonzini * FUSE_HAS_RESEND: kernel supports resending pending requests, and the high bit 422ab0c7fb2SPaolo Bonzini * of the request ID indicates resend requests 423*0d2eeef7SBibo Mao * FUSE_ALLOW_IDMAP: allow creation of idmapped mounts 424a62a9e19SDr. David Alan Gilbert */ 425a62a9e19SDr. David Alan Gilbert #define FUSE_ASYNC_READ (1 << 0) 426a62a9e19SDr. David Alan Gilbert #define FUSE_POSIX_LOCKS (1 << 1) 427a62a9e19SDr. David Alan Gilbert #define FUSE_FILE_OPS (1 << 2) 428a62a9e19SDr. David Alan Gilbert #define FUSE_ATOMIC_O_TRUNC (1 << 3) 429a62a9e19SDr. David Alan Gilbert #define FUSE_EXPORT_SUPPORT (1 << 4) 430a62a9e19SDr. David Alan Gilbert #define FUSE_BIG_WRITES (1 << 5) 431a62a9e19SDr. David Alan Gilbert #define FUSE_DONT_MASK (1 << 6) 432a62a9e19SDr. David Alan Gilbert #define FUSE_SPLICE_WRITE (1 << 7) 433a62a9e19SDr. David Alan Gilbert #define FUSE_SPLICE_MOVE (1 << 8) 434a62a9e19SDr. David Alan Gilbert #define FUSE_SPLICE_READ (1 << 9) 435a62a9e19SDr. David Alan Gilbert #define FUSE_FLOCK_LOCKS (1 << 10) 436a62a9e19SDr. David Alan Gilbert #define FUSE_HAS_IOCTL_DIR (1 << 11) 437a62a9e19SDr. David Alan Gilbert #define FUSE_AUTO_INVAL_DATA (1 << 12) 438a62a9e19SDr. David Alan Gilbert #define FUSE_DO_READDIRPLUS (1 << 13) 439a62a9e19SDr. David Alan Gilbert #define FUSE_READDIRPLUS_AUTO (1 << 14) 440a62a9e19SDr. David Alan Gilbert #define FUSE_ASYNC_DIO (1 << 15) 441a62a9e19SDr. David Alan Gilbert #define FUSE_WRITEBACK_CACHE (1 << 16) 442a62a9e19SDr. David Alan Gilbert #define FUSE_NO_OPEN_SUPPORT (1 << 17) 443a62a9e19SDr. David Alan Gilbert #define FUSE_PARALLEL_DIROPS (1 << 18) 444a62a9e19SDr. David Alan Gilbert #define FUSE_HANDLE_KILLPRIV (1 << 19) 445a62a9e19SDr. David Alan Gilbert #define FUSE_POSIX_ACL (1 << 20) 446a62a9e19SDr. David Alan Gilbert #define FUSE_ABORT_ERROR (1 << 21) 447a62a9e19SDr. David Alan Gilbert #define FUSE_MAX_PAGES (1 << 22) 448a62a9e19SDr. David Alan Gilbert #define FUSE_CACHE_SYMLINKS (1 << 23) 449a62a9e19SDr. David Alan Gilbert #define FUSE_NO_OPENDIR_SUPPORT (1 << 24) 450a62a9e19SDr. David Alan Gilbert #define FUSE_EXPLICIT_INVAL_DATA (1 << 25) 451a62a9e19SDr. David Alan Gilbert #define FUSE_MAP_ALIGNMENT (1 << 26) 45253ba2eeeSMatthew Rosato #define FUSE_SUBMOUNTS (1 << 27) 453b3c818a4SEric Farman #define FUSE_HANDLE_KILLPRIV_V2 (1 << 28) 454278f064eSEduardo Habkost #define FUSE_SETXATTR_EXT (1 << 29) 455ef17dd6aSVivek Goyal #define FUSE_INIT_EXT (1 << 30) 456ef17dd6aSVivek Goyal #define FUSE_INIT_RESERVED (1 << 31) 457ef17dd6aSVivek Goyal /* bits 32..63 get shifted down 32 bits into the flags2 field */ 458ef17dd6aSVivek Goyal #define FUSE_SECURITY_CTX (1ULL << 32) 459ef17dd6aSVivek Goyal #define FUSE_HAS_INODE_DAX (1ULL << 33) 460c5c0fdbeSDavid 'Digit' Turner #define FUSE_CREATE_SUPP_GROUP (1ULL << 34) 461da3c22c7SThomas Huth #define FUSE_HAS_EXPIRE_ONLY (1ULL << 35) 4625817db68STianrui Zhao #define FUSE_DIRECT_IO_ALLOW_MMAP (1ULL << 36) 463ab0c7fb2SPaolo Bonzini #define FUSE_PASSTHROUGH (1ULL << 37) 464ab0c7fb2SPaolo Bonzini #define FUSE_NO_EXPORT_SUPPORT (1ULL << 38) 465ab0c7fb2SPaolo Bonzini #define FUSE_HAS_RESEND (1ULL << 39) 4665817db68STianrui Zhao 4675817db68STianrui Zhao /* Obsolete alias for FUSE_DIRECT_IO_ALLOW_MMAP */ 4685817db68STianrui Zhao #define FUSE_DIRECT_IO_RELAX FUSE_DIRECT_IO_ALLOW_MMAP 469*0d2eeef7SBibo Mao #define FUSE_ALLOW_IDMAP (1ULL << 40) 470a62a9e19SDr. David Alan Gilbert 471a62a9e19SDr. David Alan Gilbert /** 472a62a9e19SDr. David Alan Gilbert * CUSE INIT request/reply flags 473a62a9e19SDr. David Alan Gilbert * 474a62a9e19SDr. David Alan Gilbert * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl 475a62a9e19SDr. David Alan Gilbert */ 476a62a9e19SDr. David Alan Gilbert #define CUSE_UNRESTRICTED_IOCTL (1 << 0) 477a62a9e19SDr. David Alan Gilbert 478a62a9e19SDr. David Alan Gilbert /** 479a62a9e19SDr. David Alan Gilbert * Release flags 480a62a9e19SDr. David Alan Gilbert */ 481a62a9e19SDr. David Alan Gilbert #define FUSE_RELEASE_FLUSH (1 << 0) 482a62a9e19SDr. David Alan Gilbert #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1) 483a62a9e19SDr. David Alan Gilbert 484a62a9e19SDr. David Alan Gilbert /** 485a62a9e19SDr. David Alan Gilbert * Getattr flags 486a62a9e19SDr. David Alan Gilbert */ 487a62a9e19SDr. David Alan Gilbert #define FUSE_GETATTR_FH (1 << 0) 488a62a9e19SDr. David Alan Gilbert 489a62a9e19SDr. David Alan Gilbert /** 490a62a9e19SDr. David Alan Gilbert * Lock flags 491a62a9e19SDr. David Alan Gilbert */ 492a62a9e19SDr. David Alan Gilbert #define FUSE_LK_FLOCK (1 << 0) 493a62a9e19SDr. David Alan Gilbert 494a62a9e19SDr. David Alan Gilbert /** 495a62a9e19SDr. David Alan Gilbert * WRITE flags 496a62a9e19SDr. David Alan Gilbert * 497a62a9e19SDr. David Alan Gilbert * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed 498a62a9e19SDr. David Alan Gilbert * FUSE_WRITE_LOCKOWNER: lock_owner field is valid 499b3c818a4SEric Farman * FUSE_WRITE_KILL_SUIDGID: kill suid and sgid bits 500a62a9e19SDr. David Alan Gilbert */ 501a62a9e19SDr. David Alan Gilbert #define FUSE_WRITE_CACHE (1 << 0) 502a62a9e19SDr. David Alan Gilbert #define FUSE_WRITE_LOCKOWNER (1 << 1) 503b3c818a4SEric Farman #define FUSE_WRITE_KILL_SUIDGID (1 << 2) 504b3c818a4SEric Farman 505b3c818a4SEric Farman /* Obsolete alias; this flag implies killing suid/sgid only. */ 506b3c818a4SEric Farman #define FUSE_WRITE_KILL_PRIV FUSE_WRITE_KILL_SUIDGID 507a62a9e19SDr. David Alan Gilbert 508a62a9e19SDr. David Alan Gilbert /** 509a62a9e19SDr. David Alan Gilbert * Read flags 510a62a9e19SDr. David Alan Gilbert */ 511a62a9e19SDr. David Alan Gilbert #define FUSE_READ_LOCKOWNER (1 << 1) 512a62a9e19SDr. David Alan Gilbert 513a62a9e19SDr. David Alan Gilbert /** 514a62a9e19SDr. David Alan Gilbert * Ioctl flags 515a62a9e19SDr. David Alan Gilbert * 516a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine 517a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed 518a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_RETRY: retry with new iovecs 519a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_32BIT: 32bit ioctl 520a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_DIR: is a directory 521a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_COMPAT_X32: x32 compat ioctl on 64bit machine (64bit time_t) 522a62a9e19SDr. David Alan Gilbert * 523a62a9e19SDr. David Alan Gilbert * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs 524a62a9e19SDr. David Alan Gilbert */ 525a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_COMPAT (1 << 0) 526a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_UNRESTRICTED (1 << 1) 527a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_RETRY (1 << 2) 528a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_32BIT (1 << 3) 529a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_DIR (1 << 4) 530a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_COMPAT_X32 (1 << 5) 531a62a9e19SDr. David Alan Gilbert 532a62a9e19SDr. David Alan Gilbert #define FUSE_IOCTL_MAX_IOV 256 533a62a9e19SDr. David Alan Gilbert 534a62a9e19SDr. David Alan Gilbert /** 535a62a9e19SDr. David Alan Gilbert * Poll flags 536a62a9e19SDr. David Alan Gilbert * 537a62a9e19SDr. David Alan Gilbert * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify 538a62a9e19SDr. David Alan Gilbert */ 539a62a9e19SDr. David Alan Gilbert #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) 540a62a9e19SDr. David Alan Gilbert 541a62a9e19SDr. David Alan Gilbert /** 542a62a9e19SDr. David Alan Gilbert * Fsync flags 543a62a9e19SDr. David Alan Gilbert * 544a62a9e19SDr. David Alan Gilbert * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata 545a62a9e19SDr. David Alan Gilbert */ 546a62a9e19SDr. David Alan Gilbert #define FUSE_FSYNC_FDATASYNC (1 << 0) 547a62a9e19SDr. David Alan Gilbert 54853ba2eeeSMatthew Rosato /** 54953ba2eeeSMatthew Rosato * fuse_attr flags 55053ba2eeeSMatthew Rosato * 55153ba2eeeSMatthew Rosato * FUSE_ATTR_SUBMOUNT: Object is a submount root 552ef17dd6aSVivek Goyal * FUSE_ATTR_DAX: Enable DAX for this file in per inode DAX mode 55353ba2eeeSMatthew Rosato */ 55453ba2eeeSMatthew Rosato #define FUSE_ATTR_SUBMOUNT (1 << 0) 555ef17dd6aSVivek Goyal #define FUSE_ATTR_DAX (1 << 1) 55653ba2eeeSMatthew Rosato 557b3c818a4SEric Farman /** 558b3c818a4SEric Farman * Open flags 559b3c818a4SEric Farman * FUSE_OPEN_KILL_SUIDGID: Kill suid and sgid if executable 560b3c818a4SEric Farman */ 561b3c818a4SEric Farman #define FUSE_OPEN_KILL_SUIDGID (1 << 0) 562b3c818a4SEric Farman 563278f064eSEduardo Habkost /** 564278f064eSEduardo Habkost * setxattr flags 565278f064eSEduardo Habkost * FUSE_SETXATTR_ACL_KILL_SGID: Clear SGID when system.posix_acl_access is set 566278f064eSEduardo Habkost */ 567278f064eSEduardo Habkost #define FUSE_SETXATTR_ACL_KILL_SGID (1 << 0) 568278f064eSEduardo Habkost 56993d7620cSAvihai Horon /** 57093d7620cSAvihai Horon * notify_inval_entry flags 57193d7620cSAvihai Horon * FUSE_EXPIRE_ONLY 57293d7620cSAvihai Horon */ 57393d7620cSAvihai Horon #define FUSE_EXPIRE_ONLY (1 << 0) 57493d7620cSAvihai Horon 575c5c0fdbeSDavid 'Digit' Turner /** 576c5c0fdbeSDavid 'Digit' Turner * extension type 577c5c0fdbeSDavid 'Digit' Turner * FUSE_MAX_NR_SECCTX: maximum value of &fuse_secctx_header.nr_secctx 578c5c0fdbeSDavid 'Digit' Turner * FUSE_EXT_GROUPS: &fuse_supp_groups extension 579c5c0fdbeSDavid 'Digit' Turner */ 580c5c0fdbeSDavid 'Digit' Turner enum fuse_ext_type { 581c5c0fdbeSDavid 'Digit' Turner /* Types 0..31 are reserved for fuse_secctx_header */ 582c5c0fdbeSDavid 'Digit' Turner FUSE_MAX_NR_SECCTX = 31, 583c5c0fdbeSDavid 'Digit' Turner FUSE_EXT_GROUPS = 32, 584c5c0fdbeSDavid 'Digit' Turner }; 585c5c0fdbeSDavid 'Digit' Turner 586a62a9e19SDr. David Alan Gilbert enum fuse_opcode { 587a62a9e19SDr. David Alan Gilbert FUSE_LOOKUP = 1, 588a62a9e19SDr. David Alan Gilbert FUSE_FORGET = 2, /* no reply */ 589a62a9e19SDr. David Alan Gilbert FUSE_GETATTR = 3, 590a62a9e19SDr. David Alan Gilbert FUSE_SETATTR = 4, 591a62a9e19SDr. David Alan Gilbert FUSE_READLINK = 5, 592a62a9e19SDr. David Alan Gilbert FUSE_SYMLINK = 6, 593a62a9e19SDr. David Alan Gilbert FUSE_MKNOD = 8, 594a62a9e19SDr. David Alan Gilbert FUSE_MKDIR = 9, 595a62a9e19SDr. David Alan Gilbert FUSE_UNLINK = 10, 596a62a9e19SDr. David Alan Gilbert FUSE_RMDIR = 11, 597a62a9e19SDr. David Alan Gilbert FUSE_RENAME = 12, 598a62a9e19SDr. David Alan Gilbert FUSE_LINK = 13, 599a62a9e19SDr. David Alan Gilbert FUSE_OPEN = 14, 600a62a9e19SDr. David Alan Gilbert FUSE_READ = 15, 601a62a9e19SDr. David Alan Gilbert FUSE_WRITE = 16, 602a62a9e19SDr. David Alan Gilbert FUSE_STATFS = 17, 603a62a9e19SDr. David Alan Gilbert FUSE_RELEASE = 18, 604a62a9e19SDr. David Alan Gilbert FUSE_FSYNC = 20, 605a62a9e19SDr. David Alan Gilbert FUSE_SETXATTR = 21, 606a62a9e19SDr. David Alan Gilbert FUSE_GETXATTR = 22, 607a62a9e19SDr. David Alan Gilbert FUSE_LISTXATTR = 23, 608a62a9e19SDr. David Alan Gilbert FUSE_REMOVEXATTR = 24, 609a62a9e19SDr. David Alan Gilbert FUSE_FLUSH = 25, 610a62a9e19SDr. David Alan Gilbert FUSE_INIT = 26, 611a62a9e19SDr. David Alan Gilbert FUSE_OPENDIR = 27, 612a62a9e19SDr. David Alan Gilbert FUSE_READDIR = 28, 613a62a9e19SDr. David Alan Gilbert FUSE_RELEASEDIR = 29, 614a62a9e19SDr. David Alan Gilbert FUSE_FSYNCDIR = 30, 615a62a9e19SDr. David Alan Gilbert FUSE_GETLK = 31, 616a62a9e19SDr. David Alan Gilbert FUSE_SETLK = 32, 617a62a9e19SDr. David Alan Gilbert FUSE_SETLKW = 33, 618a62a9e19SDr. David Alan Gilbert FUSE_ACCESS = 34, 619a62a9e19SDr. David Alan Gilbert FUSE_CREATE = 35, 620a62a9e19SDr. David Alan Gilbert FUSE_INTERRUPT = 36, 621a62a9e19SDr. David Alan Gilbert FUSE_BMAP = 37, 622a62a9e19SDr. David Alan Gilbert FUSE_DESTROY = 38, 623a62a9e19SDr. David Alan Gilbert FUSE_IOCTL = 39, 624a62a9e19SDr. David Alan Gilbert FUSE_POLL = 40, 625a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_REPLY = 41, 626a62a9e19SDr. David Alan Gilbert FUSE_BATCH_FORGET = 42, 627a62a9e19SDr. David Alan Gilbert FUSE_FALLOCATE = 43, 628a62a9e19SDr. David Alan Gilbert FUSE_READDIRPLUS = 44, 629a62a9e19SDr. David Alan Gilbert FUSE_RENAME2 = 45, 630a62a9e19SDr. David Alan Gilbert FUSE_LSEEK = 46, 631a62a9e19SDr. David Alan Gilbert FUSE_COPY_FILE_RANGE = 47, 632a62a9e19SDr. David Alan Gilbert FUSE_SETUPMAPPING = 48, 633a62a9e19SDr. David Alan Gilbert FUSE_REMOVEMAPPING = 49, 63443709a0cSPaolo Bonzini FUSE_SYNCFS = 50, 63593e0932bSPeter Xu FUSE_TMPFILE = 51, 636da3c22c7SThomas Huth FUSE_STATX = 52, 637a62a9e19SDr. David Alan Gilbert 638a62a9e19SDr. David Alan Gilbert /* CUSE specific operations */ 639a62a9e19SDr. David Alan Gilbert CUSE_INIT = 4096, 640a62a9e19SDr. David Alan Gilbert 641a62a9e19SDr. David Alan Gilbert /* Reserved opcodes: helpful to detect structure endian-ness */ 642a62a9e19SDr. David Alan Gilbert CUSE_INIT_BSWAP_RESERVED = 1048576, /* CUSE_INIT << 8 */ 643a62a9e19SDr. David Alan Gilbert FUSE_INIT_BSWAP_RESERVED = 436207616, /* FUSE_INIT << 24 */ 644a62a9e19SDr. David Alan Gilbert }; 645a62a9e19SDr. David Alan Gilbert 646a62a9e19SDr. David Alan Gilbert enum fuse_notify_code { 647a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_POLL = 1, 648a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_INVAL_INODE = 2, 649a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_INVAL_ENTRY = 3, 650a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_STORE = 4, 651a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_RETRIEVE = 5, 652a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_DELETE = 6, 653ab0c7fb2SPaolo Bonzini FUSE_NOTIFY_RESEND = 7, 654a62a9e19SDr. David Alan Gilbert FUSE_NOTIFY_CODE_MAX, 655a62a9e19SDr. David Alan Gilbert }; 656a62a9e19SDr. David Alan Gilbert 657a62a9e19SDr. David Alan Gilbert /* The read buffer is required to be at least 8k, but may be much larger */ 658a62a9e19SDr. David Alan Gilbert #define FUSE_MIN_READ_BUFFER 8192 659a62a9e19SDr. David Alan Gilbert 660a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_ENTRY_OUT_SIZE 120 661a62a9e19SDr. David Alan Gilbert 662a62a9e19SDr. David Alan Gilbert struct fuse_entry_out { 663a62a9e19SDr. David Alan Gilbert uint64_t nodeid; /* Inode ID */ 664a62a9e19SDr. David Alan Gilbert uint64_t generation; /* Inode generation: nodeid:gen must 665a62a9e19SDr. David Alan Gilbert be unique for the fs's lifetime */ 666a62a9e19SDr. David Alan Gilbert uint64_t entry_valid; /* Cache timeout for the name */ 667a62a9e19SDr. David Alan Gilbert uint64_t attr_valid; /* Cache timeout for the attributes */ 668a62a9e19SDr. David Alan Gilbert uint32_t entry_valid_nsec; 669a62a9e19SDr. David Alan Gilbert uint32_t attr_valid_nsec; 670a62a9e19SDr. David Alan Gilbert struct fuse_attr attr; 671a62a9e19SDr. David Alan Gilbert }; 672a62a9e19SDr. David Alan Gilbert 673a62a9e19SDr. David Alan Gilbert struct fuse_forget_in { 674a62a9e19SDr. David Alan Gilbert uint64_t nlookup; 675a62a9e19SDr. David Alan Gilbert }; 676a62a9e19SDr. David Alan Gilbert 677a62a9e19SDr. David Alan Gilbert struct fuse_forget_one { 678a62a9e19SDr. David Alan Gilbert uint64_t nodeid; 679a62a9e19SDr. David Alan Gilbert uint64_t nlookup; 680a62a9e19SDr. David Alan Gilbert }; 681a62a9e19SDr. David Alan Gilbert 682a62a9e19SDr. David Alan Gilbert struct fuse_batch_forget_in { 683a62a9e19SDr. David Alan Gilbert uint32_t count; 684a62a9e19SDr. David Alan Gilbert uint32_t dummy; 685a62a9e19SDr. David Alan Gilbert }; 686a62a9e19SDr. David Alan Gilbert 687a62a9e19SDr. David Alan Gilbert struct fuse_getattr_in { 688a62a9e19SDr. David Alan Gilbert uint32_t getattr_flags; 689a62a9e19SDr. David Alan Gilbert uint32_t dummy; 690a62a9e19SDr. David Alan Gilbert uint64_t fh; 691a62a9e19SDr. David Alan Gilbert }; 692a62a9e19SDr. David Alan Gilbert 693a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_ATTR_OUT_SIZE 96 694a62a9e19SDr. David Alan Gilbert 695a62a9e19SDr. David Alan Gilbert struct fuse_attr_out { 696a62a9e19SDr. David Alan Gilbert uint64_t attr_valid; /* Cache timeout for the attributes */ 697a62a9e19SDr. David Alan Gilbert uint32_t attr_valid_nsec; 698a62a9e19SDr. David Alan Gilbert uint32_t dummy; 699a62a9e19SDr. David Alan Gilbert struct fuse_attr attr; 700a62a9e19SDr. David Alan Gilbert }; 701a62a9e19SDr. David Alan Gilbert 702da3c22c7SThomas Huth struct fuse_statx_in { 703da3c22c7SThomas Huth uint32_t getattr_flags; 704da3c22c7SThomas Huth uint32_t reserved; 705da3c22c7SThomas Huth uint64_t fh; 706da3c22c7SThomas Huth uint32_t sx_flags; 707da3c22c7SThomas Huth uint32_t sx_mask; 708da3c22c7SThomas Huth }; 709da3c22c7SThomas Huth 710da3c22c7SThomas Huth struct fuse_statx_out { 711da3c22c7SThomas Huth uint64_t attr_valid; /* Cache timeout for the attributes */ 712da3c22c7SThomas Huth uint32_t attr_valid_nsec; 713da3c22c7SThomas Huth uint32_t flags; 714da3c22c7SThomas Huth uint64_t spare[2]; 715da3c22c7SThomas Huth struct fuse_statx stat; 716da3c22c7SThomas Huth }; 717da3c22c7SThomas Huth 718a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_MKNOD_IN_SIZE 8 719a62a9e19SDr. David Alan Gilbert 720a62a9e19SDr. David Alan Gilbert struct fuse_mknod_in { 721a62a9e19SDr. David Alan Gilbert uint32_t mode; 722a62a9e19SDr. David Alan Gilbert uint32_t rdev; 723a62a9e19SDr. David Alan Gilbert uint32_t umask; 724a62a9e19SDr. David Alan Gilbert uint32_t padding; 725a62a9e19SDr. David Alan Gilbert }; 726a62a9e19SDr. David Alan Gilbert 727a62a9e19SDr. David Alan Gilbert struct fuse_mkdir_in { 728a62a9e19SDr. David Alan Gilbert uint32_t mode; 729a62a9e19SDr. David Alan Gilbert uint32_t umask; 730a62a9e19SDr. David Alan Gilbert }; 731a62a9e19SDr. David Alan Gilbert 732a62a9e19SDr. David Alan Gilbert struct fuse_rename_in { 733a62a9e19SDr. David Alan Gilbert uint64_t newdir; 734a62a9e19SDr. David Alan Gilbert }; 735a62a9e19SDr. David Alan Gilbert 736a62a9e19SDr. David Alan Gilbert struct fuse_rename2_in { 737a62a9e19SDr. David Alan Gilbert uint64_t newdir; 738a62a9e19SDr. David Alan Gilbert uint32_t flags; 739a62a9e19SDr. David Alan Gilbert uint32_t padding; 740a62a9e19SDr. David Alan Gilbert }; 741a62a9e19SDr. David Alan Gilbert 742a62a9e19SDr. David Alan Gilbert struct fuse_link_in { 743a62a9e19SDr. David Alan Gilbert uint64_t oldnodeid; 744a62a9e19SDr. David Alan Gilbert }; 745a62a9e19SDr. David Alan Gilbert 746a62a9e19SDr. David Alan Gilbert struct fuse_setattr_in { 747a62a9e19SDr. David Alan Gilbert uint32_t valid; 748a62a9e19SDr. David Alan Gilbert uint32_t padding; 749a62a9e19SDr. David Alan Gilbert uint64_t fh; 750a62a9e19SDr. David Alan Gilbert uint64_t size; 751a62a9e19SDr. David Alan Gilbert uint64_t lock_owner; 752a62a9e19SDr. David Alan Gilbert uint64_t atime; 753a62a9e19SDr. David Alan Gilbert uint64_t mtime; 754a62a9e19SDr. David Alan Gilbert uint64_t ctime; 755a62a9e19SDr. David Alan Gilbert uint32_t atimensec; 756a62a9e19SDr. David Alan Gilbert uint32_t mtimensec; 757a62a9e19SDr. David Alan Gilbert uint32_t ctimensec; 758a62a9e19SDr. David Alan Gilbert uint32_t mode; 759a62a9e19SDr. David Alan Gilbert uint32_t unused4; 760a62a9e19SDr. David Alan Gilbert uint32_t uid; 761a62a9e19SDr. David Alan Gilbert uint32_t gid; 762a62a9e19SDr. David Alan Gilbert uint32_t unused5; 763a62a9e19SDr. David Alan Gilbert }; 764a62a9e19SDr. David Alan Gilbert 765a62a9e19SDr. David Alan Gilbert struct fuse_open_in { 766a62a9e19SDr. David Alan Gilbert uint32_t flags; 767b3c818a4SEric Farman uint32_t open_flags; /* FUSE_OPEN_... */ 768a62a9e19SDr. David Alan Gilbert }; 769a62a9e19SDr. David Alan Gilbert 770a62a9e19SDr. David Alan Gilbert struct fuse_create_in { 771a62a9e19SDr. David Alan Gilbert uint32_t flags; 772a62a9e19SDr. David Alan Gilbert uint32_t mode; 773a62a9e19SDr. David Alan Gilbert uint32_t umask; 774b3c818a4SEric Farman uint32_t open_flags; /* FUSE_OPEN_... */ 775a62a9e19SDr. David Alan Gilbert }; 776a62a9e19SDr. David Alan Gilbert 777a62a9e19SDr. David Alan Gilbert struct fuse_open_out { 778a62a9e19SDr. David Alan Gilbert uint64_t fh; 779a62a9e19SDr. David Alan Gilbert uint32_t open_flags; 780ab0c7fb2SPaolo Bonzini int32_t backing_id; 781a62a9e19SDr. David Alan Gilbert }; 782a62a9e19SDr. David Alan Gilbert 783a62a9e19SDr. David Alan Gilbert struct fuse_release_in { 784a62a9e19SDr. David Alan Gilbert uint64_t fh; 785a62a9e19SDr. David Alan Gilbert uint32_t flags; 786a62a9e19SDr. David Alan Gilbert uint32_t release_flags; 787a62a9e19SDr. David Alan Gilbert uint64_t lock_owner; 788a62a9e19SDr. David Alan Gilbert }; 789a62a9e19SDr. David Alan Gilbert 790a62a9e19SDr. David Alan Gilbert struct fuse_flush_in { 791a62a9e19SDr. David Alan Gilbert uint64_t fh; 792a62a9e19SDr. David Alan Gilbert uint32_t unused; 793a62a9e19SDr. David Alan Gilbert uint32_t padding; 794a62a9e19SDr. David Alan Gilbert uint64_t lock_owner; 795a62a9e19SDr. David Alan Gilbert }; 796a62a9e19SDr. David Alan Gilbert 797a62a9e19SDr. David Alan Gilbert struct fuse_read_in { 798a62a9e19SDr. David Alan Gilbert uint64_t fh; 799a62a9e19SDr. David Alan Gilbert uint64_t offset; 800a62a9e19SDr. David Alan Gilbert uint32_t size; 801a62a9e19SDr. David Alan Gilbert uint32_t read_flags; 802a62a9e19SDr. David Alan Gilbert uint64_t lock_owner; 803a62a9e19SDr. David Alan Gilbert uint32_t flags; 804a62a9e19SDr. David Alan Gilbert uint32_t padding; 805a62a9e19SDr. David Alan Gilbert }; 806a62a9e19SDr. David Alan Gilbert 807a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_WRITE_IN_SIZE 24 808a62a9e19SDr. David Alan Gilbert 809a62a9e19SDr. David Alan Gilbert struct fuse_write_in { 810a62a9e19SDr. David Alan Gilbert uint64_t fh; 811a62a9e19SDr. David Alan Gilbert uint64_t offset; 812a62a9e19SDr. David Alan Gilbert uint32_t size; 813a62a9e19SDr. David Alan Gilbert uint32_t write_flags; 814a62a9e19SDr. David Alan Gilbert uint64_t lock_owner; 815a62a9e19SDr. David Alan Gilbert uint32_t flags; 816a62a9e19SDr. David Alan Gilbert uint32_t padding; 817a62a9e19SDr. David Alan Gilbert }; 818a62a9e19SDr. David Alan Gilbert 819a62a9e19SDr. David Alan Gilbert struct fuse_write_out { 820a62a9e19SDr. David Alan Gilbert uint32_t size; 821a62a9e19SDr. David Alan Gilbert uint32_t padding; 822a62a9e19SDr. David Alan Gilbert }; 823a62a9e19SDr. David Alan Gilbert 824a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_STATFS_SIZE 48 825a62a9e19SDr. David Alan Gilbert 826a62a9e19SDr. David Alan Gilbert struct fuse_statfs_out { 827a62a9e19SDr. David Alan Gilbert struct fuse_kstatfs st; 828a62a9e19SDr. David Alan Gilbert }; 829a62a9e19SDr. David Alan Gilbert 830a62a9e19SDr. David Alan Gilbert struct fuse_fsync_in { 831a62a9e19SDr. David Alan Gilbert uint64_t fh; 832a62a9e19SDr. David Alan Gilbert uint32_t fsync_flags; 833a62a9e19SDr. David Alan Gilbert uint32_t padding; 834a62a9e19SDr. David Alan Gilbert }; 835a62a9e19SDr. David Alan Gilbert 836278f064eSEduardo Habkost #define FUSE_COMPAT_SETXATTR_IN_SIZE 8 837278f064eSEduardo Habkost 838a62a9e19SDr. David Alan Gilbert struct fuse_setxattr_in { 839a62a9e19SDr. David Alan Gilbert uint32_t size; 840a62a9e19SDr. David Alan Gilbert uint32_t flags; 841278f064eSEduardo Habkost uint32_t setxattr_flags; 842278f064eSEduardo Habkost uint32_t padding; 843a62a9e19SDr. David Alan Gilbert }; 844a62a9e19SDr. David Alan Gilbert 845a62a9e19SDr. David Alan Gilbert struct fuse_getxattr_in { 846a62a9e19SDr. David Alan Gilbert uint32_t size; 847a62a9e19SDr. David Alan Gilbert uint32_t padding; 848a62a9e19SDr. David Alan Gilbert }; 849a62a9e19SDr. David Alan Gilbert 850a62a9e19SDr. David Alan Gilbert struct fuse_getxattr_out { 851a62a9e19SDr. David Alan Gilbert uint32_t size; 852a62a9e19SDr. David Alan Gilbert uint32_t padding; 853a62a9e19SDr. David Alan Gilbert }; 854a62a9e19SDr. David Alan Gilbert 855a62a9e19SDr. David Alan Gilbert struct fuse_lk_in { 856a62a9e19SDr. David Alan Gilbert uint64_t fh; 857a62a9e19SDr. David Alan Gilbert uint64_t owner; 858a62a9e19SDr. David Alan Gilbert struct fuse_file_lock lk; 859a62a9e19SDr. David Alan Gilbert uint32_t lk_flags; 860a62a9e19SDr. David Alan Gilbert uint32_t padding; 861a62a9e19SDr. David Alan Gilbert }; 862a62a9e19SDr. David Alan Gilbert 863a62a9e19SDr. David Alan Gilbert struct fuse_lk_out { 864a62a9e19SDr. David Alan Gilbert struct fuse_file_lock lk; 865a62a9e19SDr. David Alan Gilbert }; 866a62a9e19SDr. David Alan Gilbert 867a62a9e19SDr. David Alan Gilbert struct fuse_access_in { 868a62a9e19SDr. David Alan Gilbert uint32_t mask; 869a62a9e19SDr. David Alan Gilbert uint32_t padding; 870a62a9e19SDr. David Alan Gilbert }; 871a62a9e19SDr. David Alan Gilbert 872a62a9e19SDr. David Alan Gilbert struct fuse_init_in { 873a62a9e19SDr. David Alan Gilbert uint32_t major; 874a62a9e19SDr. David Alan Gilbert uint32_t minor; 875a62a9e19SDr. David Alan Gilbert uint32_t max_readahead; 876a62a9e19SDr. David Alan Gilbert uint32_t flags; 877ef17dd6aSVivek Goyal uint32_t flags2; 878ef17dd6aSVivek Goyal uint32_t unused[11]; 879a62a9e19SDr. David Alan Gilbert }; 880a62a9e19SDr. David Alan Gilbert 881a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_INIT_OUT_SIZE 8 882a62a9e19SDr. David Alan Gilbert #define FUSE_COMPAT_22_INIT_OUT_SIZE 24 883a62a9e19SDr. David Alan Gilbert 884a62a9e19SDr. David Alan Gilbert struct fuse_init_out { 885a62a9e19SDr. David Alan Gilbert uint32_t major; 886a62a9e19SDr. David Alan Gilbert uint32_t minor; 887a62a9e19SDr. David Alan Gilbert uint32_t max_readahead; 888a62a9e19SDr. David Alan Gilbert uint32_t flags; 889a62a9e19SDr. David Alan Gilbert uint16_t max_background; 890a62a9e19SDr. David Alan Gilbert uint16_t congestion_threshold; 891a62a9e19SDr. David Alan Gilbert uint32_t max_write; 892a62a9e19SDr. David Alan Gilbert uint32_t time_gran; 893a62a9e19SDr. David Alan Gilbert uint16_t max_pages; 894a62a9e19SDr. David Alan Gilbert uint16_t map_alignment; 895ef17dd6aSVivek Goyal uint32_t flags2; 896ab0c7fb2SPaolo Bonzini uint32_t max_stack_depth; 897ab0c7fb2SPaolo Bonzini uint32_t unused[6]; 898a62a9e19SDr. David Alan Gilbert }; 899a62a9e19SDr. David Alan Gilbert 900a62a9e19SDr. David Alan Gilbert #define CUSE_INIT_INFO_MAX 4096 901a62a9e19SDr. David Alan Gilbert 902a62a9e19SDr. David Alan Gilbert struct cuse_init_in { 903a62a9e19SDr. David Alan Gilbert uint32_t major; 904a62a9e19SDr. David Alan Gilbert uint32_t minor; 905a62a9e19SDr. David Alan Gilbert uint32_t unused; 906a62a9e19SDr. David Alan Gilbert uint32_t flags; 907a62a9e19SDr. David Alan Gilbert }; 908a62a9e19SDr. David Alan Gilbert 909a62a9e19SDr. David Alan Gilbert struct cuse_init_out { 910a62a9e19SDr. David Alan Gilbert uint32_t major; 911a62a9e19SDr. David Alan Gilbert uint32_t minor; 912a62a9e19SDr. David Alan Gilbert uint32_t unused; 913a62a9e19SDr. David Alan Gilbert uint32_t flags; 914a62a9e19SDr. David Alan Gilbert uint32_t max_read; 915a62a9e19SDr. David Alan Gilbert uint32_t max_write; 916a62a9e19SDr. David Alan Gilbert uint32_t dev_major; /* chardev major */ 917a62a9e19SDr. David Alan Gilbert uint32_t dev_minor; /* chardev minor */ 918a62a9e19SDr. David Alan Gilbert uint32_t spare[10]; 919a62a9e19SDr. David Alan Gilbert }; 920a62a9e19SDr. David Alan Gilbert 921a62a9e19SDr. David Alan Gilbert struct fuse_interrupt_in { 922a62a9e19SDr. David Alan Gilbert uint64_t unique; 923a62a9e19SDr. David Alan Gilbert }; 924a62a9e19SDr. David Alan Gilbert 925a62a9e19SDr. David Alan Gilbert struct fuse_bmap_in { 926a62a9e19SDr. David Alan Gilbert uint64_t block; 927a62a9e19SDr. David Alan Gilbert uint32_t blocksize; 928a62a9e19SDr. David Alan Gilbert uint32_t padding; 929a62a9e19SDr. David Alan Gilbert }; 930a62a9e19SDr. David Alan Gilbert 931a62a9e19SDr. David Alan Gilbert struct fuse_bmap_out { 932a62a9e19SDr. David Alan Gilbert uint64_t block; 933a62a9e19SDr. David Alan Gilbert }; 934a62a9e19SDr. David Alan Gilbert 935a62a9e19SDr. David Alan Gilbert struct fuse_ioctl_in { 936a62a9e19SDr. David Alan Gilbert uint64_t fh; 937a62a9e19SDr. David Alan Gilbert uint32_t flags; 938a62a9e19SDr. David Alan Gilbert uint32_t cmd; 939a62a9e19SDr. David Alan Gilbert uint64_t arg; 940a62a9e19SDr. David Alan Gilbert uint32_t in_size; 941a62a9e19SDr. David Alan Gilbert uint32_t out_size; 942a62a9e19SDr. David Alan Gilbert }; 943a62a9e19SDr. David Alan Gilbert 944a62a9e19SDr. David Alan Gilbert struct fuse_ioctl_iovec { 945a62a9e19SDr. David Alan Gilbert uint64_t base; 946a62a9e19SDr. David Alan Gilbert uint64_t len; 947a62a9e19SDr. David Alan Gilbert }; 948a62a9e19SDr. David Alan Gilbert 949a62a9e19SDr. David Alan Gilbert struct fuse_ioctl_out { 950a62a9e19SDr. David Alan Gilbert int32_t result; 951a62a9e19SDr. David Alan Gilbert uint32_t flags; 952a62a9e19SDr. David Alan Gilbert uint32_t in_iovs; 953a62a9e19SDr. David Alan Gilbert uint32_t out_iovs; 954a62a9e19SDr. David Alan Gilbert }; 955a62a9e19SDr. David Alan Gilbert 956a62a9e19SDr. David Alan Gilbert struct fuse_poll_in { 957a62a9e19SDr. David Alan Gilbert uint64_t fh; 958a62a9e19SDr. David Alan Gilbert uint64_t kh; 959a62a9e19SDr. David Alan Gilbert uint32_t flags; 960a62a9e19SDr. David Alan Gilbert uint32_t events; 961a62a9e19SDr. David Alan Gilbert }; 962a62a9e19SDr. David Alan Gilbert 963a62a9e19SDr. David Alan Gilbert struct fuse_poll_out { 964a62a9e19SDr. David Alan Gilbert uint32_t revents; 965a62a9e19SDr. David Alan Gilbert uint32_t padding; 966a62a9e19SDr. David Alan Gilbert }; 967a62a9e19SDr. David Alan Gilbert 968a62a9e19SDr. David Alan Gilbert struct fuse_notify_poll_wakeup_out { 969a62a9e19SDr. David Alan Gilbert uint64_t kh; 970a62a9e19SDr. David Alan Gilbert }; 971a62a9e19SDr. David Alan Gilbert 972a62a9e19SDr. David Alan Gilbert struct fuse_fallocate_in { 973a62a9e19SDr. David Alan Gilbert uint64_t fh; 974a62a9e19SDr. David Alan Gilbert uint64_t offset; 975a62a9e19SDr. David Alan Gilbert uint64_t length; 976a62a9e19SDr. David Alan Gilbert uint32_t mode; 977a62a9e19SDr. David Alan Gilbert uint32_t padding; 978a62a9e19SDr. David Alan Gilbert }; 979a62a9e19SDr. David Alan Gilbert 980ab0c7fb2SPaolo Bonzini /** 981ab0c7fb2SPaolo Bonzini * FUSE request unique ID flag 982ab0c7fb2SPaolo Bonzini * 983ab0c7fb2SPaolo Bonzini * Indicates whether this is a resend request. The receiver should handle this 984ab0c7fb2SPaolo Bonzini * request accordingly. 985ab0c7fb2SPaolo Bonzini */ 986ab0c7fb2SPaolo Bonzini #define FUSE_UNIQUE_RESEND (1ULL << 63) 987ab0c7fb2SPaolo Bonzini 988*0d2eeef7SBibo Mao /** 989*0d2eeef7SBibo Mao * This value will be set by the kernel to 990*0d2eeef7SBibo Mao * (struct fuse_in_header).{uid,gid} fields in 991*0d2eeef7SBibo Mao * case when: 992*0d2eeef7SBibo Mao * - fuse daemon enabled FUSE_ALLOW_IDMAP 993*0d2eeef7SBibo Mao * - idmapping information is not available and uid/gid 994*0d2eeef7SBibo Mao * can not be mapped in accordance with an idmapping. 995*0d2eeef7SBibo Mao * 996*0d2eeef7SBibo Mao * Note: an idmapping information always available 997*0d2eeef7SBibo Mao * for inode creation operations like: 998*0d2eeef7SBibo Mao * FUSE_MKNOD, FUSE_SYMLINK, FUSE_MKDIR, FUSE_TMPFILE, 999*0d2eeef7SBibo Mao * FUSE_CREATE and FUSE_RENAME2 (with RENAME_WHITEOUT). 1000*0d2eeef7SBibo Mao */ 1001*0d2eeef7SBibo Mao #define FUSE_INVALID_UIDGID ((uint32_t)(-1)) 1002*0d2eeef7SBibo Mao 1003a62a9e19SDr. David Alan Gilbert struct fuse_in_header { 1004a62a9e19SDr. David Alan Gilbert uint32_t len; 1005a62a9e19SDr. David Alan Gilbert uint32_t opcode; 1006a62a9e19SDr. David Alan Gilbert uint64_t unique; 1007a62a9e19SDr. David Alan Gilbert uint64_t nodeid; 1008a62a9e19SDr. David Alan Gilbert uint32_t uid; 1009a62a9e19SDr. David Alan Gilbert uint32_t gid; 1010a62a9e19SDr. David Alan Gilbert uint32_t pid; 1011c5c0fdbeSDavid 'Digit' Turner uint16_t total_extlen; /* length of extensions in 8byte units */ 1012c5c0fdbeSDavid 'Digit' Turner uint16_t padding; 1013a62a9e19SDr. David Alan Gilbert }; 1014a62a9e19SDr. David Alan Gilbert 1015a62a9e19SDr. David Alan Gilbert struct fuse_out_header { 1016a62a9e19SDr. David Alan Gilbert uint32_t len; 1017a62a9e19SDr. David Alan Gilbert int32_t error; 1018a62a9e19SDr. David Alan Gilbert uint64_t unique; 1019a62a9e19SDr. David Alan Gilbert }; 1020a62a9e19SDr. David Alan Gilbert 1021a62a9e19SDr. David Alan Gilbert struct fuse_dirent { 1022a62a9e19SDr. David Alan Gilbert uint64_t ino; 1023a62a9e19SDr. David Alan Gilbert uint64_t off; 1024a62a9e19SDr. David Alan Gilbert uint32_t namelen; 1025a62a9e19SDr. David Alan Gilbert uint32_t type; 1026a62a9e19SDr. David Alan Gilbert char name[]; 1027a62a9e19SDr. David Alan Gilbert }; 1028a62a9e19SDr. David Alan Gilbert 1029ef17dd6aSVivek Goyal /* Align variable length records to 64bit boundary */ 1030ef17dd6aSVivek Goyal #define FUSE_REC_ALIGN(x) \ 1031a62a9e19SDr. David Alan Gilbert (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1)) 1032ef17dd6aSVivek Goyal 1033ef17dd6aSVivek Goyal #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) 1034ef17dd6aSVivek Goyal #define FUSE_DIRENT_ALIGN(x) FUSE_REC_ALIGN(x) 1035a62a9e19SDr. David Alan Gilbert #define FUSE_DIRENT_SIZE(d) \ 1036a62a9e19SDr. David Alan Gilbert FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) 1037a62a9e19SDr. David Alan Gilbert 1038a62a9e19SDr. David Alan Gilbert struct fuse_direntplus { 1039a62a9e19SDr. David Alan Gilbert struct fuse_entry_out entry_out; 1040a62a9e19SDr. David Alan Gilbert struct fuse_dirent dirent; 1041a62a9e19SDr. David Alan Gilbert }; 1042a62a9e19SDr. David Alan Gilbert 1043a62a9e19SDr. David Alan Gilbert #define FUSE_NAME_OFFSET_DIRENTPLUS \ 1044a62a9e19SDr. David Alan Gilbert offsetof(struct fuse_direntplus, dirent.name) 1045a62a9e19SDr. David Alan Gilbert #define FUSE_DIRENTPLUS_SIZE(d) \ 1046a62a9e19SDr. David Alan Gilbert FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen) 1047a62a9e19SDr. David Alan Gilbert 1048a62a9e19SDr. David Alan Gilbert struct fuse_notify_inval_inode_out { 1049a62a9e19SDr. David Alan Gilbert uint64_t ino; 1050a62a9e19SDr. David Alan Gilbert int64_t off; 1051a62a9e19SDr. David Alan Gilbert int64_t len; 1052a62a9e19SDr. David Alan Gilbert }; 1053a62a9e19SDr. David Alan Gilbert 1054a62a9e19SDr. David Alan Gilbert struct fuse_notify_inval_entry_out { 1055a62a9e19SDr. David Alan Gilbert uint64_t parent; 1056a62a9e19SDr. David Alan Gilbert uint32_t namelen; 105793d7620cSAvihai Horon uint32_t flags; 1058a62a9e19SDr. David Alan Gilbert }; 1059a62a9e19SDr. David Alan Gilbert 1060a62a9e19SDr. David Alan Gilbert struct fuse_notify_delete_out { 1061a62a9e19SDr. David Alan Gilbert uint64_t parent; 1062a62a9e19SDr. David Alan Gilbert uint64_t child; 1063a62a9e19SDr. David Alan Gilbert uint32_t namelen; 1064a62a9e19SDr. David Alan Gilbert uint32_t padding; 1065a62a9e19SDr. David Alan Gilbert }; 1066a62a9e19SDr. David Alan Gilbert 1067a62a9e19SDr. David Alan Gilbert struct fuse_notify_store_out { 1068a62a9e19SDr. David Alan Gilbert uint64_t nodeid; 1069a62a9e19SDr. David Alan Gilbert uint64_t offset; 1070a62a9e19SDr. David Alan Gilbert uint32_t size; 1071a62a9e19SDr. David Alan Gilbert uint32_t padding; 1072a62a9e19SDr. David Alan Gilbert }; 1073a62a9e19SDr. David Alan Gilbert 1074a62a9e19SDr. David Alan Gilbert struct fuse_notify_retrieve_out { 1075a62a9e19SDr. David Alan Gilbert uint64_t notify_unique; 1076a62a9e19SDr. David Alan Gilbert uint64_t nodeid; 1077a62a9e19SDr. David Alan Gilbert uint64_t offset; 1078a62a9e19SDr. David Alan Gilbert uint32_t size; 1079a62a9e19SDr. David Alan Gilbert uint32_t padding; 1080a62a9e19SDr. David Alan Gilbert }; 1081a62a9e19SDr. David Alan Gilbert 1082a62a9e19SDr. David Alan Gilbert /* Matches the size of fuse_write_in */ 1083a62a9e19SDr. David Alan Gilbert struct fuse_notify_retrieve_in { 1084a62a9e19SDr. David Alan Gilbert uint64_t dummy1; 1085a62a9e19SDr. David Alan Gilbert uint64_t offset; 1086a62a9e19SDr. David Alan Gilbert uint32_t size; 1087a62a9e19SDr. David Alan Gilbert uint32_t dummy2; 1088a62a9e19SDr. David Alan Gilbert uint64_t dummy3; 1089a62a9e19SDr. David Alan Gilbert uint64_t dummy4; 1090a62a9e19SDr. David Alan Gilbert }; 1091a62a9e19SDr. David Alan Gilbert 1092ab0c7fb2SPaolo Bonzini struct fuse_backing_map { 1093ab0c7fb2SPaolo Bonzini int32_t fd; 1094ab0c7fb2SPaolo Bonzini uint32_t flags; 1095ab0c7fb2SPaolo Bonzini uint64_t padding; 1096ab0c7fb2SPaolo Bonzini }; 1097ab0c7fb2SPaolo Bonzini 1098a62a9e19SDr. David Alan Gilbert /* Device ioctls: */ 1099278f064eSEduardo Habkost #define FUSE_DEV_IOC_MAGIC 229 1100278f064eSEduardo Habkost #define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t) 1101ab0c7fb2SPaolo Bonzini #define FUSE_DEV_IOC_BACKING_OPEN _IOW(FUSE_DEV_IOC_MAGIC, 1, \ 1102ab0c7fb2SPaolo Bonzini struct fuse_backing_map) 1103ab0c7fb2SPaolo Bonzini #define FUSE_DEV_IOC_BACKING_CLOSE _IOW(FUSE_DEV_IOC_MAGIC, 2, uint32_t) 1104a62a9e19SDr. David Alan Gilbert 1105a62a9e19SDr. David Alan Gilbert struct fuse_lseek_in { 1106a62a9e19SDr. David Alan Gilbert uint64_t fh; 1107a62a9e19SDr. David Alan Gilbert uint64_t offset; 1108a62a9e19SDr. David Alan Gilbert uint32_t whence; 1109a62a9e19SDr. David Alan Gilbert uint32_t padding; 1110a62a9e19SDr. David Alan Gilbert }; 1111a62a9e19SDr. David Alan Gilbert 1112a62a9e19SDr. David Alan Gilbert struct fuse_lseek_out { 1113a62a9e19SDr. David Alan Gilbert uint64_t offset; 1114a62a9e19SDr. David Alan Gilbert }; 1115a62a9e19SDr. David Alan Gilbert 1116a62a9e19SDr. David Alan Gilbert struct fuse_copy_file_range_in { 1117a62a9e19SDr. David Alan Gilbert uint64_t fh_in; 1118a62a9e19SDr. David Alan Gilbert uint64_t off_in; 1119a62a9e19SDr. David Alan Gilbert uint64_t nodeid_out; 1120a62a9e19SDr. David Alan Gilbert uint64_t fh_out; 1121a62a9e19SDr. David Alan Gilbert uint64_t off_out; 1122a62a9e19SDr. David Alan Gilbert uint64_t len; 1123a62a9e19SDr. David Alan Gilbert uint64_t flags; 1124a62a9e19SDr. David Alan Gilbert }; 1125a62a9e19SDr. David Alan Gilbert 112653ba2eeeSMatthew Rosato #define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0) 112753ba2eeeSMatthew Rosato #define FUSE_SETUPMAPPING_FLAG_READ (1ull << 1) 112853ba2eeeSMatthew Rosato struct fuse_setupmapping_in { 112953ba2eeeSMatthew Rosato /* An already open handle */ 113053ba2eeeSMatthew Rosato uint64_t fh; 113153ba2eeeSMatthew Rosato /* Offset into the file to start the mapping */ 113253ba2eeeSMatthew Rosato uint64_t foffset; 113353ba2eeeSMatthew Rosato /* Length of mapping required */ 113453ba2eeeSMatthew Rosato uint64_t len; 113553ba2eeeSMatthew Rosato /* Flags, FUSE_SETUPMAPPING_FLAG_* */ 113653ba2eeeSMatthew Rosato uint64_t flags; 113753ba2eeeSMatthew Rosato /* Offset in Memory Window */ 113853ba2eeeSMatthew Rosato uint64_t moffset; 113953ba2eeeSMatthew Rosato }; 114053ba2eeeSMatthew Rosato 114153ba2eeeSMatthew Rosato struct fuse_removemapping_in { 114253ba2eeeSMatthew Rosato /* number of fuse_removemapping_one follows */ 114353ba2eeeSMatthew Rosato uint32_t count; 114453ba2eeeSMatthew Rosato }; 114553ba2eeeSMatthew Rosato 114653ba2eeeSMatthew Rosato struct fuse_removemapping_one { 114753ba2eeeSMatthew Rosato /* Offset into the dax window start the unmapping */ 114853ba2eeeSMatthew Rosato uint64_t moffset; 114953ba2eeeSMatthew Rosato /* Length of mapping required */ 115053ba2eeeSMatthew Rosato uint64_t len; 115153ba2eeeSMatthew Rosato }; 115253ba2eeeSMatthew Rosato 115353ba2eeeSMatthew Rosato #define FUSE_REMOVEMAPPING_MAX_ENTRY \ 115453ba2eeeSMatthew Rosato (PAGE_SIZE / sizeof(struct fuse_removemapping_one)) 115553ba2eeeSMatthew Rosato 115643709a0cSPaolo Bonzini struct fuse_syncfs_in { 115743709a0cSPaolo Bonzini uint64_t padding; 115843709a0cSPaolo Bonzini }; 115943709a0cSPaolo Bonzini 1160ef17dd6aSVivek Goyal /* 1161ef17dd6aSVivek Goyal * For each security context, send fuse_secctx with size of security context 1162ef17dd6aSVivek Goyal * fuse_secctx will be followed by security context name and this in turn 1163ef17dd6aSVivek Goyal * will be followed by actual context label. 1164ef17dd6aSVivek Goyal * fuse_secctx, name, context 1165ef17dd6aSVivek Goyal */ 1166ef17dd6aSVivek Goyal struct fuse_secctx { 1167ef17dd6aSVivek Goyal uint32_t size; 1168ef17dd6aSVivek Goyal uint32_t padding; 1169ef17dd6aSVivek Goyal }; 1170ef17dd6aSVivek Goyal 1171ef17dd6aSVivek Goyal /* 1172ef17dd6aSVivek Goyal * Contains the information about how many fuse_secctx structures are being 1173ef17dd6aSVivek Goyal * sent and what's the total size of all security contexts (including 1174ef17dd6aSVivek Goyal * size of fuse_secctx_header). 1175ef17dd6aSVivek Goyal * 1176ef17dd6aSVivek Goyal */ 1177ef17dd6aSVivek Goyal struct fuse_secctx_header { 1178ef17dd6aSVivek Goyal uint32_t size; 1179ef17dd6aSVivek Goyal uint32_t nr_secctx; 1180ef17dd6aSVivek Goyal }; 1181ef17dd6aSVivek Goyal 1182c5c0fdbeSDavid 'Digit' Turner /** 1183c5c0fdbeSDavid 'Digit' Turner * struct fuse_ext_header - extension header 1184c5c0fdbeSDavid 'Digit' Turner * @size: total size of this extension including this header 1185c5c0fdbeSDavid 'Digit' Turner * @type: type of extension 1186c5c0fdbeSDavid 'Digit' Turner * 1187c5c0fdbeSDavid 'Digit' Turner * This is made compatible with fuse_secctx_header by using type values > 1188c5c0fdbeSDavid 'Digit' Turner * FUSE_MAX_NR_SECCTX 1189c5c0fdbeSDavid 'Digit' Turner */ 1190c5c0fdbeSDavid 'Digit' Turner struct fuse_ext_header { 1191c5c0fdbeSDavid 'Digit' Turner uint32_t size; 1192c5c0fdbeSDavid 'Digit' Turner uint32_t type; 1193c5c0fdbeSDavid 'Digit' Turner }; 1194c5c0fdbeSDavid 'Digit' Turner 1195c5c0fdbeSDavid 'Digit' Turner /** 1196c5c0fdbeSDavid 'Digit' Turner * struct fuse_supp_groups - Supplementary group extension 1197c5c0fdbeSDavid 'Digit' Turner * @nr_groups: number of supplementary groups 1198c5c0fdbeSDavid 'Digit' Turner * @groups: flexible array of group IDs 1199c5c0fdbeSDavid 'Digit' Turner */ 1200c5c0fdbeSDavid 'Digit' Turner struct fuse_supp_groups { 1201c5c0fdbeSDavid 'Digit' Turner uint32_t nr_groups; 1202c5c0fdbeSDavid 'Digit' Turner uint32_t groups[]; 1203c5c0fdbeSDavid 'Digit' Turner }; 1204c5c0fdbeSDavid 'Digit' Turner 1205a62a9e19SDr. David Alan Gilbert #endif /* _LINUX_FUSE_H */ 1206