diff options
author | Christoph Hellwig <hch@lst.de> | 2005-11-07 03:59:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:53:41 -0500 |
commit | a463ddd343dacf5f1badae514ed2c5135ec0c3a9 (patch) | |
tree | 685d7416610c518020960e0f69584b2a21453ded /fs | |
parent | dc487002a26a5733967292356434e61dc5da9c98 (diff) |
[PATCH] afs: use generic_ro_fops
afs actually had a write method that returned different errors depending on
whether some flag was set - better return the standard EINVAL errno.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/afs/file.c | 30 | ||||
-rw-r--r-- | fs/afs/inode.c | 2 | ||||
-rw-r--r-- | fs/afs/internal.h | 1 |
3 files changed, 1 insertions, 32 deletions
diff --git a/fs/afs/file.c b/fs/afs/file.c index 4975c9c193dd..f53971a543b2 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c | |||
@@ -31,24 +31,10 @@ static int afs_file_readpage(struct file *file, struct page *page); | |||
31 | static int afs_file_invalidatepage(struct page *page, unsigned long offset); | 31 | static int afs_file_invalidatepage(struct page *page, unsigned long offset); |
32 | static int afs_file_releasepage(struct page *page, gfp_t gfp_flags); | 32 | static int afs_file_releasepage(struct page *page, gfp_t gfp_flags); |
33 | 33 | ||
34 | static ssize_t afs_file_write(struct file *file, const char __user *buf, | ||
35 | size_t size, loff_t *off); | ||
36 | |||
37 | struct inode_operations afs_file_inode_operations = { | 34 | struct inode_operations afs_file_inode_operations = { |
38 | .getattr = afs_inode_getattr, | 35 | .getattr = afs_inode_getattr, |
39 | }; | 36 | }; |
40 | 37 | ||
41 | struct file_operations afs_file_file_operations = { | ||
42 | .read = generic_file_read, | ||
43 | .write = afs_file_write, | ||
44 | .mmap = generic_file_mmap, | ||
45 | #if 0 | ||
46 | .open = afs_file_open, | ||
47 | .release = afs_file_release, | ||
48 | .fsync = afs_file_fsync, | ||
49 | #endif | ||
50 | }; | ||
51 | |||
52 | struct address_space_operations afs_fs_aops = { | 38 | struct address_space_operations afs_fs_aops = { |
53 | .readpage = afs_file_readpage, | 39 | .readpage = afs_file_readpage, |
54 | .sync_page = block_sync_page, | 40 | .sync_page = block_sync_page, |
@@ -59,22 +45,6 @@ struct address_space_operations afs_fs_aops = { | |||
59 | 45 | ||
60 | /*****************************************************************************/ | 46 | /*****************************************************************************/ |
61 | /* | 47 | /* |
62 | * AFS file write | ||
63 | */ | ||
64 | static ssize_t afs_file_write(struct file *file, const char __user *buf, | ||
65 | size_t size, loff_t *off) | ||
66 | { | ||
67 | struct afs_vnode *vnode; | ||
68 | |||
69 | vnode = AFS_FS_I(file->f_dentry->d_inode); | ||
70 | if (vnode->flags & AFS_VNODE_DELETED) | ||
71 | return -ESTALE; | ||
72 | |||
73 | return -EIO; | ||
74 | } /* end afs_file_write() */ | ||
75 | |||
76 | /*****************************************************************************/ | ||
77 | /* | ||
78 | * deal with notification that a page was read from the cache | 48 | * deal with notification that a page was read from the cache |
79 | */ | 49 | */ |
80 | #ifdef AFS_CACHING_SUPPORT | 50 | #ifdef AFS_CACHING_SUPPORT |
diff --git a/fs/afs/inode.c b/fs/afs/inode.c index c476fde33fbc..4ebb30a50ed5 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c | |||
@@ -49,7 +49,7 @@ static int afs_inode_map_status(struct afs_vnode *vnode) | |||
49 | case AFS_FTYPE_FILE: | 49 | case AFS_FTYPE_FILE: |
50 | inode->i_mode = S_IFREG | vnode->status.mode; | 50 | inode->i_mode = S_IFREG | vnode->status.mode; |
51 | inode->i_op = &afs_file_inode_operations; | 51 | inode->i_op = &afs_file_inode_operations; |
52 | inode->i_fop = &afs_file_file_operations; | 52 | inode->i_fop = &generic_ro_fops; |
53 | break; | 53 | break; |
54 | case AFS_FTYPE_DIR: | 54 | case AFS_FTYPE_DIR: |
55 | inode->i_mode = S_IFDIR | vnode->status.mode; | 55 | inode->i_mode = S_IFDIR | vnode->status.mode; |
diff --git a/fs/afs/internal.h b/fs/afs/internal.h index f09860b45c1a..ab8f87c66319 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h | |||
@@ -71,7 +71,6 @@ extern struct file_operations afs_dir_file_operations; | |||
71 | */ | 71 | */ |
72 | extern struct address_space_operations afs_fs_aops; | 72 | extern struct address_space_operations afs_fs_aops; |
73 | extern struct inode_operations afs_file_inode_operations; | 73 | extern struct inode_operations afs_file_inode_operations; |
74 | extern struct file_operations afs_file_file_operations; | ||
75 | 74 | ||
76 | #ifdef AFS_CACHING_SUPPORT | 75 | #ifdef AFS_CACHING_SUPPORT |
77 | extern int afs_cache_get_page_cookie(struct page *page, | 76 | extern int afs_cache_get_page_cookie(struct page *page, |