fuse  2.9.4
About: FUSE (Filesystem in Userspace) is a simple interface for userspace programs to export a virtual filesystem to the linux kernel.
  Fossies Dox: fuse-2.9.4.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

fuse_kernel.h
Go to the documentation of this file.
1 /*
2  This file defines the kernel interface of FUSE
3  Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
4 
5  This program can be distributed under the terms of the GNU GPL.
6  See the file COPYING.
7 
8  This -- and only this -- header file may also be distributed under
9  the terms of the BSD Licence as follows:
10 
11  Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved.
12 
13  Redistribution and use in source and binary forms, with or without
14  modification, are permitted provided that the following conditions
15  are met:
16  1. Redistributions of source code must retain the above copyright
17  notice, this list of conditions and the following disclaimer.
18  2. Redistributions in binary form must reproduce the above copyright
19  notice, this list of conditions and the following disclaimer in the
20  documentation and/or other materials provided with the distribution.
21 
22  THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
26  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  SUCH DAMAGE.
33 */
34 
35 /*
36  * This file defines the kernel interface of FUSE
37  *
38  * Protocol changelog:
39  *
40  * 7.9:
41  * - new fuse_getattr_in input argument of GETATTR
42  * - add lk_flags in fuse_lk_in
43  * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
44  * - add blksize field to fuse_attr
45  * - add file flags field to fuse_read_in and fuse_write_in
46  *
47  * 7.10
48  * - add nonseekable open flag
49  *
50  * 7.11
51  * - add IOCTL message
52  * - add unsolicited notification support
53  * - add POLL message and NOTIFY_POLL notification
54  *
55  * 7.12
56  * - add umask flag to input argument of open, mknod and mkdir
57  * - add notification messages for invalidation of inodes and
58  * directory entries
59  *
60  * 7.13
61  * - make max number of background requests and congestion threshold
62  * tunables
63  *
64  * 7.14
65  * - add splice support to fuse device
66  *
67  * 7.15
68  * - add store notify
69  * - add retrieve notify
70  *
71  * 7.16
72  * - add BATCH_FORGET request
73  * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
74  * fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
75  * - add FUSE_IOCTL_32BIT flag
76  *
77  * 7.17
78  * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
79  *
80  * 7.18
81  * - add FUSE_IOCTL_DIR flag
82  * - add FUSE_NOTIFY_DELETE
83  *
84  * 7.19
85  * - add FUSE_FALLOCATE
86  */
87 
88 #ifndef _LINUX_FUSE_H
89 #define _LINUX_FUSE_H
90 
91 #include <sys/types.h>
92 #define __u64 uint64_t
93 #define __s64 int64_t
94 #define __u32 uint32_t
95 #define __s32 int32_t
96 #define __u16 uint16_t
97 
98 /*
99  * Version negotiation:
100  *
101  * Both the kernel and userspace send the version they support in the
102  * INIT request and reply respectively.
103  *
104  * If the major versions match then both shall use the smallest
105  * of the two minor versions for communication.
106  *
107  * If the kernel supports a larger major version, then userspace shall
108  * reply with the major version it supports, ignore the rest of the
109  * INIT message and expect a new INIT message from the kernel with a
110  * matching major version.
111  *
112  * If the library supports a larger major version, then it shall fall
113  * back to the major protocol version sent by the kernel for
114  * communication and reply with that major version (and an arbitrary
115  * supported minor version).
116  */
117 
119 #define FUSE_KERNEL_VERSION 7
120 
122 #define FUSE_KERNEL_MINOR_VERSION 19
123 
125 #define FUSE_ROOT_ID 1
126 
127 /* Make sure all structures are padded to 64bit boundary, so 32bit
128  userspace works under 64bit kernels */
129 
130 struct fuse_attr {
147 };
148 
149 struct fuse_kstatfs {
160 };
161 
166  __u32 pid; /* tgid */
167 };
168 
172 #define FATTR_MODE (1 << 0)
173 #define FATTR_UID (1 << 1)
174 #define FATTR_GID (1 << 2)
175 #define FATTR_SIZE (1 << 3)
176 #define FATTR_ATIME (1 << 4)
177 #define FATTR_MTIME (1 << 5)
178 #define FATTR_FH (1 << 6)
179 #define FATTR_ATIME_NOW (1 << 7)
180 #define FATTR_MTIME_NOW (1 << 8)
181 #define FATTR_LOCKOWNER (1 << 9)
182 
190 #define FOPEN_DIRECT_IO (1 << 0)
191 #define FOPEN_KEEP_CACHE (1 << 1)
192 #define FOPEN_NONSEEKABLE (1 << 2)
193 
202 #define FUSE_ASYNC_READ (1 << 0)
203 #define FUSE_POSIX_LOCKS (1 << 1)
204 #define FUSE_FILE_OPS (1 << 2)
205 #define FUSE_ATOMIC_O_TRUNC (1 << 3)
206 #define FUSE_EXPORT_SUPPORT (1 << 4)
207 #define FUSE_BIG_WRITES (1 << 5)
208 #define FUSE_DONT_MASK (1 << 6)
209 #define FUSE_FLOCK_LOCKS (1 << 10)
210 
216 #define CUSE_UNRESTRICTED_IOCTL (1 << 0)
217 
221 #define FUSE_RELEASE_FLUSH (1 << 0)
222 #define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1)
223 
227 #define FUSE_GETATTR_FH (1 << 0)
228 
232 #define FUSE_LK_FLOCK (1 << 0)
233 
240 #define FUSE_WRITE_CACHE (1 << 0)
241 #define FUSE_WRITE_LOCKOWNER (1 << 1)
242 
246 #define FUSE_READ_LOCKOWNER (1 << 1)
247 
259 #define FUSE_IOCTL_COMPAT (1 << 0)
260 #define FUSE_IOCTL_UNRESTRICTED (1 << 1)
261 #define FUSE_IOCTL_RETRY (1 << 2)
262 #define FUSE_IOCTL_32BIT (1 << 3)
263 #define FUSE_IOCTL_DIR (1 << 4)
264 
265 #define FUSE_IOCTL_MAX_IOV 256
266 
272 #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
273 
276  FUSE_FORGET = 2, /* no reply */
286  FUSE_LINK = 13,
287  FUSE_OPEN = 14,
288  FUSE_READ = 15,
298  FUSE_INIT = 26,
309  FUSE_BMAP = 37,
312  FUSE_POLL = 40,
316 
317  /* CUSE specific operations */
318  CUSE_INIT = 4096,
319 };
320 
329 };
330 
331 /* The read buffer is required to be at least 8k, but may be much larger */
332 #define FUSE_MIN_READ_BUFFER 8192
333 
334 #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
335 
337  __u64 nodeid; /* Inode ID */
338  __u64 generation; /* Inode generation: nodeid:gen must
339  be unique for the fs's lifetime */
340  __u64 entry_valid; /* Cache timeout for the name */
341  __u64 attr_valid; /* Cache timeout for the attributes */
344  struct fuse_attr attr;
345 };
346 
349 };
350 
354 };
355 
359 };
360 
365 };
366 
367 #define FUSE_COMPAT_ATTR_OUT_SIZE 96
368 
370  __u64 attr_valid; /* Cache timeout for the attributes */
373  struct fuse_attr attr;
374 };
375 
376 #define FUSE_COMPAT_MKNOD_IN_SIZE 8
377 
383 };
384 
388 };
389 
392 };
393 
394 struct fuse_link_in {
396 };
397 
415 };
416 
417 struct fuse_open_in {
420 };
421 
427 };
428 
433 };
434 
440 };
441 
447 };
448 
449 struct fuse_read_in {
457 };
458 
459 #define FUSE_COMPAT_WRITE_IN_SIZE 24
460 
469 };
470 
474 };
475 
476 #define FUSE_COMPAT_STATFS_SIZE 48
477 
479  struct fuse_kstatfs st;
480 };
481 
486 };
487 
491 };
492 
496 };
497 
501 };
502 
503 struct fuse_lk_in {
509 };
510 
511 struct fuse_lk_out {
513 };
514 
518 };
519 
520 struct fuse_init_in {
525 };
526 
535 };
536 
537 #define CUSE_INIT_INFO_MAX 4096
538 
539 struct cuse_init_in {
544 };
545 
553  __u32 dev_major; /* chardev major */
554  __u32 dev_minor; /* chardev minor */
556 };
557 
560 };
561 
562 struct fuse_bmap_in {
566 };
567 
570 };
571 
579 };
580 
584 };
585 
591 };
592 
593 struct fuse_poll_in {
598 };
599 
603 };
604 
607 };
608 
615 };
616 
626 };
627 
632 };
633 
634 struct fuse_dirent {
639  char name[];
640 };
641 
642 #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
643 #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
644 #define FUSE_DIRENT_SIZE(d) \
645  FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
646 
651 };
652 
657 };
658 
664 };
665 
671 };
672 
679 };
680 
681 /* Matches the size of fuse_write_in */
689 };
690 
691 #endif /* _LINUX_FUSE_H */
__u32 read_flags
Definition: fuse_kernel.h:453
__u32 attr_valid_nsec
Definition: fuse_kernel.h:343
#define __s64
Definition: fuse_kernel.h:93
__u64 mtime
Definition: fuse_kernel.h:135
__u64 attr_valid
Definition: fuse_kernel.h:341
struct fuse_attr attr
Definition: fuse_kernel.h:373
struct fuse_file_lock lk
Definition: fuse_kernel.h:506
char name[]
Definition: fuse_kernel.h:639
__u32 namelen
Definition: fuse_kernel.h:637
__u64 owner
Definition: fuse_kernel.h:505
__u32 fsync_flags
Definition: fuse_kernel.h:484
__u32 lk_flags
Definition: fuse_kernel.h:507
struct fuse_file_lock lk
Definition: fuse_kernel.h:512
__u32 open_flags
Definition: fuse_kernel.h:431
__u32 gid
Definition: fuse_kernel.h:143
__u16 congestion_threshold
Definition: fuse_kernel.h:533
__u64 lock_owner
Definition: fuse_kernel.h:466
__u32 mode
Definition: fuse_kernel.h:140
__u32 padding
Definition: fuse_kernel.h:146
struct fuse_kstatfs st
Definition: fuse_kernel.h:479
__u32 padding
Definition: fuse_kernel.h:508
__u32 max_readahead
Definition: fuse_kernel.h:530
struct fuse_attr attr
Definition: fuse_kernel.h:344
__u32 atimensec
Definition: fuse_kernel.h:137
__u64 entry_valid
Definition: fuse_kernel.h:340
__u32 ctimensec
Definition: fuse_kernel.h:139
__u64 size
Definition: fuse_kernel.h:132
__u64 ctime
Definition: fuse_kernel.h:136
__u32 spare[10]
Definition: fuse_kernel.h:555
__u32 uid
Definition: fuse_kernel.h:142
__u32 padding
Definition: fuse_kernel.h:656
Definition: fuse_kernel.h:653
fuse_notify_code
Definition: fuse_kernel.h:321
__u32 attr_valid_nsec
Definition: fuse_kernel.h:371
__u32 blksize
Definition: fuse_kernel.h:145
__u64 ino
Definition: fuse_kernel.h:131
__u32 max_readahead
Definition: fuse_kernel.h:523
#define __s32
Definition: fuse_kernel.h:95
__u64 blocks
Definition: fuse_kernel.h:133
__u32 nlink
Definition: fuse_kernel.h:141
__u64 parent
Definition: fuse_kernel.h:654
__u64 nodeid
Definition: fuse_kernel.h:337
#define __u32
Definition: fuse_kernel.h:94
__u32 write_flags
Definition: fuse_kernel.h:465
__u64 lock_owner
Definition: fuse_kernel.h:454
__u32 spare[6]
Definition: fuse_kernel.h:159
__u64 lock_owner
Definition: fuse_kernel.h:446
__u16 max_background
Definition: fuse_kernel.h:532
__u32 rdev
Definition: fuse_kernel.h:144
__u32 namelen
Definition: fuse_kernel.h:655
__u32 mtimensec
Definition: fuse_kernel.h:138
__u64 atime
Definition: fuse_kernel.h:134
fuse_opcode
Definition: fuse_kernel.h:274
__u64 generation
Definition: fuse_kernel.h:338
#define __u16
Definition: fuse_kernel.h:96
__u64 attr_valid
Definition: fuse_kernel.h:370
#define __u64
Definition: fuse_kernel.h:92
__u32 entry_valid_nsec
Definition: fuse_kernel.h:342
Definition: fuse_kernel.h:336
__u32 blocksize
Definition: fuse_kernel.h:564