diff options
author | Nathan Scott <nathans@sgi.com> | 2006-06-19 23:04:51 -0400 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2006-06-19 23:04:51 -0400 |
commit | f6c2d1fa6310a71b1c2e05fc6d9ff9b91489fa0e (patch) | |
tree | 8541585188bfb903fc5198ea349122bf52d8ec96 /fs/xfs/xfs_rename.c | |
parent | da2f4d679c8070ba5b6a920281e495917b293aa0 (diff) |
[XFS] Remove version 1 directory code. Never functioned on Linux, just
pure bloat.
SGI-PV: 952969
SGI-Modid: xfs-linux-melb:xfs-kern:26251a
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_rename.c')
-rw-r--r-- | fs/xfs/xfs_rename.c | 54 |
1 files changed, 19 insertions, 35 deletions
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c index 7d5f9b6ffdb8..d98171deaa1c 100644 --- a/fs/xfs/xfs_rename.c +++ b/fs/xfs/xfs_rename.c | |||
@@ -22,13 +22,11 @@ | |||
22 | #include "xfs_inum.h" | 22 | #include "xfs_inum.h" |
23 | #include "xfs_trans.h" | 23 | #include "xfs_trans.h" |
24 | #include "xfs_sb.h" | 24 | #include "xfs_sb.h" |
25 | #include "xfs_dir.h" | ||
26 | #include "xfs_dir2.h" | 25 | #include "xfs_dir2.h" |
27 | #include "xfs_dmapi.h" | 26 | #include "xfs_dmapi.h" |
28 | #include "xfs_mount.h" | 27 | #include "xfs_mount.h" |
29 | #include "xfs_da_btree.h" | 28 | #include "xfs_da_btree.h" |
30 | #include "xfs_bmap_btree.h" | 29 | #include "xfs_bmap_btree.h" |
31 | #include "xfs_dir_sf.h" | ||
32 | #include "xfs_dir2_sf.h" | 30 | #include "xfs_dir2_sf.h" |
33 | #include "xfs_attr_sf.h" | 31 | #include "xfs_attr_sf.h" |
34 | #include "xfs_dinode.h" | 32 | #include "xfs_dinode.h" |
@@ -40,7 +38,6 @@ | |||
40 | #include "xfs_refcache.h" | 38 | #include "xfs_refcache.h" |
41 | #include "xfs_utils.h" | 39 | #include "xfs_utils.h" |
42 | #include "xfs_trans_space.h" | 40 | #include "xfs_trans_space.h" |
43 | #include "xfs_dir_leaf.h" | ||
44 | 41 | ||
45 | 42 | ||
46 | /* | 43 | /* |
@@ -398,34 +395,29 @@ xfs_rename( | |||
398 | * fit before actually inserting it. | 395 | * fit before actually inserting it. |
399 | */ | 396 | */ |
400 | if (spaceres == 0 && | 397 | if (spaceres == 0 && |
401 | (error = XFS_DIR_CANENTER(mp, tp, target_dp, target_name, | 398 | (error = xfs_dir_canenter(tp, target_dp, target_name, |
402 | target_namelen))) { | 399 | target_namelen))) |
403 | goto error_return; | 400 | goto error_return; |
404 | } | ||
405 | /* | 401 | /* |
406 | * If target does not exist and the rename crosses | 402 | * If target does not exist and the rename crosses |
407 | * directories, adjust the target directory link count | 403 | * directories, adjust the target directory link count |
408 | * to account for the ".." reference from the new entry. | 404 | * to account for the ".." reference from the new entry. |
409 | */ | 405 | */ |
410 | error = XFS_DIR_CREATENAME(mp, tp, target_dp, target_name, | 406 | error = xfs_dir_createname(tp, target_dp, target_name, |
411 | target_namelen, src_ip->i_ino, | 407 | target_namelen, src_ip->i_ino, |
412 | &first_block, &free_list, spaceres); | 408 | &first_block, &free_list, spaceres); |
413 | if (error == ENOSPC) { | 409 | if (error == ENOSPC) |
414 | goto error_return; | 410 | goto error_return; |
415 | } | 411 | if (error) |
416 | if (error) { | ||
417 | goto abort_return; | 412 | goto abort_return; |
418 | } | ||
419 | xfs_ichgtime(target_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 413 | xfs_ichgtime(target_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
420 | 414 | ||
421 | if (new_parent && src_is_directory) { | 415 | if (new_parent && src_is_directory) { |
422 | error = xfs_bumplink(tp, target_dp); | 416 | error = xfs_bumplink(tp, target_dp); |
423 | if (error) { | 417 | if (error) |
424 | goto abort_return; | 418 | goto abort_return; |
425 | } | ||
426 | } | 419 | } |
427 | } else { /* target_ip != NULL */ | 420 | } else { /* target_ip != NULL */ |
428 | |||
429 | /* | 421 | /* |
430 | * If target exists and it's a directory, check that both | 422 | * If target exists and it's a directory, check that both |
431 | * target and source are directories and that target can be | 423 | * target and source are directories and that target can be |
@@ -435,7 +427,7 @@ xfs_rename( | |||
435 | /* | 427 | /* |
436 | * Make sure target dir is empty. | 428 | * Make sure target dir is empty. |
437 | */ | 429 | */ |
438 | if (!(XFS_DIR_ISEMPTY(target_ip->i_mount, target_ip)) || | 430 | if (!(xfs_dir_isempty(target_ip)) || |
439 | (target_ip->i_d.di_nlink > 2)) { | 431 | (target_ip->i_d.di_nlink > 2)) { |
440 | error = XFS_ERROR(EEXIST); | 432 | error = XFS_ERROR(EEXIST); |
441 | goto error_return; | 433 | goto error_return; |
@@ -451,12 +443,11 @@ xfs_rename( | |||
451 | * In case there is already an entry with the same | 443 | * In case there is already an entry with the same |
452 | * name at the destination directory, remove it first. | 444 | * name at the destination directory, remove it first. |
453 | */ | 445 | */ |
454 | error = XFS_DIR_REPLACE(mp, tp, target_dp, target_name, | 446 | error = xfs_dir_replace(tp, target_dp, target_name, |
455 | target_namelen, src_ip->i_ino, &first_block, | 447 | target_namelen, src_ip->i_ino, |
456 | &free_list, spaceres); | 448 | &first_block, &free_list, spaceres); |
457 | if (error) { | 449 | if (error) |
458 | goto abort_return; | 450 | goto abort_return; |
459 | } | ||
460 | xfs_ichgtime(target_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 451 | xfs_ichgtime(target_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
461 | 452 | ||
462 | /* | 453 | /* |
@@ -464,9 +455,8 @@ xfs_rename( | |||
464 | * dir no longer points to it. | 455 | * dir no longer points to it. |
465 | */ | 456 | */ |
466 | error = xfs_droplink(tp, target_ip); | 457 | error = xfs_droplink(tp, target_ip); |
467 | if (error) { | 458 | if (error) |
468 | goto abort_return; | 459 | goto abort_return; |
469 | } | ||
470 | target_ip_dropped = 1; | 460 | target_ip_dropped = 1; |
471 | 461 | ||
472 | if (src_is_directory) { | 462 | if (src_is_directory) { |
@@ -474,9 +464,8 @@ xfs_rename( | |||
474 | * Drop the link from the old "." entry. | 464 | * Drop the link from the old "." entry. |
475 | */ | 465 | */ |
476 | error = xfs_droplink(tp, target_ip); | 466 | error = xfs_droplink(tp, target_ip); |
477 | if (error) { | 467 | if (error) |
478 | goto abort_return; | 468 | goto abort_return; |
479 | } | ||
480 | } | 469 | } |
481 | 470 | ||
482 | /* Do this test while we still hold the locks */ | 471 | /* Do this test while we still hold the locks */ |
@@ -488,18 +477,15 @@ xfs_rename( | |||
488 | * Remove the source. | 477 | * Remove the source. |
489 | */ | 478 | */ |
490 | if (new_parent && src_is_directory) { | 479 | if (new_parent && src_is_directory) { |
491 | |||
492 | /* | 480 | /* |
493 | * Rewrite the ".." entry to point to the new | 481 | * Rewrite the ".." entry to point to the new |
494 | * directory. | 482 | * directory. |
495 | */ | 483 | */ |
496 | error = XFS_DIR_REPLACE(mp, tp, src_ip, "..", 2, | 484 | error = xfs_dir_replace(tp, src_ip, "..", 2, target_dp->i_ino, |
497 | target_dp->i_ino, &first_block, | 485 | &first_block, &free_list, spaceres); |
498 | &free_list, spaceres); | ||
499 | ASSERT(error != EEXIST); | 486 | ASSERT(error != EEXIST); |
500 | if (error) { | 487 | if (error) |
501 | goto abort_return; | 488 | goto abort_return; |
502 | } | ||
503 | xfs_ichgtime(src_ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 489 | xfs_ichgtime(src_ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
504 | 490 | ||
505 | } else { | 491 | } else { |
@@ -527,16 +513,14 @@ xfs_rename( | |||
527 | * entry that's moved no longer points to it. | 513 | * entry that's moved no longer points to it. |
528 | */ | 514 | */ |
529 | error = xfs_droplink(tp, src_dp); | 515 | error = xfs_droplink(tp, src_dp); |
530 | if (error) { | 516 | if (error) |
531 | goto abort_return; | 517 | goto abort_return; |
532 | } | ||
533 | } | 518 | } |
534 | 519 | ||
535 | error = XFS_DIR_REMOVENAME(mp, tp, src_dp, src_name, src_namelen, | 520 | error = xfs_dir_removename(tp, src_dp, src_name, src_namelen, |
536 | src_ip->i_ino, &first_block, &free_list, spaceres); | 521 | src_ip->i_ino, &first_block, &free_list, spaceres); |
537 | if (error) { | 522 | if (error) |
538 | goto abort_return; | 523 | goto abort_return; |
539 | } | ||
540 | xfs_ichgtime(src_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 524 | xfs_ichgtime(src_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
541 | 525 | ||
542 | /* | 526 | /* |