aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4acl.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2014-01-08 09:49:01 -0500
committerJ. Bruce Fields <bfields@redhat.com>2014-01-08 12:18:53 -0500
commit3554116d3aae25353713f3d0131d86ae6c1e5674 (patch)
treefaa8c12948e667b34fa3b116f744ef14a034e394 /fs/nfsd/nfs4acl.c
parent87915c6472acbc5d7c809f3c9753808797da51a8 (diff)
nfsd4: simplify xdr encoding of nfsv4 names
We can simplify the idmapping code if it does its own encoding and returns nfs errors. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4acl.c')
-rw-r--r--fs/nfsd/nfs4acl.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
index 8a50b3c18093..eea24c9a561d 100644
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -37,6 +37,7 @@
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/nfs_fs.h> 38#include <linux/nfs_fs.h>
39#include <linux/export.h> 39#include <linux/export.h>
40#include "nfsd.h"
40#include "acl.h" 41#include "acl.h"
41 42
42 43
@@ -848,18 +849,23 @@ nfs4_acl_get_whotype(char *p, u32 len)
848 return NFS4_ACL_WHO_NAMED; 849 return NFS4_ACL_WHO_NAMED;
849} 850}
850 851
851int 852__be32 nfs4_acl_write_who(int who, __be32 **p, int *len)
852nfs4_acl_write_who(int who, char *p)
853{ 853{
854 int i; 854 int i;
855 int bytes;
855 856
856 for (i = 0; i < ARRAY_SIZE(s2t_map); i++) { 857 for (i = 0; i < ARRAY_SIZE(s2t_map); i++) {
857 if (s2t_map[i].type == who) { 858 if (s2t_map[i].type != who)
858 memcpy(p, s2t_map[i].string, s2t_map[i].stringlen); 859 continue;
859 return s2t_map[i].stringlen; 860 bytes = 4 + (XDR_QUADLEN(s2t_map[i].stringlen) << 2);
860 } 861 if (bytes > *len)
862 return nfserr_resource;
863 *p = xdr_encode_opaque(*p, s2t_map[i].string,
864 s2t_map[i].stringlen);
865 *len -= bytes;
866 return 0;
861 } 867 }
862 BUG(); 868 WARN_ON_ONCE(1);
863 return -1; 869 return -1;
864} 870}
865 871