diff options
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 7ce44a7b88a2..93fa64dd1be6 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include "xfs_trans_space.h" | 49 | #include "xfs_trans_space.h" |
50 | #include "xfs_acl.h" | 50 | #include "xfs_acl.h" |
51 | #include "xfs_rw.h" | 51 | #include "xfs_rw.h" |
52 | #include "xfs_vnodeops.h" | ||
52 | 53 | ||
53 | /* | 54 | /* |
54 | * xfs_attr.c | 55 | * xfs_attr.c |
@@ -156,10 +157,14 @@ xfs_attr_fetch(xfs_inode_t *ip, const char *name, int namelen, | |||
156 | } | 157 | } |
157 | 158 | ||
158 | int | 159 | int |
159 | xfs_attr_get(bhv_desc_t *bdp, const char *name, char *value, int *valuelenp, | 160 | xfs_attr_get( |
160 | int flags, struct cred *cred) | 161 | xfs_inode_t *ip, |
162 | const char *name, | ||
163 | char *value, | ||
164 | int *valuelenp, | ||
165 | int flags, | ||
166 | cred_t *cred) | ||
161 | { | 167 | { |
162 | xfs_inode_t *ip = XFS_BHVTOI(bdp); | ||
163 | int error, namelen; | 168 | int error, namelen; |
164 | 169 | ||
165 | XFS_STATS_INC(xs_attr_get); | 170 | XFS_STATS_INC(xs_attr_get); |
@@ -417,10 +422,13 @@ out: | |||
417 | } | 422 | } |
418 | 423 | ||
419 | int | 424 | int |
420 | xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int flags, | 425 | xfs_attr_set( |
421 | struct cred *cred) | 426 | xfs_inode_t *dp, |
427 | const char *name, | ||
428 | char *value, | ||
429 | int valuelen, | ||
430 | int flags) | ||
422 | { | 431 | { |
423 | xfs_inode_t *dp; | ||
424 | int namelen; | 432 | int namelen; |
425 | 433 | ||
426 | namelen = strlen(name); | 434 | namelen = strlen(name); |
@@ -429,7 +437,6 @@ xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int f | |||
429 | 437 | ||
430 | XFS_STATS_INC(xs_attr_set); | 438 | XFS_STATS_INC(xs_attr_set); |
431 | 439 | ||
432 | dp = XFS_BHVTOI(bdp); | ||
433 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) | 440 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) |
434 | return (EIO); | 441 | return (EIO); |
435 | 442 | ||
@@ -563,10 +570,12 @@ out: | |||
563 | } | 570 | } |
564 | 571 | ||
565 | int | 572 | int |
566 | xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred) | 573 | xfs_attr_remove( |
574 | xfs_inode_t *dp, | ||
575 | const char *name, | ||
576 | int flags) | ||
567 | { | 577 | { |
568 | xfs_inode_t *dp; | 578 | int namelen; |
569 | int namelen; | ||
570 | 579 | ||
571 | namelen = strlen(name); | 580 | namelen = strlen(name); |
572 | if (namelen >= MAXNAMELEN) | 581 | if (namelen >= MAXNAMELEN) |
@@ -574,7 +583,6 @@ xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred) | |||
574 | 583 | ||
575 | XFS_STATS_INC(xs_attr_remove); | 584 | XFS_STATS_INC(xs_attr_remove); |
576 | 585 | ||
577 | dp = XFS_BHVTOI(bdp); | ||
578 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) | 586 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) |
579 | return (EIO); | 587 | return (EIO); |
580 | 588 | ||
@@ -702,11 +710,14 @@ xfs_attr_kern_list_sizes(xfs_attr_list_context_t *context, attrnames_t *namesp, | |||
702 | * success. | 710 | * success. |
703 | */ | 711 | */ |
704 | int | 712 | int |
705 | xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags, | 713 | xfs_attr_list( |
706 | attrlist_cursor_kern_t *cursor, struct cred *cred) | 714 | xfs_inode_t *dp, |
715 | char *buffer, | ||
716 | int bufsize, | ||
717 | int flags, | ||
718 | attrlist_cursor_kern_t *cursor) | ||
707 | { | 719 | { |
708 | xfs_attr_list_context_t context; | 720 | xfs_attr_list_context_t context; |
709 | xfs_inode_t *dp; | ||
710 | int error; | 721 | int error; |
711 | 722 | ||
712 | XFS_STATS_INC(xs_attr_list); | 723 | XFS_STATS_INC(xs_attr_list); |
@@ -731,7 +742,7 @@ xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags, | |||
731 | /* | 742 | /* |
732 | * Initialize the output buffer. | 743 | * Initialize the output buffer. |
733 | */ | 744 | */ |
734 | context.dp = dp = XFS_BHVTOI(bdp); | 745 | context.dp = dp; |
735 | context.cursor = cursor; | 746 | context.cursor = cursor; |
736 | context.count = 0; | 747 | context.count = 0; |
737 | context.dupcnt = 0; | 748 | context.dupcnt = 0; |
@@ -2502,7 +2513,7 @@ STATIC int | |||
2502 | attr_generic_set( | 2513 | attr_generic_set( |
2503 | bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags) | 2514 | bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags) |
2504 | { | 2515 | { |
2505 | return -bhv_vop_attr_set(vp, name, data, size, xflags, NULL); | 2516 | return -xfs_attr_set(xfs_vtoi(vp), name, data, size, xflags); |
2506 | } | 2517 | } |
2507 | 2518 | ||
2508 | STATIC int | 2519 | STATIC int |
@@ -2511,7 +2522,8 @@ attr_generic_get( | |||
2511 | { | 2522 | { |
2512 | int error, asize = size; | 2523 | int error, asize = size; |
2513 | 2524 | ||
2514 | error = bhv_vop_attr_get(vp, name, data, &asize, xflags, NULL); | 2525 | error = xfs_attr_get(xfs_vtoi(vp), name, data, |
2526 | &asize, xflags, NULL); | ||
2515 | if (!error) | 2527 | if (!error) |
2516 | return asize; | 2528 | return asize; |
2517 | return -error; | 2529 | return -error; |
@@ -2521,7 +2533,7 @@ STATIC int | |||
2521 | attr_generic_remove( | 2533 | attr_generic_remove( |
2522 | bhv_vnode_t *vp, char *name, int xflags) | 2534 | bhv_vnode_t *vp, char *name, int xflags) |
2523 | { | 2535 | { |
2524 | return -bhv_vop_attr_remove(vp, name, xflags, NULL); | 2536 | return -xfs_attr_remove(xfs_vtoi(vp), name, xflags); |
2525 | } | 2537 | } |
2526 | 2538 | ||
2527 | STATIC int | 2539 | STATIC int |
@@ -2576,7 +2588,7 @@ attr_generic_list( | |||
2576 | attrlist_cursor_kern_t cursor = { 0 }; | 2588 | attrlist_cursor_kern_t cursor = { 0 }; |
2577 | int error; | 2589 | int error; |
2578 | 2590 | ||
2579 | error = bhv_vop_attr_list(vp, data, size, xflags, &cursor, NULL); | 2591 | error = xfs_attr_list(xfs_vtoi(vp), data, size, xflags, &cursor); |
2580 | if (error > 0) | 2592 | if (error > 0) |
2581 | return -error; | 2593 | return -error; |
2582 | *result = -error; | 2594 | *result = -error; |