Lines Matching refs:acl
41 struct posix_acl *acl; in get_cached_acl() local
45 acl = rcu_dereference(*p); in get_cached_acl()
46 if (!acl || is_uncached_acl(acl) || in get_cached_acl()
47 refcount_inc_not_zero(&acl->a_refcount)) in get_cached_acl()
53 return acl; in get_cached_acl()
63 void set_cached_acl(struct inode *inode, int type, struct posix_acl *acl) in set_cached_acl() argument
68 old = xchg(p, posix_acl_dup(acl)); in set_cached_acl()
100 struct posix_acl *acl; in get_acl() local
108 acl = get_cached_acl(inode, type); in get_acl()
109 if (!is_uncached_acl(acl)) in get_acl()
110 return acl; in get_acl()
141 acl = inode->i_op->get_acl(inode, type); in get_acl()
143 if (IS_ERR(acl)) { in get_acl()
149 return acl; in get_acl()
155 posix_acl_dup(acl); in get_acl()
156 if (unlikely(cmpxchg(p, sentinel, acl) != sentinel)) in get_acl()
157 posix_acl_release(acl); in get_acl()
158 return acl; in get_acl()
166 posix_acl_init(struct posix_acl *acl, int count) in posix_acl_init() argument
168 refcount_set(&acl->a_refcount, 1); in posix_acl_init()
169 acl->a_count = count; in posix_acl_init()
181 struct posix_acl *acl = kmalloc(size, flags); in posix_acl_alloc() local
182 if (acl) in posix_acl_alloc()
183 posix_acl_init(acl, count); in posix_acl_alloc()
184 return acl; in posix_acl_alloc()
192 posix_acl_clone(const struct posix_acl *acl, gfp_t flags) in posix_acl_clone() argument
196 if (acl) { in posix_acl_clone()
197 int size = sizeof(struct posix_acl) + acl->a_count * in posix_acl_clone()
199 clone = kmemdup(acl, size, flags); in posix_acl_clone()
210 posix_acl_valid(struct user_namespace *user_ns, const struct posix_acl *acl) in posix_acl_valid() argument
216 FOREACH_ACL_ENTRY(pa, acl, pe) { in posix_acl_valid()
279 posix_acl_equiv_mode(const struct posix_acl *acl, umode_t *mode_p) in posix_acl_equiv_mode() argument
288 if (!acl) in posix_acl_equiv_mode()
291 FOREACH_ACL_ENTRY(pa, acl, pe) { in posix_acl_equiv_mode()
327 struct posix_acl *acl = posix_acl_alloc(3, flags); in posix_acl_from_mode() local
328 if (!acl) in posix_acl_from_mode()
331 acl->a_entries[0].e_tag = ACL_USER_OBJ; in posix_acl_from_mode()
332 acl->a_entries[0].e_perm = (mode & S_IRWXU) >> 6; in posix_acl_from_mode()
334 acl->a_entries[1].e_tag = ACL_GROUP_OBJ; in posix_acl_from_mode()
335 acl->a_entries[1].e_perm = (mode & S_IRWXG) >> 3; in posix_acl_from_mode()
337 acl->a_entries[2].e_tag = ACL_OTHER; in posix_acl_from_mode()
338 acl->a_entries[2].e_perm = (mode & S_IRWXO); in posix_acl_from_mode()
339 return acl; in posix_acl_from_mode()
348 posix_acl_permission(struct inode *inode, const struct posix_acl *acl, int want) in posix_acl_permission() argument
355 FOREACH_ACL_ENTRY(pa, acl, pe) { in posix_acl_permission()
416 static int posix_acl_create_masq(struct posix_acl *acl, umode_t *mode_p) in posix_acl_create_masq() argument
425 FOREACH_ACL_ENTRY(pa, acl, pe) { in posix_acl_create_masq()
473 static int __posix_acl_chmod_masq(struct posix_acl *acl, umode_t mode) in __posix_acl_chmod_masq() argument
480 FOREACH_ACL_ENTRY(pa, acl, pe) { in __posix_acl_chmod_masq()
519 __posix_acl_create(struct posix_acl **acl, gfp_t gfp, umode_t *mode_p) in __posix_acl_create() argument
521 struct posix_acl *clone = posix_acl_clone(*acl, gfp); in __posix_acl_create()
530 posix_acl_release(*acl); in __posix_acl_create()
531 *acl = clone; in __posix_acl_create()
537 __posix_acl_chmod(struct posix_acl **acl, gfp_t gfp, umode_t mode) in __posix_acl_chmod() argument
539 struct posix_acl *clone = posix_acl_clone(*acl, gfp); in __posix_acl_chmod()
548 posix_acl_release(*acl); in __posix_acl_chmod()
549 *acl = clone; in __posix_acl_chmod()
557 struct posix_acl *acl; in posix_acl_chmod() local
565 acl = get_acl(inode, ACL_TYPE_ACCESS); in posix_acl_chmod()
566 if (IS_ERR_OR_NULL(acl)) { in posix_acl_chmod()
567 if (acl == ERR_PTR(-EOPNOTSUPP)) in posix_acl_chmod()
569 return PTR_ERR(acl); in posix_acl_chmod()
572 ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode); in posix_acl_chmod()
575 ret = inode->i_op->set_acl(inode, acl, ACL_TYPE_ACCESS); in posix_acl_chmod()
576 posix_acl_release(acl); in posix_acl_chmod()
583 struct posix_acl **default_acl, struct posix_acl **acl) in posix_acl_create() argument
589 *acl = NULL; in posix_acl_create()
615 *acl = clone; in posix_acl_create()
645 struct posix_acl **acl) in posix_acl_update_mode() argument
650 error = posix_acl_equiv_mode(*acl, &mode); in posix_acl_update_mode()
654 *acl = NULL; in posix_acl_update_mode()
731 struct posix_acl *acl; in posix_acl_from_xattr() local
747 acl = posix_acl_alloc(count, GFP_NOFS); in posix_acl_from_xattr()
748 if (!acl) in posix_acl_from_xattr()
750 acl_e = acl->a_entries; in posix_acl_from_xattr()
782 return acl; in posix_acl_from_xattr()
785 posix_acl_release(acl); in posix_acl_from_xattr()
794 posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl, in posix_acl_to_xattr() argument
801 real_size = posix_acl_xattr_size(acl->a_count); in posix_acl_to_xattr()
810 for (n=0; n < acl->a_count; n++, ext_entry++) { in posix_acl_to_xattr()
811 const struct posix_acl_entry *acl_e = &acl->a_entries[n]; in posix_acl_to_xattr()
837 struct posix_acl *acl; in posix_acl_xattr_get() local
845 acl = get_acl(inode, handler->flags); in posix_acl_xattr_get()
846 if (IS_ERR(acl)) in posix_acl_xattr_get()
847 return PTR_ERR(acl); in posix_acl_xattr_get()
848 if (acl == NULL) in posix_acl_xattr_get()
851 error = posix_acl_to_xattr(&init_user_ns, acl, value, size); in posix_acl_xattr_get()
852 posix_acl_release(acl); in posix_acl_xattr_get()
858 set_posix_acl(struct inode *inode, int type, struct posix_acl *acl) in set_posix_acl() argument
866 return acl ? -EACCES : 0; in set_posix_acl()
870 if (acl) { in set_posix_acl()
871 int ret = posix_acl_valid(inode->i_sb->s_user_ns, acl); in set_posix_acl()
875 return inode->i_op->set_acl(inode, acl, type); in set_posix_acl()
885 struct posix_acl *acl = NULL; in posix_acl_xattr_set() local
889 acl = posix_acl_from_xattr(&init_user_ns, value, size); in posix_acl_xattr_set()
890 if (IS_ERR(acl)) in posix_acl_xattr_set()
891 return PTR_ERR(acl); in posix_acl_xattr_set()
893 ret = set_posix_acl(inode, handler->flags, acl); in posix_acl_xattr_set()
894 posix_acl_release(acl); in posix_acl_xattr_set()
922 int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type) in simple_set_acl() argument
928 &inode->i_mode, &acl); in simple_set_acl()
934 set_cached_acl(inode, type, acl); in simple_set_acl()
940 struct posix_acl *default_acl, *acl; in simple_acl_create() local
943 error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); in simple_acl_create()
948 set_cached_acl(inode, ACL_TYPE_ACCESS, acl); in simple_acl_create()
952 if (acl) in simple_acl_create()
953 posix_acl_release(acl); in simple_acl_create()