acl.c (22d8dcdf8f8a3882d98757e78169014bb0bc6b23) | acl.c (6e8dc55550273084b7fb5846df2f44439f5d03d9) |
---|---|
1/* 2 * Copyright IBM Corporation, 2010 3 * Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of version 2.1 of the GNU Lesser General Public License 7 * as published by the Free Software Foundation. 8 * --- 83 unchanged lines hidden (view full) --- 92 if (acl) { 93 int error = posix_acl_permission(inode, acl, mask); 94 posix_acl_release(acl); 95 return error; 96 } 97 return -EAGAIN; 98} 99 | 1/* 2 * Copyright IBM Corporation, 2010 3 * Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of version 2.1 of the GNU Lesser General Public License 7 * as published by the Free Software Foundation. 8 * --- 83 unchanged lines hidden (view full) --- 92 if (acl) { 93 int error = posix_acl_permission(inode, acl, mask); 94 posix_acl_release(acl); 95 return error; 96 } 97 return -EAGAIN; 98} 99 |
100static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl) 101{ 102 int retval; 103 char *name; 104 size_t size; 105 void *buffer; 106 struct inode *inode = dentry->d_inode; 107 108 set_cached_acl(inode, type, acl); 109 /* Set a setxattr request to server */ 110 size = posix_acl_xattr_size(acl->a_count); 111 buffer = kmalloc(size, GFP_KERNEL); 112 if (!buffer) 113 return -ENOMEM; 114 retval = posix_acl_to_xattr(acl, buffer, size); 115 if (retval < 0) 116 goto err_free_out; 117 switch (type) { 118 case ACL_TYPE_ACCESS: 119 name = POSIX_ACL_XATTR_ACCESS; 120 break; 121 case ACL_TYPE_DEFAULT: 122 name = POSIX_ACL_XATTR_DEFAULT; 123 break; 124 default: 125 BUG(); 126 } 127 retval = v9fs_xattr_set(dentry, name, buffer, size, 0); 128err_free_out: 129 kfree(buffer); 130 return retval; 131} 132 133int v9fs_acl_chmod(struct dentry *dentry) 134{ 135 int retval = 0; 136 struct posix_acl *acl, *clone; 137 struct inode *inode = dentry->d_inode; 138 139 if (S_ISLNK(inode->i_mode)) 140 return -EOPNOTSUPP; 141 acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS); 142 if (acl) { 143 clone = posix_acl_clone(acl, GFP_KERNEL); 144 posix_acl_release(acl); 145 if (!clone) 146 return -ENOMEM; 147 retval = posix_acl_chmod_masq(clone, inode->i_mode); 148 if (!retval) 149 retval = v9fs_set_acl(dentry, ACL_TYPE_ACCESS, clone); 150 posix_acl_release(clone); 151 } 152 return retval; 153} 154 |
|
100static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name, 101 void *buffer, size_t size, int type) 102{ 103 struct posix_acl *acl; 104 int error; 105 106 if (strcmp(name, "") != 0) 107 return -EINVAL; --- 102 unchanged lines hidden --- | 155static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name, 156 void *buffer, size_t size, int type) 157{ 158 struct posix_acl *acl; 159 int error; 160 161 if (strcmp(name, "") != 0) 162 return -EINVAL; --- 102 unchanged lines hidden --- |