2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
5 This program can be distributed under the terms of the GNU GPL.
10 This -- and only this -- header file may also be distributed under
11 the terms of the BSD Licence as follows:
13 Copyright (C) 2005 Miklos Szeredi. All rights reserved.
15 Redistribution and use in source and binary forms, with or without
16 modification, are permitted provided that the following conditions
18 1. Redistributions of source code must retain the above copyright
19 notice, this list of conditions and the following disclaimer.
20 2. Redistributions in binary form must reproduce the above copyright
21 notice, this list of conditions and the following disclaimer in the
22 documentation and/or other materials provided with the distribution.
24 THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
25 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
28 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 /* This file defines the kernel interface of FUSE */
39 #include <asm/types.h>
41 /** Version number of this interface */
42 #define FUSE_KERNEL_VERSION 7
44 /** Minor version number of this interface */
45 #define FUSE_KERNEL_MINOR_VERSION 2
47 /** The node ID of the root inode */
48 #define FUSE_ROOT_ID 1
50 /** The major number of the fuse character device */
53 /** The minor number of the fuse character device */
54 #define FUSE_MINOR 229
56 /* Make sure all structures are padded to 64bit boundary, so 32bit
57 userspace works under 64bit kernels */
86 #define FATTR_MODE (1 << 0)
87 #define FATTR_UID (1 << 1)
88 #define FATTR_GID (1 << 2)
89 #define FATTR_SIZE (1 << 3)
90 #define FATTR_ATIME (1 << 4)
91 #define FATTR_MTIME (1 << 5)
92 #define FATTR_CTIME (1 << 6)
95 * Flags returned by the OPEN request
97 * FOPEN_DIRECT_IO: bypass page cache for this open file
98 * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
100 #define FOPEN_DIRECT_IO (1 << 0)
101 #define FOPEN_KEEP_CACHE (1 << 1)
105 FUSE_FORGET
= 2, /* no reply */
125 FUSE_REMOVEXATTR
= 24,
130 FUSE_RELEASEDIR
= 29,
134 /* Conservative buffer size for the client */
135 #define FUSE_MAX_IN 8192
137 #define FUSE_NAME_MAX 1024
138 #define FUSE_SYMLINK_MAX 4096
139 #define FUSE_XATTR_SIZE_MAX 4096
141 struct fuse_entry_out
{
142 __u64 nodeid
; /* Inode ID */
143 __u64 generation
; /* Inode generation: nodeid:gen must
144 be unique for the fs's lifetime */
145 __u64 entry_valid
; /* Cache timeout for the name */
146 __u64 attr_valid
; /* Cache timeout for the attributes */
147 __u32 entry_valid_nsec
;
148 __u32 attr_valid_nsec
;
149 struct fuse_attr attr
;
152 struct fuse_forget_in
{
156 struct fuse_attr_out
{
157 __u64 attr_valid
; /* Cache timeout for the attributes */
158 __u32 attr_valid_nsec
;
160 struct fuse_attr attr
;
163 struct fuse_mknod_in
{
168 struct fuse_mkdir_in
{
173 struct fuse_rename_in
{
177 struct fuse_link_in
{
181 struct fuse_setattr_in
{
184 struct fuse_attr attr
;
187 struct fuse_open_in
{
192 struct fuse_open_out
{
198 struct fuse_release_in
{
204 struct fuse_flush_in
{
210 struct fuse_read_in
{
217 struct fuse_write_in
{
224 struct fuse_write_out
{
229 struct fuse_statfs_out
{
230 struct fuse_kstatfs st
;
233 struct fuse_fsync_in
{
239 struct fuse_setxattr_in
{
244 struct fuse_getxattr_in
{
249 struct fuse_getxattr_out
{
254 struct fuse_init_in_out
{
259 struct fuse_in_header
{
270 struct fuse_out_header
{
284 #define FUSE_NAME_OFFSET ((unsigned) ((struct fuse_dirent *) 0)->name)
285 #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
286 #define FUSE_DIRENT_SIZE(d) \
287 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)