summaryrefslogtreecommitdiffstats
path: root/sbin/mount
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/mount')
-rw-r--r--sbin/mount/Makefile6
-rw-r--r--sbin/mount/getmntopts.317
-rw-r--r--sbin/mount/getmntopts.c25
-rw-r--r--sbin/mount/mntopts.h24
-rw-r--r--sbin/mount/mount.869
-rw-r--r--sbin/mount/mount.c294
-rw-r--r--sbin/mount/mount_ufs.c27
7 files changed, 307 insertions, 155 deletions
diff --git a/sbin/mount/Makefile b/sbin/mount/Makefile
index 56aea1c..6d87935 100644
--- a/sbin/mount/Makefile
+++ b/sbin/mount/Makefile
@@ -1,8 +1,8 @@
-# @(#)Makefile 8.6 (Berkeley) 5/8/95
+# @(#)Makefile 8.5 (Berkeley) 3/27/94
PROG= mount
-SRCS= mount.c mount_ufs.c getmntopts.c vfslist.c
-MAN8= mount.0
+SRCS= mount.c mount_ufs.c getmntopts.c
+MAN8= mount.8
# We do NOT install the getmntopts.3 man page.
.include <bsd.prog.mk>
diff --git a/sbin/mount/getmntopts.3 b/sbin/mount/getmntopts.3
index 8424104..c1bd25a 100644
--- a/sbin/mount/getmntopts.3
+++ b/sbin/mount/getmntopts.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getmntopts.3 8.3 (Berkeley) 3/30/95
+.\" @(#)getmntopts.3 8.1 (Berkeley) 3/27/94
.\"
-.Dd March 30, 1995
+.Dd March 27, 1994
.Dt GETMNTOPTS 3
.Os BSD 4.4
.Sh NAME
@@ -62,7 +62,7 @@ or
.Dv m_altloc
field of the option's table entry)
are updated.
-The flag words are not initialized by
+The flag word is not initialized by
.Nm getmntopt .
The table,
.Dv mopts ,
@@ -154,21 +154,16 @@ struct mntopt mopts[] = {
};
...
- mntflags = mntaltflags = 0;
+ mntflags = 0;
...
- getmntopts(options, mopts, &mntflags, &mntaltflags);
+ getmntopts(options, mopts, &mntflags)
...
.Ed
.Sh DIAGNOSTICS
-If the external integer variable
-.Dv getmnt_silent
-is non-zero then the
+The
.Nm getmntopts
function displays an error message and exits if an
unrecognized option is encountered.
-By default
-.Dv getmnt_silent
-is zero.
.Sh SEE ALSO
.Xr err 3 ,
.Xr mount 8
diff --git a/sbin/mount/getmntopts.c b/sbin/mount/getmntopts.c
index 8f972ca..75c75b2 100644
--- a/sbin/mount/getmntopts.c
+++ b/sbin/mount/getmntopts.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)getmntopts.c 8.3 (Berkeley) 3/29/95";
+static char sccsid[] = "@(#)getmntopts.c 8.1 (Berkeley) 3/27/94";
#endif /* not lint */
#include <sys/param.h>
@@ -56,8 +56,8 @@ getmntopts(options, m0, flagp, altflagp)
int *altflagp;
{
const struct mntopt *m;
- int negative;
- char *opt, *optbuf, *p;
+ int negative, len;
+ char *opt, *optbuf;
int *thisflagp;
/* Copy option string, since it is about to be torn asunder... */
@@ -72,18 +72,15 @@ getmntopts(options, m0, flagp, altflagp)
} else
negative = 0;
- /*
- * for options with assignments in them (ie. quotas)
- * ignore the assignment as it's handled elsewhere
- */
- p = strchr(opt, '=');
- if (p)
- *p = '\0';
-
/* Scan option table. */
- for (m = m0; m->m_option != NULL; ++m)
- if (strcasecmp(opt, m->m_option) == 0)
+ for (m = m0; m->m_option != NULL; ++m) {
+ len = strlen(m->m_option);
+ if (strncasecmp(opt, m->m_option, len) == 0)
+ if ( m->m_option[len] == '\0'
+ || m->m_option[len] == '='
+ )
break;
+ }
/* Save flag, or fail if option is not recognised. */
if (m->m_option) {
@@ -92,7 +89,7 @@ getmntopts(options, m0, flagp, altflagp)
*thisflagp |= m->m_flag;
else
*thisflagp &= ~m->m_flag;
- } else if (!getmnt_silent) {
+ } else if(!getmnt_silent) {
errx(1, "-o %s: option not supported", opt);
}
}
diff --git a/sbin/mount/mntopts.h b/sbin/mount/mntopts.h
index 621b0e9..032d70e 100644
--- a/sbin/mount/mntopts.h
+++ b/sbin/mount/mntopts.h
@@ -30,46 +30,48 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)mntopts.h 8.7 (Berkeley) 3/29/95
+ * @(#)mntopts.h 8.3 (Berkeley) 3/27/94
*/
struct mntopt {
const char *m_option; /* option name */
int m_inverse; /* if a negative option, eg "dev" */
int m_flag; /* bit to set, eg. MNT_RDONLY */
- int m_altloc; /* 1 => set bit in altflags */
+ int m_altloc; /* zero if this is a real mount flag */
};
/* User-visible MNT_ flags. */
#define MOPT_ASYNC { "async", 0, MNT_ASYNC, 0 }
+#define MOPT_NOATIME { "atime", 1, MNT_NOATIME, 0 }
+#define MOPT_NOAUTO { "auto", 1, 0, 0 }
#define MOPT_NODEV { "dev", 1, MNT_NODEV, 0 }
#define MOPT_NOEXEC { "exec", 1, MNT_NOEXEC, 0 }
#define MOPT_NOSUID { "suid", 1, MNT_NOSUID, 0 }
#define MOPT_RDONLY { "rdonly", 0, MNT_RDONLY, 0 }
#define MOPT_SYNC { "sync", 0, MNT_SYNCHRONOUS, 0 }
#define MOPT_UNION { "union", 0, MNT_UNION, 0 }
-#define MOPT_USERQUOTA { "userquota", 0, 0, 0 }
-#define MOPT_GROUPQUOTA { "groupquota", 0, 0, 0 }
+
+/* Skip this options without any action (needed for checkquota/quotaon) */
+#define MOPT_UQUOTA { "userquota", 0, 0, 0 }
+#define MOPT_GQUOTA { "groupquota", 0, 0, 0 }
/* Control flags. */
#define MOPT_FORCE { "force", 0, MNT_FORCE, 0 }
#define MOPT_UPDATE { "update", 0, MNT_UPDATE, 0 }
+
+/* Support for old-style "ro", "rw" flags. */
#define MOPT_RO { "ro", 0, MNT_RDONLY, 0 }
#define MOPT_RW { "rw", 1, MNT_RDONLY, 0 }
-/* This is parsed by mount(8), but is ignored by specific mount_*(8)s. */
-#define MOPT_AUTO { "auto", 0, 0, 0 }
-
#define MOPT_FSTAB_COMPAT \
MOPT_RO, \
- MOPT_RW, \
- MOPT_AUTO
+ MOPT_RW
/* Standard options which all mounts can understand. */
#define MOPT_STDOPTS \
- MOPT_USERQUOTA, \
- MOPT_GROUPQUOTA, \
MOPT_FSTAB_COMPAT, \
+ MOPT_NOATIME, \
+ MOPT_NOAUTO, \
MOPT_NODEV, \
MOPT_NOEXEC, \
MOPT_NOSUID, \
diff --git a/sbin/mount/mount.8 b/sbin/mount/mount.8
index 5767c2f..2961cc1 100644
--- a/sbin/mount/mount.8
+++ b/sbin/mount/mount.8
@@ -29,9 +29,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)mount.8 8.8 (Berkeley) 6/16/94
+.\" @(#)mount.8 8.7 (Berkeley) 3/27/94
+.\" $Id$
.\"
-.Dd June 16, 1994
+.Dd March 27, 1994
.Dt MOUNT 8
.Os BSD 4
.Sh NAME
@@ -39,13 +40,13 @@
.Nd mount file systems
.Sh SYNOPSIS
.Nm mount
-.Op Fl adfruvw
+.Op Fl adfpruvw
.Op Fl t Ar ufs | lfs | external_type
.Nm mount
-.Op Fl dfruvw
+.Op Fl dfpruvw
.Ar special | node
.Nm mount
-.Op Fl dfruvw
+.Op Fl dfpruvw
.Op Fl o Ar options
.Op Fl t Ar ufs | lfs | external_type
.Ar special node
@@ -75,12 +76,10 @@ this list is printed.
The options are as follows:
.Bl -tag -width indent
.It Fl a
-All the filesystems described in
-.Xr fstab 5
-are mounted.
-Exceptions are those marked as ``noauto'' or are excluded by the
-.Fl t
-flag (see below).
+Causes all filesystems listed in
+.Pa /etc/fstab
+(except those with the ``noauto'' option) to be mounted. This is normally
+done during system startup.
.It Fl d
Causes everything to be done except for the actual system call.
This option is useful in conjunction with the
@@ -91,7 +90,9 @@ determine what the
command is trying to do.
.It Fl f
Forces the revocation of write access when trying to downgrade
-a filesystem mount status from read-write to read-only.
+a filesystem mount status from read-write to read-only. Also
+forces the R/W mount of an unclean filesystem (dangerous; use with
+caution).
.It Fl o
Options are specified with a
.Fl o
@@ -111,11 +112,14 @@ system should your system crash.
The same as
.Fl f ;
forces the revocation of write access when trying to downgrade
-a filesystem mount status from read-write to read-only.
-.It noauto
-This filesystem should be skipped when mount is run with the
-.Fl a
-flag.
+a filesystem mount status from read-write to read-only. Also
+forces the R/W mount of an unclean filesystem (dangerous; use with caution).
+.It noatime
+Do not update the file access time when reading from a file. This option
+is useful on filesystems where there are large numbers of files and
+performance is more critical than updating the file access time (which is
+rarely ever important). This option is currently only supported on local
+filesystems.
.It nodev
Do not interpret character or block special devices on the file system.
This option is useful for a server that has file systems containing
@@ -126,6 +130,10 @@ This option is useful for a server that has file systems containing
binaries for architectures other than its own.
.It nosuid
Do not allow set-user-identifier or set-group-identifier bits to take effect.
+Note: this option is worthless if a public available suid or sgid
+wrapper like
+.Xr suidperl
+is installed on your system.
.It rdonly
The same as
.Fl r ;
@@ -166,6 +174,10 @@ to execute the equivalent of:
.Bd -literal -offset indent
/sbin/mount_mfs -o nosuid -N -s 4000 /dev/dk0b /tmp
.Ed
+.It Fl p
+Print mount information in fstab format. Implies also the
+.Fl v
+option.
.It Fl r
The file system is to be mounted read-only.
Mount the file system read-only (even the super-user may not write it).
@@ -181,7 +193,9 @@ is used to indicate the file system type.
The type
.Ar ufs
is the default.
-The \fI-t\fP option can be used
+The
+.Fl t
+option can be used
to indicate that the actions should only be taken on
filesystems of the specified type.
More than one type may be specified in a comma separated list.
@@ -210,6 +224,20 @@ where
is replaced by the type name.
For example, nfs filesystems are mounted by the program
.Pa /sbin/mount_nfs .
+.Pp
+Most filesystems will be dynamically loaded by their mount programs
+if not already present in the kernel, using the
+.Xr vfsload 3
+subroutine. Because this mechanism requires writable temporary space,
+the filesystem type containing
+.Pa /tmp
+must be compiled into the kernel, and the filesystems containing
+.Pa /tmp
+and
+.Pa /usr/bin/ld
+must be listed in
+.Pa /etc/fstab
+before any filesystems which might be dynamically loaded.
.It Fl u
The
.Fl u
@@ -252,13 +280,14 @@ file system table
.El
.Sh SEE ALSO
.Xr mount 2 ,
+.Xr vfsload 3 ,
.Xr fstab 5 ,
.Xr mount_cd9660 8 ,
.Xr mount_fdesc 8 ,
.Xr mount_kernfs 8 ,
.Xr mount_lfs 8 ,
-.Xr mount_lofs 8 ,
.Xr mount_mfs 8 ,
+.Xr mount_msdos 8 ,
.Xr mount_nfs 8 ,
.Xr mount_null 8 ,
.Xr mount_portal 8 ,
@@ -272,4 +301,4 @@ It is possible for a corrupted file system to cause a crash.
A
.Nm mount
command appeared in
-.At v6 .
+.At v1 .
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index 7d6252b..5592a63 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -38,17 +38,18 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95";
+static char sccsid[] = "@(#)mount.c 8.19 (Berkeley) 4/19/94";
#endif /* not lint */
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/wait.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <err.h>
#include <errno.h>
#include <fstab.h>
-#include <pwd.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -57,20 +58,24 @@ static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95";
#include "pathnames.h"
-int debug, verbose;
+int debug, verbose, skipvfs;
+int fstab_style = 0;
-int checkvfsname __P((const char *, const char **));
+static char *mnttype[] = INITMOUNTNAMES;
+
+int badvfsname __P((const char *, const char **));
+int badvfstype __P((int, const char **));
char *catopt __P((char *, const char *));
struct statfs
*getmntpt __P((const char *));
-int hasopt __P((const char *, const char *));
const char
**makevfslist __P((char *));
void mangle __P((char *, int *, const char **));
int mountfs __P((const char *, const char *, const char *,
int, const char *, const char *));
-void prmount __P((struct statfs *));
+void prmount __P((const char *, const char *, int));
void usage __P((void));
+void putfsent __P((const struct statfs *));
/* From mount_ufs.c. */
int mount_ufs __P((int, char * const *));
@@ -83,6 +88,7 @@ static struct opt {
{ MNT_ASYNC, "asynchronous" },
{ MNT_EXPORTED, "NFS exported" },
{ MNT_LOCAL, "local" },
+ { MNT_NOATIME, "noatime" },
{ MNT_NODEV, "nodev" },
{ MNT_NOEXEC, "noexec" },
{ MNT_NOSUID, "nosuid" },
@@ -90,6 +96,7 @@ static struct opt {
{ MNT_RDONLY, "read-only" },
{ MNT_SYNCHRONOUS, "synchronous" },
{ MNT_UNION, "union" },
+ { MNT_USER, "user mount" },
{ NULL }
};
@@ -98,7 +105,7 @@ main(argc, argv)
int argc;
char * const argv[];
{
- const char *mntfromname, **vfslist, *vfstype;
+ const char *mntonname, **vfslist, *vfstype;
struct fstab *fs;
struct statfs *mntbuf;
FILE *mountdfp;
@@ -110,8 +117,12 @@ main(argc, argv)
options = NULL;
vfslist = NULL;
vfstype = "ufs";
- while ((ch = getopt(argc, argv, "adfo:rwt:uv")) != EOF)
+ while ((ch = getopt(argc, argv, "padfo:rwt:uv")) != EOF)
switch (ch) {
+ case 'p':
+ fstab_style = 1;
+ verbose = 1;
+ break;
case 'a':
all = 1;
break;
@@ -162,22 +173,32 @@ main(argc, argv)
while ((fs = getfsent()) != NULL) {
if (BADTYPE(fs->fs_type))
continue;
- if (checkvfsname(fs->fs_vfstype, vfslist))
+ if (badvfsname(fs->fs_vfstype, vfslist))
continue;
- if (hasopt(fs->fs_mntops, "noauto"))
+ if (strstr(fs->fs_mntops, "noauto"))
continue;
if (mountfs(fs->fs_vfstype, fs->fs_spec,
- fs->fs_file, init_flags, options,
- fs->fs_mntops))
- rval = 1;
+ fs->fs_file, init_flags, options,
+ fs->fs_mntops))
+ rval = 1;
+ }
+ else if (fstab_style) {
+ if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
+ err(1, "getmntinfo");
+ for (i = 0; i < mntsize; i++) {
+ if (badvfstype(mntbuf[i].f_type, vfslist))
+ continue;
+ putfsent (&mntbuf[i]);
}
+ }
else {
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
err(1, "getmntinfo");
for (i = 0; i < mntsize; i++) {
- if (checkvfsname(mntbuf[i].f_fstypename, vfslist))
+ if (badvfstype(mntbuf[i].f_type, vfslist))
continue;
- prmount(&mntbuf[i]);
+ prmount(mntbuf[i].f_mntfromname,
+ mntbuf[i].f_mntonname, mntbuf[i].f_flags);
}
}
exit(rval);
@@ -190,23 +211,25 @@ main(argc, argv)
errx(1,
"unknown special file or file system %s.",
*argv);
- if ((fs = getfsfile(mntbuf->f_mntonname)) != NULL)
- mntfromname = fs->fs_spec;
- else
- mntfromname = mntbuf->f_mntfromname;
- rval = mountfs(mntbuf->f_fstypename, mntfromname,
- mntbuf->f_mntonname, init_flags, options, 0);
- break;
+ if ((fs = getfsfile(mntbuf->f_mntonname)) == NULL)
+ errx(1, "can't find fstab entry for %s.",
+ *argv);
+ /* If it's an update, ignore the fstab file options. */
+ fs->fs_mntops = NULL;
+ mntonname = mntbuf->f_mntonname;
+ } else {
+ if ((fs = getfsfile(*argv)) == NULL &&
+ (fs = getfsspec(*argv)) == NULL)
+ errx(1,
+ "%s: unknown special file or file system.",
+ *argv);
+ if (BADTYPE(fs->fs_type))
+ errx(1, "%s has unknown file system type.",
+ *argv);
+ mntonname = fs->fs_file;
}
- if ((fs = getfsfile(*argv)) == NULL &&
- (fs = getfsspec(*argv)) == NULL)
- errx(1, "%s: unknown special file or file system.",
- *argv);
- if (BADTYPE(fs->fs_type))
- errx(1, "%s has unknown file system type.",
- *argv);
- rval = mountfs(fs->fs_vfstype, fs->fs_spec, fs->fs_file,
- init_flags, options, fs->fs_mntops);
+ rval = mountfs(fs->fs_vfstype, fs->fs_spec,
+ mntonname, init_flags, options, fs->fs_mntops);
break;
case 2:
/*
@@ -240,35 +263,12 @@ main(argc, argv)
}
int
-hasopt(mntopts, option)
- const char *mntopts, *option;
-{
- int negative, found;
- char *opt, *optbuf;
-
- if (option[0] == 'n' && option[1] == 'o') {
- negative = 1;
- option += 2;
- } else
- negative = 0;
- optbuf = strdup(mntopts);
- found = 0;
- for (opt = optbuf; (opt = strtok(opt, ",")) != NULL; opt = NULL) {
- if (opt[0] == 'n' && opt[1] == 'o') {
- if (!strcasecmp(opt + 2, option))
- found = negative;
- } else if (!strcasecmp(opt, option))
- found = !negative;
- }
- free(optbuf);
- return (found);
-}
-
-int
mountfs(vfstype, spec, name, flags, options, mntopts)
const char *vfstype, *spec, *name, *options, *mntopts;
int flags;
{
+ struct stat sb;
+
/* List of directories containing mount_xxx subcommands. */
static const char *edirs[] = {
_PATH_SBIN,
@@ -281,22 +281,27 @@ mountfs(vfstype, spec, name, flags, options, mntopts)
int argc, i, status;
char *optbuf, execname[MAXPATHLEN + 1], mntpath[MAXPATHLEN];
- if (realpath(name, mntpath) == NULL) {
- warn("realpath %s", mntpath);
+ if (realpath(name, mntpath) != NULL && stat(mntpath, &sb) == 0) {
+ if (!S_ISDIR(sb.st_mode)) {
+ warnx("%s: Not a directory", mntpath);
+ return (1);
+ }
+ } else {
+ warn("%s", mntpath);
return (1);
}
- name = mntpath;
-
if (mntopts == NULL)
mntopts = "";
+
+ name = mntpath;
+
if (options == NULL) {
- if (*mntopts == '\0') {
+ if (*mntopts == '\0')
options = "rw";
- } else {
+ else
options = mntopts;
- mntopts = "";
- }
+ mntopts = "";
}
optbuf = catopt(strdup(mntopts), options);
@@ -340,17 +345,28 @@ mountfs(vfstype, spec, name, flags, options, mntopts)
exit(mount_ufs(argc, (char * const *) argv));
/* Go find an executable. */
- edir = edirs;
- do {
+ for (edir = edirs; *edir; edir++) {
(void)snprintf(execname,
sizeof(execname), "%s/mount_%s", *edir, vfstype);
execv(execname, (char * const *)argv);
- if (errno != ENOENT)
- warn("exec %s for %s", execname, name);
- } while (*++edir != NULL);
-
- if (errno == ENOENT)
- warn("exec %s for %s", execname, name);
+ }
+ if (errno == ENOENT) {
+ int len = 0;
+ char *cp;
+ for (edir = edirs; *edir; edir++)
+ len += strlen(*edir) + 2; /* ", " */
+ if ((cp = malloc(len)) == NULL) {
+ warn(NULL);
+ exit(1);
+ }
+ cp[0] = '\0';
+ for (edir = edirs; *edir; edir++) {
+ strcat(cp, *edir);
+ if (edir[1] != NULL)
+ strcat(cp, ", ");
+ }
+ warn("exec mount_%s not found in %s", vfstype, cp);
+ }
exit(1);
/* NOTREACHED */
default: /* Parent. */
@@ -371,10 +387,15 @@ mountfs(vfstype, spec, name, flags, options, mntopts)
if (verbose) {
if (statfs(name, &sf) < 0) {
- warn("statfs %s", name);
+ warn("%s", name);
return (1);
}
- prmount(&sf);
+
+ if (fstab_style)
+ putfsent (&sf);
+ else
+ prmount (sf.f_mntfromname,
+ sf.f_mntonname, sf.f_flags);
}
break;
}
@@ -383,29 +404,21 @@ mountfs(vfstype, spec, name, flags, options, mntopts)
}
void
-prmount(sfp)
- struct statfs *sfp;
-{
+prmount(spec, name, flags)
+ const char *spec, *name;
int flags;
+{
struct opt *o;
- struct passwd *pw;
int f;
- (void)printf("%s on %s", sfp->f_mntfromname, sfp->f_mntonname);
+ (void)printf("%s on %s", spec, name);
- flags = sfp->f_flags & MNT_VISFLAGMASK;
+ flags &= MNT_VISFLAGMASK;
for (f = 0, o = optnames; flags && o->o_opt; o++)
if (flags & o->o_opt) {
(void)printf("%s%s", !f++ ? " (" : ", ", o->o_name);
flags &= ~o->o_opt;
}
- if (sfp->f_owner) {
- (void)printf("%smounted by ", !f++ ? " (" : ", ");
- if ((pw = getpwuid(sfp->f_owner)) != NULL)
- (void)printf("%s", pw->pw_name);
- else
- (void)printf("%d", sfp->f_owner);
- }
(void)printf(f ? ")\n" : "\n");
}
@@ -424,6 +437,68 @@ getmntpt(name)
return (NULL);
}
+int
+badvfsname(vfsname, vfslist)
+ const char *vfsname;
+ const char **vfslist;
+{
+
+ if (vfslist == NULL)
+ return (0);
+ while (*vfslist != NULL) {
+ if (strcmp(vfsname, *vfslist) == 0)
+ return (skipvfs);
+ ++vfslist;
+ }
+ return (!skipvfs);
+}
+
+int
+badvfstype(vfstype, vfslist)
+ int vfstype;
+ const char **vfslist;
+{
+ struct vfsconf *vfc;
+ vfc = getvfsbytype(vfstype);
+
+ if ( ! vfc )
+ return (0);
+
+ return (badvfsname(vfc->vfc_name, vfslist));
+}
+
+const char **
+makevfslist(fslist)
+ char *fslist;
+{
+ const char **av;
+ int i;
+ char *nextcp;
+
+ if (fslist == NULL)
+ return (NULL);
+ if (fslist[0] == 'n' && fslist[1] == 'o') {
+ fslist += 2;
+ skipvfs = 1;
+ }
+ for (i = 0, nextcp = fslist; *nextcp; nextcp++)
+ if (*nextcp == ',')
+ i++;
+ if ((av = malloc((size_t)(i + 2) * sizeof(char *))) == NULL) {
+ warn(NULL);
+ return (NULL);
+ }
+ nextcp = fslist;
+ i = 0;
+ av[i++] = nextcp;
+ while ((nextcp = strchr(nextcp, ',')) != NULL) {
+ *nextcp++ = '\0';
+ av[i++] = nextcp;
+ }
+ av[i++] = NULL;
+ return (av);
+}
+
char *
catopt(s0, s1)
char *s0;
@@ -478,9 +553,48 @@ usage()
(void)fprintf(stderr,
"usage: mount %s %s\n mount %s\n mount %s\n",
- "[-dfruvw] [-o options] [-t ufs | external_type]",
+ "[-dfpruvw] [-o options] [-t ufs | external_type]",
"special node",
- "[-adfruvw] [-t ufs | external_type]",
- "[-dfruvw] special | node");
+ "[-adfpruvw] [-t ufs | external_type]",
+ "[-dfpruvw] special | node");
exit(1);
}
+
+void
+putfsent (ent)
+ const struct statfs *ent;
+{
+ struct fstab *fst;
+
+ printf ("%s\t%s\t%s %s",
+ ent->f_mntfromname, ent->f_mntonname,
+ mnttype[ent->f_type],
+ (ent->f_flags & MNT_RDONLY) ? "ro" : "rw");
+
+ if (ent->f_flags & MNT_SYNCHRONOUS)
+ printf (",sync");
+
+ if (ent->f_flags & MNT_NOEXEC)
+ printf (",noexec");
+
+ if (ent->f_flags & MNT_NOSUID)
+ printf (",nosuid");
+
+ if (ent->f_flags & MNT_NODEV)
+ printf (",nodev");
+
+ if (ent->f_flags & MNT_UNION)
+ printf (",union");
+
+ if (ent->f_flags & MNT_ASYNC)
+ printf (",async");
+
+ if (fst = getfsspec (ent->f_mntfromname))
+ printf ("\t%u %u\n", fst->fs_freq, fst->fs_passno);
+ else if (fst = getfsfile (ent->f_mntonname))
+ printf ("\t%u %u\n", fst->fs_freq, fst->fs_passno);
+ else if (ent->f_type == MOUNT_UFS)
+ printf ("\t1 1\n");
+ else
+ printf ("\t0 0\n");
+}
diff --git a/sbin/mount/mount_ufs.c b/sbin/mount/mount_ufs.c
index e14a26a..fac1417 100644
--- a/sbin/mount/mount_ufs.c
+++ b/sbin/mount/mount_ufs.c
@@ -38,7 +38,7 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)mount_ufs.c 8.4 (Berkeley) 4/26/95";
+static char sccsid[] = "@(#)mount_ufs.c 8.2 (Berkeley) 3/27/94";
#endif /* not lint */
#include <sys/param.h>
@@ -51,8 +51,6 @@ static char sccsid[] = "@(#)mount_ufs.c 8.4 (Berkeley) 4/26/95";
#include <string.h>
#include <unistd.h>
-#include <ufs/ufs/ufsmount.h>
-
#include "mntopts.h"
void ufs_usage __P((void));
@@ -61,8 +59,10 @@ static struct mntopt mopts[] = {
MOPT_STDOPTS,
MOPT_ASYNC,
MOPT_SYNC,
- MOPT_UPDATE,
MOPT_FORCE,
+ MOPT_UPDATE,
+ MOPT_UQUOTA,
+ MOPT_GQUOTA,
{ NULL }
};
@@ -75,6 +75,7 @@ mount_ufs(argc, argv)
struct ufs_args args;
int ch, mntflags;
char *fs_name;
+ struct vfsconf *vfc;
mntflags = 0;
optind = optreset = 1; /* Reset for parse of new argv. */
@@ -103,7 +104,21 @@ mount_ufs(argc, argv)
else
args.export.ex_flags = 0;
- if (mount("ufs", fs_name, mntflags, &args) < 0) {
+ setvfsent(0);
+ if(!(vfc = getvfsbyname("ufs"))) {
+ if(vfsisloadable("ufs")) {
+ if(vfsload("ufs")) {
+ warn("vfsload(\"ufs\")");
+ return 1;
+ }
+ endvfsent(); /* flush old table */
+ vfc = getvfsbyname("ufs");
+ } else {
+ /*warnx("ufs: filesystem not found");*/
+ }
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_UFS, fs_name, mntflags, &args) < 0) {
(void)fprintf(stderr, "%s on %s: ", args.fspec, fs_name);
switch (errno) {
case EMFILE:
@@ -113,7 +128,7 @@ mount_ufs(argc, argv)
if (mntflags & MNT_UPDATE)
(void)fprintf(stderr,
"Specified device does not match mounted device.\n");
- else
+ else
(void)fprintf(stderr,
"Incorrect super block.\n");
break;
OpenPOWER on IntegriCloud