-.\" $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.
.\" (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
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
-/* $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 $ */
/*
#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;
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 *[]);
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
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;
vfstype = optarg;
break;
+ case 'N':
+ filter = NET_FILTER;
+ break;
+
case '?':
default:
usage();
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;
*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)