Lines Matching refs:state
434 init_state(struct posix_acl_state *state, int cnt) in init_state() argument
438 memset(state, 0, sizeof(struct posix_acl_state)); in init_state()
439 state->empty = 1; in init_state()
447 state->users = kzalloc(alloc, GFP_KERNEL); in init_state()
448 if (!state->users) in init_state()
450 state->groups = kzalloc(alloc, GFP_KERNEL); in init_state()
451 if (!state->groups) { in init_state()
452 kfree(state->users); in init_state()
459 free_state(struct posix_acl_state *state) { in free_state() argument
460 kfree(state->users); in free_state()
461 kfree(state->groups); in free_state()
464 static inline void add_to_mask(struct posix_acl_state *state, struct posix_ace_state *astate) in add_to_mask() argument
466 state->mask.allow |= astate->allow; in add_to_mask()
500 posix_state_to_acl(struct posix_acl_state *state, unsigned int flags) in posix_state_to_acl() argument
512 if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT)) { in posix_state_to_acl()
521 nace = 4 + state->users->n + state->groups->n; in posix_state_to_acl()
528 error = check_deny(state->owner.deny, 1); in posix_state_to_acl()
531 low_mode_from_nfs4(state->owner.allow, &pace->e_perm, flags); in posix_state_to_acl()
534 for (i=0; i < state->users->n; i++) { in posix_state_to_acl()
537 error = check_deny(state->users->aces[i].perms.deny, 0); in posix_state_to_acl()
540 low_mode_from_nfs4(state->users->aces[i].perms.allow, in posix_state_to_acl()
542 pace->e_id = state->users->aces[i].uid; in posix_state_to_acl()
543 add_to_mask(state, &state->users->aces[i].perms); in posix_state_to_acl()
548 error = check_deny(state->group.deny, 0); in posix_state_to_acl()
551 low_mode_from_nfs4(state->group.allow, &pace->e_perm, flags); in posix_state_to_acl()
553 add_to_mask(state, &state->group); in posix_state_to_acl()
555 for (i=0; i < state->groups->n; i++) { in posix_state_to_acl()
558 error = check_deny(state->groups->aces[i].perms.deny, 0); in posix_state_to_acl()
561 low_mode_from_nfs4(state->groups->aces[i].perms.allow, in posix_state_to_acl()
563 pace->e_id = state->groups->aces[i].uid; in posix_state_to_acl()
564 add_to_mask(state, &state->groups->aces[i].perms); in posix_state_to_acl()
569 low_mode_from_nfs4(state->mask.allow, &pace->e_perm, flags); in posix_state_to_acl()
574 error = check_deny(state->other.deny, 0); in posix_state_to_acl()
577 low_mode_from_nfs4(state->other.allow, &pace->e_perm, flags); in posix_state_to_acl()
598 static int find_uid(struct posix_acl_state *state, struct posix_ace_state_array *a, uid_t uid) in find_uid() argument
608 a->aces[i].perms.allow = state->everyone.allow; in find_uid()
609 a->aces[i].perms.deny = state->everyone.deny; in find_uid()
630 static void process_one_v4_ace(struct posix_acl_state *state, in process_one_v4_ace() argument
636 state->empty = 0; in process_one_v4_ace()
641 allow_bits(&state->owner, mask); in process_one_v4_ace()
643 deny_bits(&state->owner, mask); in process_one_v4_ace()
647 i = find_uid(state, state->users, ace->who); in process_one_v4_ace()
649 allow_bits(&state->users->aces[i].perms, mask); in process_one_v4_ace()
651 deny_bits(&state->users->aces[i].perms, mask); in process_one_v4_ace()
652 mask = state->users->aces[i].perms.deny; in process_one_v4_ace()
653 deny_bits(&state->owner, mask); in process_one_v4_ace()
658 allow_bits(&state->group, mask); in process_one_v4_ace()
660 deny_bits(&state->group, mask); in process_one_v4_ace()
661 mask = state->group.deny; in process_one_v4_ace()
662 deny_bits(&state->owner, mask); in process_one_v4_ace()
663 deny_bits(&state->everyone, mask); in process_one_v4_ace()
664 deny_bits_array(state->users, mask); in process_one_v4_ace()
665 deny_bits_array(state->groups, mask); in process_one_v4_ace()
669 i = find_uid(state, state->groups, ace->who); in process_one_v4_ace()
671 allow_bits(&state->groups->aces[i].perms, mask); in process_one_v4_ace()
673 deny_bits(&state->groups->aces[i].perms, mask); in process_one_v4_ace()
674 mask = state->groups->aces[i].perms.deny; in process_one_v4_ace()
675 deny_bits(&state->owner, mask); in process_one_v4_ace()
676 deny_bits(&state->group, mask); in process_one_v4_ace()
677 deny_bits(&state->everyone, mask); in process_one_v4_ace()
678 deny_bits_array(state->users, mask); in process_one_v4_ace()
679 deny_bits_array(state->groups, mask); in process_one_v4_ace()
684 allow_bits(&state->owner, mask); in process_one_v4_ace()
685 allow_bits(&state->group, mask); in process_one_v4_ace()
686 allow_bits(&state->other, mask); in process_one_v4_ace()
687 allow_bits(&state->everyone, mask); in process_one_v4_ace()
688 allow_bits_array(state->users, mask); in process_one_v4_ace()
689 allow_bits_array(state->groups, mask); in process_one_v4_ace()
691 deny_bits(&state->owner, mask); in process_one_v4_ace()
692 deny_bits(&state->group, mask); in process_one_v4_ace()
693 deny_bits(&state->other, mask); in process_one_v4_ace()
694 deny_bits(&state->everyone, mask); in process_one_v4_ace()
695 deny_bits_array(state->users, mask); in process_one_v4_ace()
696 deny_bits_array(state->groups, mask); in process_one_v4_ace()