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