diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 15:53:27 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 15:53:27 -0400 |
| commit | 1d9a8a47d659f053abeca9ece45651b4d94780c8 (patch) | |
| tree | 5c61cba476fb073c8f6a250f6cda4b0a36628aea | |
| parent | f07767fd0f95c385108fa4c456a9cb216a424fec (diff) | |
| parent | a7c1b990f71574e077b94ce4582e2cf11cb891fe (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
fuse: implement nonseekable open
fuse: add include protectors
fuse: config description improvement
fuse: add missing fuse_request_free
fuse: fix SEEK_END incorrectness
| -rw-r--r-- | fs/Kconfig | 2 | ||||
| -rw-r--r-- | fs/fuse/file.c | 5 | ||||
| -rw-r--r-- | fs/fuse/fuse_i.h | 5 | ||||
| -rw-r--r-- | fs/fuse/inode.c | 3 | ||||
| -rw-r--r-- | include/linux/fuse.h | 12 |
5 files changed, 24 insertions, 3 deletions
diff --git a/fs/Kconfig b/fs/Kconfig index e282002b94d2..e46297f020c1 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
| @@ -403,7 +403,7 @@ config AUTOFS4_FS | |||
| 403 | N here. | 403 | N here. |
| 404 | 404 | ||
| 405 | config FUSE_FS | 405 | config FUSE_FS |
| 406 | tristate "Filesystem in Userspace support" | 406 | tristate "FUSE (Filesystem in Userspace) support" |
| 407 | help | 407 | help |
| 408 | With FUSE it is possible to implement a fully functional filesystem | 408 | With FUSE it is possible to implement a fully functional filesystem |
| 409 | in a userspace program. | 409 | in a userspace program. |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 2bada6bbc317..34930a964b82 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
| @@ -101,6 +101,8 @@ void fuse_finish_open(struct inode *inode, struct file *file, | |||
| 101 | file->f_op = &fuse_direct_io_file_operations; | 101 | file->f_op = &fuse_direct_io_file_operations; |
| 102 | if (!(outarg->open_flags & FOPEN_KEEP_CACHE)) | 102 | if (!(outarg->open_flags & FOPEN_KEEP_CACHE)) |
| 103 | invalidate_inode_pages2(inode->i_mapping); | 103 | invalidate_inode_pages2(inode->i_mapping); |
| 104 | if (outarg->open_flags & FOPEN_NONSEEKABLE) | ||
| 105 | nonseekable_open(inode, file); | ||
| 104 | ff->fh = outarg->fh; | 106 | ff->fh = outarg->fh; |
| 105 | file->private_data = fuse_file_get(ff); | 107 | file->private_data = fuse_file_get(ff); |
| 106 | } | 108 | } |
| @@ -1448,6 +1450,9 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin) | |||
| 1448 | mutex_lock(&inode->i_mutex); | 1450 | mutex_lock(&inode->i_mutex); |
| 1449 | switch (origin) { | 1451 | switch (origin) { |
| 1450 | case SEEK_END: | 1452 | case SEEK_END: |
| 1453 | retval = fuse_update_attributes(inode, NULL, file, NULL); | ||
| 1454 | if (retval) | ||
| 1455 | return retval; | ||
| 1451 | offset += i_size_read(inode); | 1456 | offset += i_size_read(inode); |
| 1452 | break; | 1457 | break; |
| 1453 | case SEEK_CUR: | 1458 | case SEEK_CUR: |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 3a876076bdd1..35accfdd747f 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
| @@ -6,6 +6,9 @@ | |||
| 6 | See the file COPYING. | 6 | See the file COPYING. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #ifndef _FS_FUSE_I_H | ||
| 10 | #define _FS_FUSE_I_H | ||
| 11 | |||
| 9 | #include <linux/fuse.h> | 12 | #include <linux/fuse.h> |
| 10 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
| 11 | #include <linux/mount.h> | 14 | #include <linux/mount.h> |
| @@ -655,3 +658,5 @@ void fuse_set_nowrite(struct inode *inode); | |||
| 655 | void fuse_release_nowrite(struct inode *inode); | 658 | void fuse_release_nowrite(struct inode *inode); |
| 656 | 659 | ||
| 657 | u64 fuse_get_attr_version(struct fuse_conn *fc); | 660 | u64 fuse_get_attr_version(struct fuse_conn *fc); |
| 661 | |||
| 662 | #endif /* _FS_FUSE_I_H */ | ||
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 6a84388cacff..54b1f0e1ef58 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
| @@ -865,7 +865,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
| 865 | if (is_bdev) { | 865 | if (is_bdev) { |
| 866 | fc->destroy_req = fuse_request_alloc(); | 866 | fc->destroy_req = fuse_request_alloc(); |
| 867 | if (!fc->destroy_req) | 867 | if (!fc->destroy_req) |
| 868 | goto err_put_root; | 868 | goto err_free_init_req; |
| 869 | } | 869 | } |
| 870 | 870 | ||
| 871 | mutex_lock(&fuse_mutex); | 871 | mutex_lock(&fuse_mutex); |
| @@ -895,6 +895,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
| 895 | 895 | ||
| 896 | err_unlock: | 896 | err_unlock: |
| 897 | mutex_unlock(&fuse_mutex); | 897 | mutex_unlock(&fuse_mutex); |
| 898 | err_free_init_req: | ||
| 898 | fuse_request_free(init_req); | 899 | fuse_request_free(init_req); |
| 899 | err_put_root: | 900 | err_put_root: |
| 900 | dput(root_dentry); | 901 | dput(root_dentry); |
diff --git a/include/linux/fuse.h b/include/linux/fuse.h index 265635dc9908..350fe9767bbc 100644 --- a/include/linux/fuse.h +++ b/include/linux/fuse.h | |||
| @@ -17,8 +17,14 @@ | |||
| 17 | * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in | 17 | * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in |
| 18 | * - add blksize field to fuse_attr | 18 | * - add blksize field to fuse_attr |
| 19 | * - add file flags field to fuse_read_in and fuse_write_in | 19 | * - add file flags field to fuse_read_in and fuse_write_in |
| 20 | * | ||
| 21 | * 7.10 | ||
| 22 | * - add nonseekable open flag | ||
| 20 | */ | 23 | */ |
| 21 | 24 | ||
| 25 | #ifndef _LINUX_FUSE_H | ||
| 26 | #define _LINUX_FUSE_H | ||
| 27 | |||
| 22 | #include <asm/types.h> | 28 | #include <asm/types.h> |
| 23 | #include <linux/major.h> | 29 | #include <linux/major.h> |
| 24 | 30 | ||
| @@ -26,7 +32,7 @@ | |||
| 26 | #define FUSE_KERNEL_VERSION 7 | 32 | #define FUSE_KERNEL_VERSION 7 |
| 27 | 33 | ||
| 28 | /** Minor version number of this interface */ | 34 | /** Minor version number of this interface */ |
| 29 | #define FUSE_KERNEL_MINOR_VERSION 9 | 35 | #define FUSE_KERNEL_MINOR_VERSION 10 |
| 30 | 36 | ||
| 31 | /** The node ID of the root inode */ | 37 | /** The node ID of the root inode */ |
| 32 | #define FUSE_ROOT_ID 1 | 38 | #define FUSE_ROOT_ID 1 |
| @@ -98,9 +104,11 @@ struct fuse_file_lock { | |||
| 98 | * | 104 | * |
| 99 | * FOPEN_DIRECT_IO: bypass page cache for this open file | 105 | * FOPEN_DIRECT_IO: bypass page cache for this open file |
| 100 | * FOPEN_KEEP_CACHE: don't invalidate the data cache on open | 106 | * FOPEN_KEEP_CACHE: don't invalidate the data cache on open |
| 107 | * FOPEN_NONSEEKABLE: the file is not seekable | ||
| 101 | */ | 108 | */ |
| 102 | #define FOPEN_DIRECT_IO (1 << 0) | 109 | #define FOPEN_DIRECT_IO (1 << 0) |
| 103 | #define FOPEN_KEEP_CACHE (1 << 1) | 110 | #define FOPEN_KEEP_CACHE (1 << 1) |
| 111 | #define FOPEN_NONSEEKABLE (1 << 2) | ||
| 104 | 112 | ||
| 105 | /** | 113 | /** |
| 106 | * INIT request/reply flags | 114 | * INIT request/reply flags |
| @@ -409,3 +417,5 @@ struct fuse_dirent { | |||
| 409 | #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) | 417 | #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) |
| 410 | #define FUSE_DIRENT_SIZE(d) \ | 418 | #define FUSE_DIRENT_SIZE(d) \ |
| 411 | FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) | 419 | FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) |
| 420 | |||
| 421 | #endif /* _LINUX_FUSE_H */ | ||
