[PATCH] afs: use generic_ro_fops
authorChristoph Hellwig <hch@lst.de>
Mon, 7 Nov 2005 08:59:46 +0000 (00:59 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 7 Nov 2005 15:53:41 +0000 (07:53 -0800)
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>
fs/afs/file.c
fs/afs/inode.c
fs/afs/internal.h

index 4975c9c193dd37505cbdcfad000fdcd24793676d..f53971a543b23202a13c704be25a07ee8078ea67 100644 (file)
@@ -31,24 +31,10 @@ static int afs_file_readpage(struct file *file, struct page *page);
 static int afs_file_invalidatepage(struct page *page, unsigned long offset);
 static int afs_file_releasepage(struct page *page, gfp_t gfp_flags);
 
-static ssize_t afs_file_write(struct file *file, const char __user *buf,
-                             size_t size, loff_t *off);
-
 struct inode_operations afs_file_inode_operations = {
        .getattr        = afs_inode_getattr,
 };
 
-struct file_operations afs_file_file_operations = {
-       .read           = generic_file_read,
-       .write          = afs_file_write,
-       .mmap           = generic_file_mmap,
-#if 0
-       .open           = afs_file_open,
-       .release        = afs_file_release,
-       .fsync          = afs_file_fsync,
-#endif
-};
-
 struct address_space_operations afs_fs_aops = {
        .readpage       = afs_file_readpage,
        .sync_page      = block_sync_page,
@@ -57,22 +43,6 @@ struct address_space_operations afs_fs_aops = {
        .invalidatepage = afs_file_invalidatepage,
 };
 
-/*****************************************************************************/
-/*
- * AFS file write
- */
-static ssize_t afs_file_write(struct file *file, const char __user *buf,
-                             size_t size, loff_t *off)
-{
-       struct afs_vnode *vnode;
-
-       vnode = AFS_FS_I(file->f_dentry->d_inode);
-       if (vnode->flags & AFS_VNODE_DELETED)
-               return -ESTALE;
-
-       return -EIO;
-} /* end afs_file_write() */
-
 /*****************************************************************************/
 /*
  * deal with notification that a page was read from the cache
index c476fde33fbc24ab64ed26137424e8eb7b7d776a..4ebb30a50ed5a876d28c7830e0083c10a1aa26f9 100644 (file)
@@ -49,7 +49,7 @@ static int afs_inode_map_status(struct afs_vnode *vnode)
        case AFS_FTYPE_FILE:
                inode->i_mode   = S_IFREG | vnode->status.mode;
                inode->i_op     = &afs_file_inode_operations;
-               inode->i_fop    = &afs_file_file_operations;
+               inode->i_fop    = &generic_ro_fops;
                break;
        case AFS_FTYPE_DIR:
                inode->i_mode   = S_IFDIR | vnode->status.mode;
index f09860b45c1a303e9f0702bf2ab9636f6a26689d..ab8f87c66319bc4233444e8bcd7c3f17163e5d88 100644 (file)
@@ -71,7 +71,6 @@ extern struct file_operations afs_dir_file_operations;
  */
 extern struct address_space_operations afs_fs_aops;
 extern struct inode_operations afs_file_inode_operations;
-extern struct file_operations afs_file_file_operations;
 
 #ifdef AFS_CACHING_SUPPORT
 extern int afs_cache_get_page_cookie(struct page *page,