Get rid of the last vestiges of the old MOUNT_* constants in the
mount_* programs. While we're at it, collapse the four now-identical mount programs for devfs, fdesc, kernfs, and procfs into links to a new mount_std(8) which can mount any really generic filesystem such as these when called with the appropriate argv[0]. Also, convert the mount programs to use sysexits.h.
This commit is contained in:
parent
49968bb8cf
commit
5e074e31a2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15770
@ -4,8 +4,8 @@
|
||||
|
||||
SUBDIR= adjkerntz badsect ccdconfig clri disklabel dmesg dset dump dumpfs \
|
||||
dumplfs dumpon fsck fsdb ifconfig init ipfw md5 mknod modload \
|
||||
modunload mount mount_cd9660 mount_devfs mount_ext2fs mount_fdesc \
|
||||
mount_kernfs mount_lfs mount_nfs mount_null mount_portal mount_procfs \
|
||||
modunload mount mount_cd9660 mount_ext2fs \
|
||||
mount_lfs mount_nfs mount_null mount_portal mount_std \
|
||||
mount_umap mount_union mountd newfs newlfs nfsd nfsiod \
|
||||
nologin ping quotacheck rdisc reboot restore route savecore scsi \
|
||||
scsiformat shutdown slattach startslip swapon tunefs umount
|
||||
|
@ -45,7 +45,11 @@ static char copyright[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/*
|
||||
static char sccsid[] = "@(#)mount_cd9660.c 8.4 (Berkeley) 3/27/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -56,6 +60,7 @@ static char sccsid[] = "@(#)mount_cd9660.c 8.4 (Berkeley) 3/27/94";
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
@ -124,14 +129,16 @@ main(argc, argv)
|
||||
vfc = getvfsbyname("cd9660");
|
||||
if(!vfc && vfsisloadable("cd9660")) {
|
||||
if(vfsload("cd9660")) {
|
||||
err(1, "vfsload(cd9660)");
|
||||
err(EX_OSERR, "vfsload(cd9660)");
|
||||
}
|
||||
endvfsent(); /* flush cache */
|
||||
vfc = getvfsbyname("cd9660");
|
||||
}
|
||||
if (!vfc)
|
||||
errx(EX_OSERR, "cd9660 filesystem not available");
|
||||
|
||||
if (mount(vfc ? vfc->vfc_index : MOUNT_CD9660, dir, mntflags, &args) < 0)
|
||||
err(1, "%s", dev);
|
||||
if (mount(vfc->vfc_index, dir, mntflags, &args) < 0)
|
||||
err(EX_OSERR, "%s", dev);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -140,5 +147,5 @@ usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_cd9660 [-egrt] [-o options] special node\n");
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
# @(#)Makefile 8.2 (Berkeley) 3/27/94
|
||||
|
||||
PROG= mount_devfs
|
||||
SRCS= mount_devfs.c getmntopts.c
|
||||
MAN8= mount_devfs.8
|
||||
|
||||
MOUNT= ${.CURDIR}/../mount
|
||||
CFLAGS+= -I${MOUNT}
|
||||
.PATH: ${MOUNT}
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1992 Jan-Simon Pendry
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Jan-Simon Pendry.
|
||||
*
|
||||
* 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
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1992, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)mount_devfs.c 8.2 (Berkeley) 3/27/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
|
||||
struct mntopt mopts[] = {
|
||||
MOPT_STDOPTS,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
void usage __P((void));
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int ch, mntflags;
|
||||
struct vfsconf *vfc;
|
||||
|
||||
mntflags = 0;
|
||||
while ((ch = getopt(argc, argv, "o:")) != EOF)
|
||||
switch (ch) {
|
||||
case 'o':
|
||||
getmntopts(optarg, mopts, &mntflags, 0);
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc != 2)
|
||||
usage();
|
||||
|
||||
vfc = getvfsbyname("devfs");
|
||||
if(!vfc && vfsisloadable("devfs")) {
|
||||
if(vfsload("devfs")) {
|
||||
err(1, "vfsload(devfs)");
|
||||
}
|
||||
endvfsent();
|
||||
vfc = getvfsbyname("devfs");
|
||||
}
|
||||
|
||||
if (mount(vfc ? vfc->vfc_index : MOUNT_DEVFS, argv[1], mntflags, NULL))
|
||||
err(1, NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_devfs [-o options] devfs mount_point\n");
|
||||
exit(1);
|
||||
}
|
@ -38,7 +38,11 @@ static char copyright[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/*
|
||||
static char sccsid[] = "@(#)mount_lfs.c 8.3 (Berkeley) 3/27/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -48,6 +52,7 @@ static char sccsid[] = "@(#)mount_lfs.c 8.3 (Berkeley) 3/27/94";
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
@ -58,9 +63,7 @@ struct mntopt mopts[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
void usage __P((void));
|
||||
|
||||
int short_rds, cleaner_debug;
|
||||
static __dead void usage __P((void)) __dead2;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@ -68,25 +71,17 @@ main(argc, argv)
|
||||
char *argv[];
|
||||
{
|
||||
struct ufs_args args;
|
||||
int ch, mntflags, noclean;
|
||||
int ch, mntflags;
|
||||
char *fs_name, *options;
|
||||
struct vfsconf *vfc;
|
||||
|
||||
options = NULL;
|
||||
mntflags = noclean = 0;
|
||||
while ((ch = getopt(argc, argv, "dno:s")) != EOF)
|
||||
mntflags = 0;
|
||||
while ((ch = getopt(argc, argv, "o:")) != EOF)
|
||||
switch (ch) {
|
||||
case 'd':
|
||||
cleaner_debug = 1;
|
||||
break;
|
||||
case 'n':
|
||||
noclean = 1;
|
||||
break;
|
||||
case 'o':
|
||||
getmntopts(optarg, mopts, &mntflags);
|
||||
break;
|
||||
case 's':
|
||||
short_rds = 1;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
@ -106,11 +101,20 @@ main(argc, argv)
|
||||
args.export.ex_flags = MNT_EXRDONLY;
|
||||
else
|
||||
args.export.ex_flags = 0;
|
||||
if (mount(MOUNT_EXT2FS, fs_name, mntflags, &args))
|
||||
err(1, NULL);
|
||||
|
||||
/* NOTREACHED */
|
||||
vfc = getvfsbyname("ext2fs");
|
||||
if(!vfc && vfsisloadable("ext2fs")) {
|
||||
if(vfsload("ext2fs")) {
|
||||
err(EX_OSERR, "vfsload(ext2fs)");
|
||||
}
|
||||
endvfsent(); /* flush cache */
|
||||
vfc = getvfsbyname("ext2fs");
|
||||
}
|
||||
if (!vfc)
|
||||
errx(EX_OSERR, "ext2fs filesystem not available");
|
||||
|
||||
if (mount(vfc->vfc_index, fs_name, mntflags, &args) < 0)
|
||||
err(EX_OSERR, "%s", args.fspec);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -119,5 +123,5 @@ usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_ext2fs [-o options] special node\n");
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
# @(#)Makefile 8.2 (Berkeley) 3/27/94
|
||||
|
||||
PROG= mount_fdesc
|
||||
SRCS= mount_fdesc.c getmntopts.c
|
||||
MAN8= mount_fdesc.8
|
||||
|
||||
MOUNT= ${.CURDIR}/../mount
|
||||
CFLAGS+= -I${MOUNT}
|
||||
.PATH: ${MOUNT}
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -1,109 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1992 Jan-Simon Pendry
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Jan-Simon Pendry.
|
||||
*
|
||||
* 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
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1992, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)mount_fdesc.c 8.2 (Berkeley) 3/27/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
|
||||
struct mntopt mopts[] = {
|
||||
MOPT_STDOPTS,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
void usage __P((void));
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int ch, mntflags;
|
||||
struct vfsconf *vfc;
|
||||
|
||||
mntflags = 0;
|
||||
while ((ch = getopt(argc, argv, "o:")) != EOF)
|
||||
switch (ch) {
|
||||
case 'o':
|
||||
getmntopts(optarg, mopts, &mntflags, 0);
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc != 2)
|
||||
usage();
|
||||
|
||||
vfc = getvfsbyname("fdesc");
|
||||
if(!vfc && vfsisloadable("fdesc")) {
|
||||
if(vfsload("fdesc"))
|
||||
err(1, "vfsload(fdesc)");
|
||||
endvfsent(); /* flush cache */
|
||||
vfc = getvfsbyname("fdesc");
|
||||
}
|
||||
|
||||
if (mount(vfc ? vfc->vfc_index : MOUNT_FDESC, argv[1], mntflags, NULL))
|
||||
err(1, NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_fdesc [-o options] fdesc mount_point\n");
|
||||
exit(1);
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
# @(#)Makefile 8.2 (Berkeley) 3/27/94
|
||||
|
||||
PROG= mount_kernfs
|
||||
SRCS= mount_kernfs.c getmntopts.c
|
||||
MAN8= mount_kernfs.8
|
||||
|
||||
MOUNT= ${.CURDIR}/../mount
|
||||
CFLAGS+= -I${MOUNT}
|
||||
.PATH: ${MOUNT}
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -38,7 +38,11 @@ static char copyright[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/*
|
||||
static char sccsid[] = "@(#)mount_lfs.c 8.3 (Berkeley) 3/27/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -48,21 +52,20 @@ static char sccsid[] = "@(#)mount_lfs.c 8.3 (Berkeley) 3/27/94";
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
#include "pathnames.h"
|
||||
|
||||
struct mntopt mopts[] = {
|
||||
static struct mntopt mopts[] = {
|
||||
MOPT_STDOPTS,
|
||||
MOPT_UPDATE,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
void usage __P((void));
|
||||
void invoke_cleaner __P((char *));
|
||||
|
||||
int short_rds, cleaner_debug;
|
||||
static __dead void usage __P((void)) __dead2;
|
||||
static void invoke_cleaner __P((char *, int, int));
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@ -73,9 +76,11 @@ main(argc, argv)
|
||||
int ch, mntflags, noclean;
|
||||
char *fs_name, *options;
|
||||
struct vfsconf *vfc;
|
||||
int short_rds, cleaner_debug;
|
||||
|
||||
|
||||
options = NULL;
|
||||
mntflags = noclean = 0;
|
||||
mntflags = noclean = short_rds = cleaner_debug = 0;
|
||||
while ((ch = getopt(argc, argv, "dno:s")) != EOF)
|
||||
switch (ch) {
|
||||
case 'd':
|
||||
@ -113,24 +118,28 @@ main(argc, argv)
|
||||
vfc = getvfsbyname("lfs");
|
||||
if(!vfc && vfsisloadable("lfs")) {
|
||||
if(vfsload("lfs"))
|
||||
err(1, "vfsload(lfs)");
|
||||
err(EX_OSERR, "vfsload(lfs)");
|
||||
endvfsent(); /* flush cache */
|
||||
vfc = getvfsbyname("lfs");
|
||||
}
|
||||
if (!vfc)
|
||||
errx(EX_OSERR, "lfs filesystem is not available");
|
||||
|
||||
if (mount(vfc ? vfc->vfc_index : MOUNT_LFS, fs_name, mntflags, &args))
|
||||
err(1, NULL);
|
||||
err(EX_OSERR, args.fspec);
|
||||
|
||||
if (!noclean)
|
||||
invoke_cleaner(fs_name);
|
||||
invoke_cleaner(fs_name, short_rds, cleaner_debug);
|
||||
/* NOTREACHED */
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
invoke_cleaner(name)
|
||||
static void
|
||||
invoke_cleaner(name, short_rds, cleaner_debug)
|
||||
char *name;
|
||||
int short_rds;
|
||||
int cleaner_debug;
|
||||
{
|
||||
char *args[6], **ap = args;
|
||||
|
||||
@ -144,13 +153,13 @@ invoke_cleaner(name)
|
||||
*ap = NULL;
|
||||
|
||||
execv(args[0], args);
|
||||
err(1, "exec %s", _PATH_LFS_CLEANERD);
|
||||
err(EX_OSERR, "exec %s", _PATH_LFS_CLEANERD);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_lfs [-dns] [-o options] special node\n");
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
@ -41,7 +41,11 @@ static char copyright[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/*
|
||||
static char sccsid[] = "@(#)mount_nfs.c 8.3 (Berkeley) 3/27/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -82,6 +86,7 @@ static char sccsid[] = "@(#)mount_nfs.c 8.3 (Berkeley) 3/27/94";
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
@ -411,12 +416,14 @@ main(argc, argv)
|
||||
vfc = getvfsbyname("nfs");
|
||||
if(!vfc && vfsisloadable("nfs")) {
|
||||
if(vfsload("nfs"))
|
||||
err(1, "vfsload(nfs)");
|
||||
err(EX_OSERR, "vfsload(nfs)");
|
||||
endvfsent(); /* flush cache */
|
||||
vfc = getvfsbyname("nfs");
|
||||
}
|
||||
if (!vfc)
|
||||
errx(EX_OSERR, "nfs filesystem is not loadable");
|
||||
|
||||
if (mount(vfc ? vfc->vfc_index : MOUNT_NFS, name, mntflags, nfsargsp))
|
||||
if (mount(vfc->vfc_index, name, mntflags, nfsargsp))
|
||||
#else
|
||||
if (mount(MOUNT_NFS, name, mntflags, nfsargsp))
|
||||
#endif
|
||||
|
@ -41,7 +41,11 @@ char copyright[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/*
|
||||
static char sccsid[] = "@(#)mount_null.c 8.5 (Berkeley) 3/27/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -50,9 +54,10 @@ static char sccsid[] = "@(#)mount_null.c 8.5 (Berkeley) 3/27/94";
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
|
||||
@ -62,7 +67,7 @@ struct mntopt mopts[] = {
|
||||
};
|
||||
|
||||
int subdir __P((const char *, const char *));
|
||||
void usage __P((void));
|
||||
static __dead void usage __P((void)) __dead2;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@ -91,10 +96,10 @@ main(argc, argv)
|
||||
usage();
|
||||
|
||||
if (realpath(argv[0], target) == 0)
|
||||
err(1, "%s", target);
|
||||
err(EX_OSERR, "%s", target);
|
||||
|
||||
if (subdir(target, argv[1]) || subdir(argv[1], target))
|
||||
errx(1, "%s (%s) and %s are not distinct paths",
|
||||
errx(EX_USAGE, "%s (%s) and %s are not distinct paths",
|
||||
argv[0], target, argv[1]);
|
||||
|
||||
args.target = target;
|
||||
@ -102,13 +107,15 @@ main(argc, argv)
|
||||
vfc = getvfsbyname("null");
|
||||
if(!vfc && vfsisloadable("null")) {
|
||||
if(vfsload("null"))
|
||||
err(1, "vfsload(null)");
|
||||
err(EX_OSERR, "vfsload(null)");
|
||||
endvfsent(); /* flush cache */
|
||||
vfc = getvfsbyname("null");
|
||||
}
|
||||
if (!vfc)
|
||||
errx(EX_OSERR, "null filesystem is not available");
|
||||
|
||||
if (mount(vfc ? vfc->vfc_index : MOUNT_NULL, argv[1], mntflags, &args))
|
||||
err(1, NULL);
|
||||
if (mount(vfc->vfc_index, argv[1], mntflags, &args))
|
||||
err(EX_OSERR, target);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -129,7 +136,7 @@ subdir(p, dir)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
|
@ -41,7 +41,11 @@ char copyright[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/*
|
||||
static char sccsid[] = "@(#)mount_null.c 8.5 (Berkeley) 3/27/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -50,9 +54,10 @@ static char sccsid[] = "@(#)mount_null.c 8.5 (Berkeley) 3/27/94";
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
|
||||
@ -62,7 +67,7 @@ struct mntopt mopts[] = {
|
||||
};
|
||||
|
||||
int subdir __P((const char *, const char *));
|
||||
void usage __P((void));
|
||||
static __dead void usage __P((void)) __dead2;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@ -91,10 +96,10 @@ main(argc, argv)
|
||||
usage();
|
||||
|
||||
if (realpath(argv[0], target) == 0)
|
||||
err(1, "%s", target);
|
||||
err(EX_OSERR, "%s", target);
|
||||
|
||||
if (subdir(target, argv[1]) || subdir(argv[1], target))
|
||||
errx(1, "%s (%s) and %s are not distinct paths",
|
||||
errx(EX_USAGE, "%s (%s) and %s are not distinct paths",
|
||||
argv[0], target, argv[1]);
|
||||
|
||||
args.target = target;
|
||||
@ -102,13 +107,15 @@ main(argc, argv)
|
||||
vfc = getvfsbyname("null");
|
||||
if(!vfc && vfsisloadable("null")) {
|
||||
if(vfsload("null"))
|
||||
err(1, "vfsload(null)");
|
||||
err(EX_OSERR, "vfsload(null)");
|
||||
endvfsent(); /* flush cache */
|
||||
vfc = getvfsbyname("null");
|
||||
}
|
||||
if (!vfc)
|
||||
errx(EX_OSERR, "null filesystem is not available");
|
||||
|
||||
if (mount(vfc ? vfc->vfc_index : MOUNT_NULL, argv[1], mntflags, &args))
|
||||
err(1, NULL);
|
||||
if (mount(vfc->vfc_index, argv[1], mntflags, &args))
|
||||
err(EX_OSERR, target);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -129,7 +136,7 @@ subdir(p, dir)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
|
@ -41,7 +41,11 @@ char copyright[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/*
|
||||
static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -58,6 +62,7 @@ static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
@ -69,7 +74,7 @@ struct mntopt mopts[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static void usage __P((void));
|
||||
static __dead void usage __P((void)) __dead2;
|
||||
|
||||
static sig_atomic_t readcf; /* Set when SIGHUP received */
|
||||
|
||||
@ -144,8 +149,7 @@ main(argc, argv)
|
||||
*/
|
||||
un.sun_family = AF_UNIX;
|
||||
if (sizeof(_PATH_TMPPORTAL) >= sizeof(un.sun_path)) {
|
||||
fprintf(stderr, "mount_portal: portal socket name too long\n");
|
||||
exit(1);
|
||||
errx(EX_SOFTWARE, "portal socket name too long");
|
||||
}
|
||||
strcpy(un.sun_path, _PATH_TMPPORTAL);
|
||||
mktemp(un.sun_path);
|
||||
@ -153,8 +157,7 @@ main(argc, argv)
|
||||
|
||||
so = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (so < 0) {
|
||||
fprintf(stderr, "mount_portal: socket: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
err(EX_OSERR, "socket");
|
||||
}
|
||||
(void) unlink(un.sun_path);
|
||||
if (bind(so, (struct sockaddr *) &un, sizeof(un)) < 0)
|
||||
@ -171,10 +174,12 @@ main(argc, argv)
|
||||
vfc = getvfsbyname("portal");
|
||||
if(!vfc && vfsisloadable("portal")) {
|
||||
if(vfsload("portal"))
|
||||
err(1, "vfsload(portal)");
|
||||
err(EX_OSERR, "vfsload(portal)");
|
||||
endvfsent(); /* flush cache */
|
||||
vfc = getvfsbyname("portal");
|
||||
}
|
||||
if (!vfc)
|
||||
errx(EX_OSERR, "portal filesystem is not available");
|
||||
|
||||
rc = mount(vfc ? vfc->vfc_index : MOUNT_PORTAL, mountpt, mntflags, &args);
|
||||
if (rc < 0)
|
||||
@ -233,7 +238,7 @@ main(argc, argv)
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
syslog(LOG_ERR, "select: %s", strerror(errno));
|
||||
exit(1);
|
||||
exit(EX_OSERR);
|
||||
}
|
||||
if (rc == 0)
|
||||
break;
|
||||
@ -247,7 +252,7 @@ main(argc, argv)
|
||||
break;
|
||||
if (errno != EINTR) {
|
||||
syslog(LOG_ERR, "accept: %s", strerror(errno));
|
||||
exit(1);
|
||||
exit(EX_OSERR);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -282,5 +287,5 @@ usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_portal [-o options] config mount-point\n");
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
@ -41,7 +41,11 @@ char copyright[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/*
|
||||
static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -58,6 +62,7 @@ static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
@ -69,7 +74,7 @@ struct mntopt mopts[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static void usage __P((void));
|
||||
static __dead void usage __P((void)) __dead2;
|
||||
|
||||
static sig_atomic_t readcf; /* Set when SIGHUP received */
|
||||
|
||||
@ -144,8 +149,7 @@ main(argc, argv)
|
||||
*/
|
||||
un.sun_family = AF_UNIX;
|
||||
if (sizeof(_PATH_TMPPORTAL) >= sizeof(un.sun_path)) {
|
||||
fprintf(stderr, "mount_portal: portal socket name too long\n");
|
||||
exit(1);
|
||||
errx(EX_SOFTWARE, "portal socket name too long");
|
||||
}
|
||||
strcpy(un.sun_path, _PATH_TMPPORTAL);
|
||||
mktemp(un.sun_path);
|
||||
@ -153,8 +157,7 @@ main(argc, argv)
|
||||
|
||||
so = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (so < 0) {
|
||||
fprintf(stderr, "mount_portal: socket: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
err(EX_OSERR, "socket");
|
||||
}
|
||||
(void) unlink(un.sun_path);
|
||||
if (bind(so, (struct sockaddr *) &un, sizeof(un)) < 0)
|
||||
@ -171,10 +174,12 @@ main(argc, argv)
|
||||
vfc = getvfsbyname("portal");
|
||||
if(!vfc && vfsisloadable("portal")) {
|
||||
if(vfsload("portal"))
|
||||
err(1, "vfsload(portal)");
|
||||
err(EX_OSERR, "vfsload(portal)");
|
||||
endvfsent(); /* flush cache */
|
||||
vfc = getvfsbyname("portal");
|
||||
}
|
||||
if (!vfc)
|
||||
errx(EX_OSERR, "portal filesystem is not available");
|
||||
|
||||
rc = mount(vfc ? vfc->vfc_index : MOUNT_PORTAL, mountpt, mntflags, &args);
|
||||
if (rc < 0)
|
||||
@ -233,7 +238,7 @@ main(argc, argv)
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
syslog(LOG_ERR, "select: %s", strerror(errno));
|
||||
exit(1);
|
||||
exit(EX_OSERR);
|
||||
}
|
||||
if (rc == 0)
|
||||
break;
|
||||
@ -247,7 +252,7 @@ main(argc, argv)
|
||||
break;
|
||||
if (errno != EINTR) {
|
||||
syslog(LOG_ERR, "accept: %s", strerror(errno));
|
||||
exit(1);
|
||||
exit(EX_OSERR);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -282,5 +287,5 @@ usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_portal [-o options] config mount-point\n");
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
# @(#)Makefile 8.4 (Berkeley) 3/27/94
|
||||
|
||||
PROG= mount_procfs
|
||||
SRCS= mount_procfs.c getmntopts.c
|
||||
MAN8= mount_procfs.8
|
||||
|
||||
MOUNT= ${.CURDIR}/../mount
|
||||
CFLAGS+= -I${MOUNT}
|
||||
.PATH: ${MOUNT}
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -1,109 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1992, 1993 Jan-Simon Pendry
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Jan-Simon Pendry.
|
||||
*
|
||||
* 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
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1992, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)mount_procfs.c 8.3 (Berkeley) 3/27/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
|
||||
struct mntopt mopts[] = {
|
||||
MOPT_STDOPTS,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
void usage __P((void));
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int ch, mntflags;
|
||||
struct vfsconf *vfc;
|
||||
|
||||
mntflags = 0;
|
||||
while ((ch = getopt(argc, argv, "o:")) != EOF)
|
||||
switch (ch) {
|
||||
case 'o':
|
||||
getmntopts(optarg, mopts, &mntflags, 0);
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc != 2)
|
||||
usage();
|
||||
|
||||
vfc = getvfsbyname("procfs");
|
||||
if(!vfc && vfsisloadable("procfs")) {
|
||||
if(vfsload("procfs"))
|
||||
err(1, "vfsload(procfs)");
|
||||
endvfsent(); /* flush cache */
|
||||
vfc = getvfsbyname("procfs");
|
||||
}
|
||||
|
||||
if (mount(vfc ? vfc->vfc_index : MOUNT_PROCFS, argv[1], mntflags, NULL))
|
||||
err(1, NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_procfs [-o options] /proc mount_point\n");
|
||||
exit(1);
|
||||
}
|
16
sbin/mount_std/Makefile
Normal file
16
sbin/mount_std/Makefile
Normal file
@ -0,0 +1,16 @@
|
||||
# @(#)Makefile 8.2 (Berkeley) 3/27/94
|
||||
|
||||
PROG= mount_std
|
||||
SRCS= mount_std.c getmntopts.c
|
||||
MAN8= mount_std.8 mount_devfs.8 mount_fdesc.8 mount_kernfs.8 mount_procfs.8
|
||||
|
||||
MOUNT= ${.CURDIR}/../mount
|
||||
CFLAGS+= -I${MOUNT}
|
||||
.PATH: ${MOUNT}
|
||||
|
||||
LINKS= ${BINDIR}/mount_std ${BINDIR}/mount_devfs \
|
||||
${BINDIR}/mount_std ${BINDIR}/mount_fdesc \
|
||||
${BINDIR}/mount_std ${BINDIR}/mount_kernfs \
|
||||
${BINDIR}/mount_std ${BINDIR}/mount_procfs
|
||||
|
||||
.include <bsd.prog.mk>
|
134
sbin/mount_std/mount_std.8
Normal file
134
sbin/mount_std/mount_std.8
Normal file
@ -0,0 +1,134 @@
|
||||
.\"
|
||||
.\" Copyright (c) 1992, 1993, 1994
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" This code is derived from software donated to Berkeley by
|
||||
.\" Jan-Simon Pendry.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.\"
|
||||
.Dd May 13, 1996
|
||||
.Dt MOUNT_STD 8
|
||||
.Os FreeBSD 2.2
|
||||
.Sh NAME
|
||||
.Nm mount_std
|
||||
.Nd mount ``standard'' filesystems
|
||||
.Sh SYNOPSIS
|
||||
.Nm mount_ Ns Ar fsname
|
||||
.Op Fl o Ar options
|
||||
.Ar "devfs"
|
||||
.Ar mount_point
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
command is a generic mechanism for attaching ``standard'' filesystems to
|
||||
the filesystem. A ``standard'' filesystem is one which:
|
||||
.Bl -enum -offset indent
|
||||
.It
|
||||
accepts only the standard
|
||||
.Fl o
|
||||
options
|
||||
.Dq ro
|
||||
.Pq ``rdonly'' ,
|
||||
.Dq rw ,
|
||||
.Dq nodev ,
|
||||
.Dq noexec ,
|
||||
.Dq nosuid ,
|
||||
and
|
||||
.Dq union .
|
||||
.It
|
||||
has a kernel filesystem module name the same as its user-visible name.
|
||||
.It
|
||||
requires no other special processing on the part of the
|
||||
.Nm mount_std
|
||||
command.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
command examines its zeroth command-line argument (the name by which
|
||||
it was called) to determine the type of filesystem to be mounted. If
|
||||
it is called by a name which does not end in
|
||||
.Dq Li _ Ns Ar fsname ,
|
||||
.Nm
|
||||
will issue a diagnostic and return an error. The
|
||||
.Nm
|
||||
command is normally installed with appropriate links to commands for
|
||||
the distributed filesystems which can be mounted in this way;
|
||||
for information on the function of each filesystem, see the manual page
|
||||
for that specific
|
||||
.Nm mount_ Ns Ar fsname
|
||||
command.
|
||||
.Sh DIAGNOSTICS
|
||||
.Bl -diag
|
||||
.It argv[0] must end in _fsname
|
||||
The
|
||||
.Nm mount_std
|
||||
command was called with a zero'th argument which does not specify a
|
||||
filesystem type to be mounted.
|
||||
.It vfsload(%s)
|
||||
.Nm
|
||||
was unable to load a kernel module implementing the %s filesystem
|
||||
type.
|
||||
.It %s filesystem not available
|
||||
The specified filesystem type was not present in the kernel and no
|
||||
loadable module for it was found.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr mount 2 ,
|
||||
.Xr unmount 2 ,
|
||||
.Xr getvfsbyname 3 ,
|
||||
.Xr fstab 5 ,
|
||||
.Xr mount 8 ,
|
||||
.Xr mount_devfs 8 ,
|
||||
.Xr mount_fdesc 8 ,
|
||||
.Xr mount_kernfs 8 ,
|
||||
.Xr mount_procfs 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm mount_std
|
||||
utility first appeared in
|
||||
.Fx 2.2 .
|
||||
Loadable filesystem modules first appeared in
|
||||
.Fx 2.0 .
|
||||
The
|
||||
.Dq fdesc ,
|
||||
.Dq kernfs ,
|
||||
and
|
||||
.Dq procfs
|
||||
filesystem types first appeared in
|
||||
.Fx 2.0 ;
|
||||
the
|
||||
.Dq devfs
|
||||
filesystem type first appeared in
|
||||
.Fx 2.2 .
|
||||
|
@ -42,26 +42,29 @@ char copyright[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)mount_kernfs.c 8.2 (Berkeley) 3/27/94";
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
|
||||
struct mntopt mopts[] = {
|
||||
static struct mntopt mopts[] = {
|
||||
MOPT_STDOPTS,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
void usage __P((void));
|
||||
static __dead void usage __P((void)) __dead2;
|
||||
static const char *fsname;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@ -71,6 +74,12 @@ main(argc, argv)
|
||||
int ch, mntflags;
|
||||
struct vfsconf *vfc;
|
||||
|
||||
fsname = strrchr(argv[0], '_');
|
||||
if (!fsname || strcmp(fsname, "_std") == 0)
|
||||
errx(EX_USAGE, "argv[0] must end in _fsname");
|
||||
|
||||
fsname++;
|
||||
|
||||
mntflags = 0;
|
||||
while ((ch = getopt(argc, argv, "o:")) != EOF)
|
||||
switch (ch) {
|
||||
@ -87,17 +96,19 @@ main(argc, argv)
|
||||
if (argc != 2)
|
||||
usage();
|
||||
|
||||
vfc = getvfsbyname("kernfs");
|
||||
if(!vfc && vfsisloadable("kernfs")) {
|
||||
if(vfsload("kernfs")) {
|
||||
err(1, "vfsload(kernfs)");
|
||||
vfc = getvfsbyname(fsname);
|
||||
if(!vfc && vfsisloadable(fsname)) {
|
||||
if(vfsload(fsname)) {
|
||||
err(EX_OSERR, "vfsload(%s)", fsname);
|
||||
}
|
||||
endvfsent();
|
||||
vfc = getvfsbyname("kernfs");
|
||||
vfc = getvfsbyname(fsname);
|
||||
}
|
||||
if (!vfc)
|
||||
errx(EX_OSERR, "%s filesystem not available", fsname);
|
||||
|
||||
if (mount(vfc ? vfc->vfc_index : MOUNT_KERNFS, argv[1], mntflags, NULL))
|
||||
err(1, NULL);
|
||||
if (mount(vfc->vfc_index, argv[1], mntflags, NULL))
|
||||
err(EX_OSERR, NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -105,6 +116,7 @@ void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_kernfs [-o options] /kern mount_point\n");
|
||||
exit(1);
|
||||
"usage: mount_%s [-o options] what_to_mount mount_point\n",
|
||||
fsname);
|
||||
exit(EX_USAGE);
|
||||
}
|
@ -41,7 +41,11 @@ char copyright[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/*
|
||||
static char sccsid[] = "@(#)mount_umap.c 8.3 (Berkeley) 3/27/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -54,6 +58,7 @@ static char sccsid[] = "@(#)mount_umap.c 8.3 (Berkeley) 3/27/94";
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
@ -76,12 +81,12 @@ static char sccsid[] = "@(#)mount_umap.c 8.3 (Berkeley) 3/27/94";
|
||||
* will, in turn, call the umap version of mount.
|
||||
*/
|
||||
|
||||
struct mntopt mopts[] = {
|
||||
static struct mntopt mopts[] = {
|
||||
MOPT_STDOPTS,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
void usage __P((void));
|
||||
static __dead void usage __P((void)) __dead2;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@ -125,7 +130,7 @@ main(argc, argv)
|
||||
|
||||
/* Read in uid mapping data. */
|
||||
if ((fp = fopen(mapfile, "r")) == NULL)
|
||||
err(1, "%s%s", mapfile, not);
|
||||
err(EX_NOINPUT, "%s%s", mapfile, not);
|
||||
|
||||
#ifdef MAPSECURITY
|
||||
/*
|
||||
@ -133,20 +138,20 @@ main(argc, argv)
|
||||
* this mapfile, and that the mapfile belongs to root.
|
||||
*/
|
||||
if (fstat(fileno(fp), &statbuf))
|
||||
err(1, "%s%s", mapfile, not);
|
||||
err(EX_OSERR, "%s%s", mapfile, not);
|
||||
if (statbuf.st_mode & S_IWGRP || statbuf.st_mode & S_IWOTH) {
|
||||
strmode(statbuf.st_mode, buf);
|
||||
err(1, "%s: improper write permissions (%s)%s",
|
||||
err(EX_NOPERM, "%s: improper write permissions (%s)%s",
|
||||
mapfile, buf, not);
|
||||
}
|
||||
if (statbuf.st_uid != ROOTUSER)
|
||||
errx(1, "%s does not belong to root%s", mapfile, not);
|
||||
errx(EX_NOPERM, "%s does not belong to root%s", mapfile, not);
|
||||
#endif /* MAPSECURITY */
|
||||
|
||||
if ((fscanf(fp, "%d\n", &nentries)) != 1)
|
||||
errx(1, "%s: nentries not found%s", mapfile, not);
|
||||
errx(EX_DATAERR, "%s: nentries not found%s", mapfile, not);
|
||||
if (nentries > MAPFILEENTRIES)
|
||||
errx(1,
|
||||
errx(EX_DATAERR,
|
||||
"maximum number of entries is %d%s", MAPFILEENTRIES, not);
|
||||
#if 0
|
||||
(void)printf("reading %d entries\n", nentries);
|
||||
@ -155,11 +160,11 @@ main(argc, argv)
|
||||
if ((fscanf(fp, "%lu %lu\n",
|
||||
&(mapdata[count][0]), &(mapdata[count][1]))) != 2) {
|
||||
if (ferror(fp))
|
||||
err(1, "%s%s", mapfile, not);
|
||||
err(EX_OSERR, "%s%s", mapfile, not);
|
||||
if (feof(fp))
|
||||
errx(1, "%s: unexpected end-of-file%s",
|
||||
errx(EX_DATAERR, "%s: unexpected end-of-file%s",
|
||||
mapfile, not);
|
||||
errx(1, "%s: illegal format (line %d)%s",
|
||||
errx(EX_DATAERR, "%s: illegal format (line %d)%s",
|
||||
mapfile, count + 2, not);
|
||||
}
|
||||
#if 0
|
||||
@ -172,7 +177,7 @@ main(argc, argv)
|
||||
|
||||
/* Read in gid mapping data. */
|
||||
if ((gfp = fopen(gmapfile, "r")) == NULL)
|
||||
err(1, "%s%s", gmapfile, not);
|
||||
err(EX_NOINPUT, "%s%s", gmapfile, not);
|
||||
|
||||
#ifdef MAPSECURITY
|
||||
/*
|
||||
@ -180,20 +185,20 @@ main(argc, argv)
|
||||
* this group mapfile, and that the file belongs to root.
|
||||
*/
|
||||
if (fstat(fileno(gfp), &statbuf))
|
||||
err(1, "%s%s", gmapfile, not);
|
||||
err(EX_OSERR, "%s%s", gmapfile, not);
|
||||
if (statbuf.st_mode & S_IWGRP || statbuf.st_mode & S_IWOTH) {
|
||||
strmode(statbuf.st_mode, buf);
|
||||
err(1, "%s: improper write permissions (%s)%s",
|
||||
err(EX_NOPERM, "%s: improper write permissions (%s)%s",
|
||||
gmapfile, buf, not);
|
||||
}
|
||||
if (statbuf.st_uid != ROOTUSER)
|
||||
errx(1, "%s does not belong to root%s", gmapfile, not);
|
||||
errx(EX_NOPERM, "%s does not belong to root%s", gmapfile, not);
|
||||
#endif /* MAPSECURITY */
|
||||
|
||||
if ((fscanf(gfp, "%d\n", &gnentries)) != 1)
|
||||
errx(1, "nentries not found%s", gmapfile, not);
|
||||
errx(EX_DATAERR, "nentries not found%s", gmapfile, not);
|
||||
if (gnentries > MAPFILEENTRIES)
|
||||
errx(1,
|
||||
errx(EX_DATAERR,
|
||||
"maximum number of entries is %d%s", GMAPFILEENTRIES, not);
|
||||
#if 0
|
||||
(void)printf("reading %d group entries\n", gnentries);
|
||||
@ -203,11 +208,11 @@ main(argc, argv)
|
||||
if ((fscanf(gfp, "%lu %lu\n",
|
||||
&(gmapdata[count][0]), &(gmapdata[count][1]))) != 2) {
|
||||
if (ferror(gfp))
|
||||
err(1, "%s%s", gmapfile, not);
|
||||
err(EX_OSERR, "%s%s", gmapfile, not);
|
||||
if (feof(gfp))
|
||||
errx(1, "%s: unexpected end-of-file%s",
|
||||
errx(EX_DATAERR, "%s: unexpected end-of-file%s",
|
||||
gmapfile, not);
|
||||
errx(1, "%s: illegal format (line %d)%s",
|
||||
errx(EX_DATAERR, "%s: illegal format (line %d)%s",
|
||||
gmapfile, count + 2, not);
|
||||
}
|
||||
|
||||
@ -240,5 +245,5 @@ usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_umap [-o options] -u usermap -g groupmap target_fs mount_point\n");
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
@ -41,7 +41,11 @@ char copyright[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/*
|
||||
static char sccsid[] = "@(#)mount_umap.c 8.3 (Berkeley) 3/27/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -54,6 +58,7 @@ static char sccsid[] = "@(#)mount_umap.c 8.3 (Berkeley) 3/27/94";
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
@ -76,12 +81,12 @@ static char sccsid[] = "@(#)mount_umap.c 8.3 (Berkeley) 3/27/94";
|
||||
* will, in turn, call the umap version of mount.
|
||||
*/
|
||||
|
||||
struct mntopt mopts[] = {
|
||||
static struct mntopt mopts[] = {
|
||||
MOPT_STDOPTS,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
void usage __P((void));
|
||||
static __dead void usage __P((void)) __dead2;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@ -125,7 +130,7 @@ main(argc, argv)
|
||||
|
||||
/* Read in uid mapping data. */
|
||||
if ((fp = fopen(mapfile, "r")) == NULL)
|
||||
err(1, "%s%s", mapfile, not);
|
||||
err(EX_NOINPUT, "%s%s", mapfile, not);
|
||||
|
||||
#ifdef MAPSECURITY
|
||||
/*
|
||||
@ -133,20 +138,20 @@ main(argc, argv)
|
||||
* this mapfile, and that the mapfile belongs to root.
|
||||
*/
|
||||
if (fstat(fileno(fp), &statbuf))
|
||||
err(1, "%s%s", mapfile, not);
|
||||
err(EX_OSERR, "%s%s", mapfile, not);
|
||||
if (statbuf.st_mode & S_IWGRP || statbuf.st_mode & S_IWOTH) {
|
||||
strmode(statbuf.st_mode, buf);
|
||||
err(1, "%s: improper write permissions (%s)%s",
|
||||
err(EX_NOPERM, "%s: improper write permissions (%s)%s",
|
||||
mapfile, buf, not);
|
||||
}
|
||||
if (statbuf.st_uid != ROOTUSER)
|
||||
errx(1, "%s does not belong to root%s", mapfile, not);
|
||||
errx(EX_NOPERM, "%s does not belong to root%s", mapfile, not);
|
||||
#endif /* MAPSECURITY */
|
||||
|
||||
if ((fscanf(fp, "%d\n", &nentries)) != 1)
|
||||
errx(1, "%s: nentries not found%s", mapfile, not);
|
||||
errx(EX_DATAERR, "%s: nentries not found%s", mapfile, not);
|
||||
if (nentries > MAPFILEENTRIES)
|
||||
errx(1,
|
||||
errx(EX_DATAERR,
|
||||
"maximum number of entries is %d%s", MAPFILEENTRIES, not);
|
||||
#if 0
|
||||
(void)printf("reading %d entries\n", nentries);
|
||||
@ -155,11 +160,11 @@ main(argc, argv)
|
||||
if ((fscanf(fp, "%lu %lu\n",
|
||||
&(mapdata[count][0]), &(mapdata[count][1]))) != 2) {
|
||||
if (ferror(fp))
|
||||
err(1, "%s%s", mapfile, not);
|
||||
err(EX_OSERR, "%s%s", mapfile, not);
|
||||
if (feof(fp))
|
||||
errx(1, "%s: unexpected end-of-file%s",
|
||||
errx(EX_DATAERR, "%s: unexpected end-of-file%s",
|
||||
mapfile, not);
|
||||
errx(1, "%s: illegal format (line %d)%s",
|
||||
errx(EX_DATAERR, "%s: illegal format (line %d)%s",
|
||||
mapfile, count + 2, not);
|
||||
}
|
||||
#if 0
|
||||
@ -172,7 +177,7 @@ main(argc, argv)
|
||||
|
||||
/* Read in gid mapping data. */
|
||||
if ((gfp = fopen(gmapfile, "r")) == NULL)
|
||||
err(1, "%s%s", gmapfile, not);
|
||||
err(EX_NOINPUT, "%s%s", gmapfile, not);
|
||||
|
||||
#ifdef MAPSECURITY
|
||||
/*
|
||||
@ -180,20 +185,20 @@ main(argc, argv)
|
||||
* this group mapfile, and that the file belongs to root.
|
||||
*/
|
||||
if (fstat(fileno(gfp), &statbuf))
|
||||
err(1, "%s%s", gmapfile, not);
|
||||
err(EX_OSERR, "%s%s", gmapfile, not);
|
||||
if (statbuf.st_mode & S_IWGRP || statbuf.st_mode & S_IWOTH) {
|
||||
strmode(statbuf.st_mode, buf);
|
||||
err(1, "%s: improper write permissions (%s)%s",
|
||||
err(EX_NOPERM, "%s: improper write permissions (%s)%s",
|
||||
gmapfile, buf, not);
|
||||
}
|
||||
if (statbuf.st_uid != ROOTUSER)
|
||||
errx(1, "%s does not belong to root%s", gmapfile, not);
|
||||
errx(EX_NOPERM, "%s does not belong to root%s", gmapfile, not);
|
||||
#endif /* MAPSECURITY */
|
||||
|
||||
if ((fscanf(gfp, "%d\n", &gnentries)) != 1)
|
||||
errx(1, "nentries not found%s", gmapfile, not);
|
||||
errx(EX_DATAERR, "nentries not found%s", gmapfile, not);
|
||||
if (gnentries > MAPFILEENTRIES)
|
||||
errx(1,
|
||||
errx(EX_DATAERR,
|
||||
"maximum number of entries is %d%s", GMAPFILEENTRIES, not);
|
||||
#if 0
|
||||
(void)printf("reading %d group entries\n", gnentries);
|
||||
@ -203,11 +208,11 @@ main(argc, argv)
|
||||
if ((fscanf(gfp, "%lu %lu\n",
|
||||
&(gmapdata[count][0]), &(gmapdata[count][1]))) != 2) {
|
||||
if (ferror(gfp))
|
||||
err(1, "%s%s", gmapfile, not);
|
||||
err(EX_OSERR, "%s%s", gmapfile, not);
|
||||
if (feof(gfp))
|
||||
errx(1, "%s: unexpected end-of-file%s",
|
||||
errx(EX_DATAERR, "%s: unexpected end-of-file%s",
|
||||
gmapfile, not);
|
||||
errx(1, "%s: illegal format (line %d)%s",
|
||||
errx(EX_DATAERR, "%s: illegal format (line %d)%s",
|
||||
gmapfile, count + 2, not);
|
||||
}
|
||||
|
||||
@ -240,5 +245,5 @@ usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_umap [-o options] -u usermap -g groupmap target_fs mount_point\n");
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
@ -53,17 +53,18 @@ static char sccsid[] = "@(#)mount_union.c 8.5 (Berkeley) 3/27/94";
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
|
||||
struct mntopt mopts[] = {
|
||||
static struct mntopt mopts[] = {
|
||||
MOPT_STDOPTS,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
int subdir __P((const char *, const char *));
|
||||
void usage __P((void));
|
||||
static int subdir __P((const char *, const char *));
|
||||
static __dead void usage __P((void)) __dead2;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@ -102,10 +103,10 @@ main(argc, argv)
|
||||
usage();
|
||||
|
||||
if (realpath(argv[0], target) == 0)
|
||||
err(1, "%s", target);
|
||||
err(EX_OSERR, "%s", target);
|
||||
|
||||
if (subdir(target, argv[1]) || subdir(argv[1], target))
|
||||
errx(1, "%s (%s) and %s are not distinct paths",
|
||||
errx(EX_USAGE, "%s (%s) and %s are not distinct paths",
|
||||
argv[0], target, argv[1]);
|
||||
|
||||
args.target = target;
|
||||
@ -117,9 +118,11 @@ main(argc, argv)
|
||||
endvfsent(); /* flush cache */
|
||||
vfc = getvfsbyname("union");
|
||||
}
|
||||
if (!vfc)
|
||||
errx(EX_OSERR, "union filesystem is not available");
|
||||
|
||||
if (mount(vfc ? vfc->vfc_index : MOUNT_UNION, argv[1], mntflags, &args))
|
||||
err(1, NULL);
|
||||
if (mount(vfc->vfc_index, argv[1], mntflags, &args))
|
||||
err(EX_OSERR, target);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -145,5 +148,5 @@ usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_union [-br] [-o options] target_fs mount_point\n");
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
@ -53,17 +53,18 @@ static char sccsid[] = "@(#)mount_union.c 8.5 (Berkeley) 3/27/94";
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
|
||||
struct mntopt mopts[] = {
|
||||
static struct mntopt mopts[] = {
|
||||
MOPT_STDOPTS,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
int subdir __P((const char *, const char *));
|
||||
void usage __P((void));
|
||||
static int subdir __P((const char *, const char *));
|
||||
static __dead void usage __P((void)) __dead2;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@ -102,10 +103,10 @@ main(argc, argv)
|
||||
usage();
|
||||
|
||||
if (realpath(argv[0], target) == 0)
|
||||
err(1, "%s", target);
|
||||
err(EX_OSERR, "%s", target);
|
||||
|
||||
if (subdir(target, argv[1]) || subdir(argv[1], target))
|
||||
errx(1, "%s (%s) and %s are not distinct paths",
|
||||
errx(EX_USAGE, "%s (%s) and %s are not distinct paths",
|
||||
argv[0], target, argv[1]);
|
||||
|
||||
args.target = target;
|
||||
@ -117,9 +118,11 @@ main(argc, argv)
|
||||
endvfsent(); /* flush cache */
|
||||
vfc = getvfsbyname("union");
|
||||
}
|
||||
if (!vfc)
|
||||
errx(EX_OSERR, "union filesystem is not available");
|
||||
|
||||
if (mount(vfc ? vfc->vfc_index : MOUNT_UNION, argv[1], mntflags, &args))
|
||||
err(1, NULL);
|
||||
if (mount(vfc->vfc_index, argv[1], mntflags, &args))
|
||||
err(EX_OSERR, target);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -145,5 +148,5 @@ usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_union [-br] [-o options] target_fs mount_point\n");
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
@ -41,7 +41,11 @@ char copyright[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/*
|
||||
static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -58,6 +62,7 @@ static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mntopts.h"
|
||||
@ -69,7 +74,7 @@ struct mntopt mopts[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static void usage __P((void));
|
||||
static __dead void usage __P((void)) __dead2;
|
||||
|
||||
static sig_atomic_t readcf; /* Set when SIGHUP received */
|
||||
|
||||
@ -144,8 +149,7 @@ main(argc, argv)
|
||||
*/
|
||||
un.sun_family = AF_UNIX;
|
||||
if (sizeof(_PATH_TMPPORTAL) >= sizeof(un.sun_path)) {
|
||||
fprintf(stderr, "mount_portal: portal socket name too long\n");
|
||||
exit(1);
|
||||
errx(EX_SOFTWARE, "portal socket name too long");
|
||||
}
|
||||
strcpy(un.sun_path, _PATH_TMPPORTAL);
|
||||
mktemp(un.sun_path);
|
||||
@ -153,8 +157,7 @@ main(argc, argv)
|
||||
|
||||
so = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (so < 0) {
|
||||
fprintf(stderr, "mount_portal: socket: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
err(EX_OSERR, "socket");
|
||||
}
|
||||
(void) unlink(un.sun_path);
|
||||
if (bind(so, (struct sockaddr *) &un, sizeof(un)) < 0)
|
||||
@ -171,10 +174,12 @@ main(argc, argv)
|
||||
vfc = getvfsbyname("portal");
|
||||
if(!vfc && vfsisloadable("portal")) {
|
||||
if(vfsload("portal"))
|
||||
err(1, "vfsload(portal)");
|
||||
err(EX_OSERR, "vfsload(portal)");
|
||||
endvfsent(); /* flush cache */
|
||||
vfc = getvfsbyname("portal");
|
||||
}
|
||||
if (!vfc)
|
||||
errx(EX_OSERR, "portal filesystem is not available");
|
||||
|
||||
rc = mount(vfc ? vfc->vfc_index : MOUNT_PORTAL, mountpt, mntflags, &args);
|
||||
if (rc < 0)
|
||||
@ -233,7 +238,7 @@ main(argc, argv)
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
syslog(LOG_ERR, "select: %s", strerror(errno));
|
||||
exit(1);
|
||||
exit(EX_OSERR);
|
||||
}
|
||||
if (rc == 0)
|
||||
break;
|
||||
@ -247,7 +252,7 @@ main(argc, argv)
|
||||
break;
|
||||
if (errno != EINTR) {
|
||||
syslog(LOG_ERR, "accept: %s", strerror(errno));
|
||||
exit(1);
|
||||
exit(EX_OSERR);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -282,5 +287,5 @@ usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: mount_portal [-o options] config mount-point\n");
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user