2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
5 This program can be distributed under the terms of the GNU GPL.
10 * This file defines the kernel interface of FUSE
15 * - new fuse_getattr_in input argument of GETATTR
16 * - add lk_flags in fuse_lk_in
17 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
18 * - add blksize field to fuse_attr
19 * - add file flags field to fuse_read_in and fuse_write_in
22 * - add nonseekable open flag
26 * - add unsolicited notification support
27 * - add POLL message and NOTIFY_POLL notification
30 * - add umask flag to input argument of open, mknod and mkdir
31 * - add notification messages for invalidation of inodes and
38 #include <linux/types.h>
40 /** Version number of this interface */
41 #define FUSE_KERNEL_VERSION 7
43 /** Minor version number of this interface */
44 #define FUSE_KERNEL_MINOR_VERSION 12
46 /** The node ID of the root inode */
47 #define FUSE_ROOT_ID 1
49 /* Make sure all structures are padded to 64bit boundary, so 32bit
50 userspace works under 64bit kernels */
84 struct fuse_file_lock {
92 * Bitmasks for fuse_setattr_in.valid
94 #define FATTR_MODE (1 << 0)
95 #define FATTR_UID (1 << 1)
96 #define FATTR_GID (1 << 2)
97 #define FATTR_SIZE (1 << 3)
98 #define FATTR_ATIME (1 << 4)
99 #define FATTR_MTIME (1 << 5)
100 #define FATTR_FH (1 << 6)
101 #define FATTR_ATIME_NOW (1 << 7)
102 #define FATTR_MTIME_NOW (1 << 8)
103 #define FATTR_LOCKOWNER (1 << 9)
106 * Flags returned by the OPEN request
108 * FOPEN_DIRECT_IO: bypass page cache for this open file
109 * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
110 * FOPEN_NONSEEKABLE: the file is not seekable
112 #define FOPEN_DIRECT_IO (1 << 0)
113 #define FOPEN_KEEP_CACHE (1 << 1)
114 #define FOPEN_NONSEEKABLE (1 << 2)
117 * INIT request/reply flags
119 * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
120 * FUSE_DONT_MASK: don't apply umask to file mode on create operations
122 #define FUSE_ASYNC_READ (1 << 0)
123 #define FUSE_POSIX_LOCKS (1 << 1)
124 #define FUSE_FILE_OPS (1 << 2)
125 #define FUSE_ATOMIC_O_TRUNC (1 << 3)
126 #define FUSE_EXPORT_SUPPORT (1 << 4)
127 #define FUSE_BIG_WRITES (1 << 5)
128 #define FUSE_DONT_MASK (1 << 6)
131 * CUSE INIT request/reply flags
133 * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl
135 #define CUSE_UNRESTRICTED_IOCTL (1 << 0)
140 #define FUSE_RELEASE_FLUSH (1 << 0)
145 #define FUSE_GETATTR_FH (1 << 0)
150 #define FUSE_LK_FLOCK (1 << 0)
155 * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
156 * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
158 #define FUSE_WRITE_CACHE (1 << 0)
159 #define FUSE_WRITE_LOCKOWNER (1 << 1)
164 #define FUSE_READ_LOCKOWNER (1 << 1)
169 * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
170 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
171 * FUSE_IOCTL_RETRY: retry with new iovecs
173 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
175 #define FUSE_IOCTL_COMPAT (1 << 0)
176 #define FUSE_IOCTL_UNRESTRICTED (1 << 1)
177 #define FUSE_IOCTL_RETRY (1 << 2)
179 #define FUSE_IOCTL_MAX_IOV 256
184 * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
186 #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
190 FUSE_FORGET = 2, /* no reply */
210 FUSE_REMOVEXATTR = 24,
215 FUSE_RELEASEDIR = 29,
228 /* CUSE specific operations */
232 enum fuse_notify_code {
233 FUSE_NOTIFY_POLL = 1,
234 FUSE_NOTIFY_INVAL_INODE = 2,
235 FUSE_NOTIFY_INVAL_ENTRY = 3,
236 FUSE_NOTIFY_CODE_MAX,
239 /* The read buffer is required to be at least 8k, but may be much larger */
240 #define FUSE_MIN_READ_BUFFER 8192
242 #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
244 struct fuse_entry_out {
245 __u64 nodeid; /* Inode ID */
246 __u64 generation; /* Inode generation: nodeid:gen must
247 be unique for the fs's lifetime */
248 __u64 entry_valid; /* Cache timeout for the name */
249 __u64 attr_valid; /* Cache timeout for the attributes */
250 __u32 entry_valid_nsec;
251 __u32 attr_valid_nsec;
252 struct fuse_attr attr;
255 struct fuse_forget_in {
259 struct fuse_getattr_in {
265 #define FUSE_COMPAT_ATTR_OUT_SIZE 96
267 struct fuse_attr_out {
268 __u64 attr_valid; /* Cache timeout for the attributes */
269 __u32 attr_valid_nsec;
271 struct fuse_attr attr;
274 #define FUSE_COMPAT_MKNOD_IN_SIZE 8
276 struct fuse_mknod_in {
283 struct fuse_mkdir_in {
288 struct fuse_rename_in {
292 struct fuse_link_in {
296 struct fuse_setattr_in {
315 struct fuse_open_in {
320 struct fuse_create_in {
327 struct fuse_open_out {
333 struct fuse_release_in {
340 struct fuse_flush_in {
347 struct fuse_read_in {
357 #define FUSE_COMPAT_WRITE_IN_SIZE 24
359 struct fuse_write_in {
369 struct fuse_write_out {
374 #define FUSE_COMPAT_STATFS_SIZE 48
376 struct fuse_statfs_out {
377 struct fuse_kstatfs st;
380 struct fuse_fsync_in {
386 struct fuse_setxattr_in {
391 struct fuse_getxattr_in {
396 struct fuse_getxattr_out {
404 struct fuse_file_lock lk;
410 struct fuse_file_lock lk;
413 struct fuse_access_in {
418 struct fuse_init_in {
425 struct fuse_init_out {
434 #define CUSE_INIT_INFO_MAX 4096
436 struct cuse_init_in {
443 struct cuse_init_out {
450 __u32 dev_major; /* chardev major */
451 __u32 dev_minor; /* chardev minor */
455 struct fuse_interrupt_in {
459 struct fuse_bmap_in {
465 struct fuse_bmap_out {
469 struct fuse_ioctl_in {
478 struct fuse_ioctl_out {
485 struct fuse_poll_in {
492 struct fuse_poll_out {
497 struct fuse_notify_poll_wakeup_out {
501 struct fuse_in_header {
512 struct fuse_out_header {
526 #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
527 #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
528 #define FUSE_DIRENT_SIZE(d) \
529 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
531 struct fuse_notify_inval_inode_out {
537 struct fuse_notify_inval_entry_out {
543 #endif /* _LINUX_FUSE_H */