summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/fsck/fsck.813
-rw-r--r--sbin/fsck/fsck.c42
2 files changed, 48 insertions, 7 deletions
diff --git a/sbin/fsck/fsck.8 b/sbin/fsck/fsck.8
index 4e98e4b5839..b94b2e0ec0f 100644
--- a/sbin/fsck/fsck.8
+++ b/sbin/fsck/fsck.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: fsck.8,v 1.32 2013/02/11 17:35:46 jmc Exp $
+.\" $OpenBSD: fsck.8,v 1.33 2014/07/13 12:03:48 claudio Exp $
.\" $NetBSD: fsck.8,v 1.14 1996/10/03 20:08:29 christos Exp $
.\"
.\" Copyright (c) 1996 Christos Zoulas. All rights reserved.
@@ -28,7 +28,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: February 11 2013 $
+.Dd $Mdocdate: July 13 2014 $
.Dt FSCK 8
.Os
.Sh NAME
@@ -100,6 +100,15 @@ By default, the limit is the number of
disks, running one process per disk.
If a smaller limit is given,
the disks are checked round-robin, one file system at a time.
+.It Fl N
+When using
+.Xr fstab 5 ,
+only check filesystems that have the
+.Ar net
+mount option set.
+By default file systems with the
+.Dq net
+option are ignored.
.It Fl n
Assume a
.Dq no
diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c
index ed02336d9ce..9b7366ef325 100644
--- a/sbin/fsck/fsck.c
+++ b/sbin/fsck/fsck.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsck.c,v 1.28 2010/11/17 11:22:42 jsing Exp $ */
+/* $OpenBSD: fsck.c,v 1.29 2014/07/13 12:03:48 claudio Exp $ */
/* $NetBSD: fsck.c,v 1.7 1996/10/03 20:06:30 christos Exp $ */
/*
@@ -55,6 +55,7 @@
#include "fsutil.h"
static enum { IN_LIST, NOT_IN_LIST } which = NOT_IN_LIST;
+static enum { NONET_FILTER, NET_FILTER } filter = NONET_FILTER;
TAILQ_HEAD(fstypelist, entry) opthead, selhead;
@@ -64,9 +65,9 @@ struct entry {
TAILQ_ENTRY(entry) entries;
};
-static int maxrun = 0;
-static char *options = NULL;
-static int flags = 0;
+static int maxrun;
+static char *options;
+static int flags;
int main(int, char *[]);
@@ -80,6 +81,7 @@ static char *catopt(char *, const char *, int);
static void mangle(char *, int *, const char ***, int *);
static void usage(void);
static void *isok(struct fstab *);
+static int hasopt(const char *, const char *);
int
@@ -108,7 +110,7 @@ main(int argc, char *argv[])
TAILQ_INIT(&selhead);
TAILQ_INIT(&opthead);
- while ((i = getopt(argc, argv, "dvpfnyb:l:T:t:")) != -1)
+ while ((i = getopt(argc, argv, "b:dfl:nNpT:t:vy")) != -1)
switch (i) {
case 'd':
flags |= CHECK_DEBUG;
@@ -152,6 +154,10 @@ main(int argc, char *argv[])
vfstype = optarg;
break;
+ case 'N':
+ filter = NET_FILTER;
+ break;
+
case '?':
default:
usage();
@@ -207,6 +213,16 @@ isok(struct fstab *fs)
if (BADTYPE(fs->fs_type))
return NULL;
+ switch (filter) {
+ case NET_FILTER:
+ if (!hasopt(fs->fs_mntops, "net"))
+ return NULL;
+ break;
+ case NONET_FILTER:
+ if (hasopt(fs->fs_mntops, "net"))
+ return NULL;
+ break;
+ }
if (!selected(fs->fs_vfstype))
return NULL;
@@ -463,6 +479,22 @@ mangle(char *opts, int *argcp, const char ***argvp, int *maxargcp)
*maxargcp = maxargc;
}
+static int
+hasopt(const char *mntopts, const char *option)
+{
+ int found;
+ char *opt, *optbuf;
+
+ if (mntopts == NULL)
+ return (0);
+ optbuf = strdup(mntopts);
+ found = 0;
+ for (opt = optbuf; !found && opt != NULL; strsep(&opt, ","))
+ found = !strncmp(opt, option, strlen(option));
+ free(optbuf);
+ return (found);
+}
+
static void
usage(void)