diff options
author | Christoph Hellwig <hch@lst.de> | 2009-11-13 04:52:56 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-16 12:16:49 -0500 |
commit | 431547b3c4533b8c7fd150ab36980b9a3147797b (patch) | |
tree | 807ff2790f3c13c7c91ed2afd6d833032899482d /fs/ext3 | |
parent | ef26ca97e83052790940cbc444b01b0d17a813c1 (diff) |
sanitize xattr handler prototypes
Add a flags argument to struct xattr_handler and pass it to all xattr
handler methods. This allows using the same methods for multiple
handlers, e.g. for the ACL methods which perform exactly the same action
for the access and default ACLs, just using a different underlying
attribute. With a little more groundwork it'll also allow sharing the
methods for the regular user/trusted/secure handlers in extN, ocfs2 and
jffs2 like it's already done for xfs in this patch.
Also change the inode argument to the handlers to a dentry to allow
using the handlers mechnism for filesystems that require it later,
e.g. cifs.
[with GFS2 bits updated by Steven Whitehouse <swhiteho@redhat.com>]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: James Morris <jmorris@namei.org>
Acked-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/acl.c | 74 | ||||
-rw-r--r-- | fs/ext3/xattr.c | 31 | ||||
-rw-r--r-- | fs/ext3/xattr_security.c | 20 | ||||
-rw-r--r-- | fs/ext3/xattr_trusted.c | 18 | ||||
-rw-r--r-- | fs/ext3/xattr_user.c | 25 |
5 files changed, 72 insertions, 96 deletions
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c index c9b0df376b5f..82ba34158661 100644 --- a/fs/ext3/acl.c +++ b/fs/ext3/acl.c | |||
@@ -366,12 +366,12 @@ out: | |||
366 | * Extended attribute handlers | 366 | * Extended attribute handlers |
367 | */ | 367 | */ |
368 | static size_t | 368 | static size_t |
369 | ext3_xattr_list_acl_access(struct inode *inode, char *list, size_t list_len, | 369 | ext3_xattr_list_acl_access(struct dentry *dentry, char *list, size_t list_len, |
370 | const char *name, size_t name_len) | 370 | const char *name, size_t name_len, int type) |
371 | { | 371 | { |
372 | const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS); | 372 | const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS); |
373 | 373 | ||
374 | if (!test_opt(inode->i_sb, POSIX_ACL)) | 374 | if (!test_opt(dentry->d_sb, POSIX_ACL)) |
375 | return 0; | 375 | return 0; |
376 | if (list && size <= list_len) | 376 | if (list && size <= list_len) |
377 | memcpy(list, POSIX_ACL_XATTR_ACCESS, size); | 377 | memcpy(list, POSIX_ACL_XATTR_ACCESS, size); |
@@ -379,12 +379,12 @@ ext3_xattr_list_acl_access(struct inode *inode, char *list, size_t list_len, | |||
379 | } | 379 | } |
380 | 380 | ||
381 | static size_t | 381 | static size_t |
382 | ext3_xattr_list_acl_default(struct inode *inode, char *list, size_t list_len, | 382 | ext3_xattr_list_acl_default(struct dentry *dentry, char *list, size_t list_len, |
383 | const char *name, size_t name_len) | 383 | const char *name, size_t name_len, int type) |
384 | { | 384 | { |
385 | const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT); | 385 | const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT); |
386 | 386 | ||
387 | if (!test_opt(inode->i_sb, POSIX_ACL)) | 387 | if (!test_opt(dentry->d_sb, POSIX_ACL)) |
388 | return 0; | 388 | return 0; |
389 | if (list && size <= list_len) | 389 | if (list && size <= list_len) |
390 | memcpy(list, POSIX_ACL_XATTR_DEFAULT, size); | 390 | memcpy(list, POSIX_ACL_XATTR_DEFAULT, size); |
@@ -392,15 +392,18 @@ ext3_xattr_list_acl_default(struct inode *inode, char *list, size_t list_len, | |||
392 | } | 392 | } |
393 | 393 | ||
394 | static int | 394 | static int |
395 | ext3_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size) | 395 | ext3_xattr_get_acl(struct dentry *dentry, const char *name, void *buffer, |
396 | size_t size, int type) | ||
396 | { | 397 | { |
397 | struct posix_acl *acl; | 398 | struct posix_acl *acl; |
398 | int error; | 399 | int error; |
399 | 400 | ||
400 | if (!test_opt(inode->i_sb, POSIX_ACL)) | 401 | if (strcmp(name, "") != 0) |
402 | return -EINVAL; | ||
403 | if (!test_opt(dentry->d_sb, POSIX_ACL)) | ||
401 | return -EOPNOTSUPP; | 404 | return -EOPNOTSUPP; |
402 | 405 | ||
403 | acl = ext3_get_acl(inode, type); | 406 | acl = ext3_get_acl(dentry->d_inode, type); |
404 | if (IS_ERR(acl)) | 407 | if (IS_ERR(acl)) |
405 | return PTR_ERR(acl); | 408 | return PTR_ERR(acl); |
406 | if (acl == NULL) | 409 | if (acl == NULL) |
@@ -412,31 +415,16 @@ ext3_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size) | |||
412 | } | 415 | } |
413 | 416 | ||
414 | static int | 417 | static int |
415 | ext3_xattr_get_acl_access(struct inode *inode, const char *name, | 418 | ext3_xattr_set_acl(struct dentry *dentry, const char *name, const void *value, |
416 | void *buffer, size_t size) | 419 | size_t size, int flags, int type) |
417 | { | ||
418 | if (strcmp(name, "") != 0) | ||
419 | return -EINVAL; | ||
420 | return ext3_xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size); | ||
421 | } | ||
422 | |||
423 | static int | ||
424 | ext3_xattr_get_acl_default(struct inode *inode, const char *name, | ||
425 | void *buffer, size_t size) | ||
426 | { | ||
427 | if (strcmp(name, "") != 0) | ||
428 | return -EINVAL; | ||
429 | return ext3_xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size); | ||
430 | } | ||
431 | |||
432 | static int | ||
433 | ext3_xattr_set_acl(struct inode *inode, int type, const void *value, | ||
434 | size_t size) | ||
435 | { | 420 | { |
421 | struct inode *inode = dentry->d_inode; | ||
436 | handle_t *handle; | 422 | handle_t *handle; |
437 | struct posix_acl *acl; | 423 | struct posix_acl *acl; |
438 | int error, retries = 0; | 424 | int error, retries = 0; |
439 | 425 | ||
426 | if (strcmp(name, "") != 0) | ||
427 | return -EINVAL; | ||
440 | if (!test_opt(inode->i_sb, POSIX_ACL)) | 428 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
441 | return -EOPNOTSUPP; | 429 | return -EOPNOTSUPP; |
442 | if (!is_owner_or_cap(inode)) | 430 | if (!is_owner_or_cap(inode)) |
@@ -468,34 +456,18 @@ release_and_out: | |||
468 | return error; | 456 | return error; |
469 | } | 457 | } |
470 | 458 | ||
471 | static int | ||
472 | ext3_xattr_set_acl_access(struct inode *inode, const char *name, | ||
473 | const void *value, size_t size, int flags) | ||
474 | { | ||
475 | if (strcmp(name, "") != 0) | ||
476 | return -EINVAL; | ||
477 | return ext3_xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size); | ||
478 | } | ||
479 | |||
480 | static int | ||
481 | ext3_xattr_set_acl_default(struct inode *inode, const char *name, | ||
482 | const void *value, size_t size, int flags) | ||
483 | { | ||
484 | if (strcmp(name, "") != 0) | ||
485 | return -EINVAL; | ||
486 | return ext3_xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size); | ||
487 | } | ||
488 | |||
489 | struct xattr_handler ext3_xattr_acl_access_handler = { | 459 | struct xattr_handler ext3_xattr_acl_access_handler = { |
490 | .prefix = POSIX_ACL_XATTR_ACCESS, | 460 | .prefix = POSIX_ACL_XATTR_ACCESS, |
461 | .flags = ACL_TYPE_ACCESS, | ||
491 | .list = ext3_xattr_list_acl_access, | 462 | .list = ext3_xattr_list_acl_access, |
492 | .get = ext3_xattr_get_acl_access, | 463 | .get = ext3_xattr_get_acl, |
493 | .set = ext3_xattr_set_acl_access, | 464 | .set = ext3_xattr_set_acl, |
494 | }; | 465 | }; |
495 | 466 | ||
496 | struct xattr_handler ext3_xattr_acl_default_handler = { | 467 | struct xattr_handler ext3_xattr_acl_default_handler = { |
497 | .prefix = POSIX_ACL_XATTR_DEFAULT, | 468 | .prefix = POSIX_ACL_XATTR_DEFAULT, |
469 | .flags = ACL_TYPE_DEFAULT, | ||
498 | .list = ext3_xattr_list_acl_default, | 470 | .list = ext3_xattr_list_acl_default, |
499 | .get = ext3_xattr_get_acl_default, | 471 | .get = ext3_xattr_get_acl, |
500 | .set = ext3_xattr_set_acl_default, | 472 | .set = ext3_xattr_set_acl, |
501 | }; | 473 | }; |
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index 387d92d00b97..66895ccf76c7 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c | |||
@@ -99,7 +99,7 @@ static struct buffer_head *ext3_xattr_cache_find(struct inode *, | |||
99 | struct mb_cache_entry **); | 99 | struct mb_cache_entry **); |
100 | static void ext3_xattr_rehash(struct ext3_xattr_header *, | 100 | static void ext3_xattr_rehash(struct ext3_xattr_header *, |
101 | struct ext3_xattr_entry *); | 101 | struct ext3_xattr_entry *); |
102 | static int ext3_xattr_list(struct inode *inode, char *buffer, | 102 | static int ext3_xattr_list(struct dentry *dentry, char *buffer, |
103 | size_t buffer_size); | 103 | size_t buffer_size); |
104 | 104 | ||
105 | static struct mb_cache *ext3_xattr_cache; | 105 | static struct mb_cache *ext3_xattr_cache; |
@@ -147,7 +147,7 @@ ext3_xattr_handler(int name_index) | |||
147 | ssize_t | 147 | ssize_t |
148 | ext3_listxattr(struct dentry *dentry, char *buffer, size_t size) | 148 | ext3_listxattr(struct dentry *dentry, char *buffer, size_t size) |
149 | { | 149 | { |
150 | return ext3_xattr_list(dentry->d_inode, buffer, size); | 150 | return ext3_xattr_list(dentry, buffer, size); |
151 | } | 151 | } |
152 | 152 | ||
153 | static int | 153 | static int |
@@ -332,7 +332,7 @@ ext3_xattr_get(struct inode *inode, int name_index, const char *name, | |||
332 | } | 332 | } |
333 | 333 | ||
334 | static int | 334 | static int |
335 | ext3_xattr_list_entries(struct inode *inode, struct ext3_xattr_entry *entry, | 335 | ext3_xattr_list_entries(struct dentry *dentry, struct ext3_xattr_entry *entry, |
336 | char *buffer, size_t buffer_size) | 336 | char *buffer, size_t buffer_size) |
337 | { | 337 | { |
338 | size_t rest = buffer_size; | 338 | size_t rest = buffer_size; |
@@ -342,9 +342,10 @@ ext3_xattr_list_entries(struct inode *inode, struct ext3_xattr_entry *entry, | |||
342 | ext3_xattr_handler(entry->e_name_index); | 342 | ext3_xattr_handler(entry->e_name_index); |
343 | 343 | ||
344 | if (handler) { | 344 | if (handler) { |
345 | size_t size = handler->list(inode, buffer, rest, | 345 | size_t size = handler->list(dentry, buffer, rest, |
346 | entry->e_name, | 346 | entry->e_name, |
347 | entry->e_name_len); | 347 | entry->e_name_len, |
348 | handler->flags); | ||
348 | if (buffer) { | 349 | if (buffer) { |
349 | if (size > rest) | 350 | if (size > rest) |
350 | return -ERANGE; | 351 | return -ERANGE; |
@@ -357,8 +358,9 @@ ext3_xattr_list_entries(struct inode *inode, struct ext3_xattr_entry *entry, | |||
357 | } | 358 | } |
358 | 359 | ||
359 | static int | 360 | static int |
360 | ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size) | 361 | ext3_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size) |
361 | { | 362 | { |
363 | struct inode *inode = dentry->d_inode; | ||
362 | struct buffer_head *bh = NULL; | 364 | struct buffer_head *bh = NULL; |
363 | int error; | 365 | int error; |
364 | 366 | ||
@@ -383,7 +385,7 @@ ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size) | |||
383 | goto cleanup; | 385 | goto cleanup; |
384 | } | 386 | } |
385 | ext3_xattr_cache_insert(bh); | 387 | ext3_xattr_cache_insert(bh); |
386 | error = ext3_xattr_list_entries(inode, BFIRST(bh), buffer, buffer_size); | 388 | error = ext3_xattr_list_entries(dentry, BFIRST(bh), buffer, buffer_size); |
387 | 389 | ||
388 | cleanup: | 390 | cleanup: |
389 | brelse(bh); | 391 | brelse(bh); |
@@ -392,8 +394,9 @@ cleanup: | |||
392 | } | 394 | } |
393 | 395 | ||
394 | static int | 396 | static int |
395 | ext3_xattr_ibody_list(struct inode *inode, char *buffer, size_t buffer_size) | 397 | ext3_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size) |
396 | { | 398 | { |
399 | struct inode *inode = dentry->d_inode; | ||
397 | struct ext3_xattr_ibody_header *header; | 400 | struct ext3_xattr_ibody_header *header; |
398 | struct ext3_inode *raw_inode; | 401 | struct ext3_inode *raw_inode; |
399 | struct ext3_iloc iloc; | 402 | struct ext3_iloc iloc; |
@@ -411,7 +414,7 @@ ext3_xattr_ibody_list(struct inode *inode, char *buffer, size_t buffer_size) | |||
411 | error = ext3_xattr_check_names(IFIRST(header), end); | 414 | error = ext3_xattr_check_names(IFIRST(header), end); |
412 | if (error) | 415 | if (error) |
413 | goto cleanup; | 416 | goto cleanup; |
414 | error = ext3_xattr_list_entries(inode, IFIRST(header), | 417 | error = ext3_xattr_list_entries(dentry, IFIRST(header), |
415 | buffer, buffer_size); | 418 | buffer, buffer_size); |
416 | 419 | ||
417 | cleanup: | 420 | cleanup: |
@@ -430,12 +433,12 @@ cleanup: | |||
430 | * used / required on success. | 433 | * used / required on success. |
431 | */ | 434 | */ |
432 | static int | 435 | static int |
433 | ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size) | 436 | ext3_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size) |
434 | { | 437 | { |
435 | int i_error, b_error; | 438 | int i_error, b_error; |
436 | 439 | ||
437 | down_read(&EXT3_I(inode)->xattr_sem); | 440 | down_read(&EXT3_I(dentry->d_inode)->xattr_sem); |
438 | i_error = ext3_xattr_ibody_list(inode, buffer, buffer_size); | 441 | i_error = ext3_xattr_ibody_list(dentry, buffer, buffer_size); |
439 | if (i_error < 0) { | 442 | if (i_error < 0) { |
440 | b_error = 0; | 443 | b_error = 0; |
441 | } else { | 444 | } else { |
@@ -443,11 +446,11 @@ ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size) | |||
443 | buffer += i_error; | 446 | buffer += i_error; |
444 | buffer_size -= i_error; | 447 | buffer_size -= i_error; |
445 | } | 448 | } |
446 | b_error = ext3_xattr_block_list(inode, buffer, buffer_size); | 449 | b_error = ext3_xattr_block_list(dentry, buffer, buffer_size); |
447 | if (b_error < 0) | 450 | if (b_error < 0) |
448 | i_error = 0; | 451 | i_error = 0; |
449 | } | 452 | } |
450 | up_read(&EXT3_I(inode)->xattr_sem); | 453 | up_read(&EXT3_I(dentry->d_inode)->xattr_sem); |
451 | return i_error + b_error; | 454 | return i_error + b_error; |
452 | } | 455 | } |
453 | 456 | ||
diff --git a/fs/ext3/xattr_security.c b/fs/ext3/xattr_security.c index 37b81097bdf2..474348788dd9 100644 --- a/fs/ext3/xattr_security.c +++ b/fs/ext3/xattr_security.c | |||
@@ -12,8 +12,8 @@ | |||
12 | #include "xattr.h" | 12 | #include "xattr.h" |
13 | 13 | ||
14 | static size_t | 14 | static size_t |
15 | ext3_xattr_security_list(struct inode *inode, char *list, size_t list_size, | 15 | ext3_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, |
16 | const char *name, size_t name_len) | 16 | const char *name, size_t name_len, int type) |
17 | { | 17 | { |
18 | const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN; | 18 | const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN; |
19 | const size_t total_len = prefix_len + name_len + 1; | 19 | const size_t total_len = prefix_len + name_len + 1; |
@@ -28,23 +28,23 @@ ext3_xattr_security_list(struct inode *inode, char *list, size_t list_size, | |||
28 | } | 28 | } |
29 | 29 | ||
30 | static int | 30 | static int |
31 | ext3_xattr_security_get(struct inode *inode, const char *name, | 31 | ext3_xattr_security_get(struct dentry *dentry, const char *name, |
32 | void *buffer, size_t size) | 32 | void *buffer, size_t size, int type) |
33 | { | 33 | { |
34 | if (strcmp(name, "") == 0) | 34 | if (strcmp(name, "") == 0) |
35 | return -EINVAL; | 35 | return -EINVAL; |
36 | return ext3_xattr_get(inode, EXT3_XATTR_INDEX_SECURITY, name, | 36 | return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_SECURITY, |
37 | buffer, size); | 37 | name, buffer, size); |
38 | } | 38 | } |
39 | 39 | ||
40 | static int | 40 | static int |
41 | ext3_xattr_security_set(struct inode *inode, const char *name, | 41 | ext3_xattr_security_set(struct dentry *dentry, const char *name, |
42 | const void *value, size_t size, int flags) | 42 | const void *value, size_t size, int flags, int type) |
43 | { | 43 | { |
44 | if (strcmp(name, "") == 0) | 44 | if (strcmp(name, "") == 0) |
45 | return -EINVAL; | 45 | return -EINVAL; |
46 | return ext3_xattr_set(inode, EXT3_XATTR_INDEX_SECURITY, name, | 46 | return ext3_xattr_set(dentry->d_inode, EXT3_XATTR_INDEX_SECURITY, |
47 | value, size, flags); | 47 | name, value, size, flags); |
48 | } | 48 | } |
49 | 49 | ||
50 | int | 50 | int |
diff --git a/fs/ext3/xattr_trusted.c b/fs/ext3/xattr_trusted.c index c7c41a410c4b..e5562845ed96 100644 --- a/fs/ext3/xattr_trusted.c +++ b/fs/ext3/xattr_trusted.c | |||
@@ -14,8 +14,8 @@ | |||
14 | #include "xattr.h" | 14 | #include "xattr.h" |
15 | 15 | ||
16 | static size_t | 16 | static size_t |
17 | ext3_xattr_trusted_list(struct inode *inode, char *list, size_t list_size, | 17 | ext3_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, |
18 | const char *name, size_t name_len) | 18 | const char *name, size_t name_len, int type) |
19 | { | 19 | { |
20 | const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN; | 20 | const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN; |
21 | const size_t total_len = prefix_len + name_len + 1; | 21 | const size_t total_len = prefix_len + name_len + 1; |
@@ -32,22 +32,22 @@ ext3_xattr_trusted_list(struct inode *inode, char *list, size_t list_size, | |||
32 | } | 32 | } |
33 | 33 | ||
34 | static int | 34 | static int |
35 | ext3_xattr_trusted_get(struct inode *inode, const char *name, | 35 | ext3_xattr_trusted_get(struct dentry *dentry, const char *name, |
36 | void *buffer, size_t size) | 36 | void *buffer, size_t size, int type) |
37 | { | 37 | { |
38 | if (strcmp(name, "") == 0) | 38 | if (strcmp(name, "") == 0) |
39 | return -EINVAL; | 39 | return -EINVAL; |
40 | return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name, | 40 | return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_TRUSTED, |
41 | buffer, size); | 41 | name, buffer, size); |
42 | } | 42 | } |
43 | 43 | ||
44 | static int | 44 | static int |
45 | ext3_xattr_trusted_set(struct inode *inode, const char *name, | 45 | ext3_xattr_trusted_set(struct dentry *dentry, const char *name, |
46 | const void *value, size_t size, int flags) | 46 | const void *value, size_t size, int flags, int type) |
47 | { | 47 | { |
48 | if (strcmp(name, "") == 0) | 48 | if (strcmp(name, "") == 0) |
49 | return -EINVAL; | 49 | return -EINVAL; |
50 | return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name, | 50 | return ext3_xattr_set(dentry->d_inode, EXT3_XATTR_INDEX_TRUSTED, name, |
51 | value, size, flags); | 51 | value, size, flags); |
52 | } | 52 | } |
53 | 53 | ||
diff --git a/fs/ext3/xattr_user.c b/fs/ext3/xattr_user.c index 430fe63b31b3..3bcfe9ee0a68 100644 --- a/fs/ext3/xattr_user.c +++ b/fs/ext3/xattr_user.c | |||
@@ -13,13 +13,13 @@ | |||
13 | #include "xattr.h" | 13 | #include "xattr.h" |
14 | 14 | ||
15 | static size_t | 15 | static size_t |
16 | ext3_xattr_user_list(struct inode *inode, char *list, size_t list_size, | 16 | ext3_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, |
17 | const char *name, size_t name_len) | 17 | const char *name, size_t name_len, int type) |
18 | { | 18 | { |
19 | const size_t prefix_len = XATTR_USER_PREFIX_LEN; | 19 | const size_t prefix_len = XATTR_USER_PREFIX_LEN; |
20 | const size_t total_len = prefix_len + name_len + 1; | 20 | const size_t total_len = prefix_len + name_len + 1; |
21 | 21 | ||
22 | if (!test_opt(inode->i_sb, XATTR_USER)) | 22 | if (!test_opt(dentry->d_sb, XATTR_USER)) |
23 | return 0; | 23 | return 0; |
24 | 24 | ||
25 | if (list && total_len <= list_size) { | 25 | if (list && total_len <= list_size) { |
@@ -31,26 +31,27 @@ ext3_xattr_user_list(struct inode *inode, char *list, size_t list_size, | |||
31 | } | 31 | } |
32 | 32 | ||
33 | static int | 33 | static int |
34 | ext3_xattr_user_get(struct inode *inode, const char *name, | 34 | ext3_xattr_user_get(struct dentry *dentry, const char *name, void *buffer, |
35 | void *buffer, size_t size) | 35 | size_t size, int type) |
36 | { | 36 | { |
37 | if (strcmp(name, "") == 0) | 37 | if (strcmp(name, "") == 0) |
38 | return -EINVAL; | 38 | return -EINVAL; |
39 | if (!test_opt(inode->i_sb, XATTR_USER)) | 39 | if (!test_opt(dentry->d_sb, XATTR_USER)) |
40 | return -EOPNOTSUPP; | 40 | return -EOPNOTSUPP; |
41 | return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER, name, buffer, size); | 41 | return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_USER, |
42 | name, buffer, size); | ||
42 | } | 43 | } |
43 | 44 | ||
44 | static int | 45 | static int |
45 | ext3_xattr_user_set(struct inode *inode, const char *name, | 46 | ext3_xattr_user_set(struct dentry *dentry, const char *name, |
46 | const void *value, size_t size, int flags) | 47 | const void *value, size_t size, int flags, int type) |
47 | { | 48 | { |
48 | if (strcmp(name, "") == 0) | 49 | if (strcmp(name, "") == 0) |
49 | return -EINVAL; | 50 | return -EINVAL; |
50 | if (!test_opt(inode->i_sb, XATTR_USER)) | 51 | if (!test_opt(dentry->d_sb, XATTR_USER)) |
51 | return -EOPNOTSUPP; | 52 | return -EOPNOTSUPP; |
52 | return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name, | 53 | return ext3_xattr_set(dentry->d_inode, EXT3_XATTR_INDEX_USER, |
53 | value, size, flags); | 54 | name, value, size, flags); |
54 | } | 55 | } |
55 | 56 | ||
56 | struct xattr_handler ext3_xattr_user_handler = { | 57 | struct xattr_handler ext3_xattr_user_handler = { |