Lines Matching refs:acl

40 	struct posix_acl *acl;  in get_cached_acl()  local
44 acl = rcu_dereference(*p); in get_cached_acl()
45 if (!acl || is_uncached_acl(acl) || in get_cached_acl()
46 refcount_inc_not_zero(&acl->a_refcount)) in get_cached_acl()
52 return acl; in get_cached_acl()
62 void set_cached_acl(struct inode *inode, int type, struct posix_acl *acl) in set_cached_acl() argument
67 old = xchg(p, posix_acl_dup(acl)); in set_cached_acl()
99 struct posix_acl *acl; in get_acl() local
107 acl = get_cached_acl(inode, type); in get_acl()
108 if (!is_uncached_acl(acl)) in get_acl()
109 return acl; in get_acl()
140 acl = inode->i_op->get_acl(inode, type); in get_acl()
142 if (IS_ERR(acl)) { in get_acl()
148 return acl; in get_acl()
154 posix_acl_dup(acl); in get_acl()
155 if (unlikely(cmpxchg(p, sentinel, acl) != sentinel)) in get_acl()
156 posix_acl_release(acl); in get_acl()
157 return acl; in get_acl()
165 posix_acl_init(struct posix_acl *acl, int count) in posix_acl_init() argument
167 refcount_set(&acl->a_refcount, 1); in posix_acl_init()
168 acl->a_count = count; in posix_acl_init()
180 struct posix_acl *acl = kmalloc(size, flags); in posix_acl_alloc() local
181 if (acl) in posix_acl_alloc()
182 posix_acl_init(acl, count); in posix_acl_alloc()
183 return acl; in posix_acl_alloc()
191 posix_acl_clone(const struct posix_acl *acl, gfp_t flags) in posix_acl_clone() argument
195 if (acl) { in posix_acl_clone()
196 int size = sizeof(struct posix_acl) + acl->a_count * in posix_acl_clone()
198 clone = kmemdup(acl, size, flags); in posix_acl_clone()
209 posix_acl_valid(struct user_namespace *user_ns, const struct posix_acl *acl) in posix_acl_valid() argument
215 FOREACH_ACL_ENTRY(pa, acl, pe) { in posix_acl_valid()
278 posix_acl_equiv_mode(const struct posix_acl *acl, umode_t *mode_p) in posix_acl_equiv_mode() argument
287 if (!acl) in posix_acl_equiv_mode()
290 FOREACH_ACL_ENTRY(pa, acl, pe) { in posix_acl_equiv_mode()
326 struct posix_acl *acl = posix_acl_alloc(3, flags); in posix_acl_from_mode() local
327 if (!acl) in posix_acl_from_mode()
330 acl->a_entries[0].e_tag = ACL_USER_OBJ; in posix_acl_from_mode()
331 acl->a_entries[0].e_perm = (mode & S_IRWXU) >> 6; in posix_acl_from_mode()
333 acl->a_entries[1].e_tag = ACL_GROUP_OBJ; in posix_acl_from_mode()
334 acl->a_entries[1].e_perm = (mode & S_IRWXG) >> 3; in posix_acl_from_mode()
336 acl->a_entries[2].e_tag = ACL_OTHER; in posix_acl_from_mode()
337 acl->a_entries[2].e_perm = (mode & S_IRWXO); in posix_acl_from_mode()
338 return acl; in posix_acl_from_mode()
347 posix_acl_permission(struct inode *inode, const struct posix_acl *acl, int want) in posix_acl_permission() argument
354 FOREACH_ACL_ENTRY(pa, acl, pe) { in posix_acl_permission()
415 static int posix_acl_create_masq(struct posix_acl *acl, umode_t *mode_p) in posix_acl_create_masq() argument
424 FOREACH_ACL_ENTRY(pa, acl, pe) { in posix_acl_create_masq()
472 static int __posix_acl_chmod_masq(struct posix_acl *acl, umode_t mode) in __posix_acl_chmod_masq() argument
479 FOREACH_ACL_ENTRY(pa, acl, pe) { in __posix_acl_chmod_masq()
518 __posix_acl_create(struct posix_acl **acl, gfp_t gfp, umode_t *mode_p) in __posix_acl_create() argument
520 struct posix_acl *clone = posix_acl_clone(*acl, gfp); in __posix_acl_create()
529 posix_acl_release(*acl); in __posix_acl_create()
530 *acl = clone; in __posix_acl_create()
536 __posix_acl_chmod(struct posix_acl **acl, gfp_t gfp, umode_t mode) in __posix_acl_chmod() argument
538 struct posix_acl *clone = posix_acl_clone(*acl, gfp); in __posix_acl_chmod()
547 posix_acl_release(*acl); in __posix_acl_chmod()
548 *acl = clone; in __posix_acl_chmod()
556 struct posix_acl *acl; in posix_acl_chmod() local
564 acl = get_acl(inode, ACL_TYPE_ACCESS); in posix_acl_chmod()
565 if (IS_ERR_OR_NULL(acl)) { in posix_acl_chmod()
566 if (acl == ERR_PTR(-EOPNOTSUPP)) in posix_acl_chmod()
568 return PTR_ERR(acl); in posix_acl_chmod()
571 ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode); in posix_acl_chmod()
574 ret = inode->i_op->set_acl(inode, acl, ACL_TYPE_ACCESS); in posix_acl_chmod()
575 posix_acl_release(acl); in posix_acl_chmod()
582 struct posix_acl **default_acl, struct posix_acl **acl) in posix_acl_create() argument
588 *acl = NULL; in posix_acl_create()
614 *acl = clone; in posix_acl_create()
644 struct posix_acl **acl) in posix_acl_update_mode() argument
649 error = posix_acl_equiv_mode(*acl, &mode); in posix_acl_update_mode()
653 *acl = NULL; in posix_acl_update_mode()
730 struct posix_acl *acl; in posix_acl_from_xattr() local
746 acl = posix_acl_alloc(count, GFP_NOFS); in posix_acl_from_xattr()
747 if (!acl) in posix_acl_from_xattr()
749 acl_e = acl->a_entries; in posix_acl_from_xattr()
781 return acl; in posix_acl_from_xattr()
784 posix_acl_release(acl); in posix_acl_from_xattr()
793 posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl, in posix_acl_to_xattr() argument
800 real_size = posix_acl_xattr_size(acl->a_count); in posix_acl_to_xattr()
809 for (n=0; n < acl->a_count; n++, ext_entry++) { in posix_acl_to_xattr()
810 const struct posix_acl_entry *acl_e = &acl->a_entries[n]; in posix_acl_to_xattr()
836 struct posix_acl *acl; in posix_acl_xattr_get() local
844 acl = get_acl(inode, handler->flags); in posix_acl_xattr_get()
845 if (IS_ERR(acl)) in posix_acl_xattr_get()
846 return PTR_ERR(acl); in posix_acl_xattr_get()
847 if (acl == NULL) in posix_acl_xattr_get()
850 error = posix_acl_to_xattr(&init_user_ns, acl, value, size); in posix_acl_xattr_get()
851 posix_acl_release(acl); in posix_acl_xattr_get()
857 set_posix_acl(struct inode *inode, int type, struct posix_acl *acl) in set_posix_acl() argument
865 return acl ? -EACCES : 0; in set_posix_acl()
869 if (acl) { in set_posix_acl()
870 int ret = posix_acl_valid(inode->i_sb->s_user_ns, acl); in set_posix_acl()
874 return inode->i_op->set_acl(inode, acl, type); in set_posix_acl()
884 struct posix_acl *acl = NULL; in posix_acl_xattr_set() local
888 acl = posix_acl_from_xattr(&init_user_ns, value, size); in posix_acl_xattr_set()
889 if (IS_ERR(acl)) in posix_acl_xattr_set()
890 return PTR_ERR(acl); in posix_acl_xattr_set()
892 ret = set_posix_acl(inode, handler->flags, acl); in posix_acl_xattr_set()
893 posix_acl_release(acl); in posix_acl_xattr_set()
921 int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type) in simple_set_acl() argument
927 &inode->i_mode, &acl); in simple_set_acl()
933 set_cached_acl(inode, type, acl); in simple_set_acl()
939 struct posix_acl *default_acl, *acl; in simple_acl_create() local
942 error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); in simple_acl_create()
947 set_cached_acl(inode, ACL_TYPE_ACCESS, acl); in simple_acl_create()
951 if (acl) in simple_acl_create()
952 posix_acl_release(acl); in simple_acl_create()