mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									29d434b39c
								
							
						
					
					
						commit
						a7c1b990f7
					
				
					 2 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
					@ -101,6 +101,8 @@ void fuse_finish_open(struct inode *inode, struct file *file,
 | 
				
			||||||
		file->f_op = &fuse_direct_io_file_operations;
 | 
							file->f_op = &fuse_direct_io_file_operations;
 | 
				
			||||||
	if (!(outarg->open_flags & FOPEN_KEEP_CACHE))
 | 
						if (!(outarg->open_flags & FOPEN_KEEP_CACHE))
 | 
				
			||||||
		invalidate_inode_pages2(inode->i_mapping);
 | 
							invalidate_inode_pages2(inode->i_mapping);
 | 
				
			||||||
 | 
						if (outarg->open_flags & FOPEN_NONSEEKABLE)
 | 
				
			||||||
 | 
							nonseekable_open(inode, file);
 | 
				
			||||||
	ff->fh = outarg->fh;
 | 
						ff->fh = outarg->fh;
 | 
				
			||||||
	file->private_data = fuse_file_get(ff);
 | 
						file->private_data = fuse_file_get(ff);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,6 +17,9 @@
 | 
				
			||||||
 *  - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
 | 
					 *  - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
 | 
				
			||||||
 *  - add blksize field to fuse_attr
 | 
					 *  - add blksize field to fuse_attr
 | 
				
			||||||
 *  - add file flags field to fuse_read_in and fuse_write_in
 | 
					 *  - add file flags field to fuse_read_in and fuse_write_in
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 7.10
 | 
				
			||||||
 | 
					 *  - add nonseekable open flag
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef _LINUX_FUSE_H
 | 
					#ifndef _LINUX_FUSE_H
 | 
				
			||||||
| 
						 | 
					@ -29,7 +32,7 @@
 | 
				
			||||||
#define FUSE_KERNEL_VERSION 7
 | 
					#define FUSE_KERNEL_VERSION 7
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Minor version number of this interface */
 | 
					/** 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 */
 | 
					/** The node ID of the root inode */
 | 
				
			||||||
#define FUSE_ROOT_ID 1
 | 
					#define FUSE_ROOT_ID 1
 | 
				
			||||||
| 
						 | 
					@ -101,9 +104,11 @@ struct fuse_file_lock {
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * FOPEN_DIRECT_IO: bypass page cache for this open file
 | 
					 * FOPEN_DIRECT_IO: bypass page cache for this open file
 | 
				
			||||||
 * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
 | 
					 * 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_DIRECT_IO		(1 << 0)
 | 
				
			||||||
#define FOPEN_KEEP_CACHE	(1 << 1)
 | 
					#define FOPEN_KEEP_CACHE	(1 << 1)
 | 
				
			||||||
 | 
					#define FOPEN_NONSEEKABLE	(1 << 2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * INIT request/reply flags
 | 
					 * INIT request/reply flags
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue