From f33321141b273d60cbb3a8f56a5489baad82ba5e Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Thu, 18 Oct 2007 03:07:04 -0700 Subject: fuse: add support for mandatory locking For mandatory locking the userspace filesystem needs to know the lock ownership for read, write and truncate operations. This patch adds the necessary fields to the protocol. Signed-off-by: Miklos Szeredi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/fuse.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/fuse.h b/include/linux/fuse.h index 6f4a31266cd5..7d4fa5b25b87 100644 --- a/include/linux/fuse.h +++ b/include/linux/fuse.h @@ -14,6 +14,7 @@ * 7.9: * - new fuse_getattr_in input argument of GETATTR * - add lk_flags in fuse_lk_in + * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in */ #include @@ -86,6 +87,7 @@ struct fuse_file_lock { #define FATTR_FH (1 << 6) #define FATTR_ATIME_NOW (1 << 7) #define FATTR_MTIME_NOW (1 << 8) +#define FATTR_LOCKOWNER (1 << 9) /** * Flags returned by the OPEN request @@ -123,8 +125,15 @@ struct fuse_file_lock { * WRITE flags * * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed + * FUSE_WRITE_LOCKOWNER: lock_owner field is valid */ #define FUSE_WRITE_CACHE (1 << 0) +#define FUSE_WRITE_LOCKOWNER (1 << 1) + +/** + * Read flags + */ +#define FUSE_READ_LOCKOWNER (1 << 1) enum fuse_opcode { FUSE_LOOKUP = 1, @@ -219,7 +228,7 @@ struct fuse_setattr_in { __u32 padding; __u64 fh; __u64 size; - __u64 unused1; + __u64 lock_owner; __u64 atime; __u64 mtime; __u64 unused2; @@ -262,14 +271,18 @@ struct fuse_read_in { __u64 fh; __u64 offset; __u32 size; - __u32 padding; + __u32 read_flags; + __u64 lock_owner; }; +#define FUSE_COMPAT_WRITE_IN_SIZE 24 + struct fuse_write_in { __u64 fh; __u64 offset; __u32 size; __u32 write_flags; + __u64 lock_owner; }; struct fuse_write_out { -- cgit v1.2.3