3 * jiofsck - A journal checker and recovery tool for libjio
4 * Alberto Bertogli (albertogli@telpin.com.ar)
14 printf("Use: jiofsck [clean] FILE\n\n");
15 printf("Where \"FILE\" is the name of the file "
16 "which you want to check the journal from,\n"
17 "and the optional parameter \"clean\" makes "
18 "jiofsck to clean up the journal after\n"
22 int main(int argc
, char **argv
)
26 struct jfsck_result res
;
28 if (argc
!= 2 && argc
!= 3) {
34 if (strcmp("clean", argv
[1]) != 0 ) {
45 memset(&res
, 0, sizeof(res
));
47 printf("Checking journal: ");
49 rv
= jfsck(file
, &res
);
52 printf("No such file or directory\n");
54 } else if (rv
== J_ENOJOURNAL
) {
55 printf("No journal associated to the file, "
56 "or journal empty\n");
63 printf("Cleaning journal: ");
65 if (!jfsck_cleanup(file
)) {
66 printf("Error cleaning journal\n");
73 printf("Journal checking results\n");
74 printf("------------------------\n\n");
76 printf("Total:\t\t %d\n", res
.total
);
77 printf("Invalid:\t %d\n", res
.invalid
);
78 printf("In progress:\t %d\n", res
.in_progress
);
79 printf("Broken head:\t %d\n", res
.broken_head
);
80 printf("Broken body:\t %d\n", res
.broken_body
);
81 printf("Load error:\t %d\n", res
.load_error
);
82 printf("Corrupt:\t %d\n", res
.corrupt
);
83 printf("Apply error:\t %d\n", res
.apply_error
);
84 printf("Reapplied:\t %d\n", res
.reapplied
);
88 printf("You can now safely remove the journal directory "
89 "completely\nto start a new journal.\n");
91 printf("The journal has been checked and cleaned up.\n");