clang-format
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
#include "passes.h"
|
||||
#include "main.h"
|
||||
|
||||
static int badness=0;
|
||||
static int badness = 0;
|
||||
|
||||
/*
|
||||
* Update the badness state. (codes are in main.h)
|
||||
@@ -50,69 +50,65 @@ static int badness=0;
|
||||
* The badness state only gets worse, and is ultimately the process
|
||||
* exit code.
|
||||
*/
|
||||
void
|
||||
setbadness(int code)
|
||||
{
|
||||
if (badness < code) {
|
||||
badness = code;
|
||||
}
|
||||
void setbadness(int code) {
|
||||
if (badness < code) {
|
||||
badness = code;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Main.
|
||||
*/
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int main(int argc, char **argv) {
|
||||
#ifdef HOST
|
||||
hostcompat_init(argc, argv);
|
||||
hostcompat_init(argc, argv);
|
||||
#endif
|
||||
|
||||
/* FUTURE: add -n option */
|
||||
if (argc!=2) {
|
||||
errx(EXIT_USAGE, "Usage: sfsck device/diskfile");
|
||||
}
|
||||
/* FUTURE: add -n option */
|
||||
if (argc != 2) {
|
||||
errx(EXIT_USAGE, "Usage: sfsck device/diskfile");
|
||||
}
|
||||
|
||||
opendisk(argv[1]);
|
||||
opendisk(argv[1]);
|
||||
|
||||
sfs_setup();
|
||||
sb_load();
|
||||
sb_check();
|
||||
freemap_setup();
|
||||
sfs_setup();
|
||||
sb_load();
|
||||
sb_check();
|
||||
freemap_setup();
|
||||
|
||||
printf("Phase 1 -- check blocks and sizes\n");
|
||||
pass1();
|
||||
freemap_check();
|
||||
printf("Phase 1 -- check blocks and sizes\n");
|
||||
pass1();
|
||||
freemap_check();
|
||||
|
||||
printf("Phase 2 -- check directory tree\n");
|
||||
inode_sorttable();
|
||||
pass2();
|
||||
printf("Phase 2 -- check directory tree\n");
|
||||
inode_sorttable();
|
||||
pass2();
|
||||
|
||||
printf("Phase 3 -- check reference counts\n");
|
||||
inode_adjust_filelinks();
|
||||
printf("Phase 3 -- check reference counts\n");
|
||||
inode_adjust_filelinks();
|
||||
|
||||
closedisk();
|
||||
closedisk();
|
||||
|
||||
warnx("%lu blocks used (of %lu); %lu directories; %lu files",
|
||||
freemap_blocksused(), (unsigned long)sb_totalblocks(),
|
||||
pass1_founddirs(), pass1_foundfiles());
|
||||
warnx("%lu blocks used (of %lu); %lu directories; %lu files",
|
||||
freemap_blocksused(), (unsigned long)sb_totalblocks(),
|
||||
pass1_founddirs(), pass1_foundfiles());
|
||||
|
||||
switch (badness) {
|
||||
case EXIT_USAGE:
|
||||
case EXIT_FATAL:
|
||||
default:
|
||||
/* not supposed to happen here */
|
||||
assert(0);
|
||||
break;
|
||||
case EXIT_UNRECOV:
|
||||
warnx("WARNING - unrecoverable errors. Maybe try again?");
|
||||
break;
|
||||
case EXIT_RECOV:
|
||||
warnx("Caution - filesystem modified. Run again for luck.");
|
||||
break;
|
||||
case EXIT_CLEAN:
|
||||
break;
|
||||
}
|
||||
switch (badness) {
|
||||
case EXIT_USAGE:
|
||||
case EXIT_FATAL:
|
||||
default:
|
||||
/* not supposed to happen here */
|
||||
assert(0);
|
||||
break;
|
||||
case EXIT_UNRECOV:
|
||||
warnx("WARNING - unrecoverable errors. Maybe try again?");
|
||||
break;
|
||||
case EXIT_RECOV:
|
||||
warnx("Caution - filesystem modified. Run again for luck.");
|
||||
break;
|
||||
case EXIT_CLEAN:
|
||||
break;
|
||||
}
|
||||
|
||||
return badness;
|
||||
return badness;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user