diff options
author | relan <relan@users.noreply.github.com> | 2017-03-11 09:40:51 +0300 |
---|---|---|
committer | relan <relan@users.noreply.github.com> | 2018-09-15 07:51:17 +0300 |
commit | 1596df976fec93aa051edf63617bfddaf7e16c28 (patch) | |
tree | b1dfec09075042b6798d6cdf3b9a0bbe6e9d1768 | |
parent | eb68016c5442cbab4887d435ac4819be61001ff7 (diff) | |
download | android_external_exfat-1596df976fec93aa051edf63617bfddaf7e16c28.tar.gz android_external_exfat-1596df976fec93aa051edf63617bfddaf7e16c28.tar.bz2 android_external_exfat-1596df976fec93aa051edf63617bfddaf7e16c28.zip |
Repairing: prepare fsck.
-rw-r--r-- | fsck/main.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/fsck/main.c b/fsck/main.c index 1eb4c1e..89508d1 100644 --- a/fsck/main.c +++ b/fsck/main.c @@ -121,10 +121,21 @@ static void dirck(struct exfat* ef, const char* path) free(entry_path); } -static void fsck(struct exfat* ef) +static void fsck(struct exfat* ef, const char* spec, const char* options) { + if (exfat_mount(ef, spec, options) != 0) + { + fputs("File system checking stopped. ", stdout); + return; + } + exfat_print_info(ef->sb, exfat_count_free_clusters(ef)); dirck(ef, ""); + exfat_unmount(ef); + + printf("Totally %"PRIu64" directories and %"PRIu64" files.\n", + directories_count, files_count); + fputs("File system checking finished. ", stdout); } static void usage(const char* prog) @@ -157,19 +168,12 @@ int main(int argc, char* argv[]) usage(argv[0]); spec = argv[optind]; - if (exfat_mount(&ef, spec, "ro") != 0) - return 1; - printf("Checking file system on %s.\n", spec); - fsck(&ef); - exfat_unmount(&ef); - printf("Totally %"PRIu64" directories and %"PRIu64" files.\n", - directories_count, files_count); - - fputs("File system checking finished. ", stdout); + fsck(&ef, spec, "ro"); if (exfat_errors != 0) { - printf("ERRORS FOUND: %d.\n", exfat_errors); + printf("ERRORS FOUND: %d, FIXED: %d.\n", + exfat_errors, exfat_errors_fixed); return 1; } puts("No errors found."); |