blob: 68619e9210b9308148bc788600940fcfd9f60a83 [file] [log] [blame]
Miklos Szeredid8a5ba42005-09-09 13:10:26 -07001/*
2 FUSE: Filesystem in Userspace
Miklos Szeredi1f55ed02008-12-01 19:14:02 +01003 Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
Miklos Szeredid8a5ba42005-09-09 13:10:26 -07004
5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING.
7*/
8
Miklos Szeredic79e3222007-10-18 03:06:59 -07009/*
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 Szeredia9ff4f82007-10-18 03:07:02 -070016 * - add lk_flags in fuse_lk_in
Miklos Szeredif3332112007-10-18 03:07:04 -070017 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
Miklos Szeredi0e9663e2007-10-18 03:07:05 -070018 * - add blksize field to fuse_attr
Miklos Szeredia6643092007-11-28 16:22:00 -080019 * - add file flags field to fuse_read_in and fuse_write_in
Tejun Heoa7c1b992008-10-16 16:08:57 +020020 *
21 * 7.10
22 * - add nonseekable open flag
Miklos Szeredi1f55ed02008-12-01 19:14:02 +010023 *
24 * 7.11
25 * - add IOCTL message
26 * - add unsolicited notification support
27 * - add POLL message and NOTIFY_POLL notification
Miklos Szeredie0a43dd2009-06-30 20:12:23 +020028 *
29 * 7.12
30 * - add umask flag to input argument of open, mknod and mkdir
John Muir3b463ae2009-05-31 11:13:57 -040031 * - add notification messages for invalidation of inodes and
32 * directory entries
Csaba Henk7a6d3c82009-07-01 17:28:41 -070033 *
34 * 7.13
35 * - make max number of background requests and congestion threshold
36 * tunables
Miklos Szeredidd3bb142010-05-25 15:06:06 +020037 *
38 * 7.14
39 * - add splice support to fuse device
Miklos Szeredia1d75f22010-07-12 14:41:40 +020040 *
41 * 7.15
42 * - add store notify
Miklos Szeredi2d45ba32010-07-12 14:41:40 +020043 * - add retrieve notify
Miklos Szeredi02c048b2010-12-07 20:16:56 +010044 *
45 * 7.16
46 * - add BATCH_FORGET request
Miklos Szeredi1baa26b2010-12-07 20:16:56 +010047 * - 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 Szeredi37fb3a32011-08-08 16:08:08 +020050 *
51 * 7.17
52 * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
Miklos Szeredib18da0c2011-12-13 11:58:49 +010053 *
54 * 7.18
55 * - add FUSE_IOCTL_DIR flag
John Muir451d0f52011-12-06 21:50:06 +010056 * - add FUSE_NOTIFY_DELETE
Anatol Pomozov05ba1f02012-04-22 18:45:24 -070057 *
58 * 7.19
59 * - add FUSE_FALLOCATE
Brian Foster72d0d242012-07-16 15:23:48 -040060 *
61 * 7.20
62 * - add FUSE_AUTO_INVAL_DATA
Miklos Szeredi23c153e2013-01-31 17:08:11 +010063 *
64 * 7.21
65 * - add FUSE_READDIRPLUS
Enke Chen0415d292013-02-04 16:14:32 +010066 * - send the requested events in POLL request
Miklos Szeredic79e3222007-10-18 03:06:59 -070067 */
Miklos Szeredid8a5ba42005-09-09 13:10:26 -070068
Tejun Heo29d434b2008-10-16 16:08:57 +020069#ifndef _LINUX_FUSE_H
70#define _LINUX_FUSE_H
71
Miklos Szeredi1f55ed02008-12-01 19:14:02 +010072#include <linux/types.h>
Miklos Szeredid8a5ba42005-09-09 13:10:26 -070073
Miklos Szeredi37d217f2009-07-08 18:17:58 +020074/*
75 * Version negotiation:
76 *
77 * Both the kernel and userspace send the version they support in the
78 * INIT request and reply respectively.
79 *
80 * If the major versions match then both shall use the smallest
81 * of the two minor versions for communication.
82 *
83 * If the kernel supports a larger major version, then userspace shall
84 * reply with the major version it supports, ignore the rest of the
85 * INIT message and expect a new INIT message from the kernel with a
86 * matching major version.
87 *
88 * If the library supports a larger major version, then it shall fall
89 * back to the major protocol version sent by the kernel for
90 * communication and reply with that major version (and an arbitrary
91 * supported minor version).
92 */
93
Miklos Szeredid8a5ba42005-09-09 13:10:26 -070094/** Version number of this interface */
Miklos Szeredi9e6268d2005-09-09 13:10:29 -070095#define FUSE_KERNEL_VERSION 7
Miklos Szeredid8a5ba42005-09-09 13:10:26 -070096
97/** Minor version number of this interface */
Miklos Szeredi23c153e2013-01-31 17:08:11 +010098#define FUSE_KERNEL_MINOR_VERSION 21
Miklos Szeredid8a5ba42005-09-09 13:10:26 -070099
100/** The node ID of the root inode */
101#define FUSE_ROOT_ID 1
102
Miklos Szeredi06663262005-09-09 13:10:32 -0700103/* Make sure all structures are padded to 64bit boundary, so 32bit
104 userspace works under 64bit kernels */
105
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700106struct fuse_attr {
107 __u64 ino;
108 __u64 size;
109 __u64 blocks;
110 __u64 atime;
111 __u64 mtime;
112 __u64 ctime;
113 __u32 atimensec;
114 __u32 mtimensec;
115 __u32 ctimensec;
116 __u32 mode;
117 __u32 nlink;
118 __u32 uid;
119 __u32 gid;
120 __u32 rdev;
Miklos Szeredi0e9663e2007-10-18 03:07:05 -0700121 __u32 blksize;
122 __u32 padding;
Miklos Szeredid8a5ba42005-09-09 13:10:26 -0700123};
124
Miklos Szeredie5e55582005-09-09 13:10:28 -0700125struct fuse_kstatfs {
126 __u64 blocks;
127 __u64 bfree;
128 __u64 bavail;
129 __u64 files;
130 __u64 ffree;
131 __u32 bsize;
132 __u32 namelen;
Miklos Szeredide5f1202006-01-06 00:19:37 -0800133 __u32 frsize;
134 __u32 padding;
135 __u32 spare[6];
Miklos Szeredie5e55582005-09-09 13:10:28 -0700136};
137
Miklos Szeredi71421252006-06-25 05:48:52 -0700138struct fuse_file_lock {
139 __u64 start;
140 __u64 end;
141 __u32 type;
142 __u32 pid; /* tgid */
143};
144
Miklos Szeredi9cd68452006-02-01 03:04:40 -0800145/**
146 * Bitmasks for fuse_setattr_in.valid
147 */
Miklos Szeredi9e6268d2005-09-09 13:10:29 -0700148#define FATTR_MODE (1 << 0)
149#define FATTR_UID (1 << 1)
150#define FATTR_GID (1 << 2)
151#define FATTR_SIZE (1 << 3)
152#define FATTR_ATIME (1 << 4)
153#define FATTR_MTIME (1 << 5)
Miklos Szeredibefc6492005-11-07 00:59:52 -0800154#define FATTR_FH (1 << 6)
Miklos Szeredi17637cb2007-10-18 03:07:01 -0700155#define FATTR_ATIME_NOW (1 << 7)
156#define FATTR_MTIME_NOW (1 << 8)
Miklos Szeredif3332112007-10-18 03:07:04 -0700157#define FATTR_LOCKOWNER (1 << 9)
Miklos Szeredi9e6268d2005-09-09 13:10:29 -0700158
Miklos Szeredi45323fb2005-09-09 13:10:37 -0700159/**
160 * Flags returned by the OPEN request
161 *
162 * FOPEN_DIRECT_IO: bypass page cache for this open file
163 * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
Tejun Heoa7c1b992008-10-16 16:08:57 +0200164 * FOPEN_NONSEEKABLE: the file is not seekable
Miklos Szeredi45323fb2005-09-09 13:10:37 -0700165 */
166#define FOPEN_DIRECT_IO (1 << 0)
167#define FOPEN_KEEP_CACHE (1 << 1)
Tejun Heoa7c1b992008-10-16 16:08:57 +0200168#define FOPEN_NONSEEKABLE (1 << 2)
Miklos Szeredi45323fb2005-09-09 13:10:37 -0700169
Miklos Szeredi9cd68452006-02-01 03:04:40 -0800170/**
171 * INIT request/reply flags
Miklos Szeredi33670fa2008-07-25 01:49:02 -0700172 *
Miklos Szeredif3840dc2012-07-18 16:09:40 +0200173 * FUSE_ASYNC_READ: asynchronous read requests
Miklos Szeredi37fb3a32011-08-08 16:08:08 +0200174 * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
Miklos Szeredif3840dc2012-07-18 16:09:40 +0200175 * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
176 * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
Miklos Szeredi33670fa2008-07-25 01:49:02 -0700177 * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
Miklos Szeredif3840dc2012-07-18 16:09:40 +0200178 * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
Miklos Szeredie0a43dd2009-06-30 20:12:23 +0200179 * FUSE_DONT_MASK: don't apply umask to file mode on create operations
Miklos Szeredi69fe05c2012-07-18 16:09:40 +0200180 * FUSE_SPLICE_WRITE: kernel supports splice write on the device
181 * FUSE_SPLICE_MOVE: kernel supports splice move on the device
182 * FUSE_SPLICE_READ: kernel supports splice read on the device
Miklos Szeredi37fb3a32011-08-08 16:08:08 +0200183 * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
Miklos Szeredi69fe05c2012-07-18 16:09:40 +0200184 * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
Brian Foster72d0d242012-07-16 15:23:48 -0400185 * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
Miklos Szeredi9cd68452006-02-01 03:04:40 -0800186 */
187#define FUSE_ASYNC_READ (1 << 0)
Miklos Szeredi71421252006-06-25 05:48:52 -0700188#define FUSE_POSIX_LOCKS (1 << 1)
Miklos Szeredic79e3222007-10-18 03:06:59 -0700189#define FUSE_FILE_OPS (1 << 2)
Miklos Szeredi6ff958e2007-10-18 03:07:02 -0700190#define FUSE_ATOMIC_O_TRUNC (1 << 3)
Miklos Szeredi33670fa2008-07-25 01:49:02 -0700191#define FUSE_EXPORT_SUPPORT (1 << 4)
Miklos Szeredi78bb6cb2008-05-12 14:02:32 -0700192#define FUSE_BIG_WRITES (1 << 5)
Miklos Szeredie0a43dd2009-06-30 20:12:23 +0200193#define FUSE_DONT_MASK (1 << 6)
Miklos Szeredi69fe05c2012-07-18 16:09:40 +0200194#define FUSE_SPLICE_WRITE (1 << 7)
195#define FUSE_SPLICE_MOVE (1 << 8)
196#define FUSE_SPLICE_READ (1 << 9)
Miklos Szeredi37fb3a32011-08-08 16:08:08 +0200197#define FUSE_FLOCK_LOCKS (1 << 10)
Miklos Szeredi69fe05c2012-07-18 16:09:40 +0200198#define FUSE_HAS_IOCTL_DIR (1 << 11)
Brian Foster72d0d242012-07-16 15:23:48 -0400199#define FUSE_AUTO_INVAL_DATA (1 << 12)
Anand V. Avati0b05b182012-08-19 08:53:23 -0400200#define FUSE_DO_READDIRPLUS (1 << 13)
Miklos Szeredi9cd68452006-02-01 03:04:40 -0800201
Miklos Szeredie9168c12006-12-06 20:35:38 -0800202/**
Tejun Heo151060a2009-04-14 10:54:54 +0900203 * CUSE INIT request/reply flags
204 *
205 * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl
206 */
207#define CUSE_UNRESTRICTED_IOCTL (1 << 0)
208
209/**
Miklos Szeredie9168c12006-12-06 20:35:38 -0800210 * Release flags
211 */
212#define FUSE_RELEASE_FLUSH (1 << 0)
Miklos Szeredi37fb3a32011-08-08 16:08:08 +0200213#define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1)
Miklos Szeredie9168c12006-12-06 20:35:38 -0800214
Miklos Szeredic79e3222007-10-18 03:06:59 -0700215/**
216 * Getattr flags
217 */
218#define FUSE_GETATTR_FH (1 << 0)
219
Miklos Szeredia9ff4f82007-10-18 03:07:02 -0700220/**
221 * Lock flags
222 */
223#define FUSE_LK_FLOCK (1 << 0)
224
Miklos Szeredib25e82e2007-10-18 03:07:03 -0700225/**
226 * WRITE flags
227 *
228 * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
Miklos Szeredif3332112007-10-18 03:07:04 -0700229 * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
Miklos Szeredib25e82e2007-10-18 03:07:03 -0700230 */
231#define FUSE_WRITE_CACHE (1 << 0)
Miklos Szeredif3332112007-10-18 03:07:04 -0700232#define FUSE_WRITE_LOCKOWNER (1 << 1)
233
234/**
235 * Read flags
236 */
237#define FUSE_READ_LOCKOWNER (1 << 1)
Miklos Szeredib25e82e2007-10-18 03:07:03 -0700238
Tejun Heo59efec72008-11-26 12:03:55 +0100239/**
240 * Ioctl flags
241 *
242 * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
243 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
244 * FUSE_IOCTL_RETRY: retry with new iovecs
Miklos Szeredi1baa26b2010-12-07 20:16:56 +0100245 * FUSE_IOCTL_32BIT: 32bit ioctl
Miklos Szeredib18da0c2011-12-13 11:58:49 +0100246 * FUSE_IOCTL_DIR: is a directory
Tejun Heo59efec72008-11-26 12:03:55 +0100247 *
248 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
249 */
250#define FUSE_IOCTL_COMPAT (1 << 0)
251#define FUSE_IOCTL_UNRESTRICTED (1 << 1)
252#define FUSE_IOCTL_RETRY (1 << 2)
Miklos Szeredi1baa26b2010-12-07 20:16:56 +0100253#define FUSE_IOCTL_32BIT (1 << 3)
Miklos Szeredib18da0c2011-12-13 11:58:49 +0100254#define FUSE_IOCTL_DIR (1 << 4)
Tejun Heo59efec72008-11-26 12:03:55 +0100255
256#define FUSE_IOCTL_MAX_IOV 256
257
Tejun Heo95668a62008-11-26 12:03:55 +0100258/**
259 * Poll flags
260 *
261 * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
262 */
263#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
264
Miklos Szeredi334f4852005-09-09 13:10:27 -0700265enum fuse_opcode {
Miklos Szeredie5e55582005-09-09 13:10:28 -0700266 FUSE_LOOKUP = 1,
267 FUSE_FORGET = 2, /* no reply */
268 FUSE_GETATTR = 3,
Miklos Szeredi9e6268d2005-09-09 13:10:29 -0700269 FUSE_SETATTR = 4,
Miklos Szeredie5e55582005-09-09 13:10:28 -0700270 FUSE_READLINK = 5,
Miklos Szeredi9e6268d2005-09-09 13:10:29 -0700271 FUSE_SYMLINK = 6,
Miklos Szeredi9e6268d2005-09-09 13:10:29 -0700272 FUSE_MKNOD = 8,
273 FUSE_MKDIR = 9,
274 FUSE_UNLINK = 10,
275 FUSE_RMDIR = 11,
276 FUSE_RENAME = 12,
277 FUSE_LINK = 13,
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700278 FUSE_OPEN = 14,
279 FUSE_READ = 15,
280 FUSE_WRITE = 16,
Miklos Szeredie5e55582005-09-09 13:10:28 -0700281 FUSE_STATFS = 17,
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700282 FUSE_RELEASE = 18,
283 FUSE_FSYNC = 20,
Miklos Szeredi92a87802005-09-09 13:10:31 -0700284 FUSE_SETXATTR = 21,
285 FUSE_GETXATTR = 22,
286 FUSE_LISTXATTR = 23,
287 FUSE_REMOVEXATTR = 24,
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700288 FUSE_FLUSH = 25,
Miklos Szeredi04730fe2005-09-09 13:10:36 -0700289 FUSE_INIT = 26,
290 FUSE_OPENDIR = 27,
291 FUSE_READDIR = 28,
Miklos Szeredi82547982005-09-09 13:10:38 -0700292 FUSE_RELEASEDIR = 29,
Miklos Szeredi31d40d72005-11-07 00:59:50 -0800293 FUSE_FSYNCDIR = 30,
Miklos Szeredi71421252006-06-25 05:48:52 -0700294 FUSE_GETLK = 31,
295 FUSE_SETLK = 32,
296 FUSE_SETLKW = 33,
Miklos Szeredifd72faa2005-11-07 00:59:51 -0800297 FUSE_ACCESS = 34,
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700298 FUSE_CREATE = 35,
299 FUSE_INTERRUPT = 36,
Miklos Szeredib2d22722006-12-06 20:35:51 -0800300 FUSE_BMAP = 37,
Miklos Szeredi0ec7ca42006-12-06 20:35:52 -0800301 FUSE_DESTROY = 38,
Tejun Heo59efec72008-11-26 12:03:55 +0100302 FUSE_IOCTL = 39,
Tejun Heo95668a62008-11-26 12:03:55 +0100303 FUSE_POLL = 40,
Miklos Szeredi2d45ba32010-07-12 14:41:40 +0200304 FUSE_NOTIFY_REPLY = 41,
Miklos Szeredi02c048b2010-12-07 20:16:56 +0100305 FUSE_BATCH_FORGET = 42,
Anatol Pomozov05ba1f02012-04-22 18:45:24 -0700306 FUSE_FALLOCATE = 43,
Anand V. Avati0b05b182012-08-19 08:53:23 -0400307 FUSE_READDIRPLUS = 44,
Tejun Heo151060a2009-04-14 10:54:54 +0900308
309 /* CUSE specific operations */
310 CUSE_INIT = 4096,
Miklos Szeredi334f4852005-09-09 13:10:27 -0700311};
312
Tejun Heo85993962008-11-26 12:03:55 +0100313enum fuse_notify_code {
Tejun Heo95668a62008-11-26 12:03:55 +0100314 FUSE_NOTIFY_POLL = 1,
John Muir3b463ae2009-05-31 11:13:57 -0400315 FUSE_NOTIFY_INVAL_INODE = 2,
316 FUSE_NOTIFY_INVAL_ENTRY = 3,
Miklos Szeredia1d75f22010-07-12 14:41:40 +0200317 FUSE_NOTIFY_STORE = 4,
Miklos Szeredi2d45ba32010-07-12 14:41:40 +0200318 FUSE_NOTIFY_RETRIEVE = 5,
John Muir451d0f52011-12-06 21:50:06 +0100319 FUSE_NOTIFY_DELETE = 6,
Tejun Heo85993962008-11-26 12:03:55 +0100320 FUSE_NOTIFY_CODE_MAX,
321};
322
Miklos Szeredi1d3d7522006-01-06 00:19:40 -0800323/* The read buffer is required to be at least 8k, but may be much larger */
324#define FUSE_MIN_READ_BUFFER 8192
Miklos Szeredie5e55582005-09-09 13:10:28 -0700325
Miklos Szeredi0e9663e2007-10-18 03:07:05 -0700326#define FUSE_COMPAT_ENTRY_OUT_SIZE 120
327
Miklos Szeredie5e55582005-09-09 13:10:28 -0700328struct fuse_entry_out {
329 __u64 nodeid; /* Inode ID */
330 __u64 generation; /* Inode generation: nodeid:gen must
331 be unique for the fs's lifetime */
332 __u64 entry_valid; /* Cache timeout for the name */
333 __u64 attr_valid; /* Cache timeout for the attributes */
334 __u32 entry_valid_nsec;
335 __u32 attr_valid_nsec;
336 struct fuse_attr attr;
337};
338
339struct fuse_forget_in {
Miklos Szeredi9e6268d2005-09-09 13:10:29 -0700340 __u64 nlookup;
Miklos Szeredie5e55582005-09-09 13:10:28 -0700341};
342
Miklos Szeredi02c048b2010-12-07 20:16:56 +0100343struct fuse_forget_one {
344 __u64 nodeid;
345 __u64 nlookup;
346};
347
348struct fuse_batch_forget_in {
349 __u32 count;
350 __u32 dummy;
351};
352
Miklos Szeredic79e3222007-10-18 03:06:59 -0700353struct fuse_getattr_in {
354 __u32 getattr_flags;
355 __u32 dummy;
356 __u64 fh;
357};
358
Miklos Szeredi0e9663e2007-10-18 03:07:05 -0700359#define FUSE_COMPAT_ATTR_OUT_SIZE 96
360
Miklos Szeredie5e55582005-09-09 13:10:28 -0700361struct fuse_attr_out {
362 __u64 attr_valid; /* Cache timeout for the attributes */
363 __u32 attr_valid_nsec;
364 __u32 dummy;
365 struct fuse_attr attr;
366};
367
Miklos Szeredie0a43dd2009-06-30 20:12:23 +0200368#define FUSE_COMPAT_MKNOD_IN_SIZE 8
369
Miklos Szeredi9e6268d2005-09-09 13:10:29 -0700370struct fuse_mknod_in {
371 __u32 mode;
372 __u32 rdev;
Miklos Szeredie0a43dd2009-06-30 20:12:23 +0200373 __u32 umask;
374 __u32 padding;
Miklos Szeredi9e6268d2005-09-09 13:10:29 -0700375};
376
377struct fuse_mkdir_in {
378 __u32 mode;
Miklos Szeredie0a43dd2009-06-30 20:12:23 +0200379 __u32 umask;
Miklos Szeredi9e6268d2005-09-09 13:10:29 -0700380};
381
382struct fuse_rename_in {
383 __u64 newdir;
384};
385
386struct fuse_link_in {
387 __u64 oldnodeid;
388};
389
390struct fuse_setattr_in {
391 __u32 valid;
Miklos Szeredi06663262005-09-09 13:10:32 -0700392 __u32 padding;
Miklos Szeredibefc6492005-11-07 00:59:52 -0800393 __u64 fh;
394 __u64 size;
Miklos Szeredif3332112007-10-18 03:07:04 -0700395 __u64 lock_owner;
Miklos Szeredibefc6492005-11-07 00:59:52 -0800396 __u64 atime;
397 __u64 mtime;
398 __u64 unused2;
399 __u32 atimensec;
400 __u32 mtimensec;
401 __u32 unused3;
402 __u32 mode;
403 __u32 unused4;
404 __u32 uid;
405 __u32 gid;
406 __u32 unused5;
Miklos Szeredi9e6268d2005-09-09 13:10:29 -0700407};
408
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700409struct fuse_open_in {
410 __u32 flags;
Miklos Szeredie0a43dd2009-06-30 20:12:23 +0200411 __u32 unused;
412};
413
414struct fuse_create_in {
415 __u32 flags;
Miklos Szeredifd72faa2005-11-07 00:59:51 -0800416 __u32 mode;
Miklos Szeredie0a43dd2009-06-30 20:12:23 +0200417 __u32 umask;
418 __u32 padding;
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700419};
420
421struct fuse_open_out {
422 __u64 fh;
423 __u32 open_flags;
Miklos Szeredi06663262005-09-09 13:10:32 -0700424 __u32 padding;
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700425};
426
427struct fuse_release_in {
428 __u64 fh;
429 __u32 flags;
Miklos Szeredie9168c12006-12-06 20:35:38 -0800430 __u32 release_flags;
431 __u64 lock_owner;
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700432};
433
434struct fuse_flush_in {
435 __u64 fh;
Miklos Szeredie9168c12006-12-06 20:35:38 -0800436 __u32 unused;
Miklos Szeredi06663262005-09-09 13:10:32 -0700437 __u32 padding;
Miklos Szeredi71421252006-06-25 05:48:52 -0700438 __u64 lock_owner;
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700439};
440
441struct fuse_read_in {
442 __u64 fh;
443 __u64 offset;
444 __u32 size;
Miklos Szeredif3332112007-10-18 03:07:04 -0700445 __u32 read_flags;
446 __u64 lock_owner;
Miklos Szeredia6643092007-11-28 16:22:00 -0800447 __u32 flags;
448 __u32 padding;
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700449};
450
Miklos Szeredif3332112007-10-18 03:07:04 -0700451#define FUSE_COMPAT_WRITE_IN_SIZE 24
452
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700453struct fuse_write_in {
454 __u64 fh;
455 __u64 offset;
456 __u32 size;
457 __u32 write_flags;
Miklos Szeredif3332112007-10-18 03:07:04 -0700458 __u64 lock_owner;
Miklos Szeredia6643092007-11-28 16:22:00 -0800459 __u32 flags;
460 __u32 padding;
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700461};
462
463struct fuse_write_out {
464 __u32 size;
Miklos Szeredi06663262005-09-09 13:10:32 -0700465 __u32 padding;
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700466};
467
Miklos Szeredide5f1202006-01-06 00:19:37 -0800468#define FUSE_COMPAT_STATFS_SIZE 48
469
Miklos Szeredie5e55582005-09-09 13:10:28 -0700470struct fuse_statfs_out {
471 struct fuse_kstatfs st;
472};
473
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700474struct fuse_fsync_in {
475 __u64 fh;
476 __u32 fsync_flags;
Miklos Szeredi06663262005-09-09 13:10:32 -0700477 __u32 padding;
Miklos Szeredib6aeade2005-09-09 13:10:30 -0700478};
479
Miklos Szeredi92a87802005-09-09 13:10:31 -0700480struct fuse_setxattr_in {
481 __u32 size;
482 __u32 flags;
483};
484
485struct fuse_getxattr_in {
486 __u32 size;
Miklos Szeredi06663262005-09-09 13:10:32 -0700487 __u32 padding;
Miklos Szeredi92a87802005-09-09 13:10:31 -0700488};
489
490struct fuse_getxattr_out {
491 __u32 size;
Miklos Szeredi06663262005-09-09 13:10:32 -0700492 __u32 padding;
Miklos Szeredi92a87802005-09-09 13:10:31 -0700493};
494
Miklos Szeredi71421252006-06-25 05:48:52 -0700495struct fuse_lk_in {
496 __u64 fh;
497 __u64 owner;
498 struct fuse_file_lock lk;
Miklos Szeredia9ff4f82007-10-18 03:07:02 -0700499 __u32 lk_flags;
500 __u32 padding;
Miklos Szeredi71421252006-06-25 05:48:52 -0700501};
502
503struct fuse_lk_out {
504 struct fuse_file_lock lk;
505};
506
Miklos Szeredi31d40d72005-11-07 00:59:50 -0800507struct fuse_access_in {
508 __u32 mask;
509 __u32 padding;
510};
511
Miklos Szeredi3ec870d2006-01-06 00:19:41 -0800512struct fuse_init_in {
Miklos Szeredi334f4852005-09-09 13:10:27 -0700513 __u32 major;
514 __u32 minor;
Miklos Szeredi9cd68452006-02-01 03:04:40 -0800515 __u32 max_readahead;
516 __u32 flags;
Miklos Szeredi334f4852005-09-09 13:10:27 -0700517};
518
Miklos Szeredi3ec870d2006-01-06 00:19:41 -0800519struct fuse_init_out {
520 __u32 major;
521 __u32 minor;
Miklos Szeredi9cd68452006-02-01 03:04:40 -0800522 __u32 max_readahead;
523 __u32 flags;
Csaba Henk7a6d3c82009-07-01 17:28:41 -0700524 __u16 max_background;
525 __u16 congestion_threshold;
Miklos Szeredi3ec870d2006-01-06 00:19:41 -0800526 __u32 max_write;
527};
528
Tejun Heo151060a2009-04-14 10:54:54 +0900529#define CUSE_INIT_INFO_MAX 4096
530
531struct cuse_init_in {
532 __u32 major;
533 __u32 minor;
534 __u32 unused;
535 __u32 flags;
536};
537
538struct cuse_init_out {
539 __u32 major;
540 __u32 minor;
541 __u32 unused;
542 __u32 flags;
543 __u32 max_read;
544 __u32 max_write;
545 __u32 dev_major; /* chardev major */
546 __u32 dev_minor; /* chardev minor */
547 __u32 spare[10];
548};
549
Miklos Szeredia4d27e72006-06-25 05:48:54 -0700550struct fuse_interrupt_in {
551 __u64 unique;
552};
553
Miklos Szeredib2d22722006-12-06 20:35:51 -0800554struct fuse_bmap_in {
555 __u64 block;
556 __u32 blocksize;
557 __u32 padding;
558};
559
560struct fuse_bmap_out {
561 __u64 block;
562};
563
Tejun Heo59efec72008-11-26 12:03:55 +0100564struct fuse_ioctl_in {
565 __u64 fh;
566 __u32 flags;
567 __u32 cmd;
568 __u64 arg;
569 __u32 in_size;
570 __u32 out_size;
571};
572
Miklos Szeredi1baa26b2010-12-07 20:16:56 +0100573struct fuse_ioctl_iovec {
574 __u64 base;
575 __u64 len;
576};
577
Tejun Heo59efec72008-11-26 12:03:55 +0100578struct fuse_ioctl_out {
579 __s32 result;
580 __u32 flags;
581 __u32 in_iovs;
582 __u32 out_iovs;
583};
584
Tejun Heo95668a62008-11-26 12:03:55 +0100585struct fuse_poll_in {
586 __u64 fh;
587 __u64 kh;
588 __u32 flags;
Enke Chen0415d292013-02-04 16:14:32 +0100589 __u32 events;
Tejun Heo95668a62008-11-26 12:03:55 +0100590};
591
592struct fuse_poll_out {
593 __u32 revents;
594 __u32 padding;
595};
596
597struct fuse_notify_poll_wakeup_out {
598 __u64 kh;
599};
600
Anatol Pomozov05ba1f02012-04-22 18:45:24 -0700601struct fuse_fallocate_in {
602 __u64 fh;
603 __u64 offset;
604 __u64 length;
605 __u32 mode;
606 __u32 padding;
607};
608
Miklos Szeredi334f4852005-09-09 13:10:27 -0700609struct fuse_in_header {
610 __u32 len;
611 __u32 opcode;
612 __u64 unique;
613 __u64 nodeid;
614 __u32 uid;
615 __u32 gid;
616 __u32 pid;
Miklos Szeredi06663262005-09-09 13:10:32 -0700617 __u32 padding;
Miklos Szeredi334f4852005-09-09 13:10:27 -0700618};
619
620struct fuse_out_header {
621 __u32 len;
622 __s32 error;
623 __u64 unique;
624};
625
Miklos Szeredie5e55582005-09-09 13:10:28 -0700626struct fuse_dirent {
627 __u64 ino;
628 __u64 off;
629 __u32 namelen;
630 __u32 type;
Miklos Szeredic628ee62012-04-12 12:57:08 +0200631 char name[];
Miklos Szeredie5e55582005-09-09 13:10:28 -0700632};
633
Andrew Morton21f3da92007-07-15 23:39:50 -0700634#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
Miklos Szeredie5e55582005-09-09 13:10:28 -0700635#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
636#define FUSE_DIRENT_SIZE(d) \
637 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
Tejun Heo29d434b2008-10-16 16:08:57 +0200638
Anand V. Avati0b05b182012-08-19 08:53:23 -0400639struct fuse_direntplus {
640 struct fuse_entry_out entry_out;
641 struct fuse_dirent dirent;
642};
643
644#define FUSE_NAME_OFFSET_DIRENTPLUS \
645 offsetof(struct fuse_direntplus, dirent.name)
646#define FUSE_DIRENTPLUS_SIZE(d) \
647 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
648
John Muir3b463ae2009-05-31 11:13:57 -0400649struct fuse_notify_inval_inode_out {
650 __u64 ino;
651 __s64 off;
652 __s64 len;
653};
654
655struct fuse_notify_inval_entry_out {
656 __u64 parent;
657 __u32 namelen;
658 __u32 padding;
659};
660
John Muir451d0f52011-12-06 21:50:06 +0100661struct fuse_notify_delete_out {
662 __u64 parent;
663 __u64 child;
664 __u32 namelen;
665 __u32 padding;
666};
667
Miklos Szeredia1d75f22010-07-12 14:41:40 +0200668struct fuse_notify_store_out {
669 __u64 nodeid;
670 __u64 offset;
671 __u32 size;
672 __u32 padding;
673};
674
Miklos Szeredi2d45ba32010-07-12 14:41:40 +0200675struct fuse_notify_retrieve_out {
676 __u64 notify_unique;
677 __u64 nodeid;
678 __u64 offset;
679 __u32 size;
680 __u32 padding;
681};
682
683/* Matches the size of fuse_write_in */
684struct fuse_notify_retrieve_in {
685 __u64 dummy1;
686 __u64 offset;
687 __u32 size;
688 __u32 dummy2;
689 __u64 dummy3;
690 __u64 dummy4;
691};
692
Tejun Heo29d434b2008-10-16 16:08:57 +0200693#endif /* _LINUX_FUSE_H */