diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2006-06-25 08:48:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:19 -0400 |
commit | 7142125937e1482ad3ae4366594c6586153dfc86 (patch) | |
tree | 8d85908a36485df0c80de2032e7fcfa493621fe4 /include | |
parent | bafa96541b250a7051e3fbc5de6e8369daf8ffec (diff) |
[PATCH] fuse: add POSIX file locking support
This patch adds POSIX file locking support to the fuse interface.
This implementation doesn't keep any locking state in kernel. Unlocking on
close() is handled by the FLUSH message, which now contains the lock owner id.
Mandatory locking is not supported. The filesystem may enfoce mandatory
locking in userspace if needed.
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/fuse.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/include/linux/fuse.h b/include/linux/fuse.h index 8e4319614bef..e7a76ec0f05c 100644 --- a/include/linux/fuse.h +++ b/include/linux/fuse.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | FUSE: Filesystem in Userspace | 2 | FUSE: Filesystem in Userspace |
3 | Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> | 3 | Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu> |
4 | 4 | ||
5 | This program can be distributed under the terms of the GNU GPL. | 5 | This program can be distributed under the terms of the GNU GPL. |
6 | See the file COPYING. | 6 | See the file COPYING. |
@@ -15,7 +15,7 @@ | |||
15 | #define FUSE_KERNEL_VERSION 7 | 15 | #define FUSE_KERNEL_VERSION 7 |
16 | 16 | ||
17 | /** Minor version number of this interface */ | 17 | /** Minor version number of this interface */ |
18 | #define FUSE_KERNEL_MINOR_VERSION 6 | 18 | #define FUSE_KERNEL_MINOR_VERSION 7 |
19 | 19 | ||
20 | /** The node ID of the root inode */ | 20 | /** The node ID of the root inode */ |
21 | #define FUSE_ROOT_ID 1 | 21 | #define FUSE_ROOT_ID 1 |
@@ -59,6 +59,13 @@ struct fuse_kstatfs { | |||
59 | __u32 spare[6]; | 59 | __u32 spare[6]; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | struct fuse_file_lock { | ||
63 | __u64 start; | ||
64 | __u64 end; | ||
65 | __u32 type; | ||
66 | __u32 pid; /* tgid */ | ||
67 | }; | ||
68 | |||
62 | /** | 69 | /** |
63 | * Bitmasks for fuse_setattr_in.valid | 70 | * Bitmasks for fuse_setattr_in.valid |
64 | */ | 71 | */ |
@@ -83,6 +90,7 @@ struct fuse_kstatfs { | |||
83 | * INIT request/reply flags | 90 | * INIT request/reply flags |
84 | */ | 91 | */ |
85 | #define FUSE_ASYNC_READ (1 << 0) | 92 | #define FUSE_ASYNC_READ (1 << 0) |
93 | #define FUSE_POSIX_LOCKS (1 << 1) | ||
86 | 94 | ||
87 | enum fuse_opcode { | 95 | enum fuse_opcode { |
88 | FUSE_LOOKUP = 1, | 96 | FUSE_LOOKUP = 1, |
@@ -113,6 +121,9 @@ enum fuse_opcode { | |||
113 | FUSE_READDIR = 28, | 121 | FUSE_READDIR = 28, |
114 | FUSE_RELEASEDIR = 29, | 122 | FUSE_RELEASEDIR = 29, |
115 | FUSE_FSYNCDIR = 30, | 123 | FUSE_FSYNCDIR = 30, |
124 | FUSE_GETLK = 31, | ||
125 | FUSE_SETLK = 32, | ||
126 | FUSE_SETLKW = 33, | ||
116 | FUSE_ACCESS = 34, | 127 | FUSE_ACCESS = 34, |
117 | FUSE_CREATE = 35 | 128 | FUSE_CREATE = 35 |
118 | }; | 129 | }; |
@@ -200,6 +211,7 @@ struct fuse_flush_in { | |||
200 | __u64 fh; | 211 | __u64 fh; |
201 | __u32 flush_flags; | 212 | __u32 flush_flags; |
202 | __u32 padding; | 213 | __u32 padding; |
214 | __u64 lock_owner; | ||
203 | }; | 215 | }; |
204 | 216 | ||
205 | struct fuse_read_in { | 217 | struct fuse_read_in { |
@@ -248,6 +260,16 @@ struct fuse_getxattr_out { | |||
248 | __u32 padding; | 260 | __u32 padding; |
249 | }; | 261 | }; |
250 | 262 | ||
263 | struct fuse_lk_in { | ||
264 | __u64 fh; | ||
265 | __u64 owner; | ||
266 | struct fuse_file_lock lk; | ||
267 | }; | ||
268 | |||
269 | struct fuse_lk_out { | ||
270 | struct fuse_file_lock lk; | ||
271 | }; | ||
272 | |||
251 | struct fuse_access_in { | 273 | struct fuse_access_in { |
252 | __u32 mask; | 274 | __u32 mask; |
253 | __u32 padding; | 275 | __u32 padding; |