exFAT file system checker.
Free exFAT implementation.
- Copyright (C) 2011-2017 Andrew Nayenko
+ Copyright (C) 2011-2018 Andrew Nayenko
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
exfat_put_node(ef, parent);
return;
}
- while ((node = exfat_readdir(ef, &it)))
+ while ((node = exfat_readdir(&it)))
{
exfat_get_name(node, entry_path + path_length + 1);
exfat_debug("%s: %s, %"PRIu64" bytes, cluster %u", entry_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)
switch (opt)
{
case 'V':
- puts("Copyright (C) 2011-2017 Andrew Nayenko");
+ puts("Copyright (C) 2011-2018 Andrew Nayenko");
return 0;
default:
usage(argv[0]);
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.");