Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / fs / nfsd / nfs4acl.c
index 11ebf6c..edb107e 100644 (file)
@@ -125,7 +125,7 @@ static short ace2type(struct nfs4_ace *);
 static int _posix_to_nfsv4_one(struct posix_acl *, struct nfs4_acl *, unsigned int);
 static struct posix_acl *_nfsv4_to_posix_one(struct nfs4_acl *, unsigned int);
 int nfs4_acl_add_ace(struct nfs4_acl *, u32, u32, u32, int, uid_t);
-int nfs4_acl_split(struct nfs4_acl *, struct nfs4_acl *);
+static int nfs4_acl_split(struct nfs4_acl *, struct nfs4_acl *);
 
 struct nfs4_acl *
 nfs4_acl_posix_to_nfsv4(struct posix_acl *pacl, struct posix_acl *dpacl,
@@ -710,9 +710,9 @@ calculate_posix_ace_count(struct nfs4_acl *n4acl)
                /* Also, the remaining entries are for named users and
                 * groups, and come in threes (mask, allow, deny): */
                if (n4acl->naces < 7)
-                       return -1;
+                       return -EINVAL;
                if ((n4acl->naces - 7) % 3)
-                       return -1;
+                       return -EINVAL;
                return 4 + (n4acl->naces - 7)/3;
        }
 }
@@ -775,7 +775,7 @@ out_err:
        return pacl;
 }
 
-int
+static int
 nfs4_acl_split(struct nfs4_acl *acl, struct nfs4_acl *dacl)
 {
        struct list_head *h, *n;
@@ -790,7 +790,7 @@ nfs4_acl_split(struct nfs4_acl *acl, struct nfs4_acl *dacl)
                        continue;
 
                error = nfs4_acl_add_ace(dacl, ace->type, ace->flag,
-                               ace->access_mask, ace->whotype, ace->who) == -1;
+                               ace->access_mask, ace->whotype, ace->who);
                if (error < 0)
                        goto out;
 
@@ -866,7 +866,7 @@ nfs4_acl_add_ace(struct nfs4_acl *acl, u32 type, u32 flag, u32 access_mask,
        struct nfs4_ace *ace;
 
        if ((ace = kmalloc(sizeof(*ace), GFP_KERNEL)) == NULL)
-               return -1;
+               return -ENOMEM;
 
        ace->type = type;
        ace->flag = flag;
@@ -907,7 +907,7 @@ nfs4_acl_get_whotype(char *p, u32 len)
 {
        int i;
 
-       for (i=0; i < sizeof(s2t_map) / sizeof(*s2t_map); i++) {
+       for (i = 0; i < ARRAY_SIZE(s2t_map); i++) {
                if (s2t_map[i].stringlen == len &&
                                0 == memcmp(s2t_map[i].string, p, len))
                        return s2t_map[i].type;
@@ -920,7 +920,7 @@ nfs4_acl_write_who(int who, char *p)
 {
        int i;
 
-       for (i=0; i < sizeof(s2t_map) / sizeof(*s2t_map); i++) {
+       for (i = 0; i < ARRAY_SIZE(s2t_map); i++) {
                if (s2t_map[i].type == who) {
                        memcpy(p, s2t_map[i].string, s2t_map[i].stringlen);
                        return s2t_map[i].stringlen;