4 * Common NFSv4 ACL handling code.
6 * Copyright (c) 2002, 2003 The Regents of the University of Michigan.
9 * Marius Aamodt Eriksen <marius@umich.edu>
10 * Jeff Sedlak <jsedlak@umich.edu>
11 * J. Bruce Fields <bfields@umich.edu>
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 * 3. Neither the name of the University nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
33 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #include <linux/string.h>
40 #include <linux/slab.h>
41 #include <linux/list.h>
42 #include <linux/types.h>
44 #include <linux/module.h>
45 #include <linux/nfs_fs.h>
46 #include <linux/posix_acl.h>
47 #include <linux/nfs4.h>
48 #include <linux/nfs4_acl.h>
51 /* mode bit translations: */
52 #define NFS4_READ_MODE (NFS4_ACE_READ_DATA)
53 #define NFS4_WRITE_MODE (NFS4_ACE_WRITE_DATA | NFS4_ACE_APPEND_DATA)
54 #define NFS4_EXECUTE_MODE NFS4_ACE_EXECUTE
55 #define NFS4_ANYONE_MODE (NFS4_ACE_READ_ATTRIBUTES | NFS4_ACE_READ_ACL | NFS4_ACE_SYNCHRONIZE)
56 #define NFS4_OWNER_MODE (NFS4_ACE_WRITE_ATTRIBUTES | NFS4_ACE_WRITE_ACL)
58 /* We don't support these bits; insist they be neither allowed nor denied */
59 #define NFS4_MASK_UNSUPP (NFS4_ACE_DELETE | NFS4_ACE_WRITE_OWNER \
60 | NFS4_ACE_READ_NAMED_ATTRS | NFS4_ACE_WRITE_NAMED_ATTRS)
62 /* flags used to simulate posix default ACLs */
63 #define NFS4_INHERITANCE_FLAGS (NFS4_ACE_FILE_INHERIT_ACE \
64 | NFS4_ACE_DIRECTORY_INHERIT_ACE)
66 #define NFS4_SUPPORTED_FLAGS (NFS4_INHERITANCE_FLAGS \
67 | NFS4_ACE_INHERIT_ONLY_ACE \
68 | NFS4_ACE_IDENTIFIER_GROUP)
70 #define MASK_EQUAL(mask1, mask2) \
71 ( ((mask1) & NFS4_ACE_MASK_ALL) == ((mask2) & NFS4_ACE_MASK_ALL) )
74 mask_from_posix(unsigned short perm, unsigned int flags)
76 int mask = NFS4_ANYONE_MODE;
78 if (flags & NFS4_ACL_OWNER)
79 mask |= NFS4_OWNER_MODE;
81 mask |= NFS4_READ_MODE;
83 mask |= NFS4_WRITE_MODE;
84 if ((perm & ACL_WRITE) && (flags & NFS4_ACL_DIR))
85 mask |= NFS4_ACE_DELETE_CHILD;
86 if (perm & ACL_EXECUTE)
87 mask |= NFS4_EXECUTE_MODE;
92 deny_mask_from_posix(unsigned short perm, u32 flags)
97 mask |= NFS4_READ_MODE;
99 mask |= NFS4_WRITE_MODE;
100 if ((perm & ACL_WRITE) && (flags & NFS4_ACL_DIR))
101 mask |= NFS4_ACE_DELETE_CHILD;
102 if (perm & ACL_EXECUTE)
103 mask |= NFS4_EXECUTE_MODE;
107 /* XXX: modify functions to return NFS errors; they're only ever
108 * used by nfs code, after all.... */
110 /* We only map from NFSv4 to POSIX ACLs when setting ACLs, when we err on the
111 * side of being more restrictive, so the mode bit mapping below is
112 * pessimistic. An optimistic version would be needed to handle DENY's,
113 * but we espect to coalesce all ALLOWs and DENYs before mapping to mode
117 low_mode_from_nfs4(u32 perm, unsigned short *mode, unsigned int flags)
119 u32 write_mode = NFS4_WRITE_MODE;
121 if (flags & NFS4_ACL_DIR)
122 write_mode |= NFS4_ACE_DELETE_CHILD;
124 if ((perm & NFS4_READ_MODE) == NFS4_READ_MODE)
126 if ((perm & write_mode) == write_mode)
128 if ((perm & NFS4_EXECUTE_MODE) == NFS4_EXECUTE_MODE)
129 *mode |= ACL_EXECUTE;
132 struct ace_container {
133 struct nfs4_ace *ace;
134 struct list_head ace_l;
137 static short ace2type(struct nfs4_ace *);
138 static void _posix_to_nfsv4_one(struct posix_acl *, struct nfs4_acl *,
140 void nfs4_acl_add_ace(struct nfs4_acl *, u32, u32, u32, int, uid_t);
143 nfs4_acl_posix_to_nfsv4(struct posix_acl *pacl, struct posix_acl *dpacl,
146 struct nfs4_acl *acl;
150 if (posix_acl_valid(pacl) < 0)
151 return ERR_PTR(-EINVAL);
152 size += 2*pacl->a_count;
155 if (posix_acl_valid(dpacl) < 0)
156 return ERR_PTR(-EINVAL);
157 size += 2*dpacl->a_count;
160 /* Allocate for worst case: one (deny, allow) pair each: */
161 acl = nfs4_acl_new(size);
163 return ERR_PTR(-ENOMEM);
166 _posix_to_nfsv4_one(pacl, acl, flags & ~NFS4_ACL_TYPE_DEFAULT);
169 _posix_to_nfsv4_one(dpacl, acl, flags | NFS4_ACL_TYPE_DEFAULT);
174 struct posix_acl_summary {
175 unsigned short owner;
176 unsigned short users;
177 unsigned short group;
178 unsigned short groups;
179 unsigned short other;
184 summarize_posix_acl(struct posix_acl *acl, struct posix_acl_summary *pas)
186 struct posix_acl_entry *pa, *pe;
191 pe = acl->a_entries + acl->a_count;
193 FOREACH_ACL_ENTRY(pa, acl, pe) {
196 pas->owner = pa->e_perm;
199 pas->group = pa->e_perm;
202 pas->users |= pa->e_perm;
205 pas->groups |= pa->e_perm;
208 pas->other = pa->e_perm;
211 pas->mask = pa->e_perm;
215 /* We'll only care about effective permissions: */
216 pas->users &= pas->mask;
217 pas->group &= pas->mask;
218 pas->groups &= pas->mask;
221 /* We assume the acl has been verified with posix_acl_valid. */
223 _posix_to_nfsv4_one(struct posix_acl *pacl, struct nfs4_acl *acl,
226 struct posix_acl_entry *pa, *group_owner_entry;
227 struct nfs4_ace *ace;
228 struct posix_acl_summary pas;
230 int eflag = ((flags & NFS4_ACL_TYPE_DEFAULT) ?
231 NFS4_INHERITANCE_FLAGS : 0);
233 BUG_ON(pacl->a_count < 3);
234 summarize_posix_acl(pacl, &pas);
236 pa = pacl->a_entries;
237 ace = acl->aces + acl->naces;
239 /* We could deny everything not granted by the owner: */
242 * but it is equivalent (and simpler) to deny only what is not
243 * granted by later entries:
245 deny &= pas.users | pas.group | pas.groups | pas.other;
247 ace->type = NFS4_ACE_ACCESS_DENIED_ACE_TYPE;
249 ace->access_mask = deny_mask_from_posix(deny, flags);
250 ace->whotype = NFS4_ACL_WHO_OWNER;
255 ace->type = NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE;
257 ace->access_mask = mask_from_posix(pa->e_perm, flags | NFS4_ACL_OWNER);
258 ace->whotype = NFS4_ACL_WHO_OWNER;
263 while (pa->e_tag == ACL_USER) {
264 deny = ~(pa->e_perm & pas.mask);
265 deny &= pas.groups | pas.group | pas.other;
267 ace->type = NFS4_ACE_ACCESS_DENIED_ACE_TYPE;
269 ace->access_mask = deny_mask_from_posix(deny, flags);
270 ace->whotype = NFS4_ACL_WHO_NAMED;
275 ace->type = NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE;
277 ace->access_mask = mask_from_posix(pa->e_perm & pas.mask,
279 ace->whotype = NFS4_ACL_WHO_NAMED;
286 /* In the case of groups, we apply allow ACEs first, then deny ACEs,
287 * since a user can be in more than one group. */
291 group_owner_entry = pa;
293 ace->type = NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE;
295 ace->access_mask = mask_from_posix(pas.group, flags);
296 ace->whotype = NFS4_ACL_WHO_GROUP;
301 while (pa->e_tag == ACL_GROUP) {
302 ace->type = NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE;
303 ace->flag = eflag | NFS4_ACE_IDENTIFIER_GROUP;
304 ace->access_mask = mask_from_posix(pa->e_perm & pas.mask,
306 ace->whotype = NFS4_ACL_WHO_NAMED;
315 pa = group_owner_entry;
317 deny = ~pas.group & pas.other;
319 ace->type = NFS4_ACE_ACCESS_DENIED_ACE_TYPE;
320 ace->flag = eflag | NFS4_ACE_IDENTIFIER_GROUP;
321 ace->access_mask = deny_mask_from_posix(deny, flags);
322 ace->whotype = NFS4_ACL_WHO_GROUP;
328 while (pa->e_tag == ACL_GROUP) {
329 deny = ~(pa->e_perm & pas.mask);
332 ace->type = NFS4_ACE_ACCESS_DENIED_ACE_TYPE;
333 ace->flag = eflag | NFS4_ACE_IDENTIFIER_GROUP;
334 ace->access_mask = mask_from_posix(deny, flags);
335 ace->whotype = NFS4_ACL_WHO_NAMED;
343 if (pa->e_tag == ACL_MASK)
345 ace->type = NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE;
347 ace->access_mask = mask_from_posix(pa->e_perm, flags);
348 ace->whotype = NFS4_ACL_WHO_EVERYONE;
353 sort_pacl_range(struct posix_acl *pacl, int start, int end) {
355 struct posix_acl_entry tmp;
357 /* We just do a bubble sort; easy to do in place, and we're not
358 * expecting acl's to be long enough to justify anything more. */
361 for (i = start; i < end; i++) {
362 if (pacl->a_entries[i].e_id
363 > pacl->a_entries[i+1].e_id) {
365 tmp = pacl->a_entries[i];
366 pacl->a_entries[i] = pacl->a_entries[i+1];
367 pacl->a_entries[i+1] = tmp;
374 sort_pacl(struct posix_acl *pacl)
376 /* posix_acl_valid requires that users and groups be in order
380 if (pacl->a_count <= 4)
381 return; /* no users or groups */
383 while (pacl->a_entries[i].e_tag == ACL_USER)
385 sort_pacl_range(pacl, 1, i-1);
387 BUG_ON(pacl->a_entries[i].e_tag != ACL_GROUP_OBJ);
389 while (pacl->a_entries[j].e_tag == ACL_GROUP)
391 sort_pacl_range(pacl, i, j-1);
396 * While processing the NFSv4 ACE, this maintains bitmasks representing
397 * which permission bits have been allowed and which denied to a given
399 struct posix_ace_state {
404 struct posix_user_ace_state {
406 struct posix_ace_state perms;
409 struct posix_ace_state_array {
411 struct posix_user_ace_state aces[];
415 * While processing the NFSv4 ACE, this maintains the partial permissions
416 * calculated so far: */
418 struct posix_acl_state {
420 struct posix_ace_state owner;
421 struct posix_ace_state group;
422 struct posix_ace_state other;
423 struct posix_ace_state everyone;
424 struct posix_ace_state mask; /* Deny unused in this case */
425 struct posix_ace_state_array *users;
426 struct posix_ace_state_array *groups;
430 init_state(struct posix_acl_state *state, int cnt)
434 memset(state, 0, sizeof(struct posix_acl_state));
437 * In the worst case, each individual acl could be for a distinct
438 * named user or group, but we don't no which, so we allocate
439 * enough space for either:
441 alloc = sizeof(struct posix_ace_state_array)
442 + cnt*sizeof(struct posix_ace_state);
443 state->users = kzalloc(alloc, GFP_KERNEL);
446 state->groups = kzalloc(alloc, GFP_KERNEL);
447 if (!state->groups) {
455 free_state(struct posix_acl_state *state) {
457 kfree(state->groups);
460 static inline void add_to_mask(struct posix_acl_state *state, struct posix_ace_state *astate)
462 state->mask.allow |= astate->allow;
466 * Certain bits (SYNCHRONIZE, DELETE, WRITE_OWNER, READ/WRITE_NAMED_ATTRS,
467 * READ_ATTRIBUTES, READ_ACL) are currently unenforceable and don't translate
468 * to traditional read/write/execute permissions.
470 * It's problematic to reject acls that use certain mode bits, because it
471 * places the burden on users to learn the rules about which bits one
472 * particular server sets, without giving the user a lot of help--we return an
473 * error that could mean any number of different things. To make matters
474 * worse, the problematic bits might be introduced by some application that's
475 * automatically mapping from some other acl model.
477 * So wherever possible we accept anything, possibly erring on the side of
478 * denying more permissions than necessary.
480 * However we do reject *explicit* DENY's of a few bits representing
481 * permissions we could never deny:
484 static inline int check_deny(u32 mask, int isowner)
486 if (mask & (NFS4_ACE_READ_ATTRIBUTES | NFS4_ACE_READ_ACL))
490 if (mask & (NFS4_ACE_WRITE_ATTRIBUTES | NFS4_ACE_WRITE_ACL))
495 static struct posix_acl *
496 posix_state_to_acl(struct posix_acl_state *state, unsigned int flags)
498 struct posix_acl_entry *pace;
499 struct posix_acl *pacl;
504 * ACLs with no ACEs are treated differently in the inheritable
505 * and effective cases: when there are no inheritable ACEs, we
506 * set a zero-length default posix acl:
508 if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT)) {
509 pacl = posix_acl_alloc(0, GFP_KERNEL);
510 return pacl ? pacl : ERR_PTR(-ENOMEM);
513 * When there are no effective ACEs, the following will end
514 * up setting a 3-element effective posix ACL with all
517 nace = 4 + state->users->n + state->groups->n;
518 pacl = posix_acl_alloc(nace, GFP_KERNEL);
520 return ERR_PTR(-ENOMEM);
522 pace = pacl->a_entries;
523 pace->e_tag = ACL_USER_OBJ;
524 error = check_deny(state->owner.deny, 1);
527 low_mode_from_nfs4(state->owner.allow, &pace->e_perm, flags);
528 pace->e_id = ACL_UNDEFINED_ID;
530 for (i=0; i < state->users->n; i++) {
532 pace->e_tag = ACL_USER;
533 error = check_deny(state->users->aces[i].perms.deny, 0);
536 low_mode_from_nfs4(state->users->aces[i].perms.allow,
537 &pace->e_perm, flags);
538 pace->e_id = state->users->aces[i].uid;
539 add_to_mask(state, &state->users->aces[i].perms);
543 pace->e_tag = ACL_GROUP_OBJ;
544 error = check_deny(state->group.deny, 0);
547 low_mode_from_nfs4(state->group.allow, &pace->e_perm, flags);
548 pace->e_id = ACL_UNDEFINED_ID;
549 add_to_mask(state, &state->group);
551 for (i=0; i < state->groups->n; i++) {
553 pace->e_tag = ACL_GROUP;
554 error = check_deny(state->groups->aces[i].perms.deny, 0);
557 low_mode_from_nfs4(state->groups->aces[i].perms.allow,
558 &pace->e_perm, flags);
559 pace->e_id = state->groups->aces[i].uid;
560 add_to_mask(state, &state->groups->aces[i].perms);
564 pace->e_tag = ACL_MASK;
565 low_mode_from_nfs4(state->mask.allow, &pace->e_perm, flags);
566 pace->e_id = ACL_UNDEFINED_ID;
569 pace->e_tag = ACL_OTHER;
570 error = check_deny(state->other.deny, 0);
573 low_mode_from_nfs4(state->other.allow, &pace->e_perm, flags);
574 pace->e_id = ACL_UNDEFINED_ID;
578 posix_acl_release(pacl);
579 return ERR_PTR(error);
582 static inline void allow_bits(struct posix_ace_state *astate, u32 mask)
584 /* Allow all bits in the mask not already denied: */
585 astate->allow |= mask & ~astate->deny;
588 static inline void deny_bits(struct posix_ace_state *astate, u32 mask)
590 /* Deny all bits in the mask not already allowed: */
591 astate->deny |= mask & ~astate->allow;
594 static int find_uid(struct posix_acl_state *state, struct posix_ace_state_array *a, uid_t uid)
598 for (i = 0; i < a->n; i++)
599 if (a->aces[i].uid == uid)
603 a->aces[i].uid = uid;
604 a->aces[i].perms.allow = state->everyone.allow;
605 a->aces[i].perms.deny = state->everyone.deny;
610 static void deny_bits_array(struct posix_ace_state_array *a, u32 mask)
614 for (i=0; i < a->n; i++)
615 deny_bits(&a->aces[i].perms, mask);
618 static void allow_bits_array(struct posix_ace_state_array *a, u32 mask)
622 for (i=0; i < a->n; i++)
623 allow_bits(&a->aces[i].perms, mask);
626 static void process_one_v4_ace(struct posix_acl_state *state,
627 struct nfs4_ace *ace)
629 u32 mask = ace->access_mask;
634 switch (ace2type(ace)) {
636 if (ace->type == NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE) {
637 allow_bits(&state->owner, mask);
639 deny_bits(&state->owner, mask);
643 i = find_uid(state, state->users, ace->who);
644 if (ace->type == NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE) {
645 allow_bits(&state->users->aces[i].perms, mask);
647 deny_bits(&state->users->aces[i].perms, mask);
648 mask = state->users->aces[i].perms.deny;
649 deny_bits(&state->owner, mask);
653 if (ace->type == NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE) {
654 allow_bits(&state->group, mask);
656 deny_bits(&state->group, mask);
657 mask = state->group.deny;
658 deny_bits(&state->owner, mask);
659 deny_bits(&state->everyone, mask);
660 deny_bits_array(state->users, mask);
661 deny_bits_array(state->groups, mask);
665 i = find_uid(state, state->groups, ace->who);
666 if (ace->type == NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE) {
667 allow_bits(&state->groups->aces[i].perms, mask);
669 deny_bits(&state->groups->aces[i].perms, mask);
670 mask = state->groups->aces[i].perms.deny;
671 deny_bits(&state->owner, mask);
672 deny_bits(&state->group, mask);
673 deny_bits(&state->everyone, mask);
674 deny_bits_array(state->users, mask);
675 deny_bits_array(state->groups, mask);
679 if (ace->type == NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE) {
680 allow_bits(&state->owner, mask);
681 allow_bits(&state->group, mask);
682 allow_bits(&state->other, mask);
683 allow_bits(&state->everyone, mask);
684 allow_bits_array(state->users, mask);
685 allow_bits_array(state->groups, mask);
687 deny_bits(&state->owner, mask);
688 deny_bits(&state->group, mask);
689 deny_bits(&state->other, mask);
690 deny_bits(&state->everyone, mask);
691 deny_bits_array(state->users, mask);
692 deny_bits_array(state->groups, mask);
697 int nfs4_acl_nfsv4_to_posix(struct nfs4_acl *acl, struct posix_acl **pacl,
698 struct posix_acl **dpacl, unsigned int flags)
700 struct posix_acl_state effective_acl_state, default_acl_state;
701 struct nfs4_ace *ace;
704 ret = init_state(&effective_acl_state, acl->naces);
707 ret = init_state(&default_acl_state, acl->naces);
711 for (ace = acl->aces; ace < acl->aces + acl->naces; ace++) {
712 if (ace->type != NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE &&
713 ace->type != NFS4_ACE_ACCESS_DENIED_ACE_TYPE)
715 if (ace->flag & ~NFS4_SUPPORTED_FLAGS)
717 if ((ace->flag & NFS4_INHERITANCE_FLAGS) == 0) {
718 process_one_v4_ace(&effective_acl_state, ace);
721 if (!(flags & NFS4_ACL_DIR))
724 * Note that when only one of FILE_INHERIT or DIRECTORY_INHERIT
725 * is set, we're effectively turning on the other. That's OK,
726 * according to rfc 3530.
728 process_one_v4_ace(&default_acl_state, ace);
730 if (!(ace->flag & NFS4_ACE_INHERIT_ONLY_ACE))
731 process_one_v4_ace(&effective_acl_state, ace);
733 *pacl = posix_state_to_acl(&effective_acl_state, flags);
735 ret = PTR_ERR(*pacl);
738 *dpacl = posix_state_to_acl(&default_acl_state,
739 flags | NFS4_ACL_TYPE_DEFAULT);
740 if (IS_ERR(*dpacl)) {
741 ret = PTR_ERR(*dpacl);
742 posix_acl_release(*pacl);
749 free_state(&default_acl_state);
751 free_state(&effective_acl_state);
756 ace2type(struct nfs4_ace *ace)
758 switch (ace->whotype) {
759 case NFS4_ACL_WHO_NAMED:
760 return (ace->flag & NFS4_ACE_IDENTIFIER_GROUP ?
761 ACL_GROUP : ACL_USER);
762 case NFS4_ACL_WHO_OWNER:
764 case NFS4_ACL_WHO_GROUP:
765 return ACL_GROUP_OBJ;
766 case NFS4_ACL_WHO_EVERYONE:
773 EXPORT_SYMBOL(nfs4_acl_posix_to_nfsv4);
774 EXPORT_SYMBOL(nfs4_acl_nfsv4_to_posix);
779 struct nfs4_acl *acl;
781 acl = kmalloc(sizeof(*acl) + n*sizeof(struct nfs4_ace), GFP_KERNEL);
789 nfs4_acl_add_ace(struct nfs4_acl *acl, u32 type, u32 flag, u32 access_mask,
790 int whotype, uid_t who)
792 struct nfs4_ace *ace = acl->aces + acl->naces;
796 ace->access_mask = access_mask;
797 ace->whotype = whotype;
810 .stringlen = sizeof("OWNER@") - 1,
811 .type = NFS4_ACL_WHO_OWNER,
815 .stringlen = sizeof("GROUP@") - 1,
816 .type = NFS4_ACL_WHO_GROUP,
819 .string = "EVERYONE@",
820 .stringlen = sizeof("EVERYONE@") - 1,
821 .type = NFS4_ACL_WHO_EVERYONE,
826 nfs4_acl_get_whotype(char *p, u32 len)
830 for (i = 0; i < ARRAY_SIZE(s2t_map); i++) {
831 if (s2t_map[i].stringlen == len &&
832 0 == memcmp(s2t_map[i].string, p, len))
833 return s2t_map[i].type;
835 return NFS4_ACL_WHO_NAMED;
839 nfs4_acl_write_who(int who, char *p)
843 for (i = 0; i < ARRAY_SIZE(s2t_map); i++) {
844 if (s2t_map[i].type == who) {
845 memcpy(p, s2t_map[i].string, s2t_map[i].stringlen);
846 return s2t_map[i].stringlen;
853 EXPORT_SYMBOL(nfs4_acl_new);
854 EXPORT_SYMBOL(nfs4_acl_add_ace);
855 EXPORT_SYMBOL(nfs4_acl_get_whotype);
856 EXPORT_SYMBOL(nfs4_acl_write_who);