Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/fsck Add -x <mountpoint> ``exclude'' option.
details: https://anonhg.NetBSD.org/src/rev/7c1e7701bee2
branches: trunk
changeset: 752173:7c1e7701bee2
user: christos <christos%NetBSD.org@localhost>
date: Wed Feb 17 23:30:21 2010 +0000
description:
Add -x <mountpoint> ``exclude'' option.
diffstat:
sbin/fsck/fsck.8 | 11 +++++++++--
sbin/fsck/fsck.c | 33 ++++++++++++++++++++++++++++-----
2 files changed, 37 insertions(+), 7 deletions(-)
diffs (136 lines):
diff -r e4f351ac30a0 -r 7c1e7701bee2 sbin/fsck/fsck.8
--- a/sbin/fsck/fsck.8 Wed Feb 17 22:04:14 2010 +0000
+++ b/sbin/fsck/fsck.8 Wed Feb 17 23:30:21 2010 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: fsck.8,v 1.35 2009/10/21 01:07:46 snj Exp $
+.\" $NetBSD: fsck.8,v 1.36 2010/02/17 23:30:21 christos Exp $
.\"
.\" Copyright (c) 1996 Christos Zoulas. All rights reserved.
.\"
@@ -22,7 +22,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 February 23, 2008
+.Dd February 17, 2010
.Dt FSCK 8
.Os
.Sh NAME
@@ -34,6 +34,7 @@
.Op Fl l Ar maxparallel
.Op Fl T Ar fstype:fsoptions
.Op Fl t Ar fstype
+.Op Fl x Ar mountpoint
.Op special | node ...
.Sh DESCRIPTION
The
@@ -111,6 +112,12 @@
for the file system types that are not specified in the list.
.It Fl v
Print the commands before executing them.
+.It Fl x Ar mountpoint
+Exclude the filesystem which has a
+.Ar mountpoint
+the same as in
+.Pa /etc/fstab .
+Used only in ``preen'' mode.
.It Fl y
Causes
.Nm
diff -r e4f351ac30a0 -r 7c1e7701bee2 sbin/fsck/fsck.c
--- a/sbin/fsck/fsck.c Wed Feb 17 22:04:14 2010 +0000
+++ b/sbin/fsck/fsck.c Wed Feb 17 23:30:21 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fsck.c,v 1.47 2008/02/23 21:41:47 christos Exp $ */
+/* $NetBSD: fsck.c,v 1.48 2010/02/17 23:30:21 christos Exp $ */
/*
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fsck.c,v 1.47 2008/02/23 21:41:47 christos Exp $");
+__RCSID("$NetBSD: fsck.c,v 1.48 2010/02/17 23:30:21 christos Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -67,7 +67,7 @@
static enum { IN_LIST, NOT_IN_LIST } which = NOT_IN_LIST;
-TAILQ_HEAD(fstypelist, entry) opthead, selhead;
+TAILQ_HEAD(fstypelist, entry) opthead, selhead, omhead;
struct entry {
char *type;
@@ -81,6 +81,7 @@
static int checkfs(const char *, const char *, const char *, void *, pid_t *);
static int selected(const char *);
+static int omitted(const char *);
static void addoption(char *);
static const char *getoptions(const char *);
static void addentry(struct fstypelist *, const char *, const char *);
@@ -105,8 +106,9 @@
TAILQ_INIT(&selhead);
TAILQ_INIT(&opthead);
+ TAILQ_INIT(&omhead);
- while ((i = getopt(argc, argv, "dfl:nPpqT:t:vy")) != -1) {
+ while ((i = getopt(argc, argv, "dfl:nPpqT:t:vx:y")) != -1) {
switch (i) {
case 'd':
flags |= CHECK_DEBUG;
@@ -152,6 +154,10 @@
flags |= CHECK_VERBOSE;
continue;
+ case 'x':
+ addentry(&omhead, optarg, "");
+ break;
+
case 'y':
break;
@@ -236,6 +242,9 @@
if (!selected(fs->fs_vfstype))
return NULL;
+ if (omitted(fs->fs_file))
+ return NULL;
+
return fs;
}
@@ -391,6 +400,20 @@
}
+static int
+omitted(const char *mountedon)
+{
+ struct entry *e;
+
+ /* If no type specified, it's always selected. */
+ TAILQ_FOREACH(e, &omhead, entries)
+ if (!strcmp(e->type, mountedon))
+ return 1;
+
+ return 0;
+}
+
+
static const char *
getoptions(const char *type)
{
@@ -558,7 +581,7 @@
usage(void)
{
static const char common[] =
- "[-dfnPpqvy] [-l maxparallel] [-T fstype:fsoptions]\n\t\t[-t fstype]";
+ "[-dfnPpqvy] [-x excludemount] [-l maxparallel] [-T fstype:fsoptions]\n\t\t[-t fstype]";
(void)fprintf(stderr, "usage: %s %s [special|node]...\n",
getprogname(), common);
Home |
Main Index |
Thread Index |
Old Index