151369649SPedro F. Giffuni /*-- 25fe58019SAttilio Rao * This file defines the kernel interface of FUSE 39c62bc70SAlan Somers * Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> 45fe58019SAttilio Rao * 55fe58019SAttilio Rao * This program can be distributed under the terms of the GNU GPL. 65fe58019SAttilio Rao * See the file COPYING. 75fe58019SAttilio Rao * 85fe58019SAttilio Rao * This -- and only this -- header file may also be distributed under 95fe58019SAttilio Rao * the terms of the BSD Licence as follows: 105fe58019SAttilio Rao * 115fe58019SAttilio Rao * Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved. 125fe58019SAttilio Rao * 135fe58019SAttilio Rao * Redistribution and use in source and binary forms, with or without 145fe58019SAttilio Rao * modification, are permitted provided that the following conditions 155fe58019SAttilio Rao * are met: 165fe58019SAttilio Rao * 1. Redistributions of source code must retain the above copyright 175fe58019SAttilio Rao * notice, this list of conditions and the following disclaimer. 185fe58019SAttilio Rao * 2. Redistributions in binary form must reproduce the above copyright 195fe58019SAttilio Rao * notice, this list of conditions and the following disclaimer in the 205fe58019SAttilio Rao * documentation and/or other materials provided with the distribution. 215fe58019SAttilio Rao * 225fe58019SAttilio Rao * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 235fe58019SAttilio Rao * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 245fe58019SAttilio Rao * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 255fe58019SAttilio Rao * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 265fe58019SAttilio Rao * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 275fe58019SAttilio Rao * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 285fe58019SAttilio Rao * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 295fe58019SAttilio Rao * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 305fe58019SAttilio Rao * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 315fe58019SAttilio Rao * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 325fe58019SAttilio Rao * SUCH DAMAGE. 335fe58019SAttilio Rao * 345fe58019SAttilio Rao * $FreeBSD$ 355fe58019SAttilio Rao */ 365fe58019SAttilio Rao 3716bd2d47SAlan Somers /* 3816bd2d47SAlan Somers * This file defines the kernel interface of FUSE 3916bd2d47SAlan Somers * 4016bd2d47SAlan Somers * Protocol changelog: 4116bd2d47SAlan Somers * 4216bd2d47SAlan Somers * 7.9: 4316bd2d47SAlan Somers * - new fuse_getattr_in input argument of GETATTR 4416bd2d47SAlan Somers * - add lk_flags in fuse_lk_in 4516bd2d47SAlan Somers * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in 4616bd2d47SAlan Somers * - add blksize field to fuse_attr 4716bd2d47SAlan Somers * - add file flags field to fuse_read_in and fuse_write_in 483f105d16SAlan Somers * 493f105d16SAlan Somers * 7.10 503f105d16SAlan Somers * - add nonseekable open flag 519c62bc70SAlan Somers * 529c62bc70SAlan Somers * 7.11 539c62bc70SAlan Somers * - add IOCTL message 549c62bc70SAlan Somers * - add unsolicited notification support 55a4856c96SAlan Somers * 56a4856c96SAlan Somers * 7.12 57a4856c96SAlan Somers * - add umask flag to input argument of open, mknod and mkdir 58a4856c96SAlan Somers * - add notification messages for invalidation of inodes and 59a4856c96SAlan Somers * directory entries 602ffddc5eSAlan Somers * 612ffddc5eSAlan Somers * 7.13 622ffddc5eSAlan Somers * - make max number of background requests and congestion threshold 632ffddc5eSAlan Somers * tunables 64bb23d439SAlan Somers * 65bb23d439SAlan Somers * 7.14 66bb23d439SAlan Somers * - add splice support to fuse device 677cbb8e8aSAlan Somers * 687cbb8e8aSAlan Somers * 7.15 697cbb8e8aSAlan Somers * - add store notify 707cbb8e8aSAlan Somers * - add retrieve notify 71*b160acd1SAlan Somers * 72*b160acd1SAlan Somers * 7.16 73*b160acd1SAlan Somers * - add BATCH_FORGET request 74*b160acd1SAlan Somers * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct 75*b160acd1SAlan Somers * fuse_ioctl_iovec' instead of ambiguous 'struct iovec' 76*b160acd1SAlan Somers * - add FUSE_IOCTL_32BIT flag 77*b160acd1SAlan Somers * 78*b160acd1SAlan Somers * 7.17 79*b160acd1SAlan Somers * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK 80*b160acd1SAlan Somers * 81*b160acd1SAlan Somers * 7.18 82*b160acd1SAlan Somers * - add FUSE_IOCTL_DIR flag 83*b160acd1SAlan Somers * - add FUSE_NOTIFY_DELETE 84*b160acd1SAlan Somers * 85*b160acd1SAlan Somers * 7.19 86*b160acd1SAlan Somers * - add FUSE_FALLOCATE 87*b160acd1SAlan Somers * 88*b160acd1SAlan Somers * 7.20 89*b160acd1SAlan Somers * - add FUSE_AUTO_INVAL_DATA 90*b160acd1SAlan Somers * 7.21 91*b160acd1SAlan Somers * - add FUSE_READDIRPLUS 92*b160acd1SAlan Somers * - send the requested events in POLL request 9316bd2d47SAlan Somers */ 9416bd2d47SAlan Somers 9516bd2d47SAlan Somers #ifndef _FUSE_FUSE_KERNEL_H 9616bd2d47SAlan Somers #define _FUSE_FUSE_KERNEL_H 9716bd2d47SAlan Somers 98*b160acd1SAlan Somers #ifdef __linux__ 99*b160acd1SAlan Somers #include <linux/types.h> 100*b160acd1SAlan Somers #else 1015fe58019SAttilio Rao #include <sys/types.h> 1025fe58019SAttilio Rao #define __u64 uint64_t 103a4856c96SAlan Somers #define __s64 int64_t 1045fe58019SAttilio Rao #define __u32 uint32_t 1055fe58019SAttilio Rao #define __s32 int32_t 1062ffddc5eSAlan Somers #define __u16 uint16_t 1075fe58019SAttilio Rao #endif 1085fe58019SAttilio Rao 1095fe58019SAttilio Rao /** Version number of this interface */ 1105fe58019SAttilio Rao #define FUSE_KERNEL_VERSION 7 1115fe58019SAttilio Rao 1125fe58019SAttilio Rao /** Minor version number of this interface */ 113*b160acd1SAlan Somers #define FUSE_KERNEL_MINOR_VERSION 21 1145fe58019SAttilio Rao 1155fe58019SAttilio Rao /** The node ID of the root inode */ 1165fe58019SAttilio Rao #define FUSE_ROOT_ID 1 1175fe58019SAttilio Rao 1185fe58019SAttilio Rao /* Make sure all structures are padded to 64bit boundary, so 32bit 1195fe58019SAttilio Rao userspace works under 64bit kernels */ 1205fe58019SAttilio Rao 1215fe58019SAttilio Rao struct fuse_attr { 1225fe58019SAttilio Rao __u64 ino; 1235fe58019SAttilio Rao __u64 size; 1245fe58019SAttilio Rao __u64 blocks; 1255fe58019SAttilio Rao __u64 atime; 1265fe58019SAttilio Rao __u64 mtime; 1275fe58019SAttilio Rao __u64 ctime; 1285fe58019SAttilio Rao __u32 atimensec; 1295fe58019SAttilio Rao __u32 mtimensec; 1305fe58019SAttilio Rao __u32 ctimensec; 1315fe58019SAttilio Rao __u32 mode; 1325fe58019SAttilio Rao __u32 nlink; 1335fe58019SAttilio Rao __u32 uid; 1345fe58019SAttilio Rao __u32 gid; 1355fe58019SAttilio Rao __u32 rdev; 13616bd2d47SAlan Somers __u32 blksize; 13716bd2d47SAlan Somers __u32 padding; 1385fe58019SAttilio Rao }; 1395fe58019SAttilio Rao 1405fe58019SAttilio Rao struct fuse_kstatfs { 1415fe58019SAttilio Rao __u64 blocks; 1425fe58019SAttilio Rao __u64 bfree; 1435fe58019SAttilio Rao __u64 bavail; 1445fe58019SAttilio Rao __u64 files; 1455fe58019SAttilio Rao __u64 ffree; 1465fe58019SAttilio Rao __u32 bsize; 1475fe58019SAttilio Rao __u32 namelen; 1485fe58019SAttilio Rao __u32 frsize; 1495fe58019SAttilio Rao __u32 padding; 1505fe58019SAttilio Rao __u32 spare[6]; 1515fe58019SAttilio Rao }; 1525fe58019SAttilio Rao 1535fe58019SAttilio Rao struct fuse_file_lock { 1545fe58019SAttilio Rao __u64 start; 1555fe58019SAttilio Rao __u64 end; 1565fe58019SAttilio Rao __u32 type; 1575fe58019SAttilio Rao __u32 pid; /* tgid */ 1585fe58019SAttilio Rao }; 1595fe58019SAttilio Rao 1605fe58019SAttilio Rao /** 1615fe58019SAttilio Rao * Bitmasks for fuse_setattr_in.valid 1625fe58019SAttilio Rao */ 1635fe58019SAttilio Rao #define FATTR_MODE (1 << 0) 1645fe58019SAttilio Rao #define FATTR_UID (1 << 1) 1655fe58019SAttilio Rao #define FATTR_GID (1 << 2) 1665fe58019SAttilio Rao #define FATTR_SIZE (1 << 3) 1675fe58019SAttilio Rao #define FATTR_ATIME (1 << 4) 1685fe58019SAttilio Rao #define FATTR_MTIME (1 << 5) 1695fe58019SAttilio Rao #define FATTR_FH (1 << 6) 17016bd2d47SAlan Somers #define FATTR_ATIME_NOW (1 << 7) 17116bd2d47SAlan Somers #define FATTR_MTIME_NOW (1 << 8) 17216bd2d47SAlan Somers #define FATTR_LOCKOWNER (1 << 9) 1735fe58019SAttilio Rao 1745fe58019SAttilio Rao /** 1755fe58019SAttilio Rao * Flags returned by the OPEN request 1765fe58019SAttilio Rao * 1775fe58019SAttilio Rao * FOPEN_DIRECT_IO: bypass page cache for this open file 1785fe58019SAttilio Rao * FOPEN_KEEP_CACHE: don't invalidate the data cache on open 1793f105d16SAlan Somers * FOPEN_NONSEEKABLE: the file is not seekable 1805fe58019SAttilio Rao */ 1815fe58019SAttilio Rao #define FOPEN_DIRECT_IO (1 << 0) 1825fe58019SAttilio Rao #define FOPEN_KEEP_CACHE (1 << 1) 1833f105d16SAlan Somers #define FOPEN_NONSEEKABLE (1 << 2) 1845fe58019SAttilio Rao 1855fe58019SAttilio Rao /** 1865fe58019SAttilio Rao * INIT request/reply flags 18716bd2d47SAlan Somers * 188*b160acd1SAlan Somers * FUSE_ASYNC_READ: asynchronous read requests 189*b160acd1SAlan Somers * FUSE_POSIX_LOCKS: remote locking for POSIX file locks 190*b160acd1SAlan Somers * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported) 191*b160acd1SAlan Somers * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem 19216bd2d47SAlan Somers * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." 193*b160acd1SAlan Somers * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB 194a4856c96SAlan Somers * FUSE_DONT_MASK: don't apply umask to file mode on create operations 195*b160acd1SAlan Somers * FUSE_SPLICE_WRITE: kernel supports splice write on the device 196*b160acd1SAlan Somers * FUSE_SPLICE_MOVE: kernel supports splice move on the device 197*b160acd1SAlan Somers * FUSE_SPLICE_READ: kernel supports splice read on the device 198*b160acd1SAlan Somers * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks 199*b160acd1SAlan Somers * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories 200*b160acd1SAlan Somers * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages 201*b160acd1SAlan Somers * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one) 202*b160acd1SAlan Somers * FUSE_READDIRPLUS_AUTO: adaptive readdirplus 2035fe58019SAttilio Rao */ 2045fe58019SAttilio Rao #define FUSE_ASYNC_READ (1 << 0) 2055fe58019SAttilio Rao #define FUSE_POSIX_LOCKS (1 << 1) 20616bd2d47SAlan Somers #define FUSE_FILE_OPS (1 << 2) 20716bd2d47SAlan Somers #define FUSE_ATOMIC_O_TRUNC (1 << 3) 20816bd2d47SAlan Somers #define FUSE_EXPORT_SUPPORT (1 << 4) 20916bd2d47SAlan Somers #define FUSE_BIG_WRITES (1 << 5) 210a4856c96SAlan Somers #define FUSE_DONT_MASK (1 << 6) 211*b160acd1SAlan Somers #define FUSE_SPLICE_WRITE (1 << 7) 212*b160acd1SAlan Somers #define FUSE_SPLICE_MOVE (1 << 8) 213*b160acd1SAlan Somers #define FUSE_SPLICE_READ (1 << 9) 214*b160acd1SAlan Somers #define FUSE_FLOCK_LOCKS (1 << 10) 215*b160acd1SAlan Somers #define FUSE_HAS_IOCTL_DIR (1 << 11) 216*b160acd1SAlan Somers #define FUSE_AUTO_INVAL_DATA (1 << 12) 217*b160acd1SAlan Somers #define FUSE_DO_READDIRPLUS (1 << 13) 218*b160acd1SAlan Somers #define FUSE_READDIRPLUS_AUTO (1 << 14) 2195fe58019SAttilio Rao 2209c62bc70SAlan Somers #ifdef linux 2219c62bc70SAlan Somers /** 2229c62bc70SAlan Somers * CUSE INIT request/reply flags 2239c62bc70SAlan Somers * 2249c62bc70SAlan Somers * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl 2259c62bc70SAlan Somers */ 2269c62bc70SAlan Somers #define CUSE_UNRESTRICTED_IOCTL (1 << 0) 2279c62bc70SAlan Somers #endif /* linux */ 2289c62bc70SAlan Somers 2295fe58019SAttilio Rao /** 2305fe58019SAttilio Rao * Release flags 2315fe58019SAttilio Rao */ 2325fe58019SAttilio Rao #define FUSE_RELEASE_FLUSH (1 << 0) 233*b160acd1SAlan Somers #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1) 2345fe58019SAttilio Rao 23516bd2d47SAlan Somers /** 23616bd2d47SAlan Somers * Getattr flags 23716bd2d47SAlan Somers */ 23816bd2d47SAlan Somers #define FUSE_GETATTR_FH (1 << 0) 23916bd2d47SAlan Somers 24016bd2d47SAlan Somers /** 24116bd2d47SAlan Somers * Lock flags 24216bd2d47SAlan Somers */ 24316bd2d47SAlan Somers #define FUSE_LK_FLOCK (1 << 0) 24416bd2d47SAlan Somers 24516bd2d47SAlan Somers /** 24616bd2d47SAlan Somers * WRITE flags 24716bd2d47SAlan Somers * 24816bd2d47SAlan Somers * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed 24916bd2d47SAlan Somers * FUSE_WRITE_LOCKOWNER: lock_owner field is valid 25016bd2d47SAlan Somers */ 25116bd2d47SAlan Somers #define FUSE_WRITE_CACHE (1 << 0) 25216bd2d47SAlan Somers #define FUSE_WRITE_LOCKOWNER (1 << 1) 25316bd2d47SAlan Somers 25416bd2d47SAlan Somers /** 25516bd2d47SAlan Somers * Read flags 25616bd2d47SAlan Somers */ 25716bd2d47SAlan Somers #define FUSE_READ_LOCKOWNER (1 << 1) 25816bd2d47SAlan Somers 2599c62bc70SAlan Somers /** 2609c62bc70SAlan Somers * Ioctl flags 2619c62bc70SAlan Somers * 2629c62bc70SAlan Somers * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine 2639c62bc70SAlan Somers * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed 2649c62bc70SAlan Somers * FUSE_IOCTL_RETRY: retry with new iovecs 265*b160acd1SAlan Somers * FUSE_IOCTL_32BIT: 32bit ioctl 266*b160acd1SAlan Somers * FUSE_IOCTL_DIR: is a directory 2679c62bc70SAlan Somers * 2689c62bc70SAlan Somers * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs 2699c62bc70SAlan Somers */ 2709c62bc70SAlan Somers #define FUSE_IOCTL_COMPAT (1 << 0) 2719c62bc70SAlan Somers #define FUSE_IOCTL_UNRESTRICTED (1 << 1) 2729c62bc70SAlan Somers #define FUSE_IOCTL_RETRY (1 << 2) 273*b160acd1SAlan Somers #define FUSE_IOCTL_32BIT (1 << 3) 274*b160acd1SAlan Somers #define FUSE_IOCTL_DIR (1 << 4) 2759c62bc70SAlan Somers 2769c62bc70SAlan Somers #define FUSE_IOCTL_MAX_IOV 256 2779c62bc70SAlan Somers 2789c62bc70SAlan Somers /** 2799c62bc70SAlan Somers * Poll flags 2809c62bc70SAlan Somers * 2819c62bc70SAlan Somers * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify 2829c62bc70SAlan Somers */ 2839c62bc70SAlan Somers #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) 2849c62bc70SAlan Somers 2855fe58019SAttilio Rao enum fuse_opcode { 2865fe58019SAttilio Rao FUSE_LOOKUP = 1, 2875fe58019SAttilio Rao FUSE_FORGET = 2, /* no reply */ 2885fe58019SAttilio Rao FUSE_GETATTR = 3, 2895fe58019SAttilio Rao FUSE_SETATTR = 4, 2905fe58019SAttilio Rao FUSE_READLINK = 5, 2915fe58019SAttilio Rao FUSE_SYMLINK = 6, 2925fe58019SAttilio Rao FUSE_MKNOD = 8, 2935fe58019SAttilio Rao FUSE_MKDIR = 9, 2945fe58019SAttilio Rao FUSE_UNLINK = 10, 2955fe58019SAttilio Rao FUSE_RMDIR = 11, 2965fe58019SAttilio Rao FUSE_RENAME = 12, 2975fe58019SAttilio Rao FUSE_LINK = 13, 2985fe58019SAttilio Rao FUSE_OPEN = 14, 2995fe58019SAttilio Rao FUSE_READ = 15, 3005fe58019SAttilio Rao FUSE_WRITE = 16, 3015fe58019SAttilio Rao FUSE_STATFS = 17, 3025fe58019SAttilio Rao FUSE_RELEASE = 18, 3035fe58019SAttilio Rao FUSE_FSYNC = 20, 3045fe58019SAttilio Rao FUSE_SETXATTR = 21, 3055fe58019SAttilio Rao FUSE_GETXATTR = 22, 3065fe58019SAttilio Rao FUSE_LISTXATTR = 23, 3075fe58019SAttilio Rao FUSE_REMOVEXATTR = 24, 3085fe58019SAttilio Rao FUSE_FLUSH = 25, 3095fe58019SAttilio Rao FUSE_INIT = 26, 3105fe58019SAttilio Rao FUSE_OPENDIR = 27, 3115fe58019SAttilio Rao FUSE_READDIR = 28, 3125fe58019SAttilio Rao FUSE_RELEASEDIR = 29, 3135fe58019SAttilio Rao FUSE_FSYNCDIR = 30, 3145fe58019SAttilio Rao FUSE_GETLK = 31, 3155fe58019SAttilio Rao FUSE_SETLK = 32, 3165fe58019SAttilio Rao FUSE_SETLKW = 33, 3175fe58019SAttilio Rao FUSE_ACCESS = 34, 3185fe58019SAttilio Rao FUSE_CREATE = 35, 3195fe58019SAttilio Rao FUSE_INTERRUPT = 36, 3205fe58019SAttilio Rao FUSE_BMAP = 37, 3215fe58019SAttilio Rao FUSE_DESTROY = 38, 3229c62bc70SAlan Somers FUSE_IOCTL = 39, 3239c62bc70SAlan Somers FUSE_POLL = 40, 3247cbb8e8aSAlan Somers FUSE_NOTIFY_REPLY = 41, 325*b160acd1SAlan Somers FUSE_BATCH_FORGET = 42, 326*b160acd1SAlan Somers FUSE_FALLOCATE = 43, 327*b160acd1SAlan Somers FUSE_READDIRPLUS = 44, 3289c62bc70SAlan Somers 3299c62bc70SAlan Somers #ifdef linux 3309c62bc70SAlan Somers /* CUSE specific operations */ 3319c62bc70SAlan Somers CUSE_INIT = 4096, 3329c62bc70SAlan Somers #endif /* linux */ 3339c62bc70SAlan Somers }; 3349c62bc70SAlan Somers 3359c62bc70SAlan Somers enum fuse_notify_code { 3369c62bc70SAlan Somers FUSE_NOTIFY_POLL = 1, 337a4856c96SAlan Somers FUSE_NOTIFY_INVAL_INODE = 2, 338a4856c96SAlan Somers FUSE_NOTIFY_INVAL_ENTRY = 3, 3397cbb8e8aSAlan Somers FUSE_NOTIFY_STORE = 4, 3407cbb8e8aSAlan Somers FUSE_NOTIFY_RETRIEVE = 5, 341*b160acd1SAlan Somers FUSE_NOTIFY_DELETE = 6, 3429c62bc70SAlan Somers FUSE_NOTIFY_CODE_MAX, 3435fe58019SAttilio Rao }; 3445fe58019SAttilio Rao 3455fe58019SAttilio Rao /* The read buffer is required to be at least 8k, but may be much larger */ 3465fe58019SAttilio Rao #define FUSE_MIN_READ_BUFFER 8192 3475fe58019SAttilio Rao 34816bd2d47SAlan Somers #define FUSE_COMPAT_ENTRY_OUT_SIZE 120 34916bd2d47SAlan Somers 3505fe58019SAttilio Rao struct fuse_entry_out { 3515fe58019SAttilio Rao __u64 nodeid; /* Inode ID */ 3525fe58019SAttilio Rao __u64 generation; /* Inode generation: nodeid:gen must 3535fe58019SAttilio Rao be unique for the fs's lifetime */ 3545fe58019SAttilio Rao __u64 entry_valid; /* Cache timeout for the name */ 3555fe58019SAttilio Rao __u64 attr_valid; /* Cache timeout for the attributes */ 3565fe58019SAttilio Rao __u32 entry_valid_nsec; 3575fe58019SAttilio Rao __u32 attr_valid_nsec; 3585fe58019SAttilio Rao struct fuse_attr attr; 3595fe58019SAttilio Rao }; 3605fe58019SAttilio Rao 3615fe58019SAttilio Rao struct fuse_forget_in { 3625fe58019SAttilio Rao __u64 nlookup; 3635fe58019SAttilio Rao }; 3645fe58019SAttilio Rao 365*b160acd1SAlan Somers struct fuse_forget_one { 366*b160acd1SAlan Somers __u64 nodeid; 367*b160acd1SAlan Somers __u64 nlookup; 368*b160acd1SAlan Somers }; 369*b160acd1SAlan Somers 370*b160acd1SAlan Somers struct fuse_batch_forget_in { 371*b160acd1SAlan Somers __u32 count; 372*b160acd1SAlan Somers __u32 dummy; 373*b160acd1SAlan Somers }; 374*b160acd1SAlan Somers 37516bd2d47SAlan Somers struct fuse_getattr_in { 37616bd2d47SAlan Somers __u32 getattr_flags; 37716bd2d47SAlan Somers __u32 dummy; 37816bd2d47SAlan Somers __u64 fh; 37916bd2d47SAlan Somers }; 38016bd2d47SAlan Somers 38116bd2d47SAlan Somers #define FUSE_COMPAT_ATTR_OUT_SIZE 96 38216bd2d47SAlan Somers 3835fe58019SAttilio Rao struct fuse_attr_out { 3845fe58019SAttilio Rao __u64 attr_valid; /* Cache timeout for the attributes */ 3855fe58019SAttilio Rao __u32 attr_valid_nsec; 3865fe58019SAttilio Rao __u32 dummy; 3875fe58019SAttilio Rao struct fuse_attr attr; 3885fe58019SAttilio Rao }; 3895fe58019SAttilio Rao 390a4856c96SAlan Somers #define FUSE_COMPAT_MKNOD_IN_SIZE 8 391a4856c96SAlan Somers 3924cbb4f88SAlan Somers struct fuse_mknod_in { 3934cbb4f88SAlan Somers __u32 mode; 3944cbb4f88SAlan Somers __u32 rdev; 395a4856c96SAlan Somers __u32 umask; 396a4856c96SAlan Somers __u32 padding; 3974cbb4f88SAlan Somers }; 3984cbb4f88SAlan Somers 3995fe58019SAttilio Rao struct fuse_mkdir_in { 4005fe58019SAttilio Rao __u32 mode; 401a4856c96SAlan Somers __u32 umask; 4025fe58019SAttilio Rao }; 4035fe58019SAttilio Rao 4045fe58019SAttilio Rao struct fuse_rename_in { 4055fe58019SAttilio Rao __u64 newdir; 4065fe58019SAttilio Rao }; 4075fe58019SAttilio Rao 4085fe58019SAttilio Rao struct fuse_link_in { 4095fe58019SAttilio Rao __u64 oldnodeid; 4105fe58019SAttilio Rao }; 4115fe58019SAttilio Rao 4125fe58019SAttilio Rao struct fuse_setattr_in { 4135fe58019SAttilio Rao __u32 valid; 4145fe58019SAttilio Rao __u32 padding; 4155fe58019SAttilio Rao __u64 fh; 4165fe58019SAttilio Rao __u64 size; 41716bd2d47SAlan Somers __u64 lock_owner; 4185fe58019SAttilio Rao __u64 atime; 4195fe58019SAttilio Rao __u64 mtime; 4205fe58019SAttilio Rao __u64 unused2; 4215fe58019SAttilio Rao __u32 atimensec; 4225fe58019SAttilio Rao __u32 mtimensec; 4235fe58019SAttilio Rao __u32 unused3; 4245fe58019SAttilio Rao __u32 mode; 4255fe58019SAttilio Rao __u32 unused4; 4265fe58019SAttilio Rao __u32 uid; 4275fe58019SAttilio Rao __u32 gid; 4285fe58019SAttilio Rao __u32 unused5; 4295fe58019SAttilio Rao }; 4305fe58019SAttilio Rao 4315fe58019SAttilio Rao struct fuse_open_in { 4325fe58019SAttilio Rao __u32 flags; 433a4856c96SAlan Somers __u32 unused; 434a4856c96SAlan Somers }; 435a4856c96SAlan Somers 436a4856c96SAlan Somers struct fuse_create_in { 437a4856c96SAlan Somers __u32 flags; 4385fe58019SAttilio Rao __u32 mode; 439a4856c96SAlan Somers __u32 umask; 440a4856c96SAlan Somers __u32 padding; 4415fe58019SAttilio Rao }; 4425fe58019SAttilio Rao 4435fe58019SAttilio Rao struct fuse_open_out { 4445fe58019SAttilio Rao __u64 fh; 4455fe58019SAttilio Rao __u32 open_flags; 4465fe58019SAttilio Rao __u32 padding; 4475fe58019SAttilio Rao }; 4485fe58019SAttilio Rao 4495fe58019SAttilio Rao struct fuse_release_in { 4505fe58019SAttilio Rao __u64 fh; 4515fe58019SAttilio Rao __u32 flags; 4525fe58019SAttilio Rao __u32 release_flags; 4535fe58019SAttilio Rao __u64 lock_owner; 4545fe58019SAttilio Rao }; 4555fe58019SAttilio Rao 4565fe58019SAttilio Rao struct fuse_flush_in { 4575fe58019SAttilio Rao __u64 fh; 4585fe58019SAttilio Rao __u32 unused; 4595fe58019SAttilio Rao __u32 padding; 4605fe58019SAttilio Rao __u64 lock_owner; 4615fe58019SAttilio Rao }; 4625fe58019SAttilio Rao 4635fe58019SAttilio Rao struct fuse_read_in { 4645fe58019SAttilio Rao __u64 fh; 4655fe58019SAttilio Rao __u64 offset; 4665fe58019SAttilio Rao __u32 size; 46716bd2d47SAlan Somers __u32 read_flags; 46816bd2d47SAlan Somers __u64 lock_owner; 46916bd2d47SAlan Somers __u32 flags; 4705fe58019SAttilio Rao __u32 padding; 4715fe58019SAttilio Rao }; 4725fe58019SAttilio Rao 47316bd2d47SAlan Somers #define FUSE_COMPAT_WRITE_IN_SIZE 24 47416bd2d47SAlan Somers 4755fe58019SAttilio Rao struct fuse_write_in { 4765fe58019SAttilio Rao __u64 fh; 4775fe58019SAttilio Rao __u64 offset; 4785fe58019SAttilio Rao __u32 size; 4795fe58019SAttilio Rao __u32 write_flags; 48016bd2d47SAlan Somers __u64 lock_owner; 48116bd2d47SAlan Somers __u32 flags; 48216bd2d47SAlan Somers __u32 padding; 4835fe58019SAttilio Rao }; 4845fe58019SAttilio Rao 4855fe58019SAttilio Rao struct fuse_write_out { 4865fe58019SAttilio Rao __u32 size; 4875fe58019SAttilio Rao __u32 padding; 4885fe58019SAttilio Rao }; 4895fe58019SAttilio Rao 4905fe58019SAttilio Rao #define FUSE_COMPAT_STATFS_SIZE 48 4915fe58019SAttilio Rao 4925fe58019SAttilio Rao struct fuse_statfs_out { 4935fe58019SAttilio Rao struct fuse_kstatfs st; 4945fe58019SAttilio Rao }; 4955fe58019SAttilio Rao 4965fe58019SAttilio Rao struct fuse_fsync_in { 4975fe58019SAttilio Rao __u64 fh; 4985fe58019SAttilio Rao __u32 fsync_flags; 4995fe58019SAttilio Rao __u32 padding; 5005fe58019SAttilio Rao }; 5015fe58019SAttilio Rao 50296192dfcSAlan Somers struct fuse_setxattr_in { 503493b4a8cSFedor Uporov __u32 size; 504493b4a8cSFedor Uporov __u32 flags; 505493b4a8cSFedor Uporov }; 506493b4a8cSFedor Uporov 50796192dfcSAlan Somers struct fuse_listxattr_in { 50896192dfcSAlan Somers __u32 size; 50996192dfcSAlan Somers __u32 padding; 51096192dfcSAlan Somers }; 51196192dfcSAlan Somers 512493b4a8cSFedor Uporov struct fuse_listxattr_out { 5135fe58019SAttilio Rao __u32 size; 51496192dfcSAlan Somers __u32 padding; 5155fe58019SAttilio Rao }; 5165fe58019SAttilio Rao 5175fe58019SAttilio Rao struct fuse_getxattr_in { 5185fe58019SAttilio Rao __u32 size; 5195fe58019SAttilio Rao __u32 padding; 5205fe58019SAttilio Rao }; 5215fe58019SAttilio Rao 5225fe58019SAttilio Rao struct fuse_getxattr_out { 5235fe58019SAttilio Rao __u32 size; 5245fe58019SAttilio Rao __u32 padding; 5255fe58019SAttilio Rao }; 5265fe58019SAttilio Rao 5275fe58019SAttilio Rao struct fuse_lk_in { 5285fe58019SAttilio Rao __u64 fh; 5295fe58019SAttilio Rao __u64 owner; 5305fe58019SAttilio Rao struct fuse_file_lock lk; 53116bd2d47SAlan Somers __u32 lk_flags; 53216bd2d47SAlan Somers __u32 padding; 5335fe58019SAttilio Rao }; 5345fe58019SAttilio Rao 5355fe58019SAttilio Rao struct fuse_lk_out { 5365fe58019SAttilio Rao struct fuse_file_lock lk; 5375fe58019SAttilio Rao }; 5385fe58019SAttilio Rao 5395fe58019SAttilio Rao struct fuse_access_in { 5405fe58019SAttilio Rao __u32 mask; 5415fe58019SAttilio Rao __u32 padding; 5425fe58019SAttilio Rao }; 5435fe58019SAttilio Rao 5445fe58019SAttilio Rao struct fuse_init_in { 5455fe58019SAttilio Rao __u32 major; 5465fe58019SAttilio Rao __u32 minor; 5475fe58019SAttilio Rao __u32 max_readahead; 5485fe58019SAttilio Rao __u32 flags; 5495fe58019SAttilio Rao }; 5505fe58019SAttilio Rao 5515fe58019SAttilio Rao struct fuse_init_out { 5525fe58019SAttilio Rao __u32 major; 5535fe58019SAttilio Rao __u32 minor; 5545fe58019SAttilio Rao __u32 max_readahead; 5555fe58019SAttilio Rao __u32 flags; 5562ffddc5eSAlan Somers __u16 max_background; 5572ffddc5eSAlan Somers __u16 congestion_threshold; 5585fe58019SAttilio Rao __u32 max_write; 5595fe58019SAttilio Rao }; 5605fe58019SAttilio Rao 5619c62bc70SAlan Somers #ifdef linux 5629c62bc70SAlan Somers #define CUSE_INIT_INFO_MAX 4096 5639c62bc70SAlan Somers 5649c62bc70SAlan Somers struct cuse_init_in { 5659c62bc70SAlan Somers __u32 major; 5669c62bc70SAlan Somers __u32 minor; 5679c62bc70SAlan Somers __u32 unused; 5689c62bc70SAlan Somers __u32 flags; 5699c62bc70SAlan Somers }; 5709c62bc70SAlan Somers 5719c62bc70SAlan Somers struct cuse_init_out { 5729c62bc70SAlan Somers __u32 major; 5739c62bc70SAlan Somers __u32 minor; 5749c62bc70SAlan Somers __u32 unused; 5759c62bc70SAlan Somers __u32 flags; 5769c62bc70SAlan Somers __u32 max_read; 5779c62bc70SAlan Somers __u32 max_write; 5789c62bc70SAlan Somers __u32 dev_major; /* chardev major */ 5799c62bc70SAlan Somers __u32 dev_minor; /* chardev minor */ 5809c62bc70SAlan Somers __u32 spare[10]; 5819c62bc70SAlan Somers }; 5829c62bc70SAlan Somers #endif /* linux */ 5839c62bc70SAlan Somers 5845fe58019SAttilio Rao struct fuse_interrupt_in { 5855fe58019SAttilio Rao __u64 unique; 5865fe58019SAttilio Rao }; 5875fe58019SAttilio Rao 5885fe58019SAttilio Rao struct fuse_bmap_in { 5895fe58019SAttilio Rao __u64 block; 5905fe58019SAttilio Rao __u32 blocksize; 5915fe58019SAttilio Rao __u32 padding; 5925fe58019SAttilio Rao }; 5935fe58019SAttilio Rao 5945fe58019SAttilio Rao struct fuse_bmap_out { 5955fe58019SAttilio Rao __u64 block; 5965fe58019SAttilio Rao }; 5975fe58019SAttilio Rao 5989c62bc70SAlan Somers struct fuse_ioctl_in { 5999c62bc70SAlan Somers __u64 fh; 6009c62bc70SAlan Somers __u32 flags; 6019c62bc70SAlan Somers __u32 cmd; 6029c62bc70SAlan Somers __u64 arg; 6039c62bc70SAlan Somers __u32 in_size; 6049c62bc70SAlan Somers __u32 out_size; 6059c62bc70SAlan Somers }; 6069c62bc70SAlan Somers 607*b160acd1SAlan Somers struct fuse_ioctl_iovec { 608*b160acd1SAlan Somers __u64 base; 609*b160acd1SAlan Somers __u64 len; 610*b160acd1SAlan Somers }; 611*b160acd1SAlan Somers 6129c62bc70SAlan Somers struct fuse_ioctl_out { 6139c62bc70SAlan Somers __s32 result; 6149c62bc70SAlan Somers __u32 flags; 6159c62bc70SAlan Somers __u32 in_iovs; 6169c62bc70SAlan Somers __u32 out_iovs; 6179c62bc70SAlan Somers }; 6189c62bc70SAlan Somers 6199c62bc70SAlan Somers struct fuse_poll_in { 6209c62bc70SAlan Somers __u64 fh; 6219c62bc70SAlan Somers __u64 kh; 6229c62bc70SAlan Somers __u32 flags; 623*b160acd1SAlan Somers __u32 events; 6249c62bc70SAlan Somers }; 6259c62bc70SAlan Somers 6269c62bc70SAlan Somers struct fuse_poll_out { 6279c62bc70SAlan Somers __u32 revents; 6289c62bc70SAlan Somers __u32 padding; 6299c62bc70SAlan Somers }; 6309c62bc70SAlan Somers 6319c62bc70SAlan Somers struct fuse_notify_poll_wakeup_out { 6329c62bc70SAlan Somers __u64 kh; 6339c62bc70SAlan Somers }; 6349c62bc70SAlan Somers 635*b160acd1SAlan Somers struct fuse_fallocate_in { 636*b160acd1SAlan Somers __u64 fh; 637*b160acd1SAlan Somers __u64 offset; 638*b160acd1SAlan Somers __u64 length; 639*b160acd1SAlan Somers __u32 mode; 640*b160acd1SAlan Somers __u32 padding; 641*b160acd1SAlan Somers }; 642*b160acd1SAlan Somers 6435fe58019SAttilio Rao struct fuse_in_header { 6445fe58019SAttilio Rao __u32 len; 6455fe58019SAttilio Rao __u32 opcode; 6465fe58019SAttilio Rao __u64 unique; 6475fe58019SAttilio Rao __u64 nodeid; 6485fe58019SAttilio Rao __u32 uid; 6495fe58019SAttilio Rao __u32 gid; 6505fe58019SAttilio Rao __u32 pid; 6515fe58019SAttilio Rao __u32 padding; 6525fe58019SAttilio Rao }; 6535fe58019SAttilio Rao 6545fe58019SAttilio Rao struct fuse_out_header { 6555fe58019SAttilio Rao __u32 len; 6565fe58019SAttilio Rao __s32 error; 6575fe58019SAttilio Rao __u64 unique; 6585fe58019SAttilio Rao }; 6595fe58019SAttilio Rao 6605fe58019SAttilio Rao struct fuse_dirent { 6615fe58019SAttilio Rao __u64 ino; 6625fe58019SAttilio Rao __u64 off; 6635fe58019SAttilio Rao __u32 namelen; 6645fe58019SAttilio Rao __u32 type; 665*b160acd1SAlan Somers char name[]; 6665fe58019SAttilio Rao }; 6675fe58019SAttilio Rao 6685fe58019SAttilio Rao #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) 6695fe58019SAttilio Rao #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) 6705fe58019SAttilio Rao #define FUSE_DIRENT_SIZE(d) \ 6715fe58019SAttilio Rao FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) 67216bd2d47SAlan Somers 673*b160acd1SAlan Somers struct fuse_direntplus { 674*b160acd1SAlan Somers struct fuse_entry_out entry_out; 675*b160acd1SAlan Somers struct fuse_dirent dirent; 676*b160acd1SAlan Somers }; 677*b160acd1SAlan Somers 678*b160acd1SAlan Somers #define FUSE_NAME_OFFSET_DIRENTPLUS \ 679*b160acd1SAlan Somers offsetof(struct fuse_direntplus, dirent.name) 680*b160acd1SAlan Somers #define FUSE_DIRENTPLUS_SIZE(d) \ 681*b160acd1SAlan Somers FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen) 682*b160acd1SAlan Somers 683a4856c96SAlan Somers struct fuse_notify_inval_inode_out { 684a4856c96SAlan Somers __u64 ino; 685a4856c96SAlan Somers __s64 off; 686a4856c96SAlan Somers __s64 len; 687a4856c96SAlan Somers }; 688a4856c96SAlan Somers 689a4856c96SAlan Somers struct fuse_notify_inval_entry_out { 690a4856c96SAlan Somers __u64 parent; 691a4856c96SAlan Somers __u32 namelen; 692a4856c96SAlan Somers __u32 padding; 693a4856c96SAlan Somers }; 694a4856c96SAlan Somers 695*b160acd1SAlan Somers struct fuse_notify_delete_out { 696*b160acd1SAlan Somers __u64 parent; 697*b160acd1SAlan Somers __u64 child; 698*b160acd1SAlan Somers __u32 namelen; 699*b160acd1SAlan Somers __u32 padding; 700*b160acd1SAlan Somers }; 701*b160acd1SAlan Somers 702ecb48915SAlan Somers struct fuse_notify_store_out { 703ecb48915SAlan Somers __u64 nodeid; 704ecb48915SAlan Somers __u64 offset; 705ecb48915SAlan Somers __u32 size; 706ecb48915SAlan Somers __u32 padding; 707ecb48915SAlan Somers }; 708ecb48915SAlan Somers 709ecb48915SAlan Somers struct fuse_notify_retrieve_out { 710ecb48915SAlan Somers __u64 notify_unique; 711ecb48915SAlan Somers __u64 nodeid; 712ecb48915SAlan Somers __u64 offset; 713ecb48915SAlan Somers __u32 size; 714ecb48915SAlan Somers __u32 padding; 715ecb48915SAlan Somers }; 716ecb48915SAlan Somers 717ecb48915SAlan Somers /* Matches the size of fuse_write_in */ 718ecb48915SAlan Somers struct fuse_notify_retrieve_in { 719ecb48915SAlan Somers __u64 dummy1; 720ecb48915SAlan Somers __u64 offset; 721ecb48915SAlan Somers __u32 size; 722ecb48915SAlan Somers __u32 dummy2; 723ecb48915SAlan Somers __u64 dummy3; 724ecb48915SAlan Somers __u64 dummy4; 725ecb48915SAlan Somers }; 726ecb48915SAlan Somers 72716bd2d47SAlan Somers #endif /* _FUSE_FUSE_KERNEL_H */ 728