diff options
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 66 |
1 files changed, 30 insertions, 36 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index b6e1e02bbb28..1a2101043275 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include "xfs_trans.h" | 27 | #include "xfs_trans.h" |
28 | #include "xfs_sb.h" | 28 | #include "xfs_sb.h" |
29 | #include "xfs_ag.h" | 29 | #include "xfs_ag.h" |
30 | #include "xfs_dir.h" | ||
31 | #include "xfs_dir2.h" | 30 | #include "xfs_dir2.h" |
32 | #include "xfs_dmapi.h" | 31 | #include "xfs_dmapi.h" |
33 | #include "xfs_mount.h" | 32 | #include "xfs_mount.h" |
@@ -35,7 +34,6 @@ | |||
35 | #include "xfs_bmap_btree.h" | 34 | #include "xfs_bmap_btree.h" |
36 | #include "xfs_alloc_btree.h" | 35 | #include "xfs_alloc_btree.h" |
37 | #include "xfs_ialloc_btree.h" | 36 | #include "xfs_ialloc_btree.h" |
38 | #include "xfs_dir_sf.h" | ||
39 | #include "xfs_dir2_sf.h" | 37 | #include "xfs_dir2_sf.h" |
40 | #include "xfs_attr_sf.h" | 38 | #include "xfs_attr_sf.h" |
41 | #include "xfs_dinode.h" | 39 | #include "xfs_dinode.h" |
@@ -1910,7 +1908,7 @@ xfs_attr_rmtval_get(xfs_da_args_t *args) | |||
1910 | error = xfs_bmapi(args->trans, args->dp, (xfs_fileoff_t)lblkno, | 1908 | error = xfs_bmapi(args->trans, args->dp, (xfs_fileoff_t)lblkno, |
1911 | args->rmtblkcnt, | 1909 | args->rmtblkcnt, |
1912 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, | 1910 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, |
1913 | NULL, 0, map, &nmap, NULL); | 1911 | NULL, 0, map, &nmap, NULL, NULL); |
1914 | if (error) | 1912 | if (error) |
1915 | return(error); | 1913 | return(error); |
1916 | ASSERT(nmap >= 1); | 1914 | ASSERT(nmap >= 1); |
@@ -1988,7 +1986,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
1988 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA | | 1986 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA | |
1989 | XFS_BMAPI_WRITE, | 1987 | XFS_BMAPI_WRITE, |
1990 | args->firstblock, args->total, &map, &nmap, | 1988 | args->firstblock, args->total, &map, &nmap, |
1991 | args->flist); | 1989 | args->flist, NULL); |
1992 | if (!error) { | 1990 | if (!error) { |
1993 | error = xfs_bmap_finish(&args->trans, args->flist, | 1991 | error = xfs_bmap_finish(&args->trans, args->flist, |
1994 | *args->firstblock, &committed); | 1992 | *args->firstblock, &committed); |
@@ -2039,7 +2037,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2039 | error = xfs_bmapi(NULL, dp, (xfs_fileoff_t)lblkno, | 2037 | error = xfs_bmapi(NULL, dp, (xfs_fileoff_t)lblkno, |
2040 | args->rmtblkcnt, | 2038 | args->rmtblkcnt, |
2041 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, | 2039 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, |
2042 | args->firstblock, 0, &map, &nmap, NULL); | 2040 | args->firstblock, 0, &map, &nmap, |
2041 | NULL, NULL); | ||
2043 | if (error) { | 2042 | if (error) { |
2044 | return(error); | 2043 | return(error); |
2045 | } | 2044 | } |
@@ -2104,7 +2103,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) | |||
2104 | args->rmtblkcnt, | 2103 | args->rmtblkcnt, |
2105 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, | 2104 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, |
2106 | args->firstblock, 0, &map, &nmap, | 2105 | args->firstblock, 0, &map, &nmap, |
2107 | args->flist); | 2106 | args->flist, NULL); |
2108 | if (error) { | 2107 | if (error) { |
2109 | return(error); | 2108 | return(error); |
2110 | } | 2109 | } |
@@ -2142,7 +2141,8 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) | |||
2142 | XFS_BMAP_INIT(args->flist, args->firstblock); | 2141 | XFS_BMAP_INIT(args->flist, args->firstblock); |
2143 | error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt, | 2142 | error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt, |
2144 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, | 2143 | XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, |
2145 | 1, args->firstblock, args->flist, &done); | 2144 | 1, args->firstblock, args->flist, |
2145 | NULL, &done); | ||
2146 | if (!error) { | 2146 | if (!error) { |
2147 | error = xfs_bmap_finish(&args->trans, args->flist, | 2147 | error = xfs_bmap_finish(&args->trans, args->flist, |
2148 | *args->firstblock, &committed); | 2148 | *args->firstblock, &committed); |
@@ -2322,56 +2322,56 @@ xfs_attr_trace_enter(int type, char *where, | |||
2322 | 2322 | ||
2323 | STATIC int | 2323 | STATIC int |
2324 | posix_acl_access_set( | 2324 | posix_acl_access_set( |
2325 | vnode_t *vp, char *name, void *data, size_t size, int xflags) | 2325 | bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags) |
2326 | { | 2326 | { |
2327 | return xfs_acl_vset(vp, data, size, _ACL_TYPE_ACCESS); | 2327 | return xfs_acl_vset(vp, data, size, _ACL_TYPE_ACCESS); |
2328 | } | 2328 | } |
2329 | 2329 | ||
2330 | STATIC int | 2330 | STATIC int |
2331 | posix_acl_access_remove( | 2331 | posix_acl_access_remove( |
2332 | struct vnode *vp, char *name, int xflags) | 2332 | bhv_vnode_t *vp, char *name, int xflags) |
2333 | { | 2333 | { |
2334 | return xfs_acl_vremove(vp, _ACL_TYPE_ACCESS); | 2334 | return xfs_acl_vremove(vp, _ACL_TYPE_ACCESS); |
2335 | } | 2335 | } |
2336 | 2336 | ||
2337 | STATIC int | 2337 | STATIC int |
2338 | posix_acl_access_get( | 2338 | posix_acl_access_get( |
2339 | vnode_t *vp, char *name, void *data, size_t size, int xflags) | 2339 | bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags) |
2340 | { | 2340 | { |
2341 | return xfs_acl_vget(vp, data, size, _ACL_TYPE_ACCESS); | 2341 | return xfs_acl_vget(vp, data, size, _ACL_TYPE_ACCESS); |
2342 | } | 2342 | } |
2343 | 2343 | ||
2344 | STATIC int | 2344 | STATIC int |
2345 | posix_acl_access_exists( | 2345 | posix_acl_access_exists( |
2346 | vnode_t *vp) | 2346 | bhv_vnode_t *vp) |
2347 | { | 2347 | { |
2348 | return xfs_acl_vhasacl_access(vp); | 2348 | return xfs_acl_vhasacl_access(vp); |
2349 | } | 2349 | } |
2350 | 2350 | ||
2351 | STATIC int | 2351 | STATIC int |
2352 | posix_acl_default_set( | 2352 | posix_acl_default_set( |
2353 | vnode_t *vp, char *name, void *data, size_t size, int xflags) | 2353 | bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags) |
2354 | { | 2354 | { |
2355 | return xfs_acl_vset(vp, data, size, _ACL_TYPE_DEFAULT); | 2355 | return xfs_acl_vset(vp, data, size, _ACL_TYPE_DEFAULT); |
2356 | } | 2356 | } |
2357 | 2357 | ||
2358 | STATIC int | 2358 | STATIC int |
2359 | posix_acl_default_get( | 2359 | posix_acl_default_get( |
2360 | vnode_t *vp, char *name, void *data, size_t size, int xflags) | 2360 | bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags) |
2361 | { | 2361 | { |
2362 | return xfs_acl_vget(vp, data, size, _ACL_TYPE_DEFAULT); | 2362 | return xfs_acl_vget(vp, data, size, _ACL_TYPE_DEFAULT); |
2363 | } | 2363 | } |
2364 | 2364 | ||
2365 | STATIC int | 2365 | STATIC int |
2366 | posix_acl_default_remove( | 2366 | posix_acl_default_remove( |
2367 | struct vnode *vp, char *name, int xflags) | 2367 | bhv_vnode_t *vp, char *name, int xflags) |
2368 | { | 2368 | { |
2369 | return xfs_acl_vremove(vp, _ACL_TYPE_DEFAULT); | 2369 | return xfs_acl_vremove(vp, _ACL_TYPE_DEFAULT); |
2370 | } | 2370 | } |
2371 | 2371 | ||
2372 | STATIC int | 2372 | STATIC int |
2373 | posix_acl_default_exists( | 2373 | posix_acl_default_exists( |
2374 | vnode_t *vp) | 2374 | bhv_vnode_t *vp) |
2375 | { | 2375 | { |
2376 | return xfs_acl_vhasacl_default(vp); | 2376 | return xfs_acl_vhasacl_default(vp); |
2377 | } | 2377 | } |
@@ -2404,21 +2404,18 @@ STATIC struct attrnames *attr_system_names[] = | |||
2404 | 2404 | ||
2405 | STATIC int | 2405 | STATIC int |
2406 | attr_generic_set( | 2406 | attr_generic_set( |
2407 | struct vnode *vp, char *name, void *data, size_t size, int xflags) | 2407 | bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags) |
2408 | { | 2408 | { |
2409 | int error; | 2409 | return -bhv_vop_attr_set(vp, name, data, size, xflags, NULL); |
2410 | |||
2411 | VOP_ATTR_SET(vp, name, data, size, xflags, NULL, error); | ||
2412 | return -error; | ||
2413 | } | 2410 | } |
2414 | 2411 | ||
2415 | STATIC int | 2412 | STATIC int |
2416 | attr_generic_get( | 2413 | attr_generic_get( |
2417 | struct vnode *vp, char *name, void *data, size_t size, int xflags) | 2414 | bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags) |
2418 | { | 2415 | { |
2419 | int error, asize = size; | 2416 | int error, asize = size; |
2420 | 2417 | ||
2421 | VOP_ATTR_GET(vp, name, data, &asize, xflags, NULL, error); | 2418 | error = bhv_vop_attr_get(vp, name, data, &asize, xflags, NULL); |
2422 | if (!error) | 2419 | if (!error) |
2423 | return asize; | 2420 | return asize; |
2424 | return -error; | 2421 | return -error; |
@@ -2426,12 +2423,9 @@ attr_generic_get( | |||
2426 | 2423 | ||
2427 | STATIC int | 2424 | STATIC int |
2428 | attr_generic_remove( | 2425 | attr_generic_remove( |
2429 | struct vnode *vp, char *name, int xflags) | 2426 | bhv_vnode_t *vp, char *name, int xflags) |
2430 | { | 2427 | { |
2431 | int error; | 2428 | return -bhv_vop_attr_remove(vp, name, xflags, NULL); |
2432 | |||
2433 | VOP_ATTR_REMOVE(vp, name, xflags, NULL, error); | ||
2434 | return -error; | ||
2435 | } | 2429 | } |
2436 | 2430 | ||
2437 | STATIC int | 2431 | STATIC int |
@@ -2459,7 +2453,7 @@ attr_generic_listadd( | |||
2459 | 2453 | ||
2460 | STATIC int | 2454 | STATIC int |
2461 | attr_system_list( | 2455 | attr_system_list( |
2462 | struct vnode *vp, | 2456 | bhv_vnode_t *vp, |
2463 | void *data, | 2457 | void *data, |
2464 | size_t size, | 2458 | size_t size, |
2465 | ssize_t *result) | 2459 | ssize_t *result) |
@@ -2481,12 +2475,12 @@ attr_system_list( | |||
2481 | 2475 | ||
2482 | int | 2476 | int |
2483 | attr_generic_list( | 2477 | attr_generic_list( |
2484 | struct vnode *vp, void *data, size_t size, int xflags, ssize_t *result) | 2478 | bhv_vnode_t *vp, void *data, size_t size, int xflags, ssize_t *result) |
2485 | { | 2479 | { |
2486 | attrlist_cursor_kern_t cursor = { 0 }; | 2480 | attrlist_cursor_kern_t cursor = { 0 }; |
2487 | int error; | 2481 | int error; |
2488 | 2482 | ||
2489 | VOP_ATTR_LIST(vp, data, size, xflags, &cursor, NULL, error); | 2483 | error = bhv_vop_attr_list(vp, data, size, xflags, &cursor, NULL); |
2490 | if (error > 0) | 2484 | if (error > 0) |
2491 | return -error; | 2485 | return -error; |
2492 | *result = -error; | 2486 | *result = -error; |
@@ -2514,7 +2508,7 @@ attr_lookup_namespace( | |||
2514 | */ | 2508 | */ |
2515 | STATIC int | 2509 | STATIC int |
2516 | attr_user_capable( | 2510 | attr_user_capable( |
2517 | struct vnode *vp, | 2511 | bhv_vnode_t *vp, |
2518 | cred_t *cred) | 2512 | cred_t *cred) |
2519 | { | 2513 | { |
2520 | struct inode *inode = vn_to_inode(vp); | 2514 | struct inode *inode = vn_to_inode(vp); |
@@ -2532,7 +2526,7 @@ attr_user_capable( | |||
2532 | 2526 | ||
2533 | STATIC int | 2527 | STATIC int |
2534 | attr_trusted_capable( | 2528 | attr_trusted_capable( |
2535 | struct vnode *vp, | 2529 | bhv_vnode_t *vp, |
2536 | cred_t *cred) | 2530 | cred_t *cred) |
2537 | { | 2531 | { |
2538 | struct inode *inode = vn_to_inode(vp); | 2532 | struct inode *inode = vn_to_inode(vp); |
@@ -2546,7 +2540,7 @@ attr_trusted_capable( | |||
2546 | 2540 | ||
2547 | STATIC int | 2541 | STATIC int |
2548 | attr_secure_capable( | 2542 | attr_secure_capable( |
2549 | struct vnode *vp, | 2543 | bhv_vnode_t *vp, |
2550 | cred_t *cred) | 2544 | cred_t *cred) |
2551 | { | 2545 | { |
2552 | return -ENOSECURITY; | 2546 | return -ENOSECURITY; |
@@ -2554,7 +2548,7 @@ attr_secure_capable( | |||
2554 | 2548 | ||
2555 | STATIC int | 2549 | STATIC int |
2556 | attr_system_set( | 2550 | attr_system_set( |
2557 | struct vnode *vp, char *name, void *data, size_t size, int xflags) | 2551 | bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags) |
2558 | { | 2552 | { |
2559 | attrnames_t *namesp; | 2553 | attrnames_t *namesp; |
2560 | int error; | 2554 | int error; |
@@ -2573,7 +2567,7 @@ attr_system_set( | |||
2573 | 2567 | ||
2574 | STATIC int | 2568 | STATIC int |
2575 | attr_system_get( | 2569 | attr_system_get( |
2576 | struct vnode *vp, char *name, void *data, size_t size, int xflags) | 2570 | bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags) |
2577 | { | 2571 | { |
2578 | attrnames_t *namesp; | 2572 | attrnames_t *namesp; |
2579 | 2573 | ||
@@ -2585,7 +2579,7 @@ attr_system_get( | |||
2585 | 2579 | ||
2586 | STATIC int | 2580 | STATIC int |
2587 | attr_system_remove( | 2581 | attr_system_remove( |
2588 | struct vnode *vp, char *name, int xflags) | 2582 | bhv_vnode_t *vp, char *name, int xflags) |
2589 | { | 2583 | { |
2590 | attrnames_t *namesp; | 2584 | attrnames_t *namesp; |
2591 | 2585 | ||