Lines Matching defs:acl
41 struct posix_acl *acl;
45 acl = rcu_dereference(*p);
46 if (!acl || is_uncached_acl(acl) ||
47 refcount_inc_not_zero(&acl->a_refcount))
53 return acl;
63 void set_cached_acl(struct inode *inode, int type, struct posix_acl *acl)
68 old = xchg(p, posix_acl_dup(acl));
100 struct posix_acl *acl;
108 acl = get_cached_acl(inode, type);
109 if (!is_uncached_acl(acl))
110 return acl;
141 acl = inode->i_op->get_acl(inode, type);
143 if (IS_ERR(acl)) {
149 return acl;
155 posix_acl_dup(acl);
156 if (unlikely(cmpxchg(p, sentinel, acl) != sentinel))
157 posix_acl_release(acl);
158 return acl;
166 posix_acl_init(struct posix_acl *acl, int count)
168 refcount_set(&acl->a_refcount, 1);
169 acl->a_count = count;
181 struct posix_acl *acl = kmalloc(size, flags);
182 if (acl)
183 posix_acl_init(acl, count);
184 return acl;
192 posix_acl_clone(const struct posix_acl *acl, gfp_t flags)
196 if (acl) {
197 int size = sizeof(struct posix_acl) + acl->a_count *
199 clone = kmemdup(acl, size, flags);
207 * Check if an acl is valid. Returns 0 if it is, or -E... otherwise.
210 posix_acl_valid(struct user_namespace *user_ns, const struct posix_acl *acl)
216 FOREACH_ACL_ENTRY(pa, acl, pe) {
275 * Returns 0 if the acl can be exactly represented in the traditional
279 posix_acl_equiv_mode(const struct posix_acl *acl, umode_t *mode_p)
288 if (!acl)
291 FOREACH_ACL_ENTRY(pa, acl, pe) {
327 struct posix_acl *acl = posix_acl_alloc(3, flags);
328 if (!acl)
331 acl->a_entries[0].e_tag = ACL_USER_OBJ;
332 acl->a_entries[0].e_perm = (mode & S_IRWXU) >> 6;
334 acl->a_entries[1].e_tag = ACL_GROUP_OBJ;
335 acl->a_entries[1].e_perm = (mode & S_IRWXG) >> 3;
337 acl->a_entries[2].e_tag = ACL_OTHER;
338 acl->a_entries[2].e_perm = (mode & S_IRWXO);
339 return acl;
345 * by the acl. Returns -E... otherwise.
348 posix_acl_permission(struct inode *inode, const struct posix_acl *acl, int want)
355 FOREACH_ACL_ENTRY(pa, acl, pe) {
409 * Modify acl when creating a new inode. The caller must ensure the acl is
413 * system calls. All permissions that are not granted by the acl are removed.
414 * The permissions in the acl are changed to reflect the mode_p parameter.
416 static int posix_acl_create_masq(struct posix_acl *acl, umode_t *mode_p)
423 /* assert(atomic_read(acl->a_refcount) == 1); */
425 FOREACH_ACL_ENTRY(pa, acl, pe) {
473 static int __posix_acl_chmod_masq(struct posix_acl *acl, umode_t mode)
478 /* assert(atomic_read(acl->a_refcount) == 1); */
480 FOREACH_ACL_ENTRY(pa, acl, pe) {
519 __posix_acl_create(struct posix_acl **acl, gfp_t gfp, umode_t *mode_p)
521 struct posix_acl *clone = posix_acl_clone(*acl, gfp);
530 posix_acl_release(*acl);
531 *acl = clone;
537 __posix_acl_chmod(struct posix_acl **acl, gfp_t gfp, umode_t mode)
539 struct posix_acl *clone = posix_acl_clone(*acl, gfp);
548 posix_acl_release(*acl);
549 *acl = clone;
557 struct posix_acl *acl;
565 acl = get_acl(inode, ACL_TYPE_ACCESS);
566 if (IS_ERR_OR_NULL(acl)) {
567 if (acl == ERR_PTR(-EOPNOTSUPP))
569 return PTR_ERR(acl);
572 ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode);
575 ret = inode->i_op->set_acl(inode, acl, ACL_TYPE_ACCESS);
576 posix_acl_release(acl);
583 struct posix_acl **default_acl, struct posix_acl **acl)
589 *acl = NULL;
615 *acl = clone;
636 * @acl: acl pointer
640 * file mode, set *@acl to NULL to indicate that no ACL should be set.
648 struct posix_acl **acl)
653 error = posix_acl_equiv_mode(*acl, &mode);
657 *acl = NULL;
667 * Fix up the uids and gids in posix acl extended attributes in place.
734 struct posix_acl *acl;
750 acl = posix_acl_alloc(count, GFP_NOFS);
751 if (!acl)
753 acl_e = acl->a_entries;
785 return acl;
788 posix_acl_release(acl);
797 posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl,
804 real_size = posix_acl_xattr_size(acl->a_count);
813 for (n=0; n < acl->a_count; n++, ext_entry++) {
814 const struct posix_acl_entry *acl_e = &acl->a_entries[n];
840 struct posix_acl *acl;
848 acl = get_acl(inode, handler->flags);
849 if (IS_ERR(acl))
850 return PTR_ERR(acl);
851 if (acl == NULL)
854 error = posix_acl_to_xattr(&init_user_ns, acl, value, size);
855 posix_acl_release(acl);
861 set_posix_acl(struct inode *inode, int type, struct posix_acl *acl)
869 return acl ? -EACCES : 0;
873 if (acl) {
874 int ret = posix_acl_valid(inode->i_sb->s_user_ns, acl);
878 return inode->i_op->set_acl(inode, acl, type);
888 struct posix_acl *acl = NULL;
892 acl = posix_acl_from_xattr(&init_user_ns, value, size);
893 if (IS_ERR(acl))
894 return PTR_ERR(acl);
896 ret = set_posix_acl(inode, handler->flags, acl);
897 posix_acl_release(acl);
925 int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type)
931 &inode->i_mode, &acl);
937 set_cached_acl(inode, type, acl);
943 struct posix_acl *default_acl, *acl;
946 error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl);
951 set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
955 if (acl)
956 posix_acl_release(acl);