Changeset View
Changeset View
Standalone View
Standalone View
sbin/fsck_ffs/main.c
Show First 20 Lines • Show All 266 Lines • ▼ Show 20 Lines | else | ||||
filesys = blockcheck(filesys); | filesys = blockcheck(filesys); | ||||
/* | /* | ||||
* If -F flag specified, check to see whether a background check | * If -F flag specified, check to see whether a background check | ||||
* is possible and needed. If possible and needed, exit with | * is possible and needed. If possible and needed, exit with | ||||
* status zero. Otherwise exit with status non-zero. A non-zero | * status zero. Otherwise exit with status non-zero. A non-zero | ||||
* exit status will cause a foreground check to be run. | * exit status will cause a foreground check to be run. | ||||
*/ | */ | ||||
sblock_init(); | sblock_init(); | ||||
bufinit(); | |||||
if (bkgrdcheck) { | if (bkgrdcheck) { | ||||
if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0) | if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0) | ||||
exit(3); /* Cannot read superblock */ | exit(3); /* Cannot read superblock */ | ||||
close(fsreadfd); | close(fsreadfd); | ||||
/* Earlier background failed or journaled */ | /* Earlier background failed or journaled */ | ||||
if (sblock.fs_flags & (FS_NEEDSFSCK | FS_SUJ)) | if (sblock.fs_flags & (FS_NEEDSFSCK | FS_SUJ)) | ||||
exit(4); | exit(4); | ||||
if ((sblock.fs_flags & FS_DOSOFTDEP) == 0) | if ((sblock.fs_flags & FS_DOSOFTDEP) == 0) | ||||
Show All 21 Lines | if (ckclean && skipclean) { | ||||
if ((sblock.fs_flags & FS_GJOURNAL) != 0) { | if ((sblock.fs_flags & FS_GJOURNAL) != 0) { | ||||
//printf("GJournaled file system detected on %s.\n", | //printf("GJournaled file system detected on %s.\n", | ||||
// filesys); | // filesys); | ||||
if (sblock.fs_clean == 1) { | if (sblock.fs_clean == 1) { | ||||
pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n"); | pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n"); | ||||
exit(0); | exit(0); | ||||
} | } | ||||
if ((sblock.fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) == 0) { | if ((sblock.fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) == 0) { | ||||
bufinit(); | |||||
gjournal_check(filesys); | gjournal_check(filesys); | ||||
if (chkdoreload(mntp) == 0) | if (chkdoreload(mntp) == 0) | ||||
exit(0); | exit(0); | ||||
exit(4); | exit(4); | ||||
} else { | } else { | ||||
pfatal( | pfatal( | ||||
"UNEXPECTED INCONSISTENCY, CANNOT RUN FAST FSCK\n"); | "UNEXPECTED INCONSISTENCY, CANNOT RUN FAST FSCK\n"); | ||||
close(fsreadfd); | close(fsreadfd); | ||||
▲ Show 20 Lines • Show All 434 Lines • Show Last 20 Lines |