Skip to content

Commit a463ddd

Browse files
Christoph HellwigLinus Torvalds
authored andcommitted
[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>
1 parent dc48700 commit a463ddd

3 files changed

Lines changed: 1 addition & 32 deletions

File tree

‎fs/afs/file.c‎

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,10 @@ static int afs_file_readpage(struct file *file, struct page *page);
3131
static int afs_file_invalidatepage(struct page *page, unsigned long offset);
3232
static int afs_file_releasepage(struct page *page, gfp_t gfp_flags);
3333

34-
static ssize_t afs_file_write(struct file *file, const char __user *buf,
35-
size_t size, loff_t *off);
36-
3734
struct inode_operations afs_file_inode_operations = {
3835
.getattr = afs_inode_getattr,
3936
};
4037

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-
5238
struct address_space_operations afs_fs_aops = {
5339
.readpage = afs_file_readpage,
5440
.sync_page = block_sync_page,
@@ -57,22 +43,6 @@ struct address_space_operations afs_fs_aops = {
5743
.invalidatepage = afs_file_invalidatepage,
5844
};
5945

60-
/*****************************************************************************/
61-
/*
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-
7646
/*****************************************************************************/
7747
/*
7848
* deal with notification that a page was read from the cache

‎fs/afs/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static int afs_inode_map_status(struct afs_vnode *vnode)
4949
case AFS_FTYPE_FILE:
5050
inode->i_mode = S_IFREG | vnode->status.mode;
5151
inode->i_op = &afs_file_inode_operations;
52-
inode->i_fop = &afs_file_file_operations;
52+
inode->i_fop = &generic_ro_fops;
5353
break;
5454
case AFS_FTYPE_DIR:
5555
inode->i_mode = S_IFDIR | vnode->status.mode;

‎fs/afs/internal.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ extern struct file_operations afs_dir_file_operations;
7171
*/
7272
extern struct address_space_operations afs_fs_aops;
7373
extern struct inode_operations afs_file_inode_operations;
74-
extern struct file_operations afs_file_file_operations;
7574

7675
#ifdef AFS_CACHING_SUPPORT
7776
extern int afs_cache_get_page_cookie(struct page *page,

0 commit comments

Comments
 (0)