1 |
dpavlin |
4 |
/* |
2 |
|
|
FUSE: Filesystem in Userspace |
3 |
|
|
Copyright (C) 2001-2004 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 |
|
|
|
9 |
|
|
/* This file defines the kernel interface of FUSE */ |
10 |
|
|
|
11 |
|
|
/** Version number of this interface */ |
12 |
|
|
#define FUSE_KERNEL_VERSION 3 |
13 |
|
|
|
14 |
|
|
/** Minor version number of this interface */ |
15 |
|
|
#define FUSE_KERNEL_MINOR_VERSION 1 |
16 |
|
|
|
17 |
|
|
/** The inode number of the root indode */ |
18 |
|
|
#define FUSE_ROOT_INO 1 |
19 |
|
|
|
20 |
|
|
/** Opening this will yield a new control file */ |
21 |
|
|
#define FUSE_DEV "/proc/fs/fuse/dev" |
22 |
|
|
|
23 |
|
|
/** The file containing the version in the form MAJOR.MINOR */ |
24 |
|
|
#define FUSE_VERSION_FILE "/proc/fs/fuse/version" |
25 |
|
|
|
26 |
|
|
struct fuse_attr { |
27 |
|
|
unsigned int mode; |
28 |
|
|
unsigned int nlink; |
29 |
|
|
unsigned int uid; |
30 |
|
|
unsigned int gid; |
31 |
|
|
unsigned int rdev; |
32 |
|
|
unsigned long long size; |
33 |
|
|
unsigned long blocks; |
34 |
|
|
unsigned long atime; |
35 |
|
|
unsigned long atimensec; |
36 |
|
|
unsigned long mtime; |
37 |
|
|
unsigned long mtimensec; |
38 |
|
|
unsigned long ctime; |
39 |
|
|
unsigned long ctimensec; |
40 |
|
|
}; |
41 |
|
|
|
42 |
|
|
struct fuse_kstatfs { |
43 |
|
|
unsigned int bsize; |
44 |
|
|
unsigned long long blocks; |
45 |
|
|
unsigned long long bfree; |
46 |
|
|
unsigned long long bavail; |
47 |
|
|
unsigned long long files; |
48 |
|
|
unsigned long long ffree; |
49 |
|
|
unsigned int namelen; |
50 |
|
|
}; |
51 |
|
|
|
52 |
|
|
#define FATTR_MODE (1 << 0) |
53 |
|
|
#define FATTR_UID (1 << 1) |
54 |
|
|
#define FATTR_GID (1 << 2) |
55 |
|
|
#define FATTR_SIZE (1 << 3) |
56 |
|
|
#define FATTR_ATIME (1 << 4) |
57 |
|
|
#define FATTR_MTIME (1 << 5) |
58 |
|
|
#define FATTR_CTIME (1 << 6) |
59 |
|
|
|
60 |
|
|
enum fuse_opcode { |
61 |
|
|
FUSE_LOOKUP = 1, |
62 |
|
|
FUSE_FORGET = 2, /* no reply */ |
63 |
|
|
FUSE_GETATTR = 3, |
64 |
|
|
FUSE_SETATTR = 4, |
65 |
|
|
FUSE_READLINK = 5, |
66 |
|
|
FUSE_SYMLINK = 6, |
67 |
|
|
FUSE_GETDIR = 7, |
68 |
|
|
FUSE_MKNOD = 8, |
69 |
|
|
FUSE_MKDIR = 9, |
70 |
|
|
FUSE_UNLINK = 10, |
71 |
|
|
FUSE_RMDIR = 11, |
72 |
|
|
FUSE_RENAME = 12, |
73 |
|
|
FUSE_LINK = 13, |
74 |
|
|
FUSE_OPEN = 14, |
75 |
|
|
FUSE_READ = 15, |
76 |
|
|
FUSE_WRITE = 16, |
77 |
|
|
FUSE_STATFS = 17, |
78 |
|
|
FUSE_RELEASE = 18, /* no reply */ |
79 |
|
|
FUSE_INVALIDATE = 19, /* user initiated */ |
80 |
|
|
FUSE_FSYNC = 20, |
81 |
|
|
FUSE_SETXATTR = 21, |
82 |
|
|
FUSE_GETXATTR = 22, |
83 |
|
|
FUSE_LISTXATTR = 23, |
84 |
|
|
FUSE_REMOVEXATTR = 24, |
85 |
|
|
FUSE_FLUSH = 25, |
86 |
|
|
}; |
87 |
|
|
|
88 |
|
|
/* Conservative buffer size for the client */ |
89 |
|
|
#define FUSE_MAX_IN 8192 |
90 |
|
|
|
91 |
|
|
#define FUSE_NAME_MAX 1024 |
92 |
|
|
#define FUSE_SYMLINK_MAX 4096 |
93 |
|
|
#define FUSE_XATTR_SIZE_MAX 4096 |
94 |
|
|
|
95 |
|
|
struct fuse_entry_out { |
96 |
|
|
unsigned long ino; /* Inode number */ |
97 |
|
|
unsigned long generation; /* Inode generation: ino:gen must |
98 |
|
|
be unique for the fs's lifetime */ |
99 |
|
|
unsigned long entry_valid; /* Cache timeout for the name */ |
100 |
|
|
unsigned long entry_valid_nsec; |
101 |
|
|
unsigned long attr_valid; /* Cache timeout for the attributes */ |
102 |
|
|
unsigned long attr_valid_nsec; |
103 |
|
|
struct fuse_attr attr; |
104 |
|
|
}; |
105 |
|
|
|
106 |
|
|
struct fuse_forget_in { |
107 |
|
|
int version; |
108 |
|
|
}; |
109 |
|
|
|
110 |
|
|
struct fuse_attr_out { |
111 |
|
|
unsigned long attr_valid; /* Cache timeout for the attributes */ |
112 |
|
|
unsigned long attr_valid_nsec; |
113 |
|
|
struct fuse_attr attr; |
114 |
|
|
}; |
115 |
|
|
|
116 |
|
|
struct fuse_getdir_out { |
117 |
|
|
int fd; |
118 |
|
|
}; |
119 |
|
|
|
120 |
|
|
struct fuse_mknod_in { |
121 |
|
|
unsigned int mode; |
122 |
|
|
unsigned int rdev; |
123 |
|
|
}; |
124 |
|
|
|
125 |
|
|
struct fuse_mkdir_in { |
126 |
|
|
unsigned int mode; |
127 |
|
|
}; |
128 |
|
|
|
129 |
|
|
struct fuse_rename_in { |
130 |
|
|
unsigned long newdir; |
131 |
|
|
}; |
132 |
|
|
|
133 |
|
|
struct fuse_link_in { |
134 |
|
|
unsigned long newdir; |
135 |
|
|
}; |
136 |
|
|
|
137 |
|
|
struct fuse_setattr_in { |
138 |
|
|
struct fuse_attr attr; |
139 |
|
|
unsigned int valid; |
140 |
|
|
}; |
141 |
|
|
|
142 |
|
|
struct fuse_open_in { |
143 |
|
|
unsigned int flags; |
144 |
|
|
}; |
145 |
|
|
|
146 |
|
|
struct fuse_open_out { |
147 |
|
|
unsigned int fh; |
148 |
|
|
}; |
149 |
|
|
|
150 |
|
|
struct fuse_release_in { |
151 |
|
|
unsigned int fh; |
152 |
|
|
unsigned int flags; |
153 |
|
|
}; |
154 |
|
|
|
155 |
|
|
struct fuse_flush_in { |
156 |
|
|
unsigned int fh; |
157 |
|
|
}; |
158 |
|
|
|
159 |
|
|
struct fuse_read_in { |
160 |
|
|
unsigned int fh; |
161 |
|
|
unsigned long long offset; |
162 |
|
|
unsigned int size; |
163 |
|
|
}; |
164 |
|
|
|
165 |
|
|
struct fuse_write_in { |
166 |
|
|
int writepage; |
167 |
|
|
unsigned int fh; |
168 |
|
|
unsigned long long offset; |
169 |
|
|
unsigned int size; |
170 |
|
|
}; |
171 |
|
|
|
172 |
|
|
struct fuse_write_out { |
173 |
|
|
unsigned int size; |
174 |
|
|
}; |
175 |
|
|
|
176 |
|
|
struct fuse_statfs_out { |
177 |
|
|
struct fuse_kstatfs st; |
178 |
|
|
}; |
179 |
|
|
|
180 |
|
|
struct fuse_fsync_in { |
181 |
|
|
unsigned int fh; |
182 |
|
|
int datasync; |
183 |
|
|
}; |
184 |
|
|
|
185 |
|
|
struct fuse_setxattr_in { |
186 |
|
|
unsigned int size; |
187 |
|
|
unsigned int flags; |
188 |
|
|
}; |
189 |
|
|
|
190 |
|
|
struct fuse_getxattr_in { |
191 |
|
|
unsigned int size; |
192 |
|
|
}; |
193 |
|
|
|
194 |
|
|
struct fuse_getxattr_out { |
195 |
|
|
unsigned int size; |
196 |
|
|
}; |
197 |
|
|
|
198 |
|
|
struct fuse_in_header { |
199 |
|
|
int unique; |
200 |
|
|
enum fuse_opcode opcode; |
201 |
|
|
unsigned long ino; |
202 |
|
|
unsigned int uid; |
203 |
|
|
unsigned int gid; |
204 |
|
|
}; |
205 |
|
|
|
206 |
|
|
struct fuse_out_header { |
207 |
|
|
int unique; |
208 |
|
|
int error; |
209 |
|
|
}; |
210 |
|
|
|
211 |
|
|
struct fuse_user_header { |
212 |
|
|
int unique; /* zero */ |
213 |
|
|
enum fuse_opcode opcode; |
214 |
|
|
unsigned long ino; |
215 |
|
|
}; |
216 |
|
|
|
217 |
|
|
struct fuse_dirent { |
218 |
|
|
unsigned long ino; |
219 |
|
|
unsigned short namelen; |
220 |
|
|
unsigned char type; |
221 |
|
|
char name[256]; |
222 |
|
|
}; |
223 |
|
|
|
224 |
|
|
#define FUSE_NAME_OFFSET ((unsigned int) ((struct fuse_dirent *) 0)->name) |
225 |
|
|
#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(long) - 1) & ~(sizeof(long) - 1)) |
226 |
|
|
#define FUSE_DIRENT_SIZE(d) \ |
227 |
|
|
FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) |
228 |
|
|
|
229 |
|
|
/* |
230 |
|
|
* Local Variables: |
231 |
|
|
* indent-tabs-mode: t |
232 |
|
|
* c-basic-offset: 8 |
233 |
|
|
* End: |
234 |
|
|
*/ |