Try to avoid mounting filesystems multiple times. Also while

I'm here do some -Wall cleaning.

PR:		kern/1839
Reviewed and corrected by:	joerg
This commit is contained in:
Steve Price 1997-08-24 21:02:51 +00:00
parent 8ee0110a44
commit fba1c154b2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28671
14 changed files with 198 additions and 58 deletions

View File

@ -1,9 +1,11 @@
# @(#)Makefile 8.6 (Berkeley) 5/8/95 # @(#)Makefile 8.6 (Berkeley) 5/8/95
# $Id$
PROG= mount PROG= mount
SRCS= mount.c mount_ufs.c getmntopts.c vfslist.c SRCS= mount.c mount_ufs.c getmntopts.c vfslist.c
MAN8= mount.8 MAN8= mount.8
# We do NOT install the getmntopts.3 man page. # We do NOT install the getmntopts.3 man page.
CFLAGS+= -D_NEW_VFSCONF CFLAGS+= -D_NEW_VFSCONF
NOSHARED= yes
.include <bsd.prog.mk> .include <bsd.prog.mk>

View File

@ -32,7 +32,12 @@
*/ */
#ifndef lint #ifndef lint
#if 0
static char sccsid[] = "@(#)getmntopts.c 8.3 (Berkeley) 3/29/95"; static char sccsid[] = "@(#)getmntopts.c 8.3 (Berkeley) 3/29/95";
#else
static const char rcsid[] =
"$Id$";
#endif
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -44,6 +49,7 @@ static char sccsid[] = "@(#)getmntopts.c 8.3 (Berkeley) 3/29/95";
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "extern.h"
#include "mntopts.h" #include "mntopts.h"
int getmnt_silent = 0; int getmnt_silent = 0;

View File

@ -31,6 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)mntopts.h 8.7 (Berkeley) 3/29/95 * @(#)mntopts.h 8.7 (Berkeley) 3/29/95
* $Id$
*/ */
struct mntopt { struct mntopt {
@ -77,6 +78,3 @@ struct mntopt {
MOPT_NOSUID, \ MOPT_NOSUID, \
MOPT_RDONLY, \ MOPT_RDONLY, \
MOPT_UNION MOPT_UNION
void getmntopts __P((const char *, const struct mntopt *, int *, int *));
extern int getmnt_silent;

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" @(#)mount.8 8.8 (Berkeley) 6/16/94 .\" @(#)mount.8 8.8 (Berkeley) 6/16/94
.\" $Id: mount.8,v 1.16 1997/08/24 02:27:08 steve Exp $ .\" $Id: mount.8,v 1.17 1997/08/24 17:51:12 joerg Exp $
.\" .\"
.Dd June 16, 1994 .Dd June 16, 1994
.Dt MOUNT 8 .Dt MOUNT 8
@ -79,9 +79,11 @@ The options are as follows:
All the filesystems described in All the filesystems described in
.Xr fstab 5 .Xr fstab 5
are mounted. are mounted.
Exceptions are those marked as ``noauto'' or are excluded by the Exceptions are those marked as ``noauto'', excluded by the
.Fl t .Fl t
flag (see below). flag (see below), or if they are already mounted (except the
root filesystem which is always remounted to preserve
traditional single user mode behavior).
.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 actual system call.
This option is useful in conjunction with the This option is useful in conjunction with the

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 1980, 1989, 1993, 1994 * Copyright (c) 1980, 1989, 1993, 1994
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
@ -32,13 +32,18 @@
*/ */
#ifndef lint #ifndef lint
static char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1980, 1989, 1993, 1994\n\ "@(#) Copyright (c) 1980, 1989, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n"; The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#ifndef lint #ifndef lint
#if 0
static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95"; static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95";
#else
static const char rcsid[] =
"$Id$";
#endif
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -56,17 +61,17 @@ static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95";
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include "extern.h"
#include "pathnames.h" #include "pathnames.h"
int debug, fstab_style, verbose; int debug, fstab_style, verbose;
int checkvfsname __P((const char *, const char **));
char *catopt __P((char *, const char *)); char *catopt __P((char *, const char *));
struct statfs struct statfs
*getmntpt __P((const char *)); *getmntpt __P((const char *));
int hasopt __P((const char *, const char *)); int hasopt __P((const char *, const char *));
const char int ismounted __P((struct fstab *, struct statfs *, int));
**makevfslist __P((char *)); int isremountable __P((const char *));
void mangle __P((char *, int *, const char **)); void mangle __P((char *, int *, const char **));
int mountfs __P((const char *, const char *, const char *, int mountfs __P((const char *, const char *, const char *,
int, const char *, const char *)); int, const char *, const char *));
@ -74,9 +79,6 @@ void prmount __P((struct statfs *));
void putfsent __P((const struct statfs *)); void putfsent __P((const 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;
@ -96,6 +98,17 @@ static struct opt {
{ NULL } { NULL }
}; };
/*
* List of VFS types that can be remounted without becoming mounted on top
* of each other.
* XXX Is this list correct?
*/
static const char *
remountable_fs_names[] = {
"ufs", "ffs", "lfs", "ext2fs",
0
};
int int
main(argc, argv) main(argc, argv)
int argc; int argc;
@ -165,7 +178,9 @@ main(argc, argv)
rval = 0; rval = 0;
switch (argc) { switch (argc) {
case 0: case 0:
if (all) if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
err(1, "getmntinfo");
if (all) {
while ((fs = getfsent()) != NULL) { while ((fs = getfsent()) != NULL) {
if (BADTYPE(fs->fs_type)) if (BADTYPE(fs->fs_type))
continue; continue;
@ -173,22 +188,20 @@ main(argc, argv)
continue; continue;
if (hasopt(fs->fs_mntops, "noauto")) if (hasopt(fs->fs_mntops, "noauto"))
continue; continue;
if (ismounted(fs, mntbuf, mntsize))
continue;
if (mountfs(fs->fs_vfstype, fs->fs_spec, if (mountfs(fs->fs_vfstype, fs->fs_spec,
fs->fs_file, init_flags, options, fs->fs_file, init_flags, options,
fs->fs_mntops)) fs->fs_mntops))
rval = 1; rval = 1;
} }
else if (fstab_style) { } else if (fstab_style) {
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
err(1, "getmntinfo");
for (i = 0; i < mntsize; i++) { for (i = 0; i < mntsize; i++) {
if (checkvfsname(mntbuf[i].f_fstypename, vfslist)) if (checkvfsname(mntbuf[i].f_fstypename, vfslist))
continue; continue;
putfsent(&mntbuf[i]); putfsent(&mntbuf[i]);
} }
} else { } else {
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
err(1, "getmntinfo");
for (i = 0; i < mntsize; i++) { for (i = 0; i < mntsize; i++) {
if (checkvfsname(mntbuf[i].f_fstypename, if (checkvfsname(mntbuf[i].f_fstypename,
vfslist)) vfslist))
@ -246,7 +259,7 @@ main(argc, argv)
*/ */
if (rval == 0 && getuid() == 0 && if (rval == 0 && getuid() == 0 &&
(mountdfp = fopen(_PATH_MOUNTDPID, "r")) != NULL) { (mountdfp = fopen(_PATH_MOUNTDPID, "r")) != NULL) {
if (fscanf(mountdfp, "%ld", &pid) == 1 && if (fscanf(mountdfp, "%d", &pid) == 1 &&
pid > 0 && kill(pid, SIGHUP) == -1 && errno != ESRCH) pid > 0 && kill(pid, SIGHUP) == -1 && errno != ESRCH)
err(1, "signal mountd"); err(1, "signal mountd");
(void)fclose(mountdfp); (void)fclose(mountdfp);
@ -255,6 +268,38 @@ main(argc, argv)
exit(rval); exit(rval);
} }
int
ismounted(fs, mntbuf, mntsize)
struct fstab *fs;
struct statfs *mntbuf;
int mntsize;
{
int i;
if (fs->fs_file[0] == '/' && fs->fs_file[1] == '\0')
/* the root file system can always be remounted */
return (0);
for (i = mntsize - 1; i >= 0; --i)
if (strcmp(fs->fs_file, mntbuf[i].f_mntonname) == 0 &&
(!isremountable(fs->fs_vfstype) ||
strcmp(fs->fs_spec, mntbuf[i].f_mntfromname) == 0))
return (1);
return (0);
}
int
isremountable(vfsname)
const char *vfsname;
{
const char **cp;
for (cp = remountable_fs_names; *cp; cp++)
if (strcmp(*cp, vfsname) == 0)
return (1);
return (0);
}
int int
hasopt(mntopts, option) hasopt(mntopts, option)
const char *mntopts, *option; const char *mntopts, *option;
@ -298,6 +343,11 @@ mountfs(vfstype, spec, name, flags, options, mntopts)
int argc, i, status; int argc, i, status;
char *optbuf, execname[MAXPATHLEN + 1], mntpath[MAXPATHLEN]; char *optbuf, execname[MAXPATHLEN + 1], mntpath[MAXPATHLEN];
#if __GNUC__
(void)&optbuf;
(void)&name;
#endif
if (realpath(name, mntpath) != NULL && stat(mntpath, &sb) == 0) { if (realpath(name, mntpath) != NULL && stat(mntpath, &sb) == 0) {
if (!S_ISDIR(sb.st_mode)) { if (!S_ISDIR(sb.st_mode)) {
warnx("%s: Not a directory", mntpath); warnx("%s: Not a directory", mntpath);
@ -546,9 +596,9 @@ putfsent(ent)
if (ent->f_flags & MNT_NOATIME) if (ent->f_flags & MNT_NOATIME)
printf(",noatime"); printf(",noatime");
if (fst = getfsspec(ent->f_mntfromname)) if ((fst = getfsspec(ent->f_mntfromname)))
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno); printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
else if (fst = getfsfile(ent->f_mntonname)) else if ((fst = getfsfile(ent->f_mntonname)))
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno); printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
else if (ent->f_type == MOUNT_UFS) else if (ent->f_type == MOUNT_UFS)
printf("\t1 1\n"); printf("\t1 1\n");

View File

@ -32,13 +32,18 @@
*/ */
#ifndef lint #ifndef lint
static char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1993, 1994\n\ "@(#) Copyright (c) 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n"; The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#ifndef lint #ifndef lint
#if 0
static char sccsid[] = "@(#)mount_ufs.c 8.4 (Berkeley) 4/26/95"; static char sccsid[] = "@(#)mount_ufs.c 8.4 (Berkeley) 4/26/95";
#else
static const char rcsid[] =
"$Id$";
#endif
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -53,9 +58,10 @@ static char sccsid[] = "@(#)mount_ufs.c 8.4 (Berkeley) 4/26/95";
#include <ufs/ufs/ufsmount.h> #include <ufs/ufs/ufsmount.h>
#include "extern.h"
#include "mntopts.h" #include "mntopts.h"
void ufs_usage __P((void)); static void ufs_usage __P((void));
static struct mntopt mopts[] = { static struct mntopt mopts[] = {
MOPT_STDOPTS, MOPT_STDOPTS,
@ -143,7 +149,7 @@ mount_ufs(argc, argv)
return (0); return (0);
} }
void static void
ufs_usage() ufs_usage()
{ {
(void)fprintf(stderr, "usage: mount_ufs [-o options] special node\n"); (void)fprintf(stderr, "usage: mount_ufs [-o options] special node\n");

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 1995 * Copyright (c) 1995
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
@ -32,15 +32,21 @@
*/ */
#ifndef lint #ifndef lint
#if 0
static char sccsid[] = "@(#)vfslist.c 8.1 (Berkeley) 5/8/95"; static char sccsid[] = "@(#)vfslist.c 8.1 (Berkeley) 5/8/95";
#else
static const char rcsid[] =
"$Id$";
#endif
#endif /* not lint */ #endif /* not lint */
#include <err.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
int checkvfsname __P((const char *, const char **)); #include "extern.h"
const char **makevfslist __P((char *));
static int skipvfs; static int skipvfs;
int int

View File

@ -1,9 +1,11 @@
# @(#)Makefile 8.6 (Berkeley) 5/8/95 # @(#)Makefile 8.6 (Berkeley) 5/8/95
# $Id$
PROG= mount PROG= mount
SRCS= mount.c mount_ufs.c getmntopts.c vfslist.c SRCS= mount.c mount_ufs.c getmntopts.c vfslist.c
MAN8= mount.8 MAN8= mount.8
# We do NOT install the getmntopts.3 man page. # We do NOT install the getmntopts.3 man page.
CFLAGS+= -D_NEW_VFSCONF CFLAGS+= -D_NEW_VFSCONF
NOSHARED= yes
.include <bsd.prog.mk> .include <bsd.prog.mk>

View File

@ -32,7 +32,12 @@
*/ */
#ifndef lint #ifndef lint
#if 0
static char sccsid[] = "@(#)getmntopts.c 8.3 (Berkeley) 3/29/95"; static char sccsid[] = "@(#)getmntopts.c 8.3 (Berkeley) 3/29/95";
#else
static const char rcsid[] =
"$Id$";
#endif
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -44,6 +49,7 @@ static char sccsid[] = "@(#)getmntopts.c 8.3 (Berkeley) 3/29/95";
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "extern.h"
#include "mntopts.h" #include "mntopts.h"
int getmnt_silent = 0; int getmnt_silent = 0;

View File

@ -31,6 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)mntopts.h 8.7 (Berkeley) 3/29/95 * @(#)mntopts.h 8.7 (Berkeley) 3/29/95
* $Id$
*/ */
struct mntopt { struct mntopt {
@ -77,6 +78,3 @@ struct mntopt {
MOPT_NOSUID, \ MOPT_NOSUID, \
MOPT_RDONLY, \ MOPT_RDONLY, \
MOPT_UNION MOPT_UNION
void getmntopts __P((const char *, const struct mntopt *, int *, int *));
extern int getmnt_silent;

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" @(#)mount.8 8.8 (Berkeley) 6/16/94 .\" @(#)mount.8 8.8 (Berkeley) 6/16/94
.\" $Id: mount.8,v 1.16 1997/08/24 02:27:08 steve Exp $ .\" $Id: mount.8,v 1.17 1997/08/24 17:51:12 joerg Exp $
.\" .\"
.Dd June 16, 1994 .Dd June 16, 1994
.Dt MOUNT 8 .Dt MOUNT 8
@ -79,9 +79,11 @@ The options are as follows:
All the filesystems described in All the filesystems described in
.Xr fstab 5 .Xr fstab 5
are mounted. are mounted.
Exceptions are those marked as ``noauto'' or are excluded by the Exceptions are those marked as ``noauto'', excluded by the
.Fl t .Fl t
flag (see below). flag (see below), or if they are already mounted (except the
root filesystem which is always remounted to preserve
traditional single user mode behavior).
.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 actual system call.
This option is useful in conjunction with the This option is useful in conjunction with the

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 1980, 1989, 1993, 1994 * Copyright (c) 1980, 1989, 1993, 1994
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
@ -32,13 +32,18 @@
*/ */
#ifndef lint #ifndef lint
static char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1980, 1989, 1993, 1994\n\ "@(#) Copyright (c) 1980, 1989, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n"; The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#ifndef lint #ifndef lint
#if 0
static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95"; static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95";
#else
static const char rcsid[] =
"$Id$";
#endif
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -56,17 +61,17 @@ static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95";
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include "extern.h"
#include "pathnames.h" #include "pathnames.h"
int debug, fstab_style, verbose; int debug, fstab_style, verbose;
int checkvfsname __P((const char *, const char **));
char *catopt __P((char *, const char *)); char *catopt __P((char *, const char *));
struct statfs struct statfs
*getmntpt __P((const char *)); *getmntpt __P((const char *));
int hasopt __P((const char *, const char *)); int hasopt __P((const char *, const char *));
const char int ismounted __P((struct fstab *, struct statfs *, int));
**makevfslist __P((char *)); int isremountable __P((const char *));
void mangle __P((char *, int *, const char **)); void mangle __P((char *, int *, const char **));
int mountfs __P((const char *, const char *, const char *, int mountfs __P((const char *, const char *, const char *,
int, const char *, const char *)); int, const char *, const char *));
@ -74,9 +79,6 @@ void prmount __P((struct statfs *));
void putfsent __P((const struct statfs *)); void putfsent __P((const 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;
@ -96,6 +98,17 @@ static struct opt {
{ NULL } { NULL }
}; };
/*
* List of VFS types that can be remounted without becoming mounted on top
* of each other.
* XXX Is this list correct?
*/
static const char *
remountable_fs_names[] = {
"ufs", "ffs", "lfs", "ext2fs",
0
};
int int
main(argc, argv) main(argc, argv)
int argc; int argc;
@ -165,7 +178,9 @@ main(argc, argv)
rval = 0; rval = 0;
switch (argc) { switch (argc) {
case 0: case 0:
if (all) if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
err(1, "getmntinfo");
if (all) {
while ((fs = getfsent()) != NULL) { while ((fs = getfsent()) != NULL) {
if (BADTYPE(fs->fs_type)) if (BADTYPE(fs->fs_type))
continue; continue;
@ -173,22 +188,20 @@ main(argc, argv)
continue; continue;
if (hasopt(fs->fs_mntops, "noauto")) if (hasopt(fs->fs_mntops, "noauto"))
continue; continue;
if (ismounted(fs, mntbuf, mntsize))
continue;
if (mountfs(fs->fs_vfstype, fs->fs_spec, if (mountfs(fs->fs_vfstype, fs->fs_spec,
fs->fs_file, init_flags, options, fs->fs_file, init_flags, options,
fs->fs_mntops)) fs->fs_mntops))
rval = 1; rval = 1;
} }
else if (fstab_style) { } else if (fstab_style) {
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
err(1, "getmntinfo");
for (i = 0; i < mntsize; i++) { for (i = 0; i < mntsize; i++) {
if (checkvfsname(mntbuf[i].f_fstypename, vfslist)) if (checkvfsname(mntbuf[i].f_fstypename, vfslist))
continue; continue;
putfsent(&mntbuf[i]); putfsent(&mntbuf[i]);
} }
} else { } else {
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
err(1, "getmntinfo");
for (i = 0; i < mntsize; i++) { for (i = 0; i < mntsize; i++) {
if (checkvfsname(mntbuf[i].f_fstypename, if (checkvfsname(mntbuf[i].f_fstypename,
vfslist)) vfslist))
@ -246,7 +259,7 @@ main(argc, argv)
*/ */
if (rval == 0 && getuid() == 0 && if (rval == 0 && getuid() == 0 &&
(mountdfp = fopen(_PATH_MOUNTDPID, "r")) != NULL) { (mountdfp = fopen(_PATH_MOUNTDPID, "r")) != NULL) {
if (fscanf(mountdfp, "%ld", &pid) == 1 && if (fscanf(mountdfp, "%d", &pid) == 1 &&
pid > 0 && kill(pid, SIGHUP) == -1 && errno != ESRCH) pid > 0 && kill(pid, SIGHUP) == -1 && errno != ESRCH)
err(1, "signal mountd"); err(1, "signal mountd");
(void)fclose(mountdfp); (void)fclose(mountdfp);
@ -255,6 +268,38 @@ main(argc, argv)
exit(rval); exit(rval);
} }
int
ismounted(fs, mntbuf, mntsize)
struct fstab *fs;
struct statfs *mntbuf;
int mntsize;
{
int i;
if (fs->fs_file[0] == '/' && fs->fs_file[1] == '\0')
/* the root file system can always be remounted */
return (0);
for (i = mntsize - 1; i >= 0; --i)
if (strcmp(fs->fs_file, mntbuf[i].f_mntonname) == 0 &&
(!isremountable(fs->fs_vfstype) ||
strcmp(fs->fs_spec, mntbuf[i].f_mntfromname) == 0))
return (1);
return (0);
}
int
isremountable(vfsname)
const char *vfsname;
{
const char **cp;
for (cp = remountable_fs_names; *cp; cp++)
if (strcmp(*cp, vfsname) == 0)
return (1);
return (0);
}
int int
hasopt(mntopts, option) hasopt(mntopts, option)
const char *mntopts, *option; const char *mntopts, *option;
@ -298,6 +343,11 @@ mountfs(vfstype, spec, name, flags, options, mntopts)
int argc, i, status; int argc, i, status;
char *optbuf, execname[MAXPATHLEN + 1], mntpath[MAXPATHLEN]; char *optbuf, execname[MAXPATHLEN + 1], mntpath[MAXPATHLEN];
#if __GNUC__
(void)&optbuf;
(void)&name;
#endif
if (realpath(name, mntpath) != NULL && stat(mntpath, &sb) == 0) { if (realpath(name, mntpath) != NULL && stat(mntpath, &sb) == 0) {
if (!S_ISDIR(sb.st_mode)) { if (!S_ISDIR(sb.st_mode)) {
warnx("%s: Not a directory", mntpath); warnx("%s: Not a directory", mntpath);
@ -546,9 +596,9 @@ putfsent(ent)
if (ent->f_flags & MNT_NOATIME) if (ent->f_flags & MNT_NOATIME)
printf(",noatime"); printf(",noatime");
if (fst = getfsspec(ent->f_mntfromname)) if ((fst = getfsspec(ent->f_mntfromname)))
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno); printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
else if (fst = getfsfile(ent->f_mntonname)) else if ((fst = getfsfile(ent->f_mntonname)))
printf("\t%u %u\n", fst->fs_freq, fst->fs_passno); printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
else if (ent->f_type == MOUNT_UFS) else if (ent->f_type == MOUNT_UFS)
printf("\t1 1\n"); printf("\t1 1\n");

View File

@ -32,13 +32,18 @@
*/ */
#ifndef lint #ifndef lint
static char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1993, 1994\n\ "@(#) Copyright (c) 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n"; The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#ifndef lint #ifndef lint
#if 0
static char sccsid[] = "@(#)mount_ufs.c 8.4 (Berkeley) 4/26/95"; static char sccsid[] = "@(#)mount_ufs.c 8.4 (Berkeley) 4/26/95";
#else
static const char rcsid[] =
"$Id$";
#endif
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -53,9 +58,10 @@ static char sccsid[] = "@(#)mount_ufs.c 8.4 (Berkeley) 4/26/95";
#include <ufs/ufs/ufsmount.h> #include <ufs/ufs/ufsmount.h>
#include "extern.h"
#include "mntopts.h" #include "mntopts.h"
void ufs_usage __P((void)); static void ufs_usage __P((void));
static struct mntopt mopts[] = { static struct mntopt mopts[] = {
MOPT_STDOPTS, MOPT_STDOPTS,
@ -143,7 +149,7 @@ mount_ufs(argc, argv)
return (0); return (0);
} }
void static void
ufs_usage() ufs_usage()
{ {
(void)fprintf(stderr, "usage: mount_ufs [-o options] special node\n"); (void)fprintf(stderr, "usage: mount_ufs [-o options] special node\n");

View File

@ -1,4 +1,4 @@
/* /*-
* Copyright (c) 1995 * Copyright (c) 1995
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
@ -32,15 +32,21 @@
*/ */
#ifndef lint #ifndef lint
#if 0
static char sccsid[] = "@(#)vfslist.c 8.1 (Berkeley) 5/8/95"; static char sccsid[] = "@(#)vfslist.c 8.1 (Berkeley) 5/8/95";
#else
static const char rcsid[] =
"$Id$";
#endif
#endif /* not lint */ #endif /* not lint */
#include <err.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
int checkvfsname __P((const char *, const char **)); #include "extern.h"
const char **makevfslist __P((char *));
static int skipvfs; static int skipvfs;
int int