remove FFS mounting code from mount(8); there are now _no_ 'internal' mount
types. when using mount(8) with '-a', do _NOT_ remount file systems that have been mounted once already. (This cannot be 100% precisely determined (thanks to mfs, union fs, and similar file systems which don't use a 'real' mounted-from node), and changed options cannot be updated with mount -a. however, options wouldn't be updated with the old mount -a anyway, and this solves several annoyances.
This commit is contained in:
parent
e85da9ab29
commit
723ca902ed
|
@ -1,8 +1,8 @@
|
||||||
# $NetBSD: Makefile,v 1.9 1995/03/18 14:56:53 cgd Exp $
|
# $NetBSD: Makefile,v 1.10 1995/07/12 03:45:09 cgd Exp $
|
||||||
# @(#)Makefile 8.5 (Berkeley) 3/27/94
|
# @(#)Makefile 8.5 (Berkeley) 3/27/94
|
||||||
|
|
||||||
PROG= mount
|
PROG= mount
|
||||||
SRCS= mount.c mount_ufs.c getmntopts.c
|
SRCS= mount.c getmntopts.c
|
||||||
MAN= mount.8
|
MAN= mount.8
|
||||||
# We do NOT install the getmntopts.3 man page.
|
# We do NOT install the getmntopts.3 man page.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: mount.8,v 1.9 1995/04/30 20:42:12 briggs Exp $
|
.\" $NetBSD: mount.8,v 1.10 1995/07/12 03:45:12 cgd Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1980, 1989, 1991, 1993
|
.\" Copyright (c) 1980, 1989, 1991, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
|
@ -42,24 +42,23 @@
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm mount
|
.Nm mount
|
||||||
.Op Fl adfruvw
|
.Op Fl adfruvw
|
||||||
.Op Fl t Ar ufs | lfs | external_type
|
.Op Fl t Ar type
|
||||||
.Nm mount
|
.Nm mount
|
||||||
.Op Fl dfruvw
|
.Op Fl dfruvw
|
||||||
.Ar special | node
|
.Ar special | node
|
||||||
.Nm mount
|
.Nm mount
|
||||||
.Op Fl dfruvw
|
.Op Fl dfruvw
|
||||||
.Op Fl o Ar options
|
.Op Fl o Ar options
|
||||||
.Op Fl t Ar ufs | lfs | external_type
|
.Op Fl t Ar type
|
||||||
.Ar special node
|
.Ar special node
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
.Nm mount
|
.Nm mount
|
||||||
command
|
command invokes a filesystem-specific program to prepare
|
||||||
calls the
|
and graft the
|
||||||
.Xr mount 2
|
.Ar special
|
||||||
system call to prepare and graft a
|
device or remote node (rhost:path) on to the file system
|
||||||
.Ar "special device"
|
tree at the point
|
||||||
or the remote node (rhost:path) on to the file system tree at the point
|
|
||||||
.Ar node .
|
.Ar node .
|
||||||
If either
|
If either
|
||||||
.Ar special
|
.Ar special
|
||||||
|
@ -76,8 +75,21 @@ this list is printed.
|
||||||
.Pp
|
.Pp
|
||||||
The options are as follows:
|
The options are as follows:
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
|
.It Fl a
|
||||||
|
Causes
|
||||||
|
.Nm mount
|
||||||
|
to try to mount all of the file systems listed in the
|
||||||
|
.Xr fstab
|
||||||
|
table except those for which the
|
||||||
|
.Dq noauto
|
||||||
|
option is specified.
|
||||||
|
If a file system (other than the root file system) is already
|
||||||
|
mounted,
|
||||||
|
.Nm mount
|
||||||
|
will not try to mount it again.
|
||||||
.It Fl d
|
.It Fl d
|
||||||
Causes everything to be done except for the actual system call.
|
Causes everything to be done except for the invocation of
|
||||||
|
the filesystem-specific program.
|
||||||
This option is useful in conjunction with the
|
This option is useful in conjunction with the
|
||||||
.Fl v
|
.Fl v
|
||||||
flag to
|
flag to
|
||||||
|
@ -138,8 +150,7 @@ directory is then accessed.
|
||||||
All creates are done in the mounted filesystem.
|
All creates are done in the mounted filesystem.
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
Any additional options specific to a filesystem type that is not
|
Any additional options specific to a given filesystem type (see the
|
||||||
one of the internally known types (see the
|
|
||||||
.Fl t
|
.Fl t
|
||||||
option) may be passed as a comma separated list; these options are
|
option) may be passed as a comma separated list; these options are
|
||||||
distinguished by a leading
|
distinguished by a leading
|
||||||
|
@ -165,12 +176,12 @@ The same as the
|
||||||
argument to the
|
argument to the
|
||||||
.Fl o
|
.Fl o
|
||||||
option.
|
option.
|
||||||
.It Fl t Ar "ufs \\*(Ba lfs \\*(Ba external type"
|
.It Fl t Ar type
|
||||||
The argument following the
|
The argument following the
|
||||||
.Fl t
|
.Fl t
|
||||||
is used to indicate the file system type.
|
is used to indicate the file system type.
|
||||||
The type
|
The type
|
||||||
.Ar ufs
|
.Ar ffs
|
||||||
is the default.
|
is the default.
|
||||||
The \fI-t\fP option can be used
|
The \fI-t\fP option can be used
|
||||||
to indicate that the actions should only be taken on
|
to indicate that the actions should only be taken on
|
||||||
|
@ -193,8 +204,8 @@ mounts all filesystems except those of type
|
||||||
and
|
and
|
||||||
.Tn MFS .
|
.Tn MFS .
|
||||||
.Pp
|
.Pp
|
||||||
If the type is not one of the internally known types,
|
.Nm Mount
|
||||||
mount will attempt to execute a program in
|
will attempt to execute a program in
|
||||||
.Pa /sbin/mount_ Ns Em XXX
|
.Pa /sbin/mount_ Ns Em XXX
|
||||||
where
|
where
|
||||||
.Em XXX
|
.Em XXX
|
||||||
|
@ -232,9 +243,14 @@ option.
|
||||||
Verbose mode.
|
Verbose mode.
|
||||||
.It Fl w
|
.It Fl w
|
||||||
The file system object is to be read and write.
|
The file system object is to be read and write.
|
||||||
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
The options specific to NFS filesystems are described in the
|
The options specific to the various file system types are
|
||||||
.Xr mount_nfs 8
|
described in the manual pages for those file systems'
|
||||||
|
.Nm mount_XXX
|
||||||
|
commands. For instance the options specific to Berkekely
|
||||||
|
Fast File Systems are described in the
|
||||||
|
.Xr mount_ffs 8
|
||||||
manual page.
|
manual page.
|
||||||
.Sh FILES
|
.Sh FILES
|
||||||
.Bl -tag -width /etc/fstab -compact
|
.Bl -tag -width /etc/fstab -compact
|
||||||
|
@ -247,6 +263,7 @@ file system table
|
||||||
.Xr mount_ados 8 ,
|
.Xr mount_ados 8 ,
|
||||||
.Xr mount_cd9660 8 ,
|
.Xr mount_cd9660 8 ,
|
||||||
.Xr mount_fdesc 8 ,
|
.Xr mount_fdesc 8 ,
|
||||||
|
.Xr mount_ffs 8 ,
|
||||||
.Xr mount_kernfs 8 ,
|
.Xr mount_kernfs 8 ,
|
||||||
.Xr mount_lfs 8 ,
|
.Xr mount_lfs 8 ,
|
||||||
.Xr mount_mfs 8 ,
|
.Xr mount_mfs 8 ,
|
||||||
|
@ -258,8 +275,6 @@ file system table
|
||||||
.Xr mount_umap 8 ,
|
.Xr mount_umap 8 ,
|
||||||
.Xr mount_union 8 ,
|
.Xr mount_union 8 ,
|
||||||
.Xr umount 8
|
.Xr umount 8
|
||||||
.Sh BUGS
|
|
||||||
It is possible for a corrupted file system to cause a crash.
|
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
A
|
A
|
||||||
.Nm mount
|
.Nm mount
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mount.c,v 1.20 1995/07/04 23:41:33 ghudson Exp $ */
|
/* $NetBSD: mount.c,v 1.21 1995/07/12 03:45:14 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1980, 1989, 1993, 1994
|
* Copyright (c) 1980, 1989, 1993, 1994
|
||||||
|
@ -43,7 +43,7 @@ static char copyright[] =
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)mount.c 8.19 (Berkeley) 4/19/94";
|
static char sccsid[] = "@(#)mount.c 8.19 (Berkeley) 4/19/94";
|
||||||
#else
|
#else
|
||||||
static char rcsid[] = "$NetBSD: mount.c,v 1.20 1995/07/04 23:41:33 ghudson Exp $";
|
static char rcsid[] = "$NetBSD: mount.c,v 1.21 1995/07/12 03:45:14 cgd Exp $";
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
|
@ -77,9 +77,6 @@ int mountfs __P((const char *, const char *, const char *,
|
||||||
void prmount __P((struct statfs *));
|
void prmount __P((struct statfs *));
|
||||||
void usage __P((void));
|
void usage __P((void));
|
||||||
|
|
||||||
/* From mount_ufs.c. */
|
|
||||||
int mount_ufs __P((int, char * const *));
|
|
||||||
|
|
||||||
/* Map from mount otions to printable formats. */
|
/* Map from mount otions to printable formats. */
|
||||||
static struct opt {
|
static struct opt {
|
||||||
int o_opt;
|
int o_opt;
|
||||||
|
@ -308,6 +305,22 @@ mountfs(vfstype, spec, name, flags, options, mntopts)
|
||||||
|
|
||||||
if (strcmp(name, "/") == 0)
|
if (strcmp(name, "/") == 0)
|
||||||
flags |= MNT_UPDATE;
|
flags |= MNT_UPDATE;
|
||||||
|
else {
|
||||||
|
if (statfs(name, &sf) < 0) {
|
||||||
|
warn("statfs %s", name);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
/* XXX can't check f_mntfromname, thanks to mfs, union, etc. */
|
||||||
|
if (strncmp(name, sf.f_mntonname, MNAMELEN) == 0 &&
|
||||||
|
strncmp(vfstype, sf.f_fstypename, MFSNAMELEN) == 0) {
|
||||||
|
if (verbose)
|
||||||
|
(void)printf("%s on %s type %.*s: %s\n",
|
||||||
|
sf.f_mntfromname, sf.f_mntonname,
|
||||||
|
MFSNAMELEN, sf.f_fstypename,
|
||||||
|
"already mounted");
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (flags & MNT_FORCE)
|
if (flags & MNT_FORCE)
|
||||||
optbuf = catopt(optbuf, "force");
|
optbuf = catopt(optbuf, "force");
|
||||||
if (flags & MNT_RDONLY)
|
if (flags & MNT_RDONLY)
|
||||||
|
@ -342,9 +355,6 @@ mountfs(vfstype, spec, name, flags, options, mntopts)
|
||||||
free(optbuf);
|
free(optbuf);
|
||||||
return (1);
|
return (1);
|
||||||
case 0: /* Child. */
|
case 0: /* Child. */
|
||||||
if (strcmp(vfstype, "ufs") == 0)
|
|
||||||
exit(mount_ufs(argc, (char * const *) argv));
|
|
||||||
|
|
||||||
/* Go find an executable. */
|
/* Go find an executable. */
|
||||||
edir = edirs;
|
edir = edirs;
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -1,138 +0,0 @@
|
||||||
/* $NetBSD: mount_ufs.c,v 1.2 1995/03/18 14:57:04 cgd Exp $ */
|
|
||||||
|
|
||||||
/*-
|
|
||||||
* Copyright (c) 1993, 1994
|
|
||||||
* The Regents of the University of California. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static char copyright[] =
|
|
||||||
"@(#) Copyright (c) 1993, 1994\n\
|
|
||||||
The Regents of the University of California. All rights reserved.\n";
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
#if 0
|
|
||||||
static char sccsid[] = "@(#)mount_ufs.c 8.2 (Berkeley) 3/27/94";
|
|
||||||
#else
|
|
||||||
static char rcsid[] = "$NetBSD: mount_ufs.c,v 1.2 1995/03/18 14:57:04 cgd Exp $";
|
|
||||||
#endif
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/mount.h>
|
|
||||||
|
|
||||||
#include <err.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "mntopts.h"
|
|
||||||
|
|
||||||
void ufs_usage __P((void));
|
|
||||||
|
|
||||||
static struct mntopt mopts[] = {
|
|
||||||
MOPT_STDOPTS,
|
|
||||||
MOPT_ASYNC,
|
|
||||||
MOPT_SYNC,
|
|
||||||
MOPT_UPDATE,
|
|
||||||
MOPT_RELOAD,
|
|
||||||
{ NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
int
|
|
||||||
mount_ufs(argc, argv)
|
|
||||||
int argc;
|
|
||||||
char * const argv[];
|
|
||||||
{
|
|
||||||
extern int optreset;
|
|
||||||
struct ufs_args args;
|
|
||||||
int ch, mntflags;
|
|
||||||
char *fs_name;
|
|
||||||
|
|
||||||
mntflags = 0;
|
|
||||||
optind = optreset = 1; /* Reset for parse of new argv. */
|
|
||||||
while ((ch = getopt(argc, argv, "o:")) != EOF)
|
|
||||||
switch (ch) {
|
|
||||||
case 'o':
|
|
||||||
getmntopts(optarg, mopts, &mntflags);
|
|
||||||
break;
|
|
||||||
case '?':
|
|
||||||
default:
|
|
||||||
ufs_usage();
|
|
||||||
}
|
|
||||||
argc -= optind;
|
|
||||||
argv += optind;
|
|
||||||
|
|
||||||
if (argc != 2)
|
|
||||||
ufs_usage();
|
|
||||||
|
|
||||||
args.fspec = argv[0]; /* The name of the device file. */
|
|
||||||
fs_name = argv[1]; /* The mount point. */
|
|
||||||
|
|
||||||
#define DEFAULT_ROOTUID -2
|
|
||||||
args.export.ex_root = DEFAULT_ROOTUID;
|
|
||||||
if (mntflags & MNT_RDONLY)
|
|
||||||
args.export.ex_flags = MNT_EXRDONLY;
|
|
||||||
else
|
|
||||||
args.export.ex_flags = 0;
|
|
||||||
|
|
||||||
if (mount(MOUNT_UFS, fs_name, mntflags, &args) < 0) {
|
|
||||||
(void)fprintf(stderr, "%s on %s: ", args.fspec, fs_name);
|
|
||||||
switch (errno) {
|
|
||||||
case EMFILE:
|
|
||||||
(void)fprintf(stderr, "mount table full.\n");
|
|
||||||
break;
|
|
||||||
case EINVAL:
|
|
||||||
if (mntflags & MNT_UPDATE)
|
|
||||||
(void)fprintf(stderr,
|
|
||||||
"Specified device does not match mounted device.\n");
|
|
||||||
else
|
|
||||||
(void)fprintf(stderr,
|
|
||||||
"Incorrect super block.\n");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
(void)fprintf(stderr, "%s\n", strerror(errno));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ufs_usage()
|
|
||||||
{
|
|
||||||
(void)fprintf(stderr, "usage: mount_ufs [-o options] special node\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
Loading…
Reference in New Issue