Miklos Szeredi | d8a5ba4 | 2005-09-09 13:10:26 -0700 | [diff] [blame] | 1 | /* |
| 2 | FUSE: Filesystem in Userspace |
Miklos Szeredi | 1f55ed0 | 2008-12-01 19:14:02 +0100 | [diff] [blame] | 3 | Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> |
Miklos Szeredi | d8a5ba4 | 2005-09-09 13:10:26 -0700 | [diff] [blame] | 4 | |
| 5 | This program can be distributed under the terms of the GNU GPL. |
| 6 | See the file COPYING. |
| 7 | */ |
| 8 | |
Miklos Szeredi | c79e322 | 2007-10-18 03:06:59 -0700 | [diff] [blame] | 9 | /* |
| 10 | * This file defines the kernel interface of FUSE |
| 11 | * |
| 12 | * Protocol changelog: |
| 13 | * |
| 14 | * 7.9: |
| 15 | * - new fuse_getattr_in input argument of GETATTR |
Miklos Szeredi | a9ff4f8 | 2007-10-18 03:07:02 -0700 | [diff] [blame] | 16 | * - add lk_flags in fuse_lk_in |
Miklos Szeredi | f333211 | 2007-10-18 03:07:04 -0700 | [diff] [blame] | 17 | * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in |
Miklos Szeredi | 0e9663e | 2007-10-18 03:07:05 -0700 | [diff] [blame] | 18 | * - add blksize field to fuse_attr |
Miklos Szeredi | a664309 | 2007-11-28 16:22:00 -0800 | [diff] [blame] | 19 | * - add file flags field to fuse_read_in and fuse_write_in |
Tejun Heo | a7c1b99 | 2008-10-16 16:08:57 +0200 | [diff] [blame] | 20 | * |
| 21 | * 7.10 |
| 22 | * - add nonseekable open flag |
Miklos Szeredi | 1f55ed0 | 2008-12-01 19:14:02 +0100 | [diff] [blame] | 23 | * |
| 24 | * 7.11 |
| 25 | * - add IOCTL message |
| 26 | * - add unsolicited notification support |
| 27 | * - add POLL message and NOTIFY_POLL notification |
Miklos Szeredi | e0a43dd | 2009-06-30 20:12:23 +0200 | [diff] [blame] | 28 | * |
| 29 | * 7.12 |
| 30 | * - add umask flag to input argument of open, mknod and mkdir |
John Muir | 3b463ae | 2009-05-31 11:13:57 -0400 | [diff] [blame] | 31 | * - add notification messages for invalidation of inodes and |
| 32 | * directory entries |
Csaba Henk | 7a6d3c8 | 2009-07-01 17:28:41 -0700 | [diff] [blame] | 33 | * |
| 34 | * 7.13 |
| 35 | * - make max number of background requests and congestion threshold |
| 36 | * tunables |
Miklos Szeredi | dd3bb14 | 2010-05-25 15:06:06 +0200 | [diff] [blame] | 37 | * |
| 38 | * 7.14 |
| 39 | * - add splice support to fuse device |
Miklos Szeredi | a1d75f2 | 2010-07-12 14:41:40 +0200 | [diff] [blame] | 40 | * |
| 41 | * 7.15 |
| 42 | * - add store notify |
Miklos Szeredi | 2d45ba3 | 2010-07-12 14:41:40 +0200 | [diff] [blame] | 43 | * - add retrieve notify |
Miklos Szeredi | 02c048b | 2010-12-07 20:16:56 +0100 | [diff] [blame] | 44 | * |
| 45 | * 7.16 |
| 46 | * - add BATCH_FORGET request |
Miklos Szeredi | 1baa26b | 2010-12-07 20:16:56 +0100 | [diff] [blame] | 47 | * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct |
| 48 | * fuse_ioctl_iovec' instead of ambiguous 'struct iovec' |
| 49 | * - add FUSE_IOCTL_32BIT flag |
Miklos Szeredi | 37fb3a3 | 2011-08-08 16:08:08 +0200 | [diff] [blame] | 50 | * |
| 51 | * 7.17 |
| 52 | * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK |
Miklos Szeredi | b18da0c | 2011-12-13 11:58:49 +0100 | [diff] [blame^] | 53 | * |
| 54 | * 7.18 |
| 55 | * - add FUSE_IOCTL_DIR flag |
Miklos Szeredi | c79e322 | 2007-10-18 03:06:59 -0700 | [diff] [blame] | 56 | */ |
Miklos Szeredi | d8a5ba4 | 2005-09-09 13:10:26 -0700 | [diff] [blame] | 57 | |
Tejun Heo | 29d434b | 2008-10-16 16:08:57 +0200 | [diff] [blame] | 58 | #ifndef _LINUX_FUSE_H |
| 59 | #define _LINUX_FUSE_H |
| 60 | |
Miklos Szeredi | 1f55ed0 | 2008-12-01 19:14:02 +0100 | [diff] [blame] | 61 | #include <linux/types.h> |
Miklos Szeredi | d8a5ba4 | 2005-09-09 13:10:26 -0700 | [diff] [blame] | 62 | |
Miklos Szeredi | 37d217f | 2009-07-08 18:17:58 +0200 | [diff] [blame] | 63 | /* |
| 64 | * Version negotiation: |
| 65 | * |
| 66 | * Both the kernel and userspace send the version they support in the |
| 67 | * INIT request and reply respectively. |
| 68 | * |
| 69 | * If the major versions match then both shall use the smallest |
| 70 | * of the two minor versions for communication. |
| 71 | * |
| 72 | * If the kernel supports a larger major version, then userspace shall |
| 73 | * reply with the major version it supports, ignore the rest of the |
| 74 | * INIT message and expect a new INIT message from the kernel with a |
| 75 | * matching major version. |
| 76 | * |
| 77 | * If the library supports a larger major version, then it shall fall |
| 78 | * back to the major protocol version sent by the kernel for |
| 79 | * communication and reply with that major version (and an arbitrary |
| 80 | * supported minor version). |
| 81 | */ |
| 82 | |
Miklos Szeredi | d8a5ba4 | 2005-09-09 13:10:26 -0700 | [diff] [blame] | 83 | /** Version number of this interface */ |
Miklos Szeredi | 9e6268d | 2005-09-09 13:10:29 -0700 | [diff] [blame] | 84 | #define FUSE_KERNEL_VERSION 7 |
Miklos Szeredi | d8a5ba4 | 2005-09-09 13:10:26 -0700 | [diff] [blame] | 85 | |
| 86 | /** Minor version number of this interface */ |
Miklos Szeredi | b18da0c | 2011-12-13 11:58:49 +0100 | [diff] [blame^] | 87 | #define FUSE_KERNEL_MINOR_VERSION 18 |
Miklos Szeredi | d8a5ba4 | 2005-09-09 13:10:26 -0700 | [diff] [blame] | 88 | |
| 89 | /** The node ID of the root inode */ |
| 90 | #define FUSE_ROOT_ID 1 |
| 91 | |
Miklos Szeredi | 0666326 | 2005-09-09 13:10:32 -0700 | [diff] [blame] | 92 | /* Make sure all structures are padded to 64bit boundary, so 32bit |
| 93 | userspace works under 64bit kernels */ |
| 94 | |
Miklos Szeredi | d8a5ba4 | 2005-09-09 13:10:26 -0700 | [diff] [blame] | 95 | struct fuse_attr { |
| 96 | __u64 ino; |
| 97 | __u64 size; |
| 98 | __u64 blocks; |
| 99 | __u64 atime; |
| 100 | __u64 mtime; |
| 101 | __u64 ctime; |
| 102 | __u32 atimensec; |
| 103 | __u32 mtimensec; |
| 104 | __u32 ctimensec; |
| 105 | __u32 mode; |
| 106 | __u32 nlink; |
| 107 | __u32 uid; |
| 108 | __u32 gid; |
| 109 | __u32 rdev; |
Miklos Szeredi | 0e9663e | 2007-10-18 03:07:05 -0700 | [diff] [blame] | 110 | __u32 blksize; |
| 111 | __u32 padding; |
Miklos Szeredi | d8a5ba4 | 2005-09-09 13:10:26 -0700 | [diff] [blame] | 112 | }; |
| 113 | |
Miklos Szeredi | e5e5558 | 2005-09-09 13:10:28 -0700 | [diff] [blame] | 114 | struct fuse_kstatfs { |
| 115 | __u64 blocks; |
| 116 | __u64 bfree; |
| 117 | __u64 bavail; |
| 118 | __u64 files; |
| 119 | __u64 ffree; |
| 120 | __u32 bsize; |
| 121 | __u32 namelen; |
Miklos Szeredi | de5f120 | 2006-01-06 00:19:37 -0800 | [diff] [blame] | 122 | __u32 frsize; |
| 123 | __u32 padding; |
| 124 | __u32 spare[6]; |
Miklos Szeredi | e5e5558 | 2005-09-09 13:10:28 -0700 | [diff] [blame] | 125 | }; |
| 126 | |
Miklos Szeredi | 7142125 | 2006-06-25 05:48:52 -0700 | [diff] [blame] | 127 | struct fuse_file_lock { |
| 128 | __u64 start; |
| 129 | __u64 end; |
| 130 | __u32 type; |
| 131 | __u32 pid; /* tgid */ |
| 132 | }; |
| 133 | |
Miklos Szeredi | 9cd6845 | 2006-02-01 03:04:40 -0800 | [diff] [blame] | 134 | /** |
| 135 | * Bitmasks for fuse_setattr_in.valid |
| 136 | */ |
Miklos Szeredi | 9e6268d | 2005-09-09 13:10:29 -0700 | [diff] [blame] | 137 | #define FATTR_MODE (1 << 0) |
| 138 | #define FATTR_UID (1 << 1) |
| 139 | #define FATTR_GID (1 << 2) |
| 140 | #define FATTR_SIZE (1 << 3) |
| 141 | #define FATTR_ATIME (1 << 4) |
| 142 | #define FATTR_MTIME (1 << 5) |
Miklos Szeredi | befc649 | 2005-11-07 00:59:52 -0800 | [diff] [blame] | 143 | #define FATTR_FH (1 << 6) |
Miklos Szeredi | 17637cb | 2007-10-18 03:07:01 -0700 | [diff] [blame] | 144 | #define FATTR_ATIME_NOW (1 << 7) |
| 145 | #define FATTR_MTIME_NOW (1 << 8) |
Miklos Szeredi | f333211 | 2007-10-18 03:07:04 -0700 | [diff] [blame] | 146 | #define FATTR_LOCKOWNER (1 << 9) |
Miklos Szeredi | 9e6268d | 2005-09-09 13:10:29 -0700 | [diff] [blame] | 147 | |
Miklos Szeredi | 45323fb | 2005-09-09 13:10:37 -0700 | [diff] [blame] | 148 | /** |
| 149 | * Flags returned by the OPEN request |
| 150 | * |
| 151 | * FOPEN_DIRECT_IO: bypass page cache for this open file |
| 152 | * FOPEN_KEEP_CACHE: don't invalidate the data cache on open |
Tejun Heo | a7c1b99 | 2008-10-16 16:08:57 +0200 | [diff] [blame] | 153 | * FOPEN_NONSEEKABLE: the file is not seekable |
Miklos Szeredi | 45323fb | 2005-09-09 13:10:37 -0700 | [diff] [blame] | 154 | */ |
| 155 | #define FOPEN_DIRECT_IO (1 << 0) |
| 156 | #define FOPEN_KEEP_CACHE (1 << 1) |
Tejun Heo | a7c1b99 | 2008-10-16 16:08:57 +0200 | [diff] [blame] | 157 | #define FOPEN_NONSEEKABLE (1 << 2) |
Miklos Szeredi | 45323fb | 2005-09-09 13:10:37 -0700 | [diff] [blame] | 158 | |
Miklos Szeredi | 9cd6845 | 2006-02-01 03:04:40 -0800 | [diff] [blame] | 159 | /** |
| 160 | * INIT request/reply flags |
Miklos Szeredi | 33670fa | 2008-07-25 01:49:02 -0700 | [diff] [blame] | 161 | * |
Miklos Szeredi | 37fb3a3 | 2011-08-08 16:08:08 +0200 | [diff] [blame] | 162 | * FUSE_POSIX_LOCKS: remote locking for POSIX file locks |
Miklos Szeredi | 33670fa | 2008-07-25 01:49:02 -0700 | [diff] [blame] | 163 | * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." |
Miklos Szeredi | e0a43dd | 2009-06-30 20:12:23 +0200 | [diff] [blame] | 164 | * FUSE_DONT_MASK: don't apply umask to file mode on create operations |
Miklos Szeredi | 37fb3a3 | 2011-08-08 16:08:08 +0200 | [diff] [blame] | 165 | * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks |
Miklos Szeredi | 9cd6845 | 2006-02-01 03:04:40 -0800 | [diff] [blame] | 166 | */ |
| 167 | #define FUSE_ASYNC_READ (1 << 0) |
Miklos Szeredi | 7142125 | 2006-06-25 05:48:52 -0700 | [diff] [blame] | 168 | #define FUSE_POSIX_LOCKS (1 << 1) |
Miklos Szeredi | c79e322 | 2007-10-18 03:06:59 -0700 | [diff] [blame] | 169 | #define FUSE_FILE_OPS (1 << 2) |
Miklos Szeredi | 6ff958e | 2007-10-18 03:07:02 -0700 | [diff] [blame] | 170 | #define FUSE_ATOMIC_O_TRUNC (1 << 3) |
Miklos Szeredi | 33670fa | 2008-07-25 01:49:02 -0700 | [diff] [blame] | 171 | #define FUSE_EXPORT_SUPPORT (1 << 4) |
Miklos Szeredi | 78bb6cb | 2008-05-12 14:02:32 -0700 | [diff] [blame] | 172 | #define FUSE_BIG_WRITES (1 << 5) |
Miklos Szeredi | e0a43dd | 2009-06-30 20:12:23 +0200 | [diff] [blame] | 173 | #define FUSE_DONT_MASK (1 << 6) |
Miklos Szeredi | 37fb3a3 | 2011-08-08 16:08:08 +0200 | [diff] [blame] | 174 | #define FUSE_FLOCK_LOCKS (1 << 10) |
Miklos Szeredi | 9cd6845 | 2006-02-01 03:04:40 -0800 | [diff] [blame] | 175 | |
Miklos Szeredi | e9168c1 | 2006-12-06 20:35:38 -0800 | [diff] [blame] | 176 | /** |
Tejun Heo | 151060a | 2009-04-14 10:54:54 +0900 | [diff] [blame] | 177 | * CUSE INIT request/reply flags |
| 178 | * |
| 179 | * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl |
| 180 | */ |
| 181 | #define CUSE_UNRESTRICTED_IOCTL (1 << 0) |
| 182 | |
| 183 | /** |
Miklos Szeredi | e9168c1 | 2006-12-06 20:35:38 -0800 | [diff] [blame] | 184 | * Release flags |
| 185 | */ |
| 186 | #define FUSE_RELEASE_FLUSH (1 << 0) |
Miklos Szeredi | 37fb3a3 | 2011-08-08 16:08:08 +0200 | [diff] [blame] | 187 | #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1) |
Miklos Szeredi | e9168c1 | 2006-12-06 20:35:38 -0800 | [diff] [blame] | 188 | |
Miklos Szeredi | c79e322 | 2007-10-18 03:06:59 -0700 | [diff] [blame] | 189 | /** |
| 190 | * Getattr flags |
| 191 | */ |
| 192 | #define FUSE_GETATTR_FH (1 << 0) |
| 193 | |
Miklos Szeredi | a9ff4f8 | 2007-10-18 03:07:02 -0700 | [diff] [blame] | 194 | /** |
| 195 | * Lock flags |
| 196 | */ |
| 197 | #define FUSE_LK_FLOCK (1 << 0) |
| 198 | |
Miklos Szeredi | b25e82e | 2007-10-18 03:07:03 -0700 | [diff] [blame] | 199 | /** |
| 200 | * WRITE flags |
| 201 | * |
| 202 | * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed |
Miklos Szeredi | f333211 | 2007-10-18 03:07:04 -0700 | [diff] [blame] | 203 | * FUSE_WRITE_LOCKOWNER: lock_owner field is valid |
Miklos Szeredi | b25e82e | 2007-10-18 03:07:03 -0700 | [diff] [blame] | 204 | */ |
| 205 | #define FUSE_WRITE_CACHE (1 << 0) |
Miklos Szeredi | f333211 | 2007-10-18 03:07:04 -0700 | [diff] [blame] | 206 | #define FUSE_WRITE_LOCKOWNER (1 << 1) |
| 207 | |
| 208 | /** |
| 209 | * Read flags |
| 210 | */ |
| 211 | #define FUSE_READ_LOCKOWNER (1 << 1) |
Miklos Szeredi | b25e82e | 2007-10-18 03:07:03 -0700 | [diff] [blame] | 212 | |
Tejun Heo | 59efec7 | 2008-11-26 12:03:55 +0100 | [diff] [blame] | 213 | /** |
| 214 | * Ioctl flags |
| 215 | * |
| 216 | * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine |
| 217 | * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed |
| 218 | * FUSE_IOCTL_RETRY: retry with new iovecs |
Miklos Szeredi | 1baa26b | 2010-12-07 20:16:56 +0100 | [diff] [blame] | 219 | * FUSE_IOCTL_32BIT: 32bit ioctl |
Miklos Szeredi | b18da0c | 2011-12-13 11:58:49 +0100 | [diff] [blame^] | 220 | * FUSE_IOCTL_DIR: is a directory |
Tejun Heo | 59efec7 | 2008-11-26 12:03:55 +0100 | [diff] [blame] | 221 | * |
| 222 | * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs |
| 223 | */ |
| 224 | #define FUSE_IOCTL_COMPAT (1 << 0) |
| 225 | #define FUSE_IOCTL_UNRESTRICTED (1 << 1) |
| 226 | #define FUSE_IOCTL_RETRY (1 << 2) |
Miklos Szeredi | 1baa26b | 2010-12-07 20:16:56 +0100 | [diff] [blame] | 227 | #define FUSE_IOCTL_32BIT (1 << 3) |
Miklos Szeredi | b18da0c | 2011-12-13 11:58:49 +0100 | [diff] [blame^] | 228 | #define FUSE_IOCTL_DIR (1 << 4) |
Tejun Heo | 59efec7 | 2008-11-26 12:03:55 +0100 | [diff] [blame] | 229 | |
| 230 | #define FUSE_IOCTL_MAX_IOV 256 |
| 231 | |
Tejun Heo | 95668a6 | 2008-11-26 12:03:55 +0100 | [diff] [blame] | 232 | /** |
| 233 | * Poll flags |
| 234 | * |
| 235 | * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify |
| 236 | */ |
| 237 | #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) |
| 238 | |
Miklos Szeredi | 334f485 | 2005-09-09 13:10:27 -0700 | [diff] [blame] | 239 | enum fuse_opcode { |
Miklos Szeredi | e5e5558 | 2005-09-09 13:10:28 -0700 | [diff] [blame] | 240 | FUSE_LOOKUP = 1, |
| 241 | FUSE_FORGET = 2, /* no reply */ |
| 242 | FUSE_GETATTR = 3, |
Miklos Szeredi | 9e6268d | 2005-09-09 13:10:29 -0700 | [diff] [blame] | 243 | FUSE_SETATTR = 4, |
Miklos Szeredi | e5e5558 | 2005-09-09 13:10:28 -0700 | [diff] [blame] | 244 | FUSE_READLINK = 5, |
Miklos Szeredi | 9e6268d | 2005-09-09 13:10:29 -0700 | [diff] [blame] | 245 | FUSE_SYMLINK = 6, |
Miklos Szeredi | 9e6268d | 2005-09-09 13:10:29 -0700 | [diff] [blame] | 246 | FUSE_MKNOD = 8, |
| 247 | FUSE_MKDIR = 9, |
| 248 | FUSE_UNLINK = 10, |
| 249 | FUSE_RMDIR = 11, |
| 250 | FUSE_RENAME = 12, |
| 251 | FUSE_LINK = 13, |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 252 | FUSE_OPEN = 14, |
| 253 | FUSE_READ = 15, |
| 254 | FUSE_WRITE = 16, |
Miklos Szeredi | e5e5558 | 2005-09-09 13:10:28 -0700 | [diff] [blame] | 255 | FUSE_STATFS = 17, |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 256 | FUSE_RELEASE = 18, |
| 257 | FUSE_FSYNC = 20, |
Miklos Szeredi | 92a8780 | 2005-09-09 13:10:31 -0700 | [diff] [blame] | 258 | FUSE_SETXATTR = 21, |
| 259 | FUSE_GETXATTR = 22, |
| 260 | FUSE_LISTXATTR = 23, |
| 261 | FUSE_REMOVEXATTR = 24, |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 262 | FUSE_FLUSH = 25, |
Miklos Szeredi | 04730fe | 2005-09-09 13:10:36 -0700 | [diff] [blame] | 263 | FUSE_INIT = 26, |
| 264 | FUSE_OPENDIR = 27, |
| 265 | FUSE_READDIR = 28, |
Miklos Szeredi | 8254798 | 2005-09-09 13:10:38 -0700 | [diff] [blame] | 266 | FUSE_RELEASEDIR = 29, |
Miklos Szeredi | 31d40d7 | 2005-11-07 00:59:50 -0800 | [diff] [blame] | 267 | FUSE_FSYNCDIR = 30, |
Miklos Szeredi | 7142125 | 2006-06-25 05:48:52 -0700 | [diff] [blame] | 268 | FUSE_GETLK = 31, |
| 269 | FUSE_SETLK = 32, |
| 270 | FUSE_SETLKW = 33, |
Miklos Szeredi | fd72faa | 2005-11-07 00:59:51 -0800 | [diff] [blame] | 271 | FUSE_ACCESS = 34, |
Miklos Szeredi | a4d27e7 | 2006-06-25 05:48:54 -0700 | [diff] [blame] | 272 | FUSE_CREATE = 35, |
| 273 | FUSE_INTERRUPT = 36, |
Miklos Szeredi | b2d2272 | 2006-12-06 20:35:51 -0800 | [diff] [blame] | 274 | FUSE_BMAP = 37, |
Miklos Szeredi | 0ec7ca4 | 2006-12-06 20:35:52 -0800 | [diff] [blame] | 275 | FUSE_DESTROY = 38, |
Tejun Heo | 59efec7 | 2008-11-26 12:03:55 +0100 | [diff] [blame] | 276 | FUSE_IOCTL = 39, |
Tejun Heo | 95668a6 | 2008-11-26 12:03:55 +0100 | [diff] [blame] | 277 | FUSE_POLL = 40, |
Miklos Szeredi | 2d45ba3 | 2010-07-12 14:41:40 +0200 | [diff] [blame] | 278 | FUSE_NOTIFY_REPLY = 41, |
Miklos Szeredi | 02c048b | 2010-12-07 20:16:56 +0100 | [diff] [blame] | 279 | FUSE_BATCH_FORGET = 42, |
Tejun Heo | 151060a | 2009-04-14 10:54:54 +0900 | [diff] [blame] | 280 | |
| 281 | /* CUSE specific operations */ |
| 282 | CUSE_INIT = 4096, |
Miklos Szeredi | 334f485 | 2005-09-09 13:10:27 -0700 | [diff] [blame] | 283 | }; |
| 284 | |
Tejun Heo | 8599396 | 2008-11-26 12:03:55 +0100 | [diff] [blame] | 285 | enum fuse_notify_code { |
Tejun Heo | 95668a6 | 2008-11-26 12:03:55 +0100 | [diff] [blame] | 286 | FUSE_NOTIFY_POLL = 1, |
John Muir | 3b463ae | 2009-05-31 11:13:57 -0400 | [diff] [blame] | 287 | FUSE_NOTIFY_INVAL_INODE = 2, |
| 288 | FUSE_NOTIFY_INVAL_ENTRY = 3, |
Miklos Szeredi | a1d75f2 | 2010-07-12 14:41:40 +0200 | [diff] [blame] | 289 | FUSE_NOTIFY_STORE = 4, |
Miklos Szeredi | 2d45ba3 | 2010-07-12 14:41:40 +0200 | [diff] [blame] | 290 | FUSE_NOTIFY_RETRIEVE = 5, |
Tejun Heo | 8599396 | 2008-11-26 12:03:55 +0100 | [diff] [blame] | 291 | FUSE_NOTIFY_CODE_MAX, |
| 292 | }; |
| 293 | |
Miklos Szeredi | 1d3d752 | 2006-01-06 00:19:40 -0800 | [diff] [blame] | 294 | /* The read buffer is required to be at least 8k, but may be much larger */ |
| 295 | #define FUSE_MIN_READ_BUFFER 8192 |
Miklos Szeredi | e5e5558 | 2005-09-09 13:10:28 -0700 | [diff] [blame] | 296 | |
Miklos Szeredi | 0e9663e | 2007-10-18 03:07:05 -0700 | [diff] [blame] | 297 | #define FUSE_COMPAT_ENTRY_OUT_SIZE 120 |
| 298 | |
Miklos Szeredi | e5e5558 | 2005-09-09 13:10:28 -0700 | [diff] [blame] | 299 | struct fuse_entry_out { |
| 300 | __u64 nodeid; /* Inode ID */ |
| 301 | __u64 generation; /* Inode generation: nodeid:gen must |
| 302 | be unique for the fs's lifetime */ |
| 303 | __u64 entry_valid; /* Cache timeout for the name */ |
| 304 | __u64 attr_valid; /* Cache timeout for the attributes */ |
| 305 | __u32 entry_valid_nsec; |
| 306 | __u32 attr_valid_nsec; |
| 307 | struct fuse_attr attr; |
| 308 | }; |
| 309 | |
| 310 | struct fuse_forget_in { |
Miklos Szeredi | 9e6268d | 2005-09-09 13:10:29 -0700 | [diff] [blame] | 311 | __u64 nlookup; |
Miklos Szeredi | e5e5558 | 2005-09-09 13:10:28 -0700 | [diff] [blame] | 312 | }; |
| 313 | |
Miklos Szeredi | 02c048b | 2010-12-07 20:16:56 +0100 | [diff] [blame] | 314 | struct fuse_forget_one { |
| 315 | __u64 nodeid; |
| 316 | __u64 nlookup; |
| 317 | }; |
| 318 | |
| 319 | struct fuse_batch_forget_in { |
| 320 | __u32 count; |
| 321 | __u32 dummy; |
| 322 | }; |
| 323 | |
Miklos Szeredi | c79e322 | 2007-10-18 03:06:59 -0700 | [diff] [blame] | 324 | struct fuse_getattr_in { |
| 325 | __u32 getattr_flags; |
| 326 | __u32 dummy; |
| 327 | __u64 fh; |
| 328 | }; |
| 329 | |
Miklos Szeredi | 0e9663e | 2007-10-18 03:07:05 -0700 | [diff] [blame] | 330 | #define FUSE_COMPAT_ATTR_OUT_SIZE 96 |
| 331 | |
Miklos Szeredi | e5e5558 | 2005-09-09 13:10:28 -0700 | [diff] [blame] | 332 | struct fuse_attr_out { |
| 333 | __u64 attr_valid; /* Cache timeout for the attributes */ |
| 334 | __u32 attr_valid_nsec; |
| 335 | __u32 dummy; |
| 336 | struct fuse_attr attr; |
| 337 | }; |
| 338 | |
Miklos Szeredi | e0a43dd | 2009-06-30 20:12:23 +0200 | [diff] [blame] | 339 | #define FUSE_COMPAT_MKNOD_IN_SIZE 8 |
| 340 | |
Miklos Szeredi | 9e6268d | 2005-09-09 13:10:29 -0700 | [diff] [blame] | 341 | struct fuse_mknod_in { |
| 342 | __u32 mode; |
| 343 | __u32 rdev; |
Miklos Szeredi | e0a43dd | 2009-06-30 20:12:23 +0200 | [diff] [blame] | 344 | __u32 umask; |
| 345 | __u32 padding; |
Miklos Szeredi | 9e6268d | 2005-09-09 13:10:29 -0700 | [diff] [blame] | 346 | }; |
| 347 | |
| 348 | struct fuse_mkdir_in { |
| 349 | __u32 mode; |
Miklos Szeredi | e0a43dd | 2009-06-30 20:12:23 +0200 | [diff] [blame] | 350 | __u32 umask; |
Miklos Szeredi | 9e6268d | 2005-09-09 13:10:29 -0700 | [diff] [blame] | 351 | }; |
| 352 | |
| 353 | struct fuse_rename_in { |
| 354 | __u64 newdir; |
| 355 | }; |
| 356 | |
| 357 | struct fuse_link_in { |
| 358 | __u64 oldnodeid; |
| 359 | }; |
| 360 | |
| 361 | struct fuse_setattr_in { |
| 362 | __u32 valid; |
Miklos Szeredi | 0666326 | 2005-09-09 13:10:32 -0700 | [diff] [blame] | 363 | __u32 padding; |
Miklos Szeredi | befc649 | 2005-11-07 00:59:52 -0800 | [diff] [blame] | 364 | __u64 fh; |
| 365 | __u64 size; |
Miklos Szeredi | f333211 | 2007-10-18 03:07:04 -0700 | [diff] [blame] | 366 | __u64 lock_owner; |
Miklos Szeredi | befc649 | 2005-11-07 00:59:52 -0800 | [diff] [blame] | 367 | __u64 atime; |
| 368 | __u64 mtime; |
| 369 | __u64 unused2; |
| 370 | __u32 atimensec; |
| 371 | __u32 mtimensec; |
| 372 | __u32 unused3; |
| 373 | __u32 mode; |
| 374 | __u32 unused4; |
| 375 | __u32 uid; |
| 376 | __u32 gid; |
| 377 | __u32 unused5; |
Miklos Szeredi | 9e6268d | 2005-09-09 13:10:29 -0700 | [diff] [blame] | 378 | }; |
| 379 | |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 380 | struct fuse_open_in { |
| 381 | __u32 flags; |
Miklos Szeredi | e0a43dd | 2009-06-30 20:12:23 +0200 | [diff] [blame] | 382 | __u32 unused; |
| 383 | }; |
| 384 | |
| 385 | struct fuse_create_in { |
| 386 | __u32 flags; |
Miklos Szeredi | fd72faa | 2005-11-07 00:59:51 -0800 | [diff] [blame] | 387 | __u32 mode; |
Miklos Szeredi | e0a43dd | 2009-06-30 20:12:23 +0200 | [diff] [blame] | 388 | __u32 umask; |
| 389 | __u32 padding; |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 390 | }; |
| 391 | |
| 392 | struct fuse_open_out { |
| 393 | __u64 fh; |
| 394 | __u32 open_flags; |
Miklos Szeredi | 0666326 | 2005-09-09 13:10:32 -0700 | [diff] [blame] | 395 | __u32 padding; |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 396 | }; |
| 397 | |
| 398 | struct fuse_release_in { |
| 399 | __u64 fh; |
| 400 | __u32 flags; |
Miklos Szeredi | e9168c1 | 2006-12-06 20:35:38 -0800 | [diff] [blame] | 401 | __u32 release_flags; |
| 402 | __u64 lock_owner; |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 403 | }; |
| 404 | |
| 405 | struct fuse_flush_in { |
| 406 | __u64 fh; |
Miklos Szeredi | e9168c1 | 2006-12-06 20:35:38 -0800 | [diff] [blame] | 407 | __u32 unused; |
Miklos Szeredi | 0666326 | 2005-09-09 13:10:32 -0700 | [diff] [blame] | 408 | __u32 padding; |
Miklos Szeredi | 7142125 | 2006-06-25 05:48:52 -0700 | [diff] [blame] | 409 | __u64 lock_owner; |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 410 | }; |
| 411 | |
| 412 | struct fuse_read_in { |
| 413 | __u64 fh; |
| 414 | __u64 offset; |
| 415 | __u32 size; |
Miklos Szeredi | f333211 | 2007-10-18 03:07:04 -0700 | [diff] [blame] | 416 | __u32 read_flags; |
| 417 | __u64 lock_owner; |
Miklos Szeredi | a664309 | 2007-11-28 16:22:00 -0800 | [diff] [blame] | 418 | __u32 flags; |
| 419 | __u32 padding; |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 420 | }; |
| 421 | |
Miklos Szeredi | f333211 | 2007-10-18 03:07:04 -0700 | [diff] [blame] | 422 | #define FUSE_COMPAT_WRITE_IN_SIZE 24 |
| 423 | |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 424 | struct fuse_write_in { |
| 425 | __u64 fh; |
| 426 | __u64 offset; |
| 427 | __u32 size; |
| 428 | __u32 write_flags; |
Miklos Szeredi | f333211 | 2007-10-18 03:07:04 -0700 | [diff] [blame] | 429 | __u64 lock_owner; |
Miklos Szeredi | a664309 | 2007-11-28 16:22:00 -0800 | [diff] [blame] | 430 | __u32 flags; |
| 431 | __u32 padding; |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 432 | }; |
| 433 | |
| 434 | struct fuse_write_out { |
| 435 | __u32 size; |
Miklos Szeredi | 0666326 | 2005-09-09 13:10:32 -0700 | [diff] [blame] | 436 | __u32 padding; |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 437 | }; |
| 438 | |
Miklos Szeredi | de5f120 | 2006-01-06 00:19:37 -0800 | [diff] [blame] | 439 | #define FUSE_COMPAT_STATFS_SIZE 48 |
| 440 | |
Miklos Szeredi | e5e5558 | 2005-09-09 13:10:28 -0700 | [diff] [blame] | 441 | struct fuse_statfs_out { |
| 442 | struct fuse_kstatfs st; |
| 443 | }; |
| 444 | |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 445 | struct fuse_fsync_in { |
| 446 | __u64 fh; |
| 447 | __u32 fsync_flags; |
Miklos Szeredi | 0666326 | 2005-09-09 13:10:32 -0700 | [diff] [blame] | 448 | __u32 padding; |
Miklos Szeredi | b6aeade | 2005-09-09 13:10:30 -0700 | [diff] [blame] | 449 | }; |
| 450 | |
Miklos Szeredi | 92a8780 | 2005-09-09 13:10:31 -0700 | [diff] [blame] | 451 | struct fuse_setxattr_in { |
| 452 | __u32 size; |
| 453 | __u32 flags; |
| 454 | }; |
| 455 | |
| 456 | struct fuse_getxattr_in { |
| 457 | __u32 size; |
Miklos Szeredi | 0666326 | 2005-09-09 13:10:32 -0700 | [diff] [blame] | 458 | __u32 padding; |
Miklos Szeredi | 92a8780 | 2005-09-09 13:10:31 -0700 | [diff] [blame] | 459 | }; |
| 460 | |
| 461 | struct fuse_getxattr_out { |
| 462 | __u32 size; |
Miklos Szeredi | 0666326 | 2005-09-09 13:10:32 -0700 | [diff] [blame] | 463 | __u32 padding; |
Miklos Szeredi | 92a8780 | 2005-09-09 13:10:31 -0700 | [diff] [blame] | 464 | }; |
| 465 | |
Miklos Szeredi | 7142125 | 2006-06-25 05:48:52 -0700 | [diff] [blame] | 466 | struct fuse_lk_in { |
| 467 | __u64 fh; |
| 468 | __u64 owner; |
| 469 | struct fuse_file_lock lk; |
Miklos Szeredi | a9ff4f8 | 2007-10-18 03:07:02 -0700 | [diff] [blame] | 470 | __u32 lk_flags; |
| 471 | __u32 padding; |
Miklos Szeredi | 7142125 | 2006-06-25 05:48:52 -0700 | [diff] [blame] | 472 | }; |
| 473 | |
| 474 | struct fuse_lk_out { |
| 475 | struct fuse_file_lock lk; |
| 476 | }; |
| 477 | |
Miklos Szeredi | 31d40d7 | 2005-11-07 00:59:50 -0800 | [diff] [blame] | 478 | struct fuse_access_in { |
| 479 | __u32 mask; |
| 480 | __u32 padding; |
| 481 | }; |
| 482 | |
Miklos Szeredi | 3ec870d | 2006-01-06 00:19:41 -0800 | [diff] [blame] | 483 | struct fuse_init_in { |
Miklos Szeredi | 334f485 | 2005-09-09 13:10:27 -0700 | [diff] [blame] | 484 | __u32 major; |
| 485 | __u32 minor; |
Miklos Szeredi | 9cd6845 | 2006-02-01 03:04:40 -0800 | [diff] [blame] | 486 | __u32 max_readahead; |
| 487 | __u32 flags; |
Miklos Szeredi | 334f485 | 2005-09-09 13:10:27 -0700 | [diff] [blame] | 488 | }; |
| 489 | |
Miklos Szeredi | 3ec870d | 2006-01-06 00:19:41 -0800 | [diff] [blame] | 490 | struct fuse_init_out { |
| 491 | __u32 major; |
| 492 | __u32 minor; |
Miklos Szeredi | 9cd6845 | 2006-02-01 03:04:40 -0800 | [diff] [blame] | 493 | __u32 max_readahead; |
| 494 | __u32 flags; |
Csaba Henk | 7a6d3c8 | 2009-07-01 17:28:41 -0700 | [diff] [blame] | 495 | __u16 max_background; |
| 496 | __u16 congestion_threshold; |
Miklos Szeredi | 3ec870d | 2006-01-06 00:19:41 -0800 | [diff] [blame] | 497 | __u32 max_write; |
| 498 | }; |
| 499 | |
Tejun Heo | 151060a | 2009-04-14 10:54:54 +0900 | [diff] [blame] | 500 | #define CUSE_INIT_INFO_MAX 4096 |
| 501 | |
| 502 | struct cuse_init_in { |
| 503 | __u32 major; |
| 504 | __u32 minor; |
| 505 | __u32 unused; |
| 506 | __u32 flags; |
| 507 | }; |
| 508 | |
| 509 | struct cuse_init_out { |
| 510 | __u32 major; |
| 511 | __u32 minor; |
| 512 | __u32 unused; |
| 513 | __u32 flags; |
| 514 | __u32 max_read; |
| 515 | __u32 max_write; |
| 516 | __u32 dev_major; /* chardev major */ |
| 517 | __u32 dev_minor; /* chardev minor */ |
| 518 | __u32 spare[10]; |
| 519 | }; |
| 520 | |
Miklos Szeredi | a4d27e7 | 2006-06-25 05:48:54 -0700 | [diff] [blame] | 521 | struct fuse_interrupt_in { |
| 522 | __u64 unique; |
| 523 | }; |
| 524 | |
Miklos Szeredi | b2d2272 | 2006-12-06 20:35:51 -0800 | [diff] [blame] | 525 | struct fuse_bmap_in { |
| 526 | __u64 block; |
| 527 | __u32 blocksize; |
| 528 | __u32 padding; |
| 529 | }; |
| 530 | |
| 531 | struct fuse_bmap_out { |
| 532 | __u64 block; |
| 533 | }; |
| 534 | |
Tejun Heo | 59efec7 | 2008-11-26 12:03:55 +0100 | [diff] [blame] | 535 | struct fuse_ioctl_in { |
| 536 | __u64 fh; |
| 537 | __u32 flags; |
| 538 | __u32 cmd; |
| 539 | __u64 arg; |
| 540 | __u32 in_size; |
| 541 | __u32 out_size; |
| 542 | }; |
| 543 | |
Miklos Szeredi | 1baa26b | 2010-12-07 20:16:56 +0100 | [diff] [blame] | 544 | struct fuse_ioctl_iovec { |
| 545 | __u64 base; |
| 546 | __u64 len; |
| 547 | }; |
| 548 | |
Tejun Heo | 59efec7 | 2008-11-26 12:03:55 +0100 | [diff] [blame] | 549 | struct fuse_ioctl_out { |
| 550 | __s32 result; |
| 551 | __u32 flags; |
| 552 | __u32 in_iovs; |
| 553 | __u32 out_iovs; |
| 554 | }; |
| 555 | |
Tejun Heo | 95668a6 | 2008-11-26 12:03:55 +0100 | [diff] [blame] | 556 | struct fuse_poll_in { |
| 557 | __u64 fh; |
| 558 | __u64 kh; |
| 559 | __u32 flags; |
| 560 | __u32 padding; |
| 561 | }; |
| 562 | |
| 563 | struct fuse_poll_out { |
| 564 | __u32 revents; |
| 565 | __u32 padding; |
| 566 | }; |
| 567 | |
| 568 | struct fuse_notify_poll_wakeup_out { |
| 569 | __u64 kh; |
| 570 | }; |
| 571 | |
Miklos Szeredi | 334f485 | 2005-09-09 13:10:27 -0700 | [diff] [blame] | 572 | struct fuse_in_header { |
| 573 | __u32 len; |
| 574 | __u32 opcode; |
| 575 | __u64 unique; |
| 576 | __u64 nodeid; |
| 577 | __u32 uid; |
| 578 | __u32 gid; |
| 579 | __u32 pid; |
Miklos Szeredi | 0666326 | 2005-09-09 13:10:32 -0700 | [diff] [blame] | 580 | __u32 padding; |
Miklos Szeredi | 334f485 | 2005-09-09 13:10:27 -0700 | [diff] [blame] | 581 | }; |
| 582 | |
| 583 | struct fuse_out_header { |
| 584 | __u32 len; |
| 585 | __s32 error; |
| 586 | __u64 unique; |
| 587 | }; |
| 588 | |
Miklos Szeredi | e5e5558 | 2005-09-09 13:10:28 -0700 | [diff] [blame] | 589 | struct fuse_dirent { |
| 590 | __u64 ino; |
| 591 | __u64 off; |
| 592 | __u32 namelen; |
| 593 | __u32 type; |
| 594 | char name[0]; |
| 595 | }; |
| 596 | |
Andrew Morton | 21f3da9 | 2007-07-15 23:39:50 -0700 | [diff] [blame] | 597 | #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) |
Miklos Szeredi | e5e5558 | 2005-09-09 13:10:28 -0700 | [diff] [blame] | 598 | #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) |
| 599 | #define FUSE_DIRENT_SIZE(d) \ |
| 600 | FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) |
Tejun Heo | 29d434b | 2008-10-16 16:08:57 +0200 | [diff] [blame] | 601 | |
John Muir | 3b463ae | 2009-05-31 11:13:57 -0400 | [diff] [blame] | 602 | struct fuse_notify_inval_inode_out { |
| 603 | __u64 ino; |
| 604 | __s64 off; |
| 605 | __s64 len; |
| 606 | }; |
| 607 | |
| 608 | struct fuse_notify_inval_entry_out { |
| 609 | __u64 parent; |
| 610 | __u32 namelen; |
| 611 | __u32 padding; |
| 612 | }; |
| 613 | |
Miklos Szeredi | a1d75f2 | 2010-07-12 14:41:40 +0200 | [diff] [blame] | 614 | struct fuse_notify_store_out { |
| 615 | __u64 nodeid; |
| 616 | __u64 offset; |
| 617 | __u32 size; |
| 618 | __u32 padding; |
| 619 | }; |
| 620 | |
Miklos Szeredi | 2d45ba3 | 2010-07-12 14:41:40 +0200 | [diff] [blame] | 621 | struct fuse_notify_retrieve_out { |
| 622 | __u64 notify_unique; |
| 623 | __u64 nodeid; |
| 624 | __u64 offset; |
| 625 | __u32 size; |
| 626 | __u32 padding; |
| 627 | }; |
| 628 | |
| 629 | /* Matches the size of fuse_write_in */ |
| 630 | struct fuse_notify_retrieve_in { |
| 631 | __u64 dummy1; |
| 632 | __u64 offset; |
| 633 | __u32 size; |
| 634 | __u32 dummy2; |
| 635 | __u64 dummy3; |
| 636 | __u64 dummy4; |
| 637 | }; |
| 638 | |
Tejun Heo | 29d434b | 2008-10-16 16:08:57 +0200 | [diff] [blame] | 639 | #endif /* _LINUX_FUSE_H */ |