diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-19 02:04:09 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-19 02:04:09 +0000 |
| commit | f8c11aa65df2af4ab20c0effc42997bbd7357cc3 (patch) | |
| tree | 63e19eb72bae4a6cafd0692f9d947d222ac1eacc | |
| parent | e18a293a5253bd1b793af7d47c2f6a9159c3a12d (diff) | |
| download | busybox-w32-f8c11aa65df2af4ab20c0effc42997bbd7357cc3.tar.gz busybox-w32-f8c11aa65df2af4ab20c0effc42997bbd7357cc3.tar.bz2 busybox-w32-f8c11aa65df2af4ab20c0effc42997bbd7357cc3.zip | |
fsck: dead code removal; also disable progress indicator code
(doesn't look good to me)
| -rw-r--r-- | e2fsprogs/fsck.c | 208 |
1 files changed, 81 insertions, 127 deletions
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index 357f5eb60..8cbfc89fb 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c | |||
| @@ -26,6 +26,17 @@ | |||
| 26 | * %End-Header% | 26 | * %End-Header% |
| 27 | */ | 27 | */ |
| 28 | 28 | ||
| 29 | /* All filesystem specific hooks have been removed. | ||
| 30 | * If filesystem cannot be determined, we will execute | ||
| 31 | * "fsck.auto". Currently this also happens if you specify | ||
| 32 | * UUID=xxx or LABEL=xxx as an object to check. | ||
| 33 | * Detection code for that is also probably has to be in fsck.auto. | ||
| 34 | * | ||
| 35 | * In other words, this is _really_ is just a driver program which | ||
| 36 | * spawns actual fsck.something for each filesystem to check. | ||
| 37 | * It doesn't guess filesystem types from on-disk format. | ||
| 38 | */ | ||
| 39 | |||
| 29 | #include "busybox.h" | 40 | #include "busybox.h" |
| 30 | 41 | ||
| 31 | #define EXIT_OK 0 | 42 | #define EXIT_OK 0 |
| @@ -36,12 +47,8 @@ | |||
| 36 | #define EXIT_USAGE 16 | 47 | #define EXIT_USAGE 16 |
| 37 | #define FSCK_CANCELED 32 /* Aborted with a signal or ^C */ | 48 | #define FSCK_CANCELED 32 /* Aborted with a signal or ^C */ |
| 38 | 49 | ||
| 39 | #ifndef DEFAULT_FSTYPE | ||
| 40 | #define DEFAULT_FSTYPE "ext2" | ||
| 41 | #endif | ||
| 42 | |||
| 43 | /* | 50 | /* |
| 44 | * Internal structure for mount tabel entries. | 51 | * Internal structure for mount table entries. |
| 45 | */ | 52 | */ |
| 46 | 53 | ||
| 47 | struct fs_info { | 54 | struct fs_info { |
| @@ -121,8 +128,16 @@ static smallint skip_root; | |||
| 121 | static smallint notitle; | 128 | static smallint notitle; |
| 122 | static smallint parallel_root; | 129 | static smallint parallel_root; |
| 123 | static smallint force_all_parallel; | 130 | static smallint force_all_parallel; |
| 131 | |||
| 132 | /* "progress indicator" code is somewhat buggy and ext[23] specific. | ||
| 133 | * We should be filesystem agnostic. IOW: there should be a well-defined | ||
| 134 | * API for fsck.something, NOT ad-hoc hacks in generic fsck. */ | ||
| 135 | #define DO_PROGRESS_INDICATOR 0 | ||
| 136 | #if DO_PROGRESS_INDICATOR | ||
| 124 | static smallint progress; | 137 | static smallint progress; |
| 125 | static int progress_fd; | 138 | static int progress_fd; |
| 139 | #endif | ||
| 140 | |||
| 126 | static int num_running; | 141 | static int num_running; |
| 127 | static int max_running; | 142 | static int max_running; |
| 128 | static char *fstype; | 143 | static char *fstype; |
| @@ -333,7 +348,6 @@ static void parse_escape(char *word) | |||
| 333 | 348 | ||
| 334 | static int parse_fstab_line(char *line, struct fs_info **ret_fs) | 349 | static int parse_fstab_line(char *line, struct fs_info **ret_fs) |
| 335 | { | 350 | { |
| 336 | /*char *dev;*/ | ||
| 337 | char *device, *mntpnt, *type, *opts, *freq, *passno, *cp; | 351 | char *device, *mntpnt, *type, *opts, *freq, *passno, *cp; |
| 338 | struct fs_info *fs; | 352 | struct fs_info *fs; |
| 339 | 353 | ||
| @@ -362,40 +376,16 @@ static int parse_fstab_line(char *line, struct fs_info **ret_fs) | |||
| 362 | parse_escape(freq); | 376 | parse_escape(freq); |
| 363 | parse_escape(passno); | 377 | parse_escape(passno); |
| 364 | 378 | ||
| 365 | /* | ||
| 366 | dev = blkid_get_devname(cache, device, NULL); | ||
| 367 | if (dev) | ||
| 368 | device = dev;*/ | ||
| 369 | |||
| 370 | if (strchr(type, ',')) | 379 | if (strchr(type, ',')) |
| 371 | type = NULL; | 380 | type = NULL; |
| 372 | 381 | ||
| 373 | fs = create_fs_device(device, mntpnt, type ? type : "auto", opts, | 382 | fs = create_fs_device(device, mntpnt, type ? type : "auto", opts, |
| 374 | freq ? atoi(freq) : -1, | 383 | freq ? atoi(freq) : -1, |
| 375 | passno ? atoi(passno) : -1); | 384 | passno ? atoi(passno) : -1); |
| 376 | /*if (dev) | ||
| 377 | free(dev);*/ | ||
| 378 | |||
| 379 | *ret_fs = fs; | 385 | *ret_fs = fs; |
| 380 | return 0; | 386 | return 0; |
| 381 | } | 387 | } |
| 382 | 388 | ||
| 383 | #if 0 | ||
| 384 | static void interpret_type(struct fs_info *fs) | ||
| 385 | { | ||
| 386 | char *t; | ||
| 387 | |||
| 388 | if (strcmp(fs->type, "auto") != 0) | ||
| 389 | return; | ||
| 390 | t = blkid_get_tag_value(cache, "TYPE", fs->device); | ||
| 391 | if (t) { | ||
| 392 | free(fs->type); | ||
| 393 | fs->type = t; | ||
| 394 | } | ||
| 395 | } | ||
| 396 | #endif | ||
| 397 | #define interpret_type(fs) ((void)0) | ||
| 398 | |||
| 399 | /* Load the filesystem database from /etc/fstab */ | 389 | /* Load the filesystem database from /etc/fstab */ |
| 400 | static void load_fs_info(const char *filename) | 390 | static void load_fs_info(const char *filename) |
| 401 | { | 391 | { |
| @@ -456,6 +446,7 @@ static struct fs_info *lookup(char *filesys) | |||
| 456 | return fs; | 446 | return fs; |
| 457 | } | 447 | } |
| 458 | 448 | ||
| 449 | #if DO_PROGRESS_INDICATOR | ||
| 459 | static int progress_active(void) | 450 | static int progress_active(void) |
| 460 | { | 451 | { |
| 461 | struct fsck_instance *inst; | 452 | struct fsck_instance *inst; |
| @@ -468,6 +459,8 @@ static int progress_active(void) | |||
| 468 | } | 459 | } |
| 469 | return 0; | 460 | return 0; |
| 470 | } | 461 | } |
| 462 | #endif | ||
| 463 | |||
| 471 | 464 | ||
| 472 | /* | 465 | /* |
| 473 | * Send a signal to all outstanding fsck child processes | 466 | * Send a signal to all outstanding fsck child processes |
| @@ -497,7 +490,7 @@ static struct fsck_instance *wait_one(int flags) | |||
| 497 | { | 490 | { |
| 498 | int status; | 491 | int status; |
| 499 | int sig; | 492 | int sig; |
| 500 | struct fsck_instance *inst, *inst2, *prev; | 493 | struct fsck_instance *inst, *prev; |
| 501 | pid_t pid; | 494 | pid_t pid; |
| 502 | 495 | ||
| 503 | if (!instance_list) | 496 | if (!instance_list) |
| @@ -551,21 +544,23 @@ static struct fsck_instance *wait_one(int flags) | |||
| 551 | status = WEXITSTATUS(status); | 544 | status = WEXITSTATUS(status); |
| 552 | else if (WIFSIGNALED(status)) { | 545 | else if (WIFSIGNALED(status)) { |
| 553 | sig = WTERMSIG(status); | 546 | sig = WTERMSIG(status); |
| 554 | if (sig == SIGINT) { | 547 | status = EXIT_UNCORRECTED; |
| 555 | status = EXIT_UNCORRECTED; | 548 | if (sig != SIGINT) { |
| 556 | } else { | 549 | printf("Warning... %s %s exited " |
| 557 | printf("Warning... %s for device %s exited " | 550 | "with signal %d\n", |
| 558 | "with signal %d.\n", | 551 | inst->prog, inst->device, sig); |
| 559 | inst->prog, inst->device, sig); | ||
| 560 | status = EXIT_ERROR; | 552 | status = EXIT_ERROR; |
| 561 | } | 553 | } |
| 562 | } else { | 554 | } else { |
| 563 | printf("%s %s: status is %x, should never happen.\n", | 555 | printf("%s %s: status is %x, should never happen\n", |
| 564 | inst->prog, inst->device, status); | 556 | inst->prog, inst->device, status); |
| 565 | status = EXIT_ERROR; | 557 | status = EXIT_ERROR; |
| 566 | } | 558 | } |
| 567 | inst->exit_status = status; | 559 | inst->exit_status = status; |
| 560 | |||
| 561 | #if DO_PROGRESS_INDICATOR | ||
| 568 | if (progress && (inst->flags & FLAG_PROGRESS) && !progress_active()) { | 562 | if (progress && (inst->flags & FLAG_PROGRESS) && !progress_active()) { |
| 563 | struct fsck_instance *inst2; | ||
| 569 | for (inst2 = instance_list; inst2; inst2 = inst2->next) { | 564 | for (inst2 = instance_list; inst2; inst2 = inst2->next) { |
| 570 | if (inst2->flags & FLAG_DONE) | 565 | if (inst2->flags & FLAG_DONE) |
| 571 | continue; | 566 | continue; |
| @@ -588,6 +583,8 @@ static struct fsck_instance *wait_one(int flags) | |||
| 588 | break; | 583 | break; |
| 589 | } | 584 | } |
| 590 | } | 585 | } |
| 586 | #endif | ||
| 587 | |||
| 591 | ret_inst: | 588 | ret_inst: |
| 592 | if (prev) | 589 | if (prev) |
| 593 | prev->next = inst->next; | 590 | prev->next = inst->next; |
| @@ -629,13 +626,13 @@ static int wait_many(int flags) | |||
| 629 | * Execute a particular fsck program, and link it into the list of | 626 | * Execute a particular fsck program, and link it into the list of |
| 630 | * child processes we are waiting for. | 627 | * child processes we are waiting for. |
| 631 | */ | 628 | */ |
| 632 | static int execute(const char *type, const char *device, const char *mntpt, | 629 | static void execute(const char *type, const char *device, const char *mntpt, |
| 633 | int interactive) | 630 | int interactive) |
| 634 | { | 631 | { |
| 635 | char *argv[num_args + 4]; /* see count below: */ | 632 | char *argv[num_args + 4]; /* see count below: */ |
| 636 | int argc; | 633 | int argc; |
| 637 | int i; | 634 | int i; |
| 638 | struct fsck_instance *inst, *p; | 635 | struct fsck_instance *inst; |
| 639 | pid_t pid; | 636 | pid_t pid; |
| 640 | 637 | ||
| 641 | inst = xzalloc(sizeof(*inst)); | 638 | inst = xzalloc(sizeof(*inst)); |
| @@ -645,6 +642,7 @@ static int execute(const char *type, const char *device, const char *mntpt, | |||
| 645 | argv[i+1] = args[i]; /* num_args */ | 642 | argv[i+1] = args[i]; /* num_args */ |
| 646 | argc = num_args + 1; | 643 | argc = num_args + 1; |
| 647 | 644 | ||
| 645 | #if DO_PROGRESS_INDICATOR | ||
| 648 | if (progress && !progress_active()) { | 646 | if (progress && !progress_active()) { |
| 649 | if (strcmp(type, "ext2") == 0 | 647 | if (strcmp(type, "ext2") == 0 |
| 650 | || strcmp(type, "ext3") == 0 | 648 | || strcmp(type, "ext3") == 0 |
| @@ -653,6 +651,7 @@ static int execute(const char *type, const char *device, const char *mntpt, | |||
| 653 | inst->flags |= FLAG_PROGRESS; | 651 | inst->flags |= FLAG_PROGRESS; |
| 654 | } | 652 | } |
| 655 | } | 653 | } |
| 654 | #endif | ||
| 656 | 655 | ||
| 657 | argv[argc++] = xstrdup(device); /* 1 */ | 656 | argv[argc++] = xstrdup(device); /* 1 */ |
| 658 | argv[argc] = NULL; /* 1 */ | 657 | argv[argc] = NULL; /* 1 */ |
| @@ -673,8 +672,11 @@ static int execute(const char *type, const char *device, const char *mntpt, | |||
| 673 | bb_perror_msg_and_die("fork"); | 672 | bb_perror_msg_and_die("fork"); |
| 674 | if (pid == 0) { | 673 | if (pid == 0) { |
| 675 | /* Child */ | 674 | /* Child */ |
| 676 | if (!interactive) | 675 | if (!interactive) { |
| 676 | /* NB: e2fsck will complain because of this! | ||
| 677 | * Use "fsck -s" to avoid... */ | ||
| 677 | close(0); | 678 | close(0); |
| 679 | } | ||
| 678 | execvp(argv[0], argv); | 680 | execvp(argv[0], argv); |
| 679 | bb_perror_msg_and_die("%s", argv[0]); | 681 | bb_perror_msg_and_die("%s", argv[0]); |
| 680 | } | 682 | } |
| @@ -689,20 +691,11 @@ static int execute(const char *type, const char *device, const char *mntpt, | |||
| 689 | inst->device = xstrdup(device); | 691 | inst->device = xstrdup(device); |
| 690 | inst->base_device = base_device(device); | 692 | inst->base_device = base_device(device); |
| 691 | inst->start_time = time(NULL); | 693 | inst->start_time = time(NULL); |
| 692 | inst->next = NULL; | ||
| 693 | 694 | ||
| 694 | /* | 695 | /* Add to the list of running fsck's. |
| 695 | * Find the end of the list, so we add the instance on at the end. | 696 | * (was adding to the end, but adding to the front is simpler...) */ |
| 696 | */ | 697 | inst->next = instance_list; |
| 697 | if (!instance_list) { | 698 | instance_list = inst; |
| 698 | instance_list = inst; | ||
| 699 | return 0; | ||
| 700 | } | ||
| 701 | p = instance_list; | ||
| 702 | while (p->next) | ||
| 703 | p = p->next; | ||
| 704 | p->next = inst; | ||
| 705 | return 0; | ||
| 706 | } | 699 | } |
| 707 | 700 | ||
| 708 | /* | 701 | /* |
| @@ -713,33 +706,36 @@ static int execute(const char *type, const char *device, const char *mntpt, | |||
| 713 | * use that type regardless of what is specified in /etc/fstab. | 706 | * use that type regardless of what is specified in /etc/fstab. |
| 714 | * | 707 | * |
| 715 | * If the type isn't specified by the user, then use either the type | 708 | * If the type isn't specified by the user, then use either the type |
| 716 | * specified in /etc/fstab, or DEFAULT_FSTYPE. | 709 | * specified in /etc/fstab, or "auto". |
| 717 | */ | 710 | */ |
| 718 | static void fsck_device(struct fs_info *fs, int interactive) | 711 | static void fsck_device(struct fs_info *fs, int interactive) |
| 719 | { | 712 | { |
| 720 | const char *type; | 713 | const char *type; |
| 721 | int retval; | ||
| 722 | 714 | ||
| 723 | interpret_type(fs); | 715 | if (strcmp(fs->type, "auto") != 0) { |
| 724 | |||
| 725 | type = DEFAULT_FSTYPE; | ||
| 726 | if (strcmp(fs->type, "auto") != 0) | ||
| 727 | type = fs->type; | 716 | type = fs->type; |
| 728 | else if (fstype | 717 | if (verbose > 2) |
| 718 | bb_info_msg("using filesystem type '%s' %s", | ||
| 719 | type, "from fstab"); | ||
| 720 | } else if (fstype | ||
| 729 | && (fstype[0] != 'n' || fstype[1] != 'o') /* != "no" */ | 721 | && (fstype[0] != 'n' || fstype[1] != 'o') /* != "no" */ |
| 730 | && strncmp(fstype, "opts=", 5) != 0 | 722 | && strncmp(fstype, "opts=", 5) != 0 |
| 731 | && strncmp(fstype, "loop", 4) != 0 | 723 | && strncmp(fstype, "loop", 4) != 0 |
| 732 | && !strchr(fstype, ',') | 724 | && !strchr(fstype, ',') |
| 733 | ) | 725 | ) { |
| 734 | type = fstype; | 726 | type = fstype; |
| 727 | if (verbose > 2) | ||
| 728 | bb_info_msg("using filesystem type '%s' %s", | ||
| 729 | type, "from -t"); | ||
| 730 | } else { | ||
| 731 | type = "auto"; | ||
| 732 | if (verbose > 2) | ||
| 733 | bb_info_msg("using filesystem type '%s' %s", | ||
| 734 | type, "(default)"); | ||
| 735 | } | ||
| 735 | 736 | ||
| 736 | num_running++; | 737 | num_running++; |
| 737 | retval = execute(type, fs->device, fs->mountpt, interactive); | 738 | execute(type, fs->device, fs->mountpt, interactive); |
| 738 | if (retval) { | ||
| 739 | bb_error_msg("error %d while executing fsck.%s for %s", | ||
| 740 | retval, type, fs->device); | ||
| 741 | num_running--; | ||
| 742 | } | ||
| 743 | } | 739 | } |
| 744 | 740 | ||
| 745 | /* | 741 | /* |
| @@ -859,8 +855,6 @@ static int ignore(struct fs_info *fs) | |||
| 859 | if (fs->passno == 0) | 855 | if (fs->passno == 0) |
| 860 | return 1; | 856 | return 1; |
| 861 | 857 | ||
| 862 | interpret_type(fs); | ||
| 863 | |||
| 864 | /* | 858 | /* |
| 865 | * If a specific fstype is specified, and it doesn't match, | 859 | * If a specific fstype is specified, and it doesn't match, |
| 866 | * ignore it. | 860 | * ignore it. |
| @@ -871,20 +865,7 @@ static int ignore(struct fs_info *fs) | |||
| 871 | /* Are we ignoring this type? */ | 865 | /* Are we ignoring this type? */ |
| 872 | if (index_in_str_array(ignored_types, fs->type) >= 0) | 866 | if (index_in_str_array(ignored_types, fs->type) >= 0) |
| 873 | return 1; | 867 | return 1; |
| 874 | #if 0 | 868 | |
| 875 | /* Do we really really want to check this fs? */ | ||
| 876 | wanted = index_in_str_array(really_wanted, fs->type) >= 0; | ||
| 877 | |||
| 878 | /* See if the <fsck.fs> program is available. */ | ||
| 879 | s = find_fsck(fs->type); | ||
| 880 | if (s == NULL) { | ||
| 881 | if (wanted) | ||
| 882 | bb_error_msg("cannot check %s: fsck.%s not found", | ||
| 883 | fs->device, fs->type); | ||
| 884 | return 1; | ||
| 885 | } | ||
| 886 | free(s); | ||
| 887 | #endif | ||
| 888 | /* We can and want to check this file system type. */ | 869 | /* We can and want to check this file system type. */ |
| 889 | return 0; | 870 | return 0; |
| 890 | } | 871 | } |
| @@ -1074,54 +1055,32 @@ static void parse_args(int argc, char *argv[]) | |||
| 1074 | int optpos = 0; | 1055 | int optpos = 0; |
| 1075 | int opts_for_fsck = 0; | 1056 | int opts_for_fsck = 0; |
| 1076 | 1057 | ||
| 1077 | /* in bss | 1058 | /* in bss, so already zeroed |
| 1078 | num_devices = 0; | 1059 | num_devices = 0; |
| 1079 | num_args = 0; | 1060 | num_args = 0; |
| 1080 | instance_list = NULL; | 1061 | instance_list = NULL; |
| 1081 | */ | 1062 | */ |
| 1082 | 1063 | ||
| 1083 | /* TODO: getopt32 */ | 1064 | /* TODO: getopt32 */ |
| 1084 | for (i = 1; i < argc; i++) { | 1065 | for (i = 1; i < argc; i++) { |
| 1085 | arg = argv[i]; | 1066 | arg = argv[i]; |
| 1067 | |||
| 1086 | /* "/dev/blk" or "/path" or "UUID=xxx" or "LABEL=xxx" */ | 1068 | /* "/dev/blk" or "/path" or "UUID=xxx" or "LABEL=xxx" */ |
| 1087 | if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) { | 1069 | if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) { |
| 1088 | #if 0 | ||
| 1089 | char *dev; | ||
| 1090 | dev = blkid_get_devname(cache, arg, NULL); | ||
| 1091 | if (!dev && strchr(arg, '=')) { | ||
| 1092 | /* | ||
| 1093 | * Check to see if we failed because | ||
| 1094 | * /proc/partitions isn't found. | ||
| 1095 | */ | ||
| 1096 | if (access("/proc/partitions", R_OK) < 0) { | ||
| 1097 | bb_perror_msg_and_die( | ||
| 1098 | "cannot open /proc/partitions (is /proc mounted?)"); | ||
| 1099 | } | ||
| 1100 | /* | ||
| 1101 | * Check to see if this is because | ||
| 1102 | * we're not running as root | ||
| 1103 | */ | ||
| 1104 | if (geteuid()) | ||
| 1105 | bb_error_msg_and_die( | ||
| 1106 | "must be root to scan for matching filesystems: %s", arg); | ||
| 1107 | else | ||
| 1108 | bb_error_msg_and_die( | ||
| 1109 | "cannot find matching filesystem: %s", arg); | ||
| 1110 | } | ||
| 1111 | devices = xrealloc(devices, (num_devices+1) * sizeof(devices[0])); | ||
| 1112 | devices[num_devices++] = dev ? dev : xstrdup(arg); | ||
| 1113 | #endif | ||
| 1114 | // FIXME: must check that arg is a blkdev, or resolve | 1070 | // FIXME: must check that arg is a blkdev, or resolve |
| 1115 | // "/path", "UUID=xxx" or "LABEL=xxx" into block device name | 1071 | // "/path", "UUID=xxx" or "LABEL=xxx" into block device name |
| 1072 | // ("UUID=xxx"/"LABEL=xxx" can probably shifted to fsck.auto duties) | ||
| 1116 | devices = xrealloc(devices, (num_devices+1) * sizeof(devices[0])); | 1073 | devices = xrealloc(devices, (num_devices+1) * sizeof(devices[0])); |
| 1117 | devices[num_devices++] = xstrdup(arg); | 1074 | devices[num_devices++] = xstrdup(arg); |
| 1118 | continue; | 1075 | continue; |
| 1119 | } | 1076 | } |
| 1077 | |||
| 1120 | if (arg[0] != '-' || opts_for_fsck) { | 1078 | if (arg[0] != '-' || opts_for_fsck) { |
| 1121 | args = xrealloc(args, (num_args+1) * sizeof(args[0])); | 1079 | args = xrealloc(args, (num_args+1) * sizeof(args[0])); |
| 1122 | args[num_args++] = xstrdup(arg); | 1080 | args[num_args++] = xstrdup(arg); |
| 1123 | continue; | 1081 | continue; |
| 1124 | } | 1082 | } |
| 1083 | |||
| 1125 | for (j = 1; arg[j]; j++) { | 1084 | for (j = 1; arg[j]; j++) { |
| 1126 | if (opts_for_fsck) { | 1085 | if (opts_for_fsck) { |
| 1127 | optpos++; | 1086 | optpos++; |
| @@ -1134,6 +1093,7 @@ static void parse_args(int argc, char *argv[]) | |||
| 1134 | case 'A': | 1093 | case 'A': |
| 1135 | doall = 1; | 1094 | doall = 1; |
| 1136 | break; | 1095 | break; |
| 1096 | #if DO_PROGRESS_INDICATOR | ||
| 1137 | case 'C': | 1097 | case 'C': |
| 1138 | progress = 1; | 1098 | progress = 1; |
| 1139 | if (arg[++j]) { /* -Cn */ | 1099 | if (arg[++j]) { /* -Cn */ |
| @@ -1143,6 +1103,7 @@ static void parse_args(int argc, char *argv[]) | |||
| 1143 | /* -C n */ | 1103 | /* -C n */ |
| 1144 | progress_fd = xatoi_u(argv[++i]); | 1104 | progress_fd = xatoi_u(argv[++i]); |
| 1145 | goto next_arg; | 1105 | goto next_arg; |
| 1106 | #endif | ||
| 1146 | case 'V': | 1107 | case 'V': |
| 1147 | verbose++; | 1108 | verbose++; |
| 1148 | break; | 1109 | break; |
| @@ -1215,24 +1176,18 @@ static void signal_cancel(int sig ATTRIBUTE_UNUSED) | |||
| 1215 | int fsck_main(int argc, char *argv[]) | 1176 | int fsck_main(int argc, char *argv[]) |
| 1216 | { | 1177 | { |
| 1217 | int i, status = 0; | 1178 | int i, status = 0; |
| 1218 | int interactive = 0; | 1179 | int interactive; |
| 1219 | const char *fstab; | 1180 | const char *fstab; |
| 1220 | struct fs_info *fs; | 1181 | struct fs_info *fs; |
| 1221 | struct sigaction sa; | 1182 | struct sigaction sa; |
| 1222 | 1183 | ||
| 1223 | /* | ||
| 1224 | * Set up signal action | ||
| 1225 | */ | ||
| 1226 | memset(&sa, 0, sizeof(sa)); | 1184 | memset(&sa, 0, sizeof(sa)); |
| 1227 | sa.sa_handler = signal_cancel; | 1185 | sa.sa_handler = signal_cancel; |
| 1228 | sigaction(SIGINT, &sa, 0); | 1186 | sigaction(SIGINT, &sa, 0); |
| 1229 | sigaction(SIGTERM, &sa, 0); | 1187 | sigaction(SIGTERM, &sa, 0); |
| 1230 | 1188 | ||
| 1231 | setbuf(stdout, NULL); | 1189 | setbuf(stdout, NULL); |
| 1232 | /*setvbuf(stdout, NULL, _IONBF, BUFSIZ);*/ | ||
| 1233 | /*setvbuf(stderr, NULL, _IONBF, BUFSIZ);*/ | ||
| 1234 | 1190 | ||
| 1235 | /*blkid_get_cache(&cache, NULL);*/ | ||
| 1236 | parse_args(argc, argv); | 1191 | parse_args(argc, argv); |
| 1237 | 1192 | ||
| 1238 | if (!notitle) | 1193 | if (!notitle) |
| @@ -1245,8 +1200,7 @@ int fsck_main(int argc, char *argv[]) | |||
| 1245 | fstab = "/etc/fstab"; | 1200 | fstab = "/etc/fstab"; |
| 1246 | load_fs_info(fstab); | 1201 | load_fs_info(fstab); |
| 1247 | 1202 | ||
| 1248 | if (num_devices == 1 || serialize) | 1203 | interactive = (num_devices == 1) | serialize; |
| 1249 | interactive = 1; | ||
| 1250 | 1204 | ||
| 1251 | /* If -A was specified ("check all"), do that! */ | 1205 | /* If -A was specified ("check all"), do that! */ |
| 1252 | if (doall) | 1206 | if (doall) |
| @@ -1263,11 +1217,12 @@ int fsck_main(int argc, char *argv[]) | |||
| 1263 | kill_all_if_cancel_requested(); | 1217 | kill_all_if_cancel_requested(); |
| 1264 | break; | 1218 | break; |
| 1265 | } | 1219 | } |
| 1220 | |||
| 1266 | fs = lookup(devices[i]); | 1221 | fs = lookup(devices[i]); |
| 1267 | if (!fs) { | 1222 | if (!fs) |
| 1268 | fs = create_fs_device(devices[i], 0, "auto", 0, -1, -1); | 1223 | fs = create_fs_device(devices[i], 0, "auto", 0, -1, -1); |
| 1269 | } | ||
| 1270 | fsck_device(fs, interactive); | 1224 | fsck_device(fs, interactive); |
| 1225 | |||
| 1271 | if (serialize | 1226 | if (serialize |
| 1272 | || (max_running && (num_running >= max_running)) | 1227 | || (max_running && (num_running >= max_running)) |
| 1273 | ) { | 1228 | ) { |
| @@ -1283,6 +1238,5 @@ int fsck_main(int argc, char *argv[]) | |||
| 1283 | } | 1238 | } |
| 1284 | } | 1239 | } |
| 1285 | status |= wait_many(FLAG_WAIT_ALL); | 1240 | status |= wait_many(FLAG_WAIT_ALL); |
| 1286 | /*blkid_put_cache(cache);*/ | ||
| 1287 | return status; | 1241 | return status; |
| 1288 | } | 1242 | } |
