Skip to content

Commit a7c1b99

Browse files
htejunszmi
authored andcommitted
fuse: implement nonseekable open
Let the client request nonseekable open using FOPEN_NONSEEKABLE and call nonseekable_open() on the file if requested. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
1 parent 29d434b commit a7c1b99

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

fs/fuse/file.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ void fuse_finish_open(struct inode *inode, struct file *file,
101101
file->f_op = &fuse_direct_io_file_operations;
102102
if (!(outarg->open_flags & FOPEN_KEEP_CACHE))
103103
invalidate_inode_pages2(inode->i_mapping);
104+
if (outarg->open_flags & FOPEN_NONSEEKABLE)
105+
nonseekable_open(inode, file);
104106
ff->fh = outarg->fh;
105107
file->private_data = fuse_file_get(ff);
106108
}

include/linux/fuse.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
* - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
1818
* - add blksize field to fuse_attr
1919
* - add file flags field to fuse_read_in and fuse_write_in
20+
*
21+
* 7.10
22+
* - add nonseekable open flag
2023
*/
2124

2225
#ifndef _LINUX_FUSE_H
@@ -29,7 +32,7 @@
2932
#define FUSE_KERNEL_VERSION 7
3033

3134
/** Minor version number of this interface */
32-
#define FUSE_KERNEL_MINOR_VERSION 9
35+
#define FUSE_KERNEL_MINOR_VERSION 10
3336

3437
/** The node ID of the root inode */
3538
#define FUSE_ROOT_ID 1
@@ -101,9 +104,11 @@ struct fuse_file_lock {
101104
*
102105
* FOPEN_DIRECT_IO: bypass page cache for this open file
103106
* FOPEN_KEEP_CACHE: don't invalidate the data cache on open
107+
* FOPEN_NONSEEKABLE: the file is not seekable
104108
*/
105109
#define FOPEN_DIRECT_IO (1 << 0)
106110
#define FOPEN_KEEP_CACHE (1 << 1)
111+
#define FOPEN_NONSEEKABLE (1 << 2)
107112

108113
/**
109114
* INIT request/reply flags

0 commit comments

Comments
 (0)