| Start/ | End/ | |||
| True | False | - | Line | Source |
| 1 | /* | |||
| 2 | * linux/fs/ext2/acl.c | |||
| 3 | * | |||
| 4 | * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de> | |||
| 5 | */ | |||
| 6 | ||||
| 7 | #include <linux/capability.h> | |||
| 8 | #include <linux/init.h> | |||
| 9 | #include <linux/sched.h> | |||
| 10 | #include <linux/slab.h> | |||
| 11 | #include <linux/fs.h> | |||
| 12 | #include "ext2.h" | |||
| 13 | #include "xattr.h" | |||
| 14 | #include "acl.h" | |||
| 15 | ||||
| 16 | /* | |||
| 17 | * Convert from filesystem to in-memory representation. | |||
| 18 | */ | |||
| 19 | static struct posix_acl * | |||
| 0 | 0 | - | 20 | ext2_acl_from_disk(const void *value, size_t size) |
| 21 | { | |||
| 22 | const char *end = (char *)value + size; | |||
| 23 | int n, count; | |||
| 24 | struct posix_acl *acl; | |||
| 25 | ||||
| 0 | 0 | - | 26 | if (!value) |
| 0 | - | 27 | return NULL; | |
| 0 | 0 | - | 28 | if (size < sizeof(ext2_acl_header)) |
| 0 | - | 29 | return ERR_PTR(-EINVAL); | |
| 30 | if (((ext2_acl_header *)value)->a_version != | |||
| 0 | 0 | - | 31 | cpu_to_le32(EXT2_ACL_VERSION)) |
| 0 | - | 32 | return ERR_PTR(-EINVAL); | |
| 33 | value = (char *)value + sizeof(ext2_acl_header); | |||
| 34 | count = ext2_acl_count(size); | |||
| 0 | 0 | - | 35 | if (count < 0) |
| 0 | - | 36 | return ERR_PTR(-EINVAL); | |
| 0 | 0 | - | 37 | if (count == 0) |
| 0 | - | 38 | return NULL; | |
| 39 | acl = posix_acl_alloc(count, GFP_KERNEL); | |||
| 0 | 0 | - | 40 | if (!acl) |
| 0 | - | 41 | return ERR_PTR(-ENOMEM); | |
| 0 | 0 | - | 42 | for (n=0; n < count; n++) { |
| 43 | ext2_acl_entry *entry = | |||
| 44 | (ext2_acl_entry *)value; | |||
| 0 | 0 | - | 45 | if ((char *)value + sizeof(ext2_acl_entry_short) > end) |
| 0 | - | 46 | goto fail; | |
| 47 | acl->a_entries[n].e_tag = le16_to_cpu(entry->e_tag); | |||
| 48 | acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm); | |||
| 49 | switch(acl->a_entries[n].e_tag) { | |||
| 0 | - | 50 | case ACL_USER_OBJ: | |
| 0 | - | 51 | case ACL_GROUP_OBJ: | |
| 0 | - | 52 | case ACL_MASK: | |
| 0 | - | 53 | case ACL_OTHER: | |
| 54 | value = (char *)value + | |||
| 55 | sizeof(ext2_acl_entry_short); | |||
| 56 | acl->a_entries[n].e_id = ACL_UNDEFINED_ID; | |||
| 0 | - | 57 | break; | |
| 58 | ||||
| 0 | - | 59 | case ACL_USER: | |
| 0 | - | 60 | case ACL_GROUP: | |
| 61 | value = (char *)value + sizeof(ext2_acl_entry); | |||
| 0 | 0 | - | 62 | if ((char *)value > end) |
| 0 | - | 63 | goto fail; | |
| 64 | acl->a_entries[n].e_id = | |||
| 65 | le32_to_cpu(entry->e_id); | |||
| 0 | - | 66 | break; | |
| 67 | ||||
| 0 | - | 68 | default: | |
| 0 | - | 69 | goto fail; | |
| 70 | } | |||
| 71 | } | |||
| 0 | 0 | - | 72 | if (value != end) |
| 0 | - | 73 | goto fail; | |
| 0 | - | 74 | return acl; | |
| 75 | ||||
| 76 | fail: | |||
| 77 | posix_acl_release(acl); | |||
| 0 | - | 78 | return ERR_PTR(-EINVAL); | |
| 79 | } | |||
| 80 | ||||
| 81 | /* | |||
| 82 | * Convert from in-memory to filesystem representation. | |||
| 83 | */ | |||
| 84 | static void * | |||
| 0 | 0 | - | 85 | ext2_acl_to_disk(const struct posix_acl *acl, size_t *size) |
| 86 | { | |||
| 87 | ext2_acl_header *ext_acl; | |||
| 88 | char *e; | |||
| 89 | size_t n; | |||
| 90 | ||||
| 91 | *size = ext2_acl_size(acl->a_count); | |||
| 92 | ext_acl = (ext2_acl_header *)kmalloc(sizeof(ext2_acl_header) + | |||
| 93 | acl->a_count * sizeof(ext2_acl_entry), GFP_KERNEL); | |||
| 0 | 0 | - | 94 | if (!ext_acl) |
| 0 | - | 95 | return ERR_PTR(-ENOMEM); | |
| 96 | ext_acl->a_version = cpu_to_le32(EXT2_ACL_VERSION); | |||
| 97 | e = (char *)ext_acl + sizeof(ext2_acl_header); | |||
| 0 | 0 | - | 98 | for (n=0; n < acl->a_count; n++) { |
| 99 | ext2_acl_entry *entry = (ext2_acl_entry *)e; | |||
| 100 | entry->e_tag = cpu_to_le16(acl->a_entries[n].e_tag); | |||
| 101 | entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm); | |||
| 102 | switch(acl->a_entries[n].e_tag) { | |||
| 0 | - | 103 | case ACL_USER: | |
| 0 | - | 104 | case ACL_GROUP: | |
| 105 | entry->e_id = | |||
| 106 | cpu_to_le32(acl->a_entries[n].e_id); | |||
| 107 | e += sizeof(ext2_acl_entry); | |||
| 0 | - | 108 | break; | |
| 109 | ||||
| 0 | - | 110 | case ACL_USER_OBJ: | |
| 0 | - | 111 | case ACL_GROUP_OBJ: | |
| 0 | - | 112 | case ACL_MASK: | |
| 0 | - | 113 | case ACL_OTHER: | |
| 114 | e += sizeof(ext2_acl_entry_short); | |||
| 0 | - | 115 | break; | |
| 116 | ||||
| 0 | - | 117 | default: | |
| 0 | - | 118 | goto fail; | |
| 119 | } | |||
| 120 | } | |||
| 0 | - | 121 | return (char *)ext_acl; | |
| 122 | ||||
| 123 | fail: | |||
| 124 | kfree(ext_acl); | |||
| 0 | - | 125 | return ERR_PTR(-EINVAL); | |
| 126 | } | |||
| 127 | ||||
| 128 | static inline struct posix_acl * | |||
| 0 | 0 | - | 129 | ext2_iget_acl(struct inode *inode, struct posix_acl **i_acl) |
| 130 | { | |||
| 131 | struct posix_acl *acl = EXT2_ACL_NOT_CACHED; | |||
| 132 | ||||
| 133 | spin_lock(&inode->i_lock); | |||
| 133 | do | |||
| 0 | 0 | - | 133 | do-while (0) |
| 0 | 0 | - | 133 | do-while (0) |
| 0 | 0 | - | 134 | if (*i_acl != EXT2_ACL_NOT_CACHED) |
| 135 | acl = posix_acl_dup(*i_acl); | |||
| 136 | spin_unlock(&inode->i_lock); | |||
| 136 | do | |||
| 0 | 0 | - | 136 | do-while (0) |
| 0 | 0 | - | 136 | do-while (0) |
| 137 | ||||
| 0 | - | 138 | return acl; | |
| 139 | } | |||
| 140 | ||||
| 141 | static inline void | |||
| 0 | 0 | - | 142 | ext2_iset_acl(struct inode *inode, struct posix_acl **i_acl, |
| 143 | struct posix_acl *acl) | |||
| 144 | { | |||
| 145 | spin_lock(&inode->i_lock); | |||
| 145 | do | |||
| 0 | 0 | - | 145 | do-while (0) |
| 0 | 0 | - | 145 | do-while (0) |
| 0 | 0 | - | 146 | if (*i_acl != EXT2_ACL_NOT_CACHED) |
| 147 | posix_acl_release(*i_acl); | |||
| 148 | *i_acl = posix_acl_dup(acl); | |||
| 149 | spin_unlock(&inode->i_lock); | |||
| 149 | do | |||
| 0 | 0 | - | 149 | do-while (0) |
| 0 | 0 | - | 149 | do-while (0) |
| 150 | } | |||
| 151 | ||||
| 152 | /* | |||
| 153 | * inode->i_mutex: don't care | |||
| 154 | */ | |||
| 155 | static struct posix_acl * | |||
| 0 | 0 | - | 156 | ext2_get_acl(struct inode *inode, int type) |
| 157 | { | |||
| 158 | struct ext2_inode_info *ei = EXT2_I(inode); | |||
| 159 | int name_index; | |||
| 160 | char *value = NULL; | |||
| 161 | struct posix_acl *acl; | |||
| 162 | int retval; | |||
| 163 | ||||
| 0 | 0 | - | 164 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
| 0 | - | 165 | return NULL; | |
| 166 | ||||
| 167 | switch(type) { | |||
| 0 | - | 168 | case ACL_TYPE_ACCESS: | |
| 169 | acl = ext2_iget_acl(inode, &ei->i_acl); | |||
| 0 | 0 | - | 170 | if (acl != EXT2_ACL_NOT_CACHED) |
| 0 | - | 171 | return acl; | |
| 172 | name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS; | |||
| 0 | - | 173 | break; | |
| 174 | ||||
| 0 | - | 175 | case ACL_TYPE_DEFAULT: | |
| 176 | acl = ext2_iget_acl(inode, &ei->i_default_acl); | |||
| 0 | 0 | - | 177 | if (acl != EXT2_ACL_NOT_CACHED) |
| 0 | - | 178 | return acl; | |
| 179 | name_index = EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT; | |||
| 0 | - | 180 | break; | |
| 181 | ||||
| 0 | - | 182 | default: | |
| 0 | - | 183 | return ERR_PTR(-EINVAL); | |
| 184 | } | |||
| 185 | retval = ext2_xattr_get(inode, name_index, "", NULL, 0); | |||
| 0 | 0 | - | 186 | if (retval > 0) { |
| 187 | value = kmalloc(retval, GFP_KERNEL); | |||
| 0 | 0 | - | 188 | if (!value) |
| 0 | - | 189 | return ERR_PTR(-ENOMEM); | |
| 190 | retval = ext2_xattr_get(inode, name_index, "", value, retval); | |||
| 191 | } | |||
| 0 | 0 | - | 192 | if (retval > 0) |
| 193 | acl = ext2_acl_from_disk(value, retval); | |||
| 0 | 0 | - | 194 | else if (retval == -ENODATA || retval == -ENOSYS) |
| 0 | - | 194 | T || _ | |
| 0 | - | 194 | F || T | |
| 0 | - | 194 | F || F | |
| 195 | acl = NULL; | |||
| 196 | else | |||
| 197 | acl = ERR_PTR(retval); | |||
| 198 | kfree(value); | |||
| 199 | ||||
| 0 | 0 | - | 200 | if (!IS_ERR(acl)) { |
| 201 | switch(type) { | |||
| 0 | - | 202 | case ACL_TYPE_ACCESS: | |
| 203 | ext2_iset_acl(inode, &ei->i_acl, acl); | |||
| 0 | - | 204 | break; | |
| 205 | ||||
| 0 | - | 206 | case ACL_TYPE_DEFAULT: | |
| 207 | ext2_iset_acl(inode, &ei->i_default_acl, acl); | |||
| 0 | - | 208 | break; | |
| 209 | } | |||
| 210 | } | |||
| 0 | - | 211 | return acl; | |
| 212 | } | |||
| 213 | ||||
| 214 | /* | |||
| 215 | * inode->i_mutex: down | |||
| 216 | */ | |||
| 217 | static int | |||
| 0 | 0 | - | 218 | ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl) |
| 219 | { | |||
| 220 | struct ext2_inode_info *ei = EXT2_I(inode); | |||
| 221 | int name_index; | |||
| 222 | void *value = NULL; | |||
| 223 | size_t size = 0; | |||
| 224 | int error; | |||
| 225 | ||||
| 0 | 0 | - | 226 | if (S_ISLNK(inode->i_mode)) |
| 0 | - | 227 | return -EOPNOTSUPP; | |
| 0 | 0 | - | 228 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
| 0 | - | 229 | return 0; | |
| 230 | ||||
| 231 | switch(type) { | |||
| 0 | - | 232 | case ACL_TYPE_ACCESS: | |
| 233 | name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS; | |||
| 0 | 0 | - | 234 | if (acl) { |
| 235 | mode_t mode = inode->i_mode; | |||
| 236 | error = posix_acl_equiv_mode(acl, &mode); | |||
| 0 | 0 | - | 237 | if (error < 0) |
| 0 | - | 238 | return error; | |
| 239 | else { | |||
| 240 | inode->i_mode = mode; | |||
| 241 | mark_inode_dirty(inode); | |||
| 0 | 0 | - | 242 | if (error == 0) |
| 243 | acl = NULL; | |||
| 244 | } | |||
| 245 | } | |||
| 0 | - | 246 | break; | |
| 247 | ||||
| 0 | - | 248 | case ACL_TYPE_DEFAULT: | |
| 249 | name_index = EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT; | |||
| 0 | 0 | - | 250 | if (!S_ISDIR(inode->i_mode)) |
| 251 | return acl ? -EACCES : 0; | |||
| 0 | 0 | - | 251 | ternary-?: acl |
| 0 | - | 251 | return acl ? - 13 : 0 | |
| 0 | - | 252 | break; | |
| 253 | ||||
| 0 | - | 254 | default: | |
| 0 | - | 255 | return -EINVAL; | |
| 256 | } | |||
| 0 | 0 | - | 257 | if (acl) { |
| 258 | value = ext2_acl_to_disk(acl, &size); | |||
| 0 | 0 | - | 259 | if (IS_ERR(value)) |
| 0 | - | 260 | return (int)PTR_ERR(value); | |
| 261 | } | |||
| 262 | ||||
| 263 | error = ext2_xattr_set(inode, name_index, "", value, size, 0); | |||
| 264 | ||||
| 265 | kfree(value); | |||
| 0 | 0 | - | 266 | if (!error) { |
| 267 | switch(type) { | |||
| 0 | - | 268 | case ACL_TYPE_ACCESS: | |
| 269 | ext2_iset_acl(inode, &ei->i_acl, acl); | |||
| 0 | - | 270 | break; | |
| 271 | ||||
| 0 | - | 272 | case ACL_TYPE_DEFAULT: | |
| 273 | ext2_iset_acl(inode, &ei->i_default_acl, acl); | |||
| 0 | - | 274 | break; | |
| 275 | } | |||
| 276 | } | |||
| 0 | - | 277 | return error; | |
| 278 | } | |||
| 279 | ||||
| 280 | static int | |||
| 0 | 0 | - | 281 | ext2_check_acl(struct inode *inode, int mask) |
| 282 | { | |||
| 283 | struct posix_acl *acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); | |||
| 284 | ||||
| 0 | 0 | - | 285 | if (IS_ERR(acl)) |
| 0 | - | 286 | return PTR_ERR(acl); | |
| 0 | 0 | - | 287 | if (acl) { |
| 288 | int error = posix_acl_permission(inode, acl, mask); | |||
| 289 | posix_acl_release(acl); | |||
| 0 | - | 290 | return error; | |
| 291 | } | |||
| 292 | ||||
| 0 | - | 293 | return -EAGAIN; | |
| 294 | } | |||
| 295 | ||||
| 296 | int | |||
| 0 | 0 | - | 297 | ext2_permission(struct inode *inode, int mask, struct nameidata *nd) |
| 298 | { | |||
| 0 | - | 299 | return generic_permission(inode, mask, ext2_check_acl); | |
| 300 | } | |||
| 301 | ||||
| 302 | /* | |||
| 303 | * Initialize the ACLs of a new inode. Called from ext2_new_inode. | |||
| 304 | * | |||
| 305 | * dir->i_mutex: down | |||
| 306 | * inode->i_mutex: up (access to inode is still exclusive) | |||
| 307 | */ | |||
| 308 | int | |||
| 0 | 0 | - | 309 | ext2_init_acl(struct inode *inode, struct inode *dir) |
| 310 | { | |||
| 311 | struct posix_acl *acl = NULL; | |||
| 312 | int error = 0; | |||
| 313 | ||||
| 0 | 0 | - | 314 | if (!S_ISLNK(inode->i_mode)) { |
| 0 | 0 | - | 315 | if (test_opt(dir->i_sb, POSIX_ACL)) { |
| 316 | acl = ext2_get_acl(dir, ACL_TYPE_DEFAULT); | |||
| 0 | 0 | - | 317 | if (IS_ERR(acl)) |
| 0 | - | 318 | return PTR_ERR(acl); | |
| 319 | } | |||
| 0 | 0 | - | 320 | if (!acl) |
| 321 | inode->i_mode &= ~current->fs->umask; | |||
| 322 | } | |||
| 0 | 0 | - | 323 | if (test_opt(inode->i_sb, POSIX_ACL) && acl) { |
| 0 | - | 323 | (T) && T | |
| 0 | - | 323 | (T) && F | |
| 0 | - | 323 | (F) && _ | |
| 324 | struct posix_acl *clone; | |||
| 325 | mode_t mode; | |||
| 326 | ||||
| 0 | 0 | - | 327 | if (S_ISDIR(inode->i_mode)) { |
| 328 | error = ext2_set_acl(inode, ACL_TYPE_DEFAULT, acl); | |||
| 0 | 0 | - | 329 | if (error) |
| 0 | - | 330 | goto cleanup; | |
| 331 | } | |||
| 332 | clone = posix_acl_clone(acl, GFP_KERNEL); | |||
| 333 | error = -ENOMEM; | |||
| 0 | 0 | - | 334 | if (!clone) |
| 0 | - | 335 | goto cleanup; | |
| 336 | mode = inode->i_mode; | |||
| 337 | error = posix_acl_create_masq(clone, &mode); | |||
| 0 | 0 | - | 338 | if (error >= 0) { |
| 339 | inode->i_mode = mode; | |||
| 0 | 0 | - | 340 | if (error > 0) { |
| 341 | /* This is an extended ACL */ | |||
| 342 | error = ext2_set_acl(inode, | |||
| 343 | ACL_TYPE_ACCESS, clone); | |||
| 344 | } | |||
| 345 | } | |||
| 346 | posix_acl_release(clone); | |||
| 347 | } | |||
| 348 | cleanup: | |||
| 349 | posix_acl_release(acl); | |||
| 0 | - | 350 | return error; | |
| 351 | } | |||
| 352 | ||||
| 353 | /* | |||
| 354 | * Does chmod for an inode that may have an Access Control List. The | |||
| 355 | * inode->i_mode field must be updated to the desired value by the caller | |||
| 356 | * before calling this function. | |||
| 357 | * Returns 0 on success, or a negative error number. | |||
| 358 | * | |||
| 359 | * We change the ACL rather than storing some ACL entries in the file | |||
| 360 | * mode permission bits (which would be more efficient), because that | |||
| 361 | * would break once additional permissions (like ACL_APPEND, ACL_DELETE | |||
| 362 | * for directories) are added. There are no more bits available in the | |||
| 363 | * file mode. | |||
| 364 | * | |||
| 365 | * inode->i_mutex: down | |||
| 366 | */ | |||
| 367 | int | |||
| 0 | 0 | - | 368 | ext2_acl_chmod(struct inode *inode) |
| 369 | { | |||
| 370 | struct posix_acl *acl, *clone; | |||
| 371 | int error; | |||
| 372 | ||||
| 0 | 0 | - | 373 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
| 0 | - | 374 | return 0; | |
| 0 | 0 | - | 375 | if (S_ISLNK(inode->i_mode)) |
| 0 | - | 376 | return -EOPNOTSUPP; | |
| 377 | acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); | |||
| 0 | 0 | - | 378 | if (IS_ERR(acl) || !acl) |
| 0 | - | 378 | T || _ | |
| 0 | - | 378 | F || T | |
| 0 | - | 378 | F || F | |
| 0 | - | 379 | return PTR_ERR(acl); | |
| 380 | clone = posix_acl_clone(acl, GFP_KERNEL); | |||
| 381 | posix_acl_release(acl); | |||
| 0 | 0 | - | 382 | if (!clone) |
| 0 | - | 383 | return -ENOMEM; | |
| 384 | error = posix_acl_chmod_masq(clone, inode->i_mode); | |||
| 0 | 0 | - | 385 | if (!error) |
| 386 | error = ext2_set_acl(inode, ACL_TYPE_ACCESS, clone); | |||
| 387 | posix_acl_release(clone); | |||
| 0 | - | 388 | return error; | |
| 389 | } | |||
| 390 | ||||
| 391 | /* | |||
| 392 | * Extended attribut handlers | |||
| 393 | */ | |||
| 394 | static size_t | |||
| 0 | 0 | - | 395 | ext2_xattr_list_acl_access(struct inode *inode, char *list, size_t list_size, |
| 396 | const char *name, size_t name_len) | |||
| 397 | { | |||
| 398 | const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS); | |||
| 399 | ||||
| 0 | 0 | - | 400 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
| 0 | - | 401 | return 0; | |
| 0 | 0 | - | 402 | if (list && size <= list_size) |
| 0 | - | 402 | T && T | |
| 0 | - | 402 | T && F | |
| 0 | - | 402 | F && _ | |
| 403 | memcpy(list, POSIX_ACL_XATTR_ACCESS, size); | |||
| 0 | - | 404 | return size; | |
| 405 | } | |||
| 406 | ||||
| 407 | static size_t | |||
| 0 | 0 | - | 408 | ext2_xattr_list_acl_default(struct inode *inode, char *list, size_t list_size, |
| 409 | const char *name, size_t name_len) | |||
| 410 | { | |||
| 411 | const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT); | |||
| 412 | ||||
| 0 | 0 | - | 413 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
| 0 | - | 414 | return 0; | |
| 0 | 0 | - | 415 | if (list && size <= list_size) |
| 0 | - | 415 | T && T | |
| 0 | - | 415 | T && F | |
| 0 | - | 415 | F && _ | |
| 416 | memcpy(list, POSIX_ACL_XATTR_DEFAULT, size); | |||
| 0 | - | 417 | return size; | |
| 418 | } | |||
| 419 | ||||
| 420 | static int | |||
| 0 | 0 | - | 421 | ext2_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size) |
| 422 | { | |||
| 423 | struct posix_acl *acl; | |||
| 424 | int error; | |||
| 425 | ||||
| 0 | 0 | - | 426 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
| 0 | - | 427 | return -EOPNOTSUPP; | |
| 428 | ||||
| 429 | acl = ext2_get_acl(inode, type); | |||
| 0 | 0 | - | 430 | if (IS_ERR(acl)) |
| 0 | - | 431 | return PTR_ERR(acl); | |
| 0 | 0 | - | 432 | if (acl == NULL) |
| 0 | - | 433 | return -ENODATA; | |
| 434 | error = posix_acl_to_xattr(acl, buffer, size); | |||
| 435 | posix_acl_release(acl); | |||
| 436 | ||||
| 0 | - | 437 | return error; | |
| 438 | } | |||
| 439 | ||||
| 440 | static int | |||
| 0 | 0 | - | 441 | ext2_xattr_get_acl_access(struct inode *inode, const char *name, |
| 442 | void *buffer, size_t size) | |||
| 443 | { | |||
| 0 | 0 | - | 444 | if (strcmp(name, "") != 0) |
| 0 | - | 445 | return -EINVAL; | |
| 0 | - | 446 | return ext2_xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size); | |
| 447 | } | |||
| 448 | ||||
| 449 | static int | |||
| 0 | 0 | - | 450 | ext2_xattr_get_acl_default(struct inode *inode, const char *name, |
| 451 | void *buffer, size_t size) | |||
| 452 | { | |||
| 0 | 0 | - | 453 | if (strcmp(name, "") != 0) |
| 0 | - | 454 | return -EINVAL; | |
| 0 | - | 455 | return ext2_xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size); | |
| 456 | } | |||
| 457 | ||||
| 458 | static int | |||
| 0 | 0 | - | 459 | ext2_xattr_set_acl(struct inode *inode, int type, const void *value, |
| 460 | size_t size) | |||
| 461 | { | |||
| 462 | struct posix_acl *acl; | |||
| 463 | int error; | |||
| 464 | ||||
| 0 | 0 | - | 465 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
| 0 | - | |||