Linux 3.8-rc7
[cris-mirror.git] / fs / nfs / nfs3client.c
blobb3fc65ef39caf0e2613ef1b2ac8fd693ba720fb7
1 #include <linux/nfs_fs.h>
2 #include <linux/nfs_mount.h>
3 #include "internal.h"
5 #ifdef CONFIG_NFS_V3_ACL
6 static struct rpc_stat nfsacl_rpcstat = { &nfsacl_program };
7 static const struct rpc_version *nfsacl_version[] = {
8 [3] = &nfsacl_version3,
9 };
11 const struct rpc_program nfsacl_program = {
12 .name = "nfsacl",
13 .number = NFS_ACL_PROGRAM,
14 .nrvers = ARRAY_SIZE(nfsacl_version),
15 .version = nfsacl_version,
16 .stats = &nfsacl_rpcstat,
20 * Initialise an NFSv3 ACL client connection
22 static void nfs_init_server_aclclient(struct nfs_server *server)
24 if (server->flags & NFS_MOUNT_NOACL)
25 goto out_noacl;
27 server->client_acl = rpc_bind_new_program(server->client, &nfsacl_program, 3);
28 if (IS_ERR(server->client_acl))
29 goto out_noacl;
31 /* No errors! Assume that Sun nfsacls are supported */
32 server->caps |= NFS_CAP_ACLS;
33 return;
35 out_noacl:
36 server->caps &= ~NFS_CAP_ACLS;
38 #else
39 static inline void nfs_init_server_aclclient(struct nfs_server *server)
41 server->flags &= ~NFS_MOUNT_NOACL;
42 server->caps &= ~NFS_CAP_ACLS;
44 #endif
46 struct nfs_server *nfs3_create_server(struct nfs_mount_info *mount_info,
47 struct nfs_subversion *nfs_mod)
49 struct nfs_server *server = nfs_create_server(mount_info, nfs_mod);
50 /* Create a client RPC handle for the NFS v3 ACL management interface */
51 if (!IS_ERR(server))
52 nfs_init_server_aclclient(server);
53 return server;
56 struct nfs_server *nfs3_clone_server(struct nfs_server *source,
57 struct nfs_fh *fh,
58 struct nfs_fattr *fattr,
59 rpc_authflavor_t flavor)
61 struct nfs_server *server = nfs_clone_server(source, fh, fattr, flavor);
62 if (!IS_ERR(server) && !IS_ERR(source->client_acl))
63 nfs_init_server_aclclient(server);
64 return server;