~ubuntu-branches/ubuntu/hardy/ntfs-3g/hardy

« back to all changes in this revision

Viewing changes to include/fuse-lite/fuse_kernel.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2008-03-07 11:21:45 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20080307112145-g4reiglv0inkb1xa
Tags: 1:1.2216-1ubuntu1
* New upstream bug fix release. (LP: #199161)
* Resynchronise with Debian. Remaining changes:
  - Add udeb shlibs entries for libntfs-3g23-udeb.
  - Bump debhelper build-dependency to 5.0.22 for dh_makeshlibs
    --add-udeb.
  - Create libntfs3g23-udeb and ntfs-3g-udeb.
  - Copy ntfs-3g into the initramfs. If ntfs-3g is used to mount the root
    filesystem (either directly or via a loopback mount), load the fuse
    module beforehand, and save ntfs-3g's PID (indirectly) in
    /var/run/sendsigs.omit.
  - Move ntfs-3g to /bin.
  - Move libntfs-3g.so.* to /lib. Adjust libntfs-3g.so symlink to match.
  - Add /sbin/mount.ntfs symlink to /bin/ntfs-3g.
  - Add a symlink for the mount.ntfs manual page too.
  - Pass basenames rather than full paths to pidof; create
    /dev/.initramfs/varrun if necessary (LP #150831).
  - Always add ntfs and ntfs-3g to sendsigs.omit (LP #181669).
  - Build against the external fuse libraries and add dependency on
    fuse-utils.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    This file defines the kernel interface of FUSE
 
3
    Copyright (C) 2001-2007  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
#ifndef linux
 
36
#include <sys/types.h>
 
37
#define __u64 uint64_t
 
38
#define __u32 uint32_t
 
39
#define __s32 int32_t
 
40
#else
 
41
#include <asm/types.h>
 
42
#include <linux/major.h>
 
43
#endif
 
44
 
 
45
/** Version number of this interface */
 
46
#define FUSE_KERNEL_VERSION 7
 
47
 
 
48
/** Minor version number of this interface */
 
49
#define FUSE_KERNEL_MINOR_VERSION 8
 
50
 
 
51
/** The node ID of the root inode */
 
52
#define FUSE_ROOT_ID 1
 
53
 
 
54
/** The major number of the fuse character device */
 
55
#define FUSE_MAJOR MISC_MAJOR
 
56
 
 
57
/** The minor number of the fuse character device */
 
58
#define FUSE_MINOR 229
 
59
 
 
60
/* Make sure all structures are padded to 64bit boundary, so 32bit
 
61
   userspace works under 64bit kernels */
 
62
 
 
63
struct fuse_attr {
 
64
        __u64   ino;
 
65
        __u64   size;
 
66
        __u64   blocks;
 
67
        __u64   atime;
 
68
        __u64   mtime;
 
69
        __u64   ctime;
 
70
        __u32   atimensec;
 
71
        __u32   mtimensec;
 
72
        __u32   ctimensec;
 
73
        __u32   mode;
 
74
        __u32   nlink;
 
75
        __u32   uid;
 
76
        __u32   gid;
 
77
        __u32   rdev;
 
78
};
 
79
 
 
80
struct fuse_kstatfs {
 
81
        __u64   blocks;
 
82
        __u64   bfree;
 
83
        __u64   bavail;
 
84
        __u64   files;
 
85
        __u64   ffree;
 
86
        __u32   bsize;
 
87
        __u32   namelen;
 
88
        __u32   frsize;
 
89
        __u32   padding;
 
90
        __u32   spare[6];
 
91
};
 
92
 
 
93
struct fuse_file_lock {
 
94
        __u64   start;
 
95
        __u64   end;
 
96
        __u32   type;
 
97
        __u32   pid; /* tgid */
 
98
};
 
99
 
 
100
/**
 
101
 * Bitmasks for fuse_setattr_in.valid
 
102
 */
 
103
#define FATTR_MODE      (1 << 0)
 
104
#define FATTR_UID       (1 << 1)
 
105
#define FATTR_GID       (1 << 2)
 
106
#define FATTR_SIZE      (1 << 3)
 
107
#define FATTR_ATIME     (1 << 4)
 
108
#define FATTR_MTIME     (1 << 5)
 
109
#define FATTR_FH        (1 << 6)
 
110
 
 
111
/**
 
112
 * Flags returned by the OPEN request
 
113
 *
 
114
 * FOPEN_DIRECT_IO: bypass page cache for this open file
 
115
 * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
 
116
 */
 
117
#define FOPEN_DIRECT_IO         (1 << 0)
 
118
#define FOPEN_KEEP_CACHE        (1 << 1)
 
119
 
 
120
/**
 
121
 * INIT request/reply flags
 
122
 */
 
123
#define FUSE_ASYNC_READ         (1 << 0)
 
124
#define FUSE_POSIX_LOCKS        (1 << 1)
 
125
 
 
126
/**
 
127
 * Release flags
 
128
 */
 
129
#define FUSE_RELEASE_FLUSH      (1 << 0)
 
130
 
 
131
enum fuse_opcode {
 
132
        FUSE_LOOKUP        = 1,
 
133
        FUSE_FORGET        = 2,  /* no reply */
 
134
        FUSE_GETATTR       = 3,
 
135
        FUSE_SETATTR       = 4,
 
136
        FUSE_READLINK      = 5,
 
137
        FUSE_SYMLINK       = 6,
 
138
        FUSE_MKNOD         = 8,
 
139
        FUSE_MKDIR         = 9,
 
140
        FUSE_UNLINK        = 10,
 
141
        FUSE_RMDIR         = 11,
 
142
        FUSE_RENAME        = 12,
 
143
        FUSE_LINK          = 13,
 
144
        FUSE_OPEN          = 14,
 
145
        FUSE_READ          = 15,
 
146
        FUSE_WRITE         = 16,
 
147
        FUSE_STATFS        = 17,
 
148
        FUSE_RELEASE       = 18,
 
149
        FUSE_FSYNC         = 20,
 
150
        FUSE_SETXATTR      = 21,
 
151
        FUSE_GETXATTR      = 22,
 
152
        FUSE_LISTXATTR     = 23,
 
153
        FUSE_REMOVEXATTR   = 24,
 
154
        FUSE_FLUSH         = 25,
 
155
        FUSE_INIT          = 26,
 
156
        FUSE_OPENDIR       = 27,
 
157
        FUSE_READDIR       = 28,
 
158
        FUSE_RELEASEDIR    = 29,
 
159
        FUSE_FSYNCDIR      = 30,
 
160
        FUSE_GETLK         = 31,
 
161
        FUSE_SETLK         = 32,
 
162
        FUSE_SETLKW        = 33,
 
163
        FUSE_ACCESS        = 34,
 
164
        FUSE_CREATE        = 35,
 
165
        FUSE_INTERRUPT     = 36,
 
166
        FUSE_BMAP          = 37,
 
167
        FUSE_DESTROY       = 38,
 
168
};
 
169
 
 
170
/* The read buffer is required to be at least 8k, but may be much larger */
 
171
#define FUSE_MIN_READ_BUFFER 8192
 
172
 
 
173
struct fuse_entry_out {
 
174
        __u64   nodeid;         /* Inode ID */
 
175
        __u64   generation;     /* Inode generation: nodeid:gen must
 
176
                                   be unique for the fs's lifetime */
 
177
        __u64   entry_valid;    /* Cache timeout for the name */
 
178
        __u64   attr_valid;     /* Cache timeout for the attributes */
 
179
        __u32   entry_valid_nsec;
 
180
        __u32   attr_valid_nsec;
 
181
        struct fuse_attr attr;
 
182
};
 
183
 
 
184
struct fuse_forget_in {
 
185
        __u64   nlookup;
 
186
};
 
187
 
 
188
struct fuse_attr_out {
 
189
        __u64   attr_valid;     /* Cache timeout for the attributes */
 
190
        __u32   attr_valid_nsec;
 
191
        __u32   dummy;
 
192
        struct fuse_attr attr;
 
193
};
 
194
 
 
195
struct fuse_mknod_in {
 
196
        __u32   mode;
 
197
        __u32   rdev;
 
198
};
 
199
 
 
200
struct fuse_mkdir_in {
 
201
        __u32   mode;
 
202
        __u32   padding;
 
203
};
 
204
 
 
205
struct fuse_rename_in {
 
206
        __u64   newdir;
 
207
};
 
208
 
 
209
struct fuse_link_in {
 
210
        __u64   oldnodeid;
 
211
};
 
212
 
 
213
struct fuse_setattr_in {
 
214
        __u32   valid;
 
215
        __u32   padding;
 
216
        __u64   fh;
 
217
        __u64   size;
 
218
        __u64   unused1;
 
219
        __u64   atime;
 
220
        __u64   mtime;
 
221
        __u64   unused2;
 
222
        __u32   atimensec;
 
223
        __u32   mtimensec;
 
224
        __u32   unused3;
 
225
        __u32   mode;
 
226
        __u32   unused4;
 
227
        __u32   uid;
 
228
        __u32   gid;
 
229
        __u32   unused5;
 
230
};
 
231
 
 
232
struct fuse_open_in {
 
233
        __u32   flags;
 
234
        __u32   mode;
 
235
};
 
236
 
 
237
struct fuse_open_out {
 
238
        __u64   fh;
 
239
        __u32   open_flags;
 
240
        __u32   padding;
 
241
};
 
242
 
 
243
struct fuse_release_in {
 
244
        __u64   fh;
 
245
        __u32   flags;
 
246
        __u32   release_flags;
 
247
        __u64   lock_owner;
 
248
};
 
249
 
 
250
struct fuse_flush_in {
 
251
        __u64   fh;
 
252
        __u32   unused;
 
253
        __u32   padding;
 
254
        __u64   lock_owner;
 
255
};
 
256
 
 
257
struct fuse_read_in {
 
258
        __u64   fh;
 
259
        __u64   offset;
 
260
        __u32   size;
 
261
        __u32   padding;
 
262
};
 
263
 
 
264
struct fuse_write_in {
 
265
        __u64   fh;
 
266
        __u64   offset;
 
267
        __u32   size;
 
268
        __u32   write_flags;
 
269
};
 
270
 
 
271
struct fuse_write_out {
 
272
        __u32   size;
 
273
        __u32   padding;
 
274
};
 
275
 
 
276
#define FUSE_COMPAT_STATFS_SIZE 48
 
277
 
 
278
struct fuse_statfs_out {
 
279
        struct fuse_kstatfs st;
 
280
};
 
281
 
 
282
struct fuse_fsync_in {
 
283
        __u64   fh;
 
284
        __u32   fsync_flags;
 
285
        __u32   padding;
 
286
};
 
287
 
 
288
struct fuse_setxattr_in {
 
289
        __u32   size;
 
290
        __u32   flags;
 
291
};
 
292
 
 
293
struct fuse_getxattr_in {
 
294
        __u32   size;
 
295
        __u32   padding;
 
296
};
 
297
 
 
298
struct fuse_getxattr_out {
 
299
        __u32   size;
 
300
        __u32   padding;
 
301
};
 
302
 
 
303
struct fuse_lk_in {
 
304
        __u64   fh;
 
305
        __u64   owner;
 
306
        struct fuse_file_lock lk;
 
307
};
 
308
 
 
309
struct fuse_lk_out {
 
310
        struct fuse_file_lock lk;
 
311
};
 
312
 
 
313
struct fuse_access_in {
 
314
        __u32   mask;
 
315
        __u32   padding;
 
316
};
 
317
 
 
318
struct fuse_init_in {
 
319
        __u32   major;
 
320
        __u32   minor;
 
321
        __u32   max_readahead;
 
322
        __u32   flags;
 
323
};
 
324
 
 
325
struct fuse_init_out {
 
326
        __u32   major;
 
327
        __u32   minor;
 
328
        __u32   max_readahead;
 
329
        __u32   flags;
 
330
        __u32   unused;
 
331
        __u32   max_write;
 
332
};
 
333
 
 
334
struct fuse_interrupt_in {
 
335
        __u64   unique;
 
336
};
 
337
 
 
338
struct fuse_bmap_in {
 
339
        __u64   block;
 
340
        __u32   blocksize;
 
341
        __u32   padding;
 
342
};
 
343
 
 
344
struct fuse_bmap_out {
 
345
        __u64   block;
 
346
};
 
347
 
 
348
struct fuse_in_header {
 
349
        __u32   len;
 
350
        __u32   opcode;
 
351
        __u64   unique;
 
352
        __u64   nodeid;
 
353
        __u32   uid;
 
354
        __u32   gid;
 
355
        __u32   pid;
 
356
        __u32   padding;
 
357
};
 
358
 
 
359
struct fuse_out_header {
 
360
        __u32   len;
 
361
        __s32   error;
 
362
        __u64   unique;
 
363
};
 
364
 
 
365
struct fuse_dirent {
 
366
        __u64   ino;
 
367
        __u64   off;
 
368
        __u32   namelen;
 
369
        __u32   type;
 
370
        char name[0];
 
371
};
 
372
 
 
373
#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
 
374
#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
 
375
#define FUSE_DIRENT_SIZE(d) \
 
376
        FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)