summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-03-12 20:01:32 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-03-12 20:01:32 +0000
commitbc14ed12cacbf5a7e00ffb37f00c07bd2cd0ed6f (patch)
tree702b0880a6377cef2bbb6cf4a5c81cad1dccee91 /sbin
parent8723c38fffe58fff1a3cbced1fab64c9f4474612 (diff)
Add the -s flag, meaning: skip mount if the file system is
already mounted. This flag is very handy when mounting mfs partitions. The -s flag will be used in an upcoming etc/rc diff. ok henning@ deraadt@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/mount/mount.810
-rw-r--r--sbin/mount/mount.c15
2 files changed, 17 insertions, 8 deletions
diff --git a/sbin/mount/mount.8 b/sbin/mount/mount.8
index 83c5a2d1468..3ff3de69247 100644
--- a/sbin/mount/mount.8
+++ b/sbin/mount/mount.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: mount.8,v 1.54 2005/12/06 20:18:57 pedro Exp $
+.\" $OpenBSD: mount.8,v 1.55 2006/03/12 20:01:31 otto Exp $
.\" $NetBSD: mount.8,v 1.11 1995/07/12 06:23:21 cgd Exp $
.\"
.\" Copyright (c) 1980, 1989, 1991, 1993
@@ -41,7 +41,7 @@
.Op Fl Aadfruvw
.Op Fl t Ar type
.Nm mount
-.Op Fl dfruvw
+.Op Fl dfrsuvw
.Ar special | node
.Nm mount
.Op Fl dfruvw
@@ -245,6 +245,12 @@ The same as the
argument to the
.Fl o
option.
+.It Fl s
+Skip mounting the file system if it is already mounted.
+See the
+.Fl a
+flag for a description of the citeria used to decide if a file system
+is already mounted.
.It Fl t Ar type
The argument following the
.Fl t
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index 662aae00104..7da3046b379 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount.c,v 1.40 2005/05/26 20:16:21 fgsch Exp $ */
+/* $OpenBSD: mount.c,v 1.41 2006/03/12 20:01:31 otto Exp $ */
/* $NetBSD: mount.c,v 1.24 1995/11/18 03:34:29 cgd Exp $ */
/*
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)mount.c 8.19 (Berkeley) 4/19/94";
#else
-static char rcsid[] = "$OpenBSD: mount.c,v 1.40 2005/05/26 20:16:21 fgsch Exp $";
+static char rcsid[] = "$OpenBSD: mount.c,v 1.41 2006/03/12 20:01:31 otto Exp $";
#endif
#endif /* not lint */
@@ -68,7 +68,7 @@ static char rcsid[] = "$OpenBSD: mount.c,v 1.40 2005/05/26 20:16:21 fgsch Exp $"
#include "pathnames.h"
-int debug, verbose;
+int debug, verbose, skip;
char **typelist = NULL;
int selected(const char *);
@@ -126,7 +126,7 @@ main(int argc, char * const argv[])
all = forceall = 0;
options = NULL;
vfstype = "ffs";
- while ((ch = getopt(argc, argv, "Aadfo:rwt:uv")) != -1)
+ while ((ch = getopt(argc, argv, "Aadfo:rswt:uv")) != -1)
switch (ch) {
case 'A':
all = forceall = 1;
@@ -149,6 +149,9 @@ main(int argc, char * const argv[])
if (!hasopt(options, "ro"))
options = catopt(options, "ro");
break;
+ case 's':
+ skip = 1;
+ break;
case 't':
if (typelist != NULL)
errx(1, "only one -t option may be specified.");
@@ -254,7 +257,7 @@ main(int argc, char * const argv[])
mntonname = fs->fs_file;
}
rval = mountfs(fs->fs_vfstype, fs->fs_spec,
- mntonname, options, fs->fs_mntops, 0);
+ mntonname, options, fs->fs_mntops, skip);
break;
case 2:
/*
@@ -721,7 +724,7 @@ usage(void)
"[-dfruvw] [-o options] [-t ffs | external_type]",
"special node",
"[-Aadfruvw] [-t ffs | external_type]",
- "[-dfruvw] special | node");
+ "[-dfrsuvw] special | node");
exit(1);
}