Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/fs/ext2/acl.c |
| 3 | * |
| 4 | * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de> |
| 5 | */ |
| 6 | |
Randy Dunlap | 16f7e0f | 2006-01-11 12:17:46 -0800 | [diff] [blame] | 7 | #include <linux/capability.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 * |
| 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 | |
| 26 | if (!value) |
| 27 | return NULL; |
| 28 | if (size < sizeof(ext2_acl_header)) |
| 29 | return ERR_PTR(-EINVAL); |
| 30 | if (((ext2_acl_header *)value)->a_version != |
| 31 | cpu_to_le32(EXT2_ACL_VERSION)) |
| 32 | return ERR_PTR(-EINVAL); |
| 33 | value = (char *)value + sizeof(ext2_acl_header); |
| 34 | count = ext2_acl_count(size); |
| 35 | if (count < 0) |
| 36 | return ERR_PTR(-EINVAL); |
| 37 | if (count == 0) |
| 38 | return NULL; |
| 39 | acl = posix_acl_alloc(count, GFP_KERNEL); |
| 40 | if (!acl) |
| 41 | return ERR_PTR(-ENOMEM); |
| 42 | for (n=0; n < count; n++) { |
| 43 | ext2_acl_entry *entry = |
| 44 | (ext2_acl_entry *)value; |
| 45 | if ((char *)value + sizeof(ext2_acl_entry_short) > end) |
| 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) { |
| 50 | case ACL_USER_OBJ: |
| 51 | case ACL_GROUP_OBJ: |
| 52 | case ACL_MASK: |
| 53 | case ACL_OTHER: |
| 54 | value = (char *)value + |
| 55 | sizeof(ext2_acl_entry_short); |
| 56 | acl->a_entries[n].e_id = ACL_UNDEFINED_ID; |
| 57 | break; |
| 58 | |
| 59 | case ACL_USER: |
| 60 | case ACL_GROUP: |
| 61 | value = (char *)value + sizeof(ext2_acl_entry); |
| 62 | if ((char *)value > end) |
| 63 | goto fail; |
| 64 | acl->a_entries[n].e_id = |
| 65 | le32_to_cpu(entry->e_id); |
| 66 | break; |
| 67 | |
| 68 | default: |
| 69 | goto fail; |
| 70 | } |
| 71 | } |
| 72 | if (value != end) |
| 73 | goto fail; |
| 74 | return acl; |
| 75 | |
| 76 | fail: |
| 77 | posix_acl_release(acl); |
| 78 | return ERR_PTR(-EINVAL); |
| 79 | } |
| 80 | |
| 81 | /* |
| 82 | * Convert from in-memory to filesystem representation. |
| 83 | */ |
| 84 | static void * |
| 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); |
Panagiotis Issaris | f52720c | 2006-09-27 01:49:39 -0700 | [diff] [blame] | 92 | ext_acl = kmalloc(sizeof(ext2_acl_header) + acl->a_count * |
| 93 | sizeof(ext2_acl_entry), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | if (!ext_acl) |
| 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); |
| 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) { |
| 103 | case ACL_USER: |
| 104 | case ACL_GROUP: |
| 105 | entry->e_id = |
| 106 | cpu_to_le32(acl->a_entries[n].e_id); |
| 107 | e += sizeof(ext2_acl_entry); |
| 108 | break; |
| 109 | |
| 110 | case ACL_USER_OBJ: |
| 111 | case ACL_GROUP_OBJ: |
| 112 | case ACL_MASK: |
| 113 | case ACL_OTHER: |
| 114 | e += sizeof(ext2_acl_entry_short); |
| 115 | break; |
| 116 | |
| 117 | default: |
| 118 | goto fail; |
| 119 | } |
| 120 | } |
| 121 | return (char *)ext_acl; |
| 122 | |
| 123 | fail: |
| 124 | kfree(ext_acl); |
| 125 | return ERR_PTR(-EINVAL); |
| 126 | } |
| 127 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | /* |
Jes Sorensen | 1b1dcc1 | 2006-01-09 15:59:24 -0800 | [diff] [blame] | 129 | * inode->i_mutex: don't care |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | */ |
Christoph Hellwig | 4e34e71 | 2011-07-23 17:37:31 +0200 | [diff] [blame] | 131 | struct posix_acl * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | ext2_get_acl(struct inode *inode, int type) |
| 133 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | int name_index; |
| 135 | char *value = NULL; |
| 136 | struct posix_acl *acl; |
| 137 | int retval; |
| 138 | |
| 139 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
| 140 | return NULL; |
| 141 | |
Al Viro | 073aaa1 | 2009-06-09 12:11:54 -0400 | [diff] [blame] | 142 | acl = get_cached_acl(inode, type); |
| 143 | if (acl != ACL_NOT_CACHED) |
| 144 | return acl; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | |
Al Viro | 073aaa1 | 2009-06-09 12:11:54 -0400 | [diff] [blame] | 146 | switch (type) { |
| 147 | case ACL_TYPE_ACCESS: |
| 148 | name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS; |
| 149 | break; |
| 150 | case ACL_TYPE_DEFAULT: |
| 151 | name_index = EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT; |
| 152 | break; |
| 153 | default: |
| 154 | BUG(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | } |
| 156 | retval = ext2_xattr_get(inode, name_index, "", NULL, 0); |
| 157 | if (retval > 0) { |
| 158 | value = kmalloc(retval, GFP_KERNEL); |
| 159 | if (!value) |
| 160 | return ERR_PTR(-ENOMEM); |
| 161 | retval = ext2_xattr_get(inode, name_index, "", value, retval); |
| 162 | } |
| 163 | if (retval > 0) |
| 164 | acl = ext2_acl_from_disk(value, retval); |
| 165 | else if (retval == -ENODATA || retval == -ENOSYS) |
| 166 | acl = NULL; |
| 167 | else |
| 168 | acl = ERR_PTR(retval); |
Jesper Juhl | f99d49a | 2005-11-07 01:01:34 -0800 | [diff] [blame] | 169 | kfree(value); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | |
Al Viro | 073aaa1 | 2009-06-09 12:11:54 -0400 | [diff] [blame] | 171 | if (!IS_ERR(acl)) |
| 172 | set_cached_acl(inode, type, acl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | return acl; |
| 175 | } |
| 176 | |
| 177 | /* |
Jes Sorensen | 1b1dcc1 | 2006-01-09 15:59:24 -0800 | [diff] [blame] | 178 | * inode->i_mutex: down |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | */ |
| 180 | static int |
| 181 | ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl) |
| 182 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | int name_index; |
| 184 | void *value = NULL; |
Andreas Gruenbacher | dfa0859 | 2006-02-03 03:04:13 -0800 | [diff] [blame] | 185 | size_t size = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | int error; |
| 187 | |
| 188 | if (S_ISLNK(inode->i_mode)) |
| 189 | return -EOPNOTSUPP; |
| 190 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
| 191 | return 0; |
| 192 | |
| 193 | switch(type) { |
| 194 | case ACL_TYPE_ACCESS: |
| 195 | name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS; |
| 196 | if (acl) { |
Al Viro | d695212 | 2011-07-23 18:56:36 -0400 | [diff] [blame] | 197 | error = posix_acl_equiv_mode(acl, &inode->i_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | if (error < 0) |
| 199 | return error; |
| 200 | else { |
Jan Kara | 523825b | 2010-06-02 16:26:51 +0200 | [diff] [blame] | 201 | inode->i_ctime = CURRENT_TIME_SEC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | mark_inode_dirty(inode); |
| 203 | if (error == 0) |
| 204 | acl = NULL; |
| 205 | } |
| 206 | } |
| 207 | break; |
| 208 | |
| 209 | case ACL_TYPE_DEFAULT: |
| 210 | name_index = EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT; |
| 211 | if (!S_ISDIR(inode->i_mode)) |
| 212 | return acl ? -EACCES : 0; |
| 213 | break; |
| 214 | |
| 215 | default: |
| 216 | return -EINVAL; |
| 217 | } |
| 218 | if (acl) { |
| 219 | value = ext2_acl_to_disk(acl, &size); |
| 220 | if (IS_ERR(value)) |
| 221 | return (int)PTR_ERR(value); |
| 222 | } |
| 223 | |
| 224 | error = ext2_xattr_set(inode, name_index, "", value, size, 0); |
| 225 | |
Jesper Juhl | f99d49a | 2005-11-07 01:01:34 -0800 | [diff] [blame] | 226 | kfree(value); |
Al Viro | 073aaa1 | 2009-06-09 12:11:54 -0400 | [diff] [blame] | 227 | if (!error) |
| 228 | set_cached_acl(inode, type, acl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | return error; |
| 230 | } |
| 231 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | /* |
| 233 | * Initialize the ACLs of a new inode. Called from ext2_new_inode. |
| 234 | * |
Jes Sorensen | 1b1dcc1 | 2006-01-09 15:59:24 -0800 | [diff] [blame] | 235 | * dir->i_mutex: down |
| 236 | * inode->i_mutex: up (access to inode is still exclusive) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | */ |
| 238 | int |
| 239 | ext2_init_acl(struct inode *inode, struct inode *dir) |
| 240 | { |
| 241 | struct posix_acl *acl = NULL; |
| 242 | int error = 0; |
| 243 | |
| 244 | if (!S_ISLNK(inode->i_mode)) { |
| 245 | if (test_opt(dir->i_sb, POSIX_ACL)) { |
| 246 | acl = ext2_get_acl(dir, ACL_TYPE_DEFAULT); |
| 247 | if (IS_ERR(acl)) |
| 248 | return PTR_ERR(acl); |
| 249 | } |
| 250 | if (!acl) |
Al Viro | ce3b0f8 | 2009-03-29 19:08:22 -0400 | [diff] [blame] | 251 | inode->i_mode &= ~current_umask(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | } |
| 253 | if (test_opt(inode->i_sb, POSIX_ACL) && acl) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | if (S_ISDIR(inode->i_mode)) { |
| 255 | error = ext2_set_acl(inode, ACL_TYPE_DEFAULT, acl); |
| 256 | if (error) |
| 257 | goto cleanup; |
| 258 | } |
Al Viro | d3fb612 | 2011-07-23 18:37:50 -0400 | [diff] [blame] | 259 | error = posix_acl_create(&acl, GFP_KERNEL, &inode->i_mode); |
Al Viro | 826cae2 | 2011-07-23 03:10:32 -0400 | [diff] [blame] | 260 | if (error < 0) |
| 261 | return error; |
Al Viro | 826cae2 | 2011-07-23 03:10:32 -0400 | [diff] [blame] | 262 | if (error > 0) { |
| 263 | /* This is an extended ACL */ |
| 264 | error = ext2_set_acl(inode, ACL_TYPE_ACCESS, acl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | } |
| 267 | cleanup: |
| 268 | posix_acl_release(acl); |
| 269 | return error; |
| 270 | } |
| 271 | |
| 272 | /* |
| 273 | * Does chmod for an inode that may have an Access Control List. The |
| 274 | * inode->i_mode field must be updated to the desired value by the caller |
| 275 | * before calling this function. |
| 276 | * Returns 0 on success, or a negative error number. |
| 277 | * |
| 278 | * We change the ACL rather than storing some ACL entries in the file |
| 279 | * mode permission bits (which would be more efficient), because that |
| 280 | * would break once additional permissions (like ACL_APPEND, ACL_DELETE |
| 281 | * for directories) are added. There are no more bits available in the |
| 282 | * file mode. |
| 283 | * |
Jes Sorensen | 1b1dcc1 | 2006-01-09 15:59:24 -0800 | [diff] [blame] | 284 | * inode->i_mutex: down |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | */ |
| 286 | int |
| 287 | ext2_acl_chmod(struct inode *inode) |
| 288 | { |
Al Viro | bc26ab5 | 2011-07-23 00:18:02 -0400 | [diff] [blame] | 289 | struct posix_acl *acl; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | int error; |
| 291 | |
| 292 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
| 293 | return 0; |
| 294 | if (S_ISLNK(inode->i_mode)) |
| 295 | return -EOPNOTSUPP; |
| 296 | acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); |
| 297 | if (IS_ERR(acl) || !acl) |
| 298 | return PTR_ERR(acl); |
Al Viro | bc26ab5 | 2011-07-23 00:18:02 -0400 | [diff] [blame] | 299 | error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); |
| 300 | if (error) |
| 301 | return error; |
| 302 | error = ext2_set_acl(inode, ACL_TYPE_ACCESS, acl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | posix_acl_release(acl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | return error; |
| 305 | } |
| 306 | |
| 307 | /* |
| 308 | * Extended attribut handlers |
| 309 | */ |
| 310 | static size_t |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 311 | ext2_xattr_list_acl_access(struct dentry *dentry, char *list, size_t list_size, |
| 312 | const char *name, size_t name_len, int type) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | { |
Christoph Hellwig | 9a59f45 | 2005-06-23 00:10:19 -0700 | [diff] [blame] | 314 | const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 316 | if (!test_opt(dentry->d_sb, POSIX_ACL)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | return 0; |
| 318 | if (list && size <= list_size) |
Christoph Hellwig | 9a59f45 | 2005-06-23 00:10:19 -0700 | [diff] [blame] | 319 | memcpy(list, POSIX_ACL_XATTR_ACCESS, size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | return size; |
| 321 | } |
| 322 | |
| 323 | static size_t |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 324 | ext2_xattr_list_acl_default(struct dentry *dentry, char *list, size_t list_size, |
| 325 | const char *name, size_t name_len, int type) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | { |
Christoph Hellwig | 9a59f45 | 2005-06-23 00:10:19 -0700 | [diff] [blame] | 327 | const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 329 | if (!test_opt(dentry->d_sb, POSIX_ACL)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | return 0; |
| 331 | if (list && size <= list_size) |
Christoph Hellwig | 9a59f45 | 2005-06-23 00:10:19 -0700 | [diff] [blame] | 332 | memcpy(list, POSIX_ACL_XATTR_DEFAULT, size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | return size; |
| 334 | } |
| 335 | |
| 336 | static int |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 337 | ext2_xattr_get_acl(struct dentry *dentry, const char *name, void *buffer, |
| 338 | size_t size, int type) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | { |
| 340 | struct posix_acl *acl; |
| 341 | int error; |
| 342 | |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 343 | if (strcmp(name, "") != 0) |
| 344 | return -EINVAL; |
| 345 | if (!test_opt(dentry->d_sb, POSIX_ACL)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | return -EOPNOTSUPP; |
| 347 | |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 348 | acl = ext2_get_acl(dentry->d_inode, type); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 349 | if (IS_ERR(acl)) |
| 350 | return PTR_ERR(acl); |
| 351 | if (acl == NULL) |
| 352 | return -ENODATA; |
| 353 | error = posix_acl_to_xattr(acl, buffer, size); |
| 354 | posix_acl_release(acl); |
| 355 | |
| 356 | return error; |
| 357 | } |
| 358 | |
| 359 | static int |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 360 | ext2_xattr_set_acl(struct dentry *dentry, const char *name, const void *value, |
| 361 | size_t size, int flags, int type) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | { |
| 363 | struct posix_acl *acl; |
| 364 | int error; |
| 365 | |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 366 | if (strcmp(name, "") != 0) |
| 367 | return -EINVAL; |
| 368 | if (!test_opt(dentry->d_sb, POSIX_ACL)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | return -EOPNOTSUPP; |
Serge E. Hallyn | 2e14967 | 2011-03-23 16:43:26 -0700 | [diff] [blame] | 370 | if (!inode_owner_or_capable(dentry->d_inode)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | return -EPERM; |
| 372 | |
| 373 | if (value) { |
| 374 | acl = posix_acl_from_xattr(value, size); |
| 375 | if (IS_ERR(acl)) |
| 376 | return PTR_ERR(acl); |
| 377 | else if (acl) { |
| 378 | error = posix_acl_valid(acl); |
| 379 | if (error) |
| 380 | goto release_and_out; |
| 381 | } |
| 382 | } else |
| 383 | acl = NULL; |
| 384 | |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 385 | error = ext2_set_acl(dentry->d_inode, type, acl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | |
| 387 | release_and_out: |
| 388 | posix_acl_release(acl); |
| 389 | return error; |
| 390 | } |
| 391 | |
Stephen Hemminger | 749c72ef | 2010-05-13 17:53:16 -0700 | [diff] [blame] | 392 | const struct xattr_handler ext2_xattr_acl_access_handler = { |
Christoph Hellwig | 9a59f45 | 2005-06-23 00:10:19 -0700 | [diff] [blame] | 393 | .prefix = POSIX_ACL_XATTR_ACCESS, |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 394 | .flags = ACL_TYPE_ACCESS, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 395 | .list = ext2_xattr_list_acl_access, |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 396 | .get = ext2_xattr_get_acl, |
| 397 | .set = ext2_xattr_set_acl, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | }; |
| 399 | |
Stephen Hemminger | 749c72ef | 2010-05-13 17:53:16 -0700 | [diff] [blame] | 400 | const struct xattr_handler ext2_xattr_acl_default_handler = { |
Christoph Hellwig | 9a59f45 | 2005-06-23 00:10:19 -0700 | [diff] [blame] | 401 | .prefix = POSIX_ACL_XATTR_DEFAULT, |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 402 | .flags = ACL_TYPE_DEFAULT, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | .list = ext2_xattr_list_acl_default, |
Christoph Hellwig | 431547b | 2009-11-13 09:52:56 +0000 | [diff] [blame] | 404 | .get = ext2_xattr_get_acl, |
| 405 | .set = ext2_xattr_set_acl, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 406 | }; |