aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsck
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2009-01-30 18:33:05 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2009-01-30 18:33:05 +0000
commit111a52201c666af03357391624dc12e8e47b09ec (patch)
tree65f596e651497e62a137531d7771a73ad6ee6ac8 /sbin/fsck
parent74f13fb3b6d70ab628f671d7566e8d4bc47da2e7 (diff)
downloadsrc-111a52201c666af03357391624dc12e8e47b09ec.tar.gz
src-111a52201c666af03357391624dc12e8e47b09ec.zip
Add the '-C' "check clean" flag. If the FS is marked clean, skip file
system checking. However, if the file system is not clean, perform a full fsck. Reviewed by: delphij Obtained from: Juniper Networks
Notes
Notes: svn path=/head/; revision=187931
Diffstat (limited to 'sbin/fsck')
-rw-r--r--sbin/fsck/fsck.89
-rw-r--r--sbin/fsck/fsck.c7
-rw-r--r--sbin/fsck/fsutil.h1
3 files changed, 13 insertions, 4 deletions
diff --git a/sbin/fsck/fsck.8 b/sbin/fsck/fsck.8
index b7360d9bd8c0..a4f6d4b0cca1 100644
--- a/sbin/fsck/fsck.8
+++ b/sbin/fsck/fsck.8
@@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 25, 2001
+.Dd January 25, 2009
.Dt FSCK 8
.Os
.Sh NAME
@@ -37,7 +37,7 @@
.Nd file system consistency check and interactive repair
.Sh SYNOPSIS
.Nm
-.Op Fl dfnpvy
+.Op Fl Cdfnpvy
.Op Fl B | F
.Op Fl T Ar fstype : Ns Ar fsoptions
.Op Fl t Ar fstype
@@ -112,6 +112,11 @@ to be the partition and slice designators.
.Pp
The options are as follows:
.Bl -tag -width indent
+.It Fl C
+Check if the
+.Dq clean
+flag is set in the superblock and skip file system checks if file system was
+properly dismounted and marked clean.
.It Fl d
Debugging mode.
Just print the commands without executing them.
diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c
index 490a29af919a..13eb9f06e067 100644
--- a/sbin/fsck/fsck.c
+++ b/sbin/fsck/fsck.c
@@ -103,7 +103,7 @@ main(int argc, char *argv[])
TAILQ_INIT(&selhead);
TAILQ_INIT(&opthead);
- while ((i = getopt(argc, argv, "BdvpfFnyl:t:T:")) != -1)
+ while ((i = getopt(argc, argv, "BCdvpfFnyl:t:T:")) != -1)
switch (i) {
case 'B':
if (flags & CHECK_BACKGRD)
@@ -128,6 +128,9 @@ main(int argc, char *argv[])
case 'p':
flags |= CHECK_PREEN;
/*FALLTHROUGH*/
+ case 'C':
+ flags |= CHECK_CLEAN;
+ /*FALLTHROUGH*/
case 'n':
case 'y':
globopt[1] = i;
@@ -566,7 +569,7 @@ static void
usage(void)
{
static const char common[] =
- "[-dfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]";
+ "[-Cdfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]";
(void)fprintf(stderr, "usage: %s %s [special | node] ...\n",
getprogname(), common);
diff --git a/sbin/fsck/fsutil.h b/sbin/fsck/fsutil.h
index 84e72909592d..657668ede4ce 100644
--- a/sbin/fsck/fsutil.h
+++ b/sbin/fsck/fsutil.h
@@ -48,6 +48,7 @@ char *estrdup(const char *);
#define CHECK_DEBUG 0x0004
#define CHECK_BACKGRD 0x0008
#define DO_BACKGRD 0x0010
+#define CHECK_CLEAN 0x0020
struct fstab;
int checkfstab(int, int (*)(struct fstab *),