From cafdcb253e4c7ad6238198982425c004b487d2e6 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Fri, 28 Nov 2008 15:12:48 +0000 Subject: [PATCH] If open sets fi->nonseekable, libfuse will tell the kernel that the file is not seekable. Patch by Tejun Heo --- ChangeLog | 5 +++++ include/fuse_common.h | 6 +++++- include/fuse_kernel.h | 15 ++++++++++++++- lib/fuse_lowlevel.c | 2 ++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5487d59..d6de6ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-11-28 Miklos Szeredi + + * If open sets fi->nonseekable, libfuse will tell the kernel that + the file is not seekable. Patch by Tejun Heo + 2008-11-19 Miklos Szeredi * lowlevel lib: fix deadlock if fuse_reply_* is called from the diff --git a/include/fuse_common.h b/include/fuse_common.h index 2543225..9bbc386 100644 --- a/include/fuse_common.h +++ b/include/fuse_common.h @@ -65,8 +65,12 @@ struct fuse_file_info { operation. Introduced in version 2.6 */ unsigned int flush : 1; + /** Can be filled in by open, to indicate that the file is not + seekable. Introduced in version 2.9 */ + unsigned int nonseekable : 1; + /** Padding. Do not use*/ - unsigned int padding : 29; + unsigned int padding : 28; /** File handle. May be filled in by filesystem in open(). Available in all other file operations */ diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h index c9c4c7e..b37d969 100644 --- a/include/fuse_kernel.h +++ b/include/fuse_kernel.h @@ -43,8 +43,14 @@ * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in * - add blksize field to fuse_attr * - add file flags field to fuse_read_in and fuse_write_in + * + * 7.10 + * - add nonseekable open flag */ +#ifndef _LINUX_FUSE_H +#define _LINUX_FUSE_H + #ifndef linux #include #define __u64 uint64_t @@ -59,7 +65,7 @@ #define FUSE_KERNEL_VERSION 7 /** Minor version number of this interface */ -#define FUSE_KERNEL_MINOR_VERSION 9 +#define FUSE_KERNEL_MINOR_VERSION 10 /** The node ID of the root inode */ #define FUSE_ROOT_ID 1 @@ -131,17 +137,22 @@ struct fuse_file_lock { * * FOPEN_DIRECT_IO: bypass page cache for this open file * FOPEN_KEEP_CACHE: don't invalidate the data cache on open + * FOPEN_NONSEEKABLE: the file is not seekable */ #define FOPEN_DIRECT_IO (1 << 0) #define FOPEN_KEEP_CACHE (1 << 1) +#define FOPEN_NONSEEKABLE (1 << 2) /** * INIT request/reply flags + * + * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." */ #define FUSE_ASYNC_READ (1 << 0) #define FUSE_POSIX_LOCKS (1 << 1) #define FUSE_FILE_OPS (1 << 2) #define FUSE_ATOMIC_O_TRUNC (1 << 3) +#define FUSE_EXPORT_SUPPORT (1 << 4) #define FUSE_BIG_WRITES (1 << 5) /** @@ -439,3 +450,5 @@ struct fuse_dirent { #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) #define FUSE_DIRENT_SIZE(d) \ FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) + +#endif /* _LINUX_FUSE_H */ diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 99fbfe3..34ff76c 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -322,6 +322,8 @@ static void fill_open(struct fuse_open_out *arg, arg->open_flags |= FOPEN_DIRECT_IO; if (f->keep_cache) arg->open_flags |= FOPEN_KEEP_CACHE; + if (f->nonseekable) + arg->open_flags |= FOPEN_NONSEEKABLE; } int fuse_reply_entry(fuse_req_t req, const struct fuse_entry_param *e) -- 2.30.2