NFS: Split out NFS v2 inode operations
[linux-block.git] / fs / nfs / proc.c
index a706b6bcc286a5a401318e868b0d1fbab2a206a4..4d3356af330975b38491d89e6ea32bb37cda5523 100644 (file)
@@ -259,7 +259,7 @@ static void nfs_free_createdata(const struct nfs_createdata *data)
 
 static int
 nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
-               int flags, struct nfs_open_context *ctx)
+               int flags)
 {
        struct nfs_createdata *data;
        struct rpc_message msg = {
@@ -651,7 +651,7 @@ static int nfs_read_done(struct rpc_task *task, struct nfs_read_data *data)
                /* Emulate the eof flag, which isn't normally needed in NFSv2
                 * as it is guaranteed to always return the file attributes
                 */
-               if (data->args.offset + data->args.count >= data->res.fattr->size)
+               if (data->args.offset + data->res.count >= data->res.fattr->size)
                        data->res.eof = 1;
        }
        return 0;
@@ -734,6 +734,38 @@ out_einval:
        return -EINVAL;
 }
 
+static int nfs_have_delegation(struct inode *inode, fmode_t flags)
+{
+       return 0;
+}
+
+static int nfs_return_delegation(struct inode *inode)
+{
+       nfs_wb_all(inode);
+       return 0;
+}
+
+static const struct inode_operations nfs_dir_inode_operations = {
+       .create         = nfs_create,
+       .lookup         = nfs_lookup,
+       .link           = nfs_link,
+       .unlink         = nfs_unlink,
+       .symlink        = nfs_symlink,
+       .mkdir          = nfs_mkdir,
+       .rmdir          = nfs_rmdir,
+       .mknod          = nfs_mknod,
+       .rename         = nfs_rename,
+       .permission     = nfs_permission,
+       .getattr        = nfs_getattr,
+       .setattr        = nfs_setattr,
+};
+
+static const struct inode_operations nfs_file_inode_operations = {
+       .permission     = nfs_permission,
+       .getattr        = nfs_getattr,
+       .setattr        = nfs_setattr,
+};
+
 const struct nfs_rpc_ops nfs_v2_clientops = {
        .version        = 2,                   /* protocol version */
        .dentry_ops     = &nfs_dentry_operations,
@@ -767,9 +799,11 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
        .pathconf       = nfs_proc_pathconf,
        .decode_dirent  = nfs2_decode_dirent,
        .read_setup     = nfs_proc_read_setup,
+       .read_pageio_init = nfs_pageio_init_read,
        .read_rpc_prepare = nfs_proc_read_rpc_prepare,
        .read_done      = nfs_read_done,
        .write_setup    = nfs_proc_write_setup,
+       .write_pageio_init = nfs_pageio_init_write,
        .write_rpc_prepare = nfs_proc_write_rpc_prepare,
        .write_done     = nfs_write_done,
        .commit_setup   = nfs_proc_commit_setup,
@@ -777,5 +811,9 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
        .lock           = nfs_proc_lock,
        .lock_check_bounds = nfs_lock_check_bounds,
        .close_context  = nfs_close_context,
+       .have_delegation = nfs_have_delegation,
+       .return_delegation = nfs_return_delegation,
+       .alloc_client   = nfs_alloc_client,
        .init_client    = nfs_init_client,
+       .free_client    = nfs_free_client,
 };