1 #include <linux/nfs_fs.h> 2 #include <linux/nfs_mount.h> 3 #include "internal.h" 4 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 }; 10 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, 17 }; 18 19 /* 20 * Initialise an NFSv3 ACL client connection 21 */ 22 static void nfs_init_server_aclclient(struct nfs_server *server) 23 { 24 if (server->flags & NFS_MOUNT_NOACL) 25 goto out_noacl; 26 27 server->client_acl = rpc_bind_new_program(server->client, &nfsacl_program, 3); 28 if (IS_ERR(server->client_acl)) 29 goto out_noacl; 30 31 /* No errors! Assume that Sun nfsacls are supported */ 32 server->caps |= NFS_CAP_ACLS; 33 return; 34 35 out_noacl: 36 server->caps &= ~NFS_CAP_ACLS; 37 } 38 #else 39 static inline void nfs_init_server_aclclient(struct nfs_server *server) 40 { 41 server->flags &= ~NFS_MOUNT_NOACL; 42 server->caps &= ~NFS_CAP_ACLS; 43 } 44 #endif 45 46 struct nfs_server *nfs3_create_server(struct nfs_mount_info *mount_info, 47 struct nfs_subversion *nfs_mod) 48 { 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; 54 } 55 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) 60 { 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; 65 } 66