aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2014-06-24 17:51:21 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-07-08 17:14:27 -0400
commitbcaab953b1d3790c724a211f2452b574fd49a7ce (patch)
tree27ca81379f29efdf4267337da9434a3eeabdae31
parent29c353b3fe54789706c0a37560ce4548a6362c2c (diff)
nfsd4: remove nfs4_acl_new
This is a not-that-useful kmalloc wrapper. And I'd like one of the callers to actually use something other than kmalloc. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/acl.h2
-rw-r--r--fs/nfsd/nfs4acl.c18
-rw-r--r--fs/nfsd/nfs4xdr.c2
3 files changed, 10 insertions, 12 deletions
diff --git a/fs/nfsd/acl.h b/fs/nfsd/acl.h
index a986ceb6fd0d..4cd7c69a6cb9 100644
--- a/fs/nfsd/acl.h
+++ b/fs/nfsd/acl.h
@@ -47,7 +47,7 @@ struct svc_rqst;
47#define NFS4_ACL_MAX ((PAGE_SIZE - sizeof(struct nfs4_acl)) \ 47#define NFS4_ACL_MAX ((PAGE_SIZE - sizeof(struct nfs4_acl)) \
48 / sizeof(struct nfs4_ace)) 48 / sizeof(struct nfs4_ace))
49 49
50struct nfs4_acl *nfs4_acl_new(int); 50int nfs4_acl_bytes(int entries);
51int nfs4_acl_get_whotype(char *, u32); 51int nfs4_acl_get_whotype(char *, u32);
52__be32 nfs4_acl_write_who(struct xdr_stream *xdr, int who); 52__be32 nfs4_acl_write_who(struct xdr_stream *xdr, int who);
53 53
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
index b0cf00d3ee7d..acf6974e6823 100644
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -161,11 +161,12 @@ nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry,
161 size += 2 * dpacl->a_count; 161 size += 2 * dpacl->a_count;
162 } 162 }
163 163
164 *acl = nfs4_acl_new(size); 164 *acl = kmalloc(nfs4_acl_bytes(size), GFP_KERNEL);
165 if (*acl == NULL) { 165 if (*acl == NULL) {
166 error = -ENOMEM; 166 error = -ENOMEM;
167 goto out; 167 goto out;
168 } 168 }
169 (*acl)->naces = 0;
169 170
170 _posix_to_nfsv4_one(pacl, *acl, flags & ~NFS4_ACL_TYPE_DEFAULT); 171 _posix_to_nfsv4_one(pacl, *acl, flags & ~NFS4_ACL_TYPE_DEFAULT);
171 172
@@ -872,16 +873,13 @@ ace2type(struct nfs4_ace *ace)
872 return -1; 873 return -1;
873} 874}
874 875
875struct nfs4_acl * 876/*
876nfs4_acl_new(int n) 877 * return the size of the struct nfs4_acl required to represent an acl
878 * with @entries entries.
879 */
880int nfs4_acl_bytes(int entries)
877{ 881{
878 struct nfs4_acl *acl; 882 return sizeof(struct nfs4_acl) + entries * sizeof(struct nfs4_ace);
879
880 acl = kmalloc(sizeof(*acl) + n*sizeof(struct nfs4_ace), GFP_KERNEL);
881 if (acl == NULL)
882 return NULL;
883 acl->naces = 0;
884 return acl;
885} 883}
886 884
887static struct { 885static struct {
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 8fb0f3718202..fea41046427c 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -309,7 +309,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
309 if (nace > NFS4_ACL_MAX) 309 if (nace > NFS4_ACL_MAX)
310 return nfserr_fbig; 310 return nfserr_fbig;
311 311
312 *acl = nfs4_acl_new(nace); 312 *acl = kmalloc(nfs4_acl_bytes(nace), GFP_KERNEL);
313 if (*acl == NULL) 313 if (*acl == NULL)
314 return nfserr_jukebox; 314 return nfserr_jukebox;
315 315