Changeset View
Changeset View
Standalone View
Standalone View
sbin/fsck_ffs/main.c
Show First 20 Lines • Show All 289 Lines • ▼ Show 20 Lines | if (bkgrdcheck) { | ||||
exit(0); | exit(0); | ||||
} | } | ||||
if (ckclean && skipclean) { | if (ckclean && skipclean) { | ||||
/* | /* | ||||
* If file system is gjournaled, check it here. | * If file system is gjournaled, check it here. | ||||
*/ | */ | ||||
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 */ | ||||
if (nflag || (fswritefd = open(filesys, O_WRONLY)) < 0) { | if (bkgrdflag == 0 && | ||||
(nflag || (fswritefd = open(filesys, O_WRONLY)) < 0)) { | |||||
fswritefd = -1; | fswritefd = -1; | ||||
if (preen) | if (preen) | ||||
pfatal("NO WRITE ACCESS"); | pfatal("NO WRITE ACCESS"); | ||||
printf(" (NO WRITE)"); | printf(" (NO WRITE)"); | ||||
} | } | ||||
if ((sblock.fs_flags & FS_GJOURNAL) != 0) { | if ((sblock.fs_flags & FS_GJOURNAL) != 0) { | ||||
//printf("GJournaled file system detected on %s.\n", | |||||
// 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(); | 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(fswritefd); | |||||
} | } | ||||
} | } | ||||
close(fsreadfd); | |||||
close(fswritefd); | |||||
} | } | ||||
/* | /* | ||||
* If we are to do a background check: | * If we are to do a background check: | ||||
* Get the mount point information of the file system | * Get the mount point information of the file system | ||||
* create snapshot file | * create snapshot file | ||||
* return created snapshot file | * return created snapshot file | ||||
* if not found, clear bkgrdflag and proceed with normal fsck | * if not found, clear bkgrdflag and proceed with normal fsck | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 425 Lines • Show Last 20 Lines |