summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-03-11 12:40:45 +0000
committerpeter <peter@FreeBSD.org>1997-03-11 12:40:45 +0000
commit1c0f77f024b01c2df41c395b7e5afd760d0a9062 (patch)
tree8250189179b31e1866ff4aede6002aa33af8d808
parentf461294e0761e04bbc572e265770de9410b31c41 (diff)
downloadFreeBSD-src-1c0f77f024b01c2df41c395b7e5afd760d0a9062.zip
FreeBSD-src-1c0f77f024b01c2df41c395b7e5afd760d0a9062.tar.gz
Merge from Lite2 (use new getvfsbyname() and mount(2) interface)
-rw-r--r--sbin/mount_cd9660/Makefile1
-rw-r--r--sbin/mount_cd9660/mount_cd9660.c34
-rw-r--r--sbin/mount_ext2fs/Makefile1
-rw-r--r--sbin/mount_ext2fs/mount_ext2fs.c21
-rw-r--r--sbin/mount_lfs/Makefile1
-rw-r--r--sbin/mount_lfs/mount_lfs.c22
-rw-r--r--sbin/mount_nfs/Makefile1
-rw-r--r--sbin/mount_nfs/mount_nfs.811
-rw-r--r--sbin/mount_nfs/mount_nfs.c71
-rw-r--r--sbin/mount_null/Makefile1
-rw-r--r--sbin/mount_null/mount_null.830
-rw-r--r--sbin/mount_null/mount_null.c23
-rw-r--r--sbin/mount_nullfs/Makefile1
-rw-r--r--sbin/mount_nullfs/mount_nullfs.830
-rw-r--r--sbin/mount_nullfs/mount_nullfs.c23
-rw-r--r--sbin/mount_portal/Makefile3
-rw-r--r--sbin/mount_portal/activate.c8
-rw-r--r--sbin/mount_portal/mount_portal.c26
-rw-r--r--sbin/mount_portal/pt_file.c4
-rw-r--r--sbin/mount_portal/pt_tcp.c23
-rw-r--r--sbin/mount_portalfs/Makefile3
-rw-r--r--sbin/mount_portalfs/activate.c8
-rw-r--r--sbin/mount_portalfs/mount_portalfs.c26
-rw-r--r--sbin/mount_portalfs/pt_file.c4
-rw-r--r--sbin/mount_portalfs/pt_tcp.c23
-rw-r--r--sbin/mount_umap/Makefile1
-rw-r--r--sbin/mount_umap/mount_umap.84
-rw-r--r--sbin/mount_umap/mount_umap.c22
-rw-r--r--sbin/mount_umapfs/Makefile1
-rw-r--r--sbin/mount_umapfs/mount_umapfs.84
-rw-r--r--sbin/mount_umapfs/mount_umapfs.c22
-rw-r--r--sbin/mount_union/Makefile1
-rw-r--r--sbin/mount_union/mount_union.c17
-rw-r--r--sbin/mount_unionfs/Makefile1
-rw-r--r--sbin/mount_unionfs/mount_unionfs.c17
-rw-r--r--usr.sbin/mount_portalfs/Makefile3
-rw-r--r--usr.sbin/mount_portalfs/activate.c8
-rw-r--r--usr.sbin/mount_portalfs/mount_portalfs.c26
-rw-r--r--usr.sbin/mount_portalfs/pt_file.c4
-rw-r--r--usr.sbin/mount_portalfs/pt_tcp.c23
40 files changed, 292 insertions, 261 deletions
diff --git a/sbin/mount_cd9660/Makefile b/sbin/mount_cd9660/Makefile
index fc192a5..61129f3 100644
--- a/sbin/mount_cd9660/Makefile
+++ b/sbin/mount_cd9660/Makefile
@@ -5,6 +5,7 @@ SRCS= mount_cd9660.c getmntopts.c
MAN8= mount_cd9660.8
MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${MOUNT}
.PATH: ${MOUNT}
diff --git a/sbin/mount_cd9660/mount_cd9660.c b/sbin/mount_cd9660/mount_cd9660.c
index 463b660..9434f3c 100644
--- a/sbin/mount_cd9660/mount_cd9660.c
+++ b/sbin/mount_cd9660/mount_cd9660.c
@@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)mount_cd9660.c 8.4 (Berkeley) 3/27/94
+ * @(#)mount_cd9660.c 8.7 (Berkeley) 5/1/95
*/
#ifndef lint
@@ -46,15 +46,15 @@ static char copyright[] =
#ifndef lint
/*
-static char sccsid[] = "@(#)mount_cd9660.c 8.4 (Berkeley) 3/27/94";
+static char sccsid[] = "@(#)mount_cd9660.c 8.7 (Berkeley) 5/1/95";
*/
static const char rcsid[] =
- "$Id$";
+ "$Id: mount_cd9660.c,v 1.9 1997/02/22 14:32:44 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
-#define CD9660
#include <sys/mount.h>
+#include <sys/../isofs/cd9660/cd9660_mount.h>
#include <err.h>
#include <stdlib.h>
@@ -84,7 +84,8 @@ main(argc, argv)
struct iso_args args;
int ch, mntflags, opts;
char *dev, *dir;
- struct vfsconf *vfc;
+ struct vfsconf vfc;
+ int error;
mntflags = opts = 0;
while ((ch = getopt(argc, argv, "ego:r")) != EOF)
@@ -115,30 +116,27 @@ main(argc, argv)
dir = argv[1];
#define DEFAULT_ROOTUID -2
- args.fspec = dev;
- args.export.ex_root = DEFAULT_ROOTUID;
-
/*
* ISO 9660 filesystems are not writeable.
*/
mntflags |= MNT_RDONLY;
args.export.ex_flags = MNT_EXRDONLY;
-
+ args.fspec = dev;
+ args.export.ex_root = DEFAULT_ROOTUID;
args.flags = opts;
- vfc = getvfsbyname("cd9660");
- if(!vfc && vfsisloadable("cd9660")) {
- if(vfsload("cd9660")) {
+ error = getvfsbyname("cd9660", &vfc);
+ if (error && vfsisloadable("cd9660")) {
+ if (vfsload("cd9660"))
err(EX_OSERR, "vfsload(cd9660)");
- }
endvfsent(); /* flush cache */
- vfc = getvfsbyname("cd9660");
+ error = getvfsbyname("cd9660", &vfc);
}
- if (!vfc)
- errx(EX_OSERR, "cd9660 filesystem not available");
+ if (error)
+ errx(1, "cd9660 filesystem is not available");
- if (mount(vfc->vfc_index, dir, mntflags, &args) < 0)
- err(EX_OSERR, "%s", dev);
+ if (mount(vfc.vfc_name, dir, mntflags, &args) < 0)
+ err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_ext2fs/Makefile b/sbin/mount_ext2fs/Makefile
index cacee97..9a463a4 100644
--- a/sbin/mount_ext2fs/Makefile
+++ b/sbin/mount_ext2fs/Makefile
@@ -5,6 +5,7 @@ SRCS= mount_ext2fs.c getmntopts.c
MAN8= mount_ext2fs.8
MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${MOUNT}
.PATH: ${MOUNT}
diff --git a/sbin/mount_ext2fs/mount_ext2fs.c b/sbin/mount_ext2fs/mount_ext2fs.c
index 46bfbda..8f3be49 100644
--- a/sbin/mount_ext2fs/mount_ext2fs.c
+++ b/sbin/mount_ext2fs/mount_ext2fs.c
@@ -42,7 +42,7 @@ static char copyright[] =
static char sccsid[] = "@(#)mount_lfs.c 8.3 (Berkeley) 3/27/94";
*/
static const char rcsid[] =
- "$Id$";
+ "$Id: mount_ext2fs.c,v 1.6 1997/02/22 14:32:45 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -55,6 +55,8 @@ static const char rcsid[] =
#include <sysexits.h>
#include <unistd.h>
+#include <ufs/ufs/ufsmount.h>
+
#include "mntopts.h"
struct mntopt mopts[] = {
@@ -73,7 +75,8 @@ main(argc, argv)
struct ufs_args args;
int ch, mntflags;
char *fs_name, *options;
- struct vfsconf *vfc;
+ struct vfsconf vfc;
+ int error;
options = NULL;
mntflags = 0;
@@ -102,18 +105,18 @@ main(argc, argv)
else
args.export.ex_flags = 0;
- vfc = getvfsbyname("ext2fs");
- if(!vfc && vfsisloadable("ext2fs")) {
- if(vfsload("ext2fs")) {
+ error = getvfsbyname("ext2fs", &vfc);
+ if (error && vfsisloadable("ext2fs")) {
+ if (vfsload("ext2fs")) {
err(EX_OSERR, "vfsload(ext2fs)");
}
endvfsent(); /* flush cache */
- vfc = getvfsbyname("ext2fs");
+ error = getvfsbyname("ext2fs", &vfc);
}
- if (!vfc)
- errx(EX_OSERR, "ext2fs filesystem not available");
+ if (error)
+ errx(EX_OSERR, "ext2fs filesystem is not available");
- if (mount(vfc->vfc_index, fs_name, mntflags, &args) < 0)
+ if (mount(vfc.vfc_name, fs_name, mntflags, &args) < 0)
err(EX_OSERR, "%s", args.fspec);
exit(0);
}
diff --git a/sbin/mount_lfs/Makefile b/sbin/mount_lfs/Makefile
index 0020b8b..bcd1f51 100644
--- a/sbin/mount_lfs/Makefile
+++ b/sbin/mount_lfs/Makefile
@@ -5,6 +5,7 @@ SRCS= mount_lfs.c getmntopts.c
MAN8= mount_lfs.8
MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${MOUNT}
.PATH: ${MOUNT}
diff --git a/sbin/mount_lfs/mount_lfs.c b/sbin/mount_lfs/mount_lfs.c
index c252b0f..0ea35df 100644
--- a/sbin/mount_lfs/mount_lfs.c
+++ b/sbin/mount_lfs/mount_lfs.c
@@ -39,14 +39,15 @@ static char copyright[] =
#ifndef lint
/*
-static char sccsid[] = "@(#)mount_lfs.c 8.3 (Berkeley) 3/27/94";
+static char sccsid[] = "@(#)mount_lfs.c 8.4 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
- "$Id$";
+ "$Id: mount_lfs.c,v 1.7 1997/02/22 14:32:46 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
#include <sys/mount.h>
+#include <ufs/ufs/ufsmount.h>
#include <err.h>
#include <stdio.h>
@@ -75,7 +76,8 @@ main(argc, argv)
struct ufs_args args;
int ch, mntflags, noclean;
char *fs_name, *options;
- struct vfsconf *vfc;
+ struct vfsconf vfc;
+ int error;
int short_rds, cleaner_debug;
@@ -115,18 +117,18 @@ main(argc, argv)
else
args.export.ex_flags = 0;
- vfc = getvfsbyname("lfs");
- if(!vfc && vfsisloadable("lfs")) {
+ error = getvfsbyname("lfs", &vfc);
+ if (error && vfsisloadable("lfs")) {
if(vfsload("lfs"))
err(EX_OSERR, "vfsload(lfs)");
- endvfsent(); /* flush cache */
- vfc = getvfsbyname("lfs");
+ endvfsent(); /* clear cache */
+ error = getvfsbyname("lfs", &vfc);
}
- if (!vfc)
+ if (error)
errx(EX_OSERR, "lfs filesystem is not available");
- if (mount(vfc ? vfc->vfc_index : MOUNT_LFS, fs_name, mntflags, &args))
- err(EX_OSERR, args.fspec);
+ if (mount(vfc.vfc_name, fs_name, mntflags, &args))
+ err(1, NULL);
if (!noclean)
invoke_cleaner(fs_name, short_rds, cleaner_debug);
diff --git a/sbin/mount_nfs/Makefile b/sbin/mount_nfs/Makefile
index ebf516b..090d37c 100644
--- a/sbin/mount_nfs/Makefile
+++ b/sbin/mount_nfs/Makefile
@@ -5,6 +5,7 @@ SRCS= mount_nfs.c getmntopts.c
MAN8= mount_nfs.8
MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -DNFS -I${MOUNT}
.PATH: ${MOUNT}
diff --git a/sbin/mount_nfs/mount_nfs.8 b/sbin/mount_nfs/mount_nfs.8
index 5048d4a..cf28059 100644
--- a/sbin/mount_nfs/mount_nfs.8
+++ b/sbin/mount_nfs/mount_nfs.8
@@ -1,4 +1,4 @@
-.\" Copyright (c) 1992, 1993, 1994
+.\" Copyright (c) 1992, 1993, 1994, 1995
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -29,11 +29,11 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)mount_nfs.8 8.2 (Berkeley) 3/27/94
+.\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95
.\"
-.\" $Id$
+.\" $Id: mount_nfs.8,v 1.7 1997/02/22 14:32:47 peter Exp $
.\""
-.Dd March 27, 1994
+.Dd March 29, 1995
.Dt MOUNT_NFS 8
.Os BSD 4.4
.Sh NAME
@@ -226,7 +226,8 @@ Same as
.Fl T.
.El
.It Fl q
-Use the leasing extensions to the NFS Version 3 protocol to maintain cache consistency.
+Use the leasing extensions to the NFS Version 3 protocol
+to maintain cache consistency.
This protocol Version 2, referred to as Not Quite Nfs (NQNFS),
is only supported by this updated release of NFS code.
(It is not backwards compatible with the release of NQNFS that went out on
diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c
index 3378825..31061c0 100644
--- a/sbin/mount_nfs/mount_nfs.c
+++ b/sbin/mount_nfs/mount_nfs.c
@@ -42,10 +42,10 @@ static char copyright[] =
#ifndef lint
/*
-static char sccsid[] = "@(#)mount_nfs.c 8.3 (Berkeley) 3/27/94";
+static char sccsid[] = "@(#)mount_nfs.c 8.11 (Berkeley) 5/4/95";
*/
static const char rcsid[] =
- "$Id$";
+ "$Id: mount_nfs.c,v 1.16 1997/02/22 14:32:48 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -64,15 +64,15 @@ static const char rcsid[] =
#endif
#ifdef NFSKERB
-#include <des.h>
+#include <kerberosIV/des.h>
#include <kerberosIV/krb.h>
#endif
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
-#define _KERNEL
+#define KERNEL
#include <nfs/nfs.h>
-#undef _KERNEL
+#undef KERNEL
#include <nfs/nqnfs.h>
#include <arpa/inet.h>
@@ -91,7 +91,6 @@ static const char rcsid[] =
#include "mntopts.h"
-#ifdef __FreeBSD__
#define ALTF_BG 0x1
#define ALTF_NOCONN 0x2
#define ALTF_DUMBTIMR 0x4
@@ -131,16 +130,9 @@ struct mntopt mopts[] = {
{ "port=", 0, ALTF_PORT, 1 },
{ NULL }
};
-#else
-struct mntopt mopts[] = {
- MOPT_STDOPTS,
- MOPT_FORCE,
- MOPT_UPDATE,
- { NULL }
-};
-#endif
struct nfs_args nfsdefargs = {
+ NFS_ARGSVERSION,
(struct sockaddr *)0,
sizeof (struct sockaddr_in),
SOCK_DGRAM,
@@ -211,7 +203,8 @@ main(argc, argv)
struct nfsd_cargs ncd;
int mntflags, altflags, i, nfssvc_flag, num;
char *name, *p, *spec;
- struct vfsconf *vfc;
+ struct vfsconf vfc;
+ int error = 0;
#ifdef NFSKERB
uid_t last_ruid;
@@ -300,7 +293,6 @@ main(argc, argv)
break;
#endif
case 'o':
-#ifdef __FreeBSD__
getmntopts(optarg, mopts, &mntflags, &altflags);
if(altflags & ALTF_BG)
opflags |= BGRND;
@@ -337,9 +329,6 @@ main(argc, argv)
if(altflags & ALTF_PORT)
port_no = atoi(strstr(optarg, "port=") + 5);
altflags = 0;
-#else
- getmntopts(optarg, mopts, &mntflags);
-#endif
break;
case 'P':
nfsargsp->flags |= NFSMNT_RESVPORT;
@@ -403,8 +392,10 @@ main(argc, argv)
argc -= optind;
argv += optind;
- if (argc != 2)
+ if (argc != 2) {
usage();
+ /* NOTREACHED */
+ }
spec = *argv++;
name = *argv;
@@ -413,21 +404,22 @@ main(argc, argv)
exit(1);
#ifdef __FreeBSD__
- vfc = getvfsbyname("nfs");
- if(!vfc && vfsisloadable("nfs")) {
+ error = getvfsbyname("nfs", &vfc);
+ if (error && vfsisloadable("nfs")) {
if(vfsload("nfs"))
err(EX_OSERR, "vfsload(nfs)");
- endvfsent(); /* flush cache */
- vfc = getvfsbyname("nfs");
+ endvfsent(); /* clear cache */
+ error = getvfsbyname("nfs", &vfc);
}
- if (!vfc)
- errx(EX_OSERR, "nfs filesystem is not loadable");
+ if (error)
+ errx(EX_OSERR, "nfs filesystem is not available");
- if (mount(vfc->vfc_index, name, mntflags, nfsargsp))
+ if (mount(vfc.vfc_name, name, mntflags, nfsargsp))
+ err(1, "%s", name);
#else
- if (mount(MOUNT_NFS, name, mntflags, nfsargsp))
-#endif
+ if (mount("nfs", name, mntflags, nfsargsp))
err(1, "%s", name);
+#endif
if (nfsargsp->flags & (NFSMNT_NQNFS | NFSMNT_KERB)) {
if ((opflags & ISBGRND) == 0) {
if (i = fork()) {
@@ -498,7 +490,7 @@ main(argc, argv)
3 * NFSX_UNSIGNED;
ncd.ncd_verfstr = (u_char *)&kverf;
ncd.ncd_verflen = sizeof (kverf);
- bcopy((caddr_t)kcr.session, (caddr_t)ncd.ncd_key,
+ memmove(ncd.ncd_key, kcr.session,
sizeof (kcr.session));
kin.t1 = htonl(ktv.tv_sec);
kin.t2 = htonl(ktv.tv_usec);
@@ -587,14 +579,13 @@ getnfsargs(spec, nfsargsp)
warnx("bad ISO address");
return (0);
}
- bzero((caddr_t)&isoaddr, sizeof (isoaddr));
- bcopy((caddr_t)isop, (caddr_t)&isoaddr.siso_addr,
- sizeof (struct iso_addr));
+ memset(&isoaddr, 0, sizeof (isoaddr));
+ memmove(&isoaddr.siso_addr, isop, sizeof (struct iso_addr));
isoaddr.siso_len = sizeof (isoaddr);
isoaddr.siso_family = AF_ISO;
isoaddr.siso_tlen = 2;
isoport = htons(NFS_PORT);
- bcopy((caddr_t)&isoport, TSEL(&isoaddr), isoaddr.siso_tlen);
+ memmove(TSEL(&isoaddr), &isoport, isoaddr.siso_tlen);
hostp = delimp + 1;
}
#endif /* ISO */
@@ -608,9 +599,9 @@ getnfsargs(spec, nfsargsp)
warnx("bad net address %s", hostp);
return (0);
}
- } else if ((hp = gethostbyname(hostp)) != NULL) {
- bcopy(hp->h_addr, (caddr_t)&saddr.sin_addr, hp->h_length);
- } else {
+ } else if ((hp = gethostbyname(hostp)) != NULL)
+ memmove(&saddr.sin_addr, hp->h_addr, hp->h_length);
+ else {
warnx("can't get net id for host");
return (0);
}
@@ -621,7 +612,7 @@ getnfsargs(spec, nfsargsp)
warnx("can't reverse resolve net address");
return (0);
}
- bcopy(hp->h_addr, (caddr_t)&saddr.sin_addr, hp->h_length);
+ memmove(&saddr.sin_addr, hp->h_addr, hp->h_length);
strncpy(inst, hp->h_name, INST_SZ);
inst[INST_SZ - 1] = '\0';
if (cp = strchr(inst, '.'))
@@ -701,8 +692,7 @@ getnfsargs(spec, nfsargsp)
if (nfhret.stat) {
if (opflags & ISBGRND)
exit(1);
- errno = nfhret.stat;
- warn("can't access %s", spec);
+ warnx("can't access %s: %s", spec, strerror(nfhret.stat));
return (0);
}
saddr.sin_port = htons(tport);
@@ -764,7 +754,6 @@ xdr_fh(xdrsp, np)
if (auth == np->auth)
authfnd++;
}
-
/*
* Some servers, such as DEC's OSF/1 return a nil authenticator
* list to indicate RPCAUTH_UNIX.
diff --git a/sbin/mount_null/Makefile b/sbin/mount_null/Makefile
index 3f8b3ef..97f3c62 100644
--- a/sbin/mount_null/Makefile
+++ b/sbin/mount_null/Makefile
@@ -5,6 +5,7 @@ SRCS= mount_null.c getmntopts.c
MAN8= mount_null.8
MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}
diff --git a/sbin/mount_null/mount_null.8 b/sbin/mount_null/mount_null.8
index 1a47b27..38473fa 100644
--- a/sbin/mount_null/mount_null.8
+++ b/sbin/mount_null/mount_null.8
@@ -34,15 +34,16 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)mount_null.8 8.4 (Berkeley) 4/19/94
-.\" $Id$
+.\" @(#)mount_null.8 8.6 (Berkeley) 5/1/95
+.\" $Id: mount_null.8,v 1.7 1997/02/22 14:32:50 peter Exp $
.\"
-.Dd April 19, 1994
+.Dd May 1, 1995
.Dt MOUNT_NULL 8
.Os BSD 4.4
.Sh NAME
.Nm mount_null
-.Nd demonstrate the use of a null file system layer
+.Nd mount a loopback filesystem sub-tree;
+demonstrate the use of a null file system layer
.Sh SYNOPSIS
.Nm mount_null
.Op Fl o Ar options
@@ -54,11 +55,22 @@ The
command creates a
null layer, duplicating a sub-tree of the file system
name space under another part of the global file system namespace.
-In this respect, it is
-similar to the loopback file system (see
-.Xr mount_lofs 8 ) .
-It differs from
-the loopback file system in two respects: it is implemented using
+This allows existing files and directories to be accessed
+using a different pathname.
+.Pp
+The primary differences between a virtual copy of the filesystem
+and a symbolic link are that
+.Xr getcwd 3
+functions correctly in the virtual copy, and that other filesystems
+may be mounted on the virtual copy without affecting the original.
+A different device number for the virtual copy is returned by
+.Xr stat 2 ,
+but in other respects it is indistinguishable from the original.
+.Pp
+The
+.Nm mount_null
+filesystem differs from a traditional
+loopback file system in two respects: it is implemented using
a stackable layers techniques, and it's
.Do
null-node
diff --git a/sbin/mount_null/mount_null.c b/sbin/mount_null/mount_null.c
index 2d654c6..9269a71 100644
--- a/sbin/mount_null/mount_null.c
+++ b/sbin/mount_null/mount_null.c
@@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
-static char sccsid[] = "@(#)mount_null.c 8.5 (Berkeley) 3/27/94";
+static char sccsid[] = "@(#)mount_null.c 8.6 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
- "$Id$";
+ "$Id: mount_null.c,v 1.7 1997/02/22 14:32:51 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -77,7 +77,8 @@ main(argc, argv)
struct null_args args;
int ch, mntflags;
char target[MAXPATHLEN];
- struct vfsconf *vfc;
+ struct vfsconf vfc;
+ int error;
mntflags = 0;
while ((ch = getopt(argc, argv, "o:")) != EOF)
@@ -104,18 +105,18 @@ main(argc, argv)
args.target = target;
- vfc = getvfsbyname("null");
- if(!vfc && vfsisloadable("null")) {
+ error = getvfsbyname("null", &vfc);
+ if (error && vfsisloadable("null")) {
if(vfsload("null"))
err(EX_OSERR, "vfsload(null)");
- endvfsent(); /* flush cache */
- vfc = getvfsbyname("null");
+ endvfsent();
+ error = getvfsbyname("null", &vfc);
}
- if (!vfc)
- errx(EX_OSERR, "null filesystem is not available");
+ if (error)
+ errx(EX_OSERR, "null/loopback filesystem is not available");
- if (mount(vfc->vfc_index, argv[1], mntflags, &args))
- err(EX_OSERR, target);
+ if (mount(vfc.vfc_name, argv[1], mntflags, &args))
+ err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_nullfs/Makefile b/sbin/mount_nullfs/Makefile
index 3f8b3ef..97f3c62 100644
--- a/sbin/mount_nullfs/Makefile
+++ b/sbin/mount_nullfs/Makefile
@@ -5,6 +5,7 @@ SRCS= mount_null.c getmntopts.c
MAN8= mount_null.8
MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}
diff --git a/sbin/mount_nullfs/mount_nullfs.8 b/sbin/mount_nullfs/mount_nullfs.8
index 1a47b27..38473fa 100644
--- a/sbin/mount_nullfs/mount_nullfs.8
+++ b/sbin/mount_nullfs/mount_nullfs.8
@@ -34,15 +34,16 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)mount_null.8 8.4 (Berkeley) 4/19/94
-.\" $Id$
+.\" @(#)mount_null.8 8.6 (Berkeley) 5/1/95
+.\" $Id: mount_null.8,v 1.7 1997/02/22 14:32:50 peter Exp $
.\"
-.Dd April 19, 1994
+.Dd May 1, 1995
.Dt MOUNT_NULL 8
.Os BSD 4.4
.Sh NAME
.Nm mount_null
-.Nd demonstrate the use of a null file system layer
+.Nd mount a loopback filesystem sub-tree;
+demonstrate the use of a null file system layer
.Sh SYNOPSIS
.Nm mount_null
.Op Fl o Ar options
@@ -54,11 +55,22 @@ The
command creates a
null layer, duplicating a sub-tree of the file system
name space under another part of the global file system namespace.
-In this respect, it is
-similar to the loopback file system (see
-.Xr mount_lofs 8 ) .
-It differs from
-the loopback file system in two respects: it is implemented using
+This allows existing files and directories to be accessed
+using a different pathname.
+.Pp
+The primary differences between a virtual copy of the filesystem
+and a symbolic link are that
+.Xr getcwd 3
+functions correctly in the virtual copy, and that other filesystems
+may be mounted on the virtual copy without affecting the original.
+A different device number for the virtual copy is returned by
+.Xr stat 2 ,
+but in other respects it is indistinguishable from the original.
+.Pp
+The
+.Nm mount_null
+filesystem differs from a traditional
+loopback file system in two respects: it is implemented using
a stackable layers techniques, and it's
.Do
null-node
diff --git a/sbin/mount_nullfs/mount_nullfs.c b/sbin/mount_nullfs/mount_nullfs.c
index 2d654c6..9269a71 100644
--- a/sbin/mount_nullfs/mount_nullfs.c
+++ b/sbin/mount_nullfs/mount_nullfs.c
@@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
-static char sccsid[] = "@(#)mount_null.c 8.5 (Berkeley) 3/27/94";
+static char sccsid[] = "@(#)mount_null.c 8.6 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
- "$Id$";
+ "$Id: mount_null.c,v 1.7 1997/02/22 14:32:51 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -77,7 +77,8 @@ main(argc, argv)
struct null_args args;
int ch, mntflags;
char target[MAXPATHLEN];
- struct vfsconf *vfc;
+ struct vfsconf vfc;
+ int error;
mntflags = 0;
while ((ch = getopt(argc, argv, "o:")) != EOF)
@@ -104,18 +105,18 @@ main(argc, argv)
args.target = target;
- vfc = getvfsbyname("null");
- if(!vfc && vfsisloadable("null")) {
+ error = getvfsbyname("null", &vfc);
+ if (error && vfsisloadable("null")) {
if(vfsload("null"))
err(EX_OSERR, "vfsload(null)");
- endvfsent(); /* flush cache */
- vfc = getvfsbyname("null");
+ endvfsent();
+ error = getvfsbyname("null", &vfc);
}
- if (!vfc)
- errx(EX_OSERR, "null filesystem is not available");
+ if (error)
+ errx(EX_OSERR, "null/loopback filesystem is not available");
- if (mount(vfc->vfc_index, argv[1], mntflags, &args))
- err(EX_OSERR, target);
+ if (mount(vfc.vfc_name, argv[1], mntflags, &args))
+ err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_portal/Makefile b/sbin/mount_portal/Makefile
index 85eca12..fd0e416 100644
--- a/sbin/mount_portal/Makefile
+++ b/sbin/mount_portal/Makefile
@@ -1,5 +1,5 @@
# From: @(#)Makefile 8.3 (Berkeley) 3/27/94
-# $Id$
+# $Id: Makefile,v 1.6 1997/02/22 14:32:52 peter Exp $
PROG= mount_portal
SRCS= mount_portal.c activate.c conf.c getmntopts.c pt_conf.c \
@@ -7,6 +7,7 @@ SRCS= mount_portal.c activate.c conf.c getmntopts.c pt_conf.c \
MAN8= mount_portal.8
MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}
diff --git a/sbin/mount_portal/activate.c b/sbin/mount_portal/activate.c
index 18e30ab..f14a4a3 100644
--- a/sbin/mount_portal/activate.c
+++ b/sbin/mount_portal/activate.c
@@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)activate.c 8.2 (Berkeley) 3/27/94
+ * @(#)activate.c 8.3 (Berkeley) 4/28/95
*
- * $Id$
+ * $Id: activate.c,v 1.3 1997/02/22 14:32:53 peter Exp $
*/
#include <stdio.h>
@@ -89,7 +89,7 @@ int klen;
iov[1].iov_base = key;
iov[1].iov_len = klen;
- bzero((char *) &msg, sizeof(msg));
+ memset(&msg, 0, sizeof(msg));
msg.msg_iov = iov;
msg.msg_iovlen = 2;
@@ -129,7 +129,7 @@ int error;
/*
* Build a msghdr
*/
- bzero((char *) &msg, sizeof(msg));
+ memset(&msg, 0, sizeof(msg));
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
diff --git a/sbin/mount_portal/mount_portal.c b/sbin/mount_portal/mount_portal.c
index 9ed05e5..cf77264 100644
--- a/sbin/mount_portal/mount_portal.c
+++ b/sbin/mount_portal/mount_portal.c
@@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
-static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
+static char sccsid[] = "@(#)mount_portal.c 8.6 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
- "$Id$";
+ "$Id: mount_portal.c,v 1.9 1997/02/22 14:32:53 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -93,7 +93,7 @@ int sig;
;
/* wrtp - waitpid _doesn't_ return 0 when no children! */
#ifdef notdef
- if (pid < 0)
+ if (pid < 0 && errno != ECHILD)
syslog(LOG_WARNING, "waitpid: %s", strerror(errno));
#endif
}
@@ -109,7 +109,7 @@ main(argc, argv)
char *mountpt;
int mntflags = 0;
char tag[32];
- struct vfsconf *vfc;
+ struct vfsconf vfc;
qelem q;
int rc;
@@ -171,26 +171,24 @@ main(argc, argv)
sprintf(tag, "portal:%d", getpid());
args.pa_config = tag;
- vfc = getvfsbyname("portal");
- if(!vfc && vfsisloadable("portal")) {
- if(vfsload("portal"))
+ error = getvfsbyname("portal", &vfc);
+ if (error && vfsisloadable("portal")) {
+ if (vfsload("portal"))
err(EX_OSERR, "vfsload(portal)");
- endvfsent(); /* flush cache */
- vfc = getvfsbyname("portal");
+ endvfsent();
+ error = getvfsbyname("portal", &vfc);
}
- if (!vfc)
+ if (error)
errx(EX_OSERR, "portal filesystem is not available");
- rc = mount(vfc ? vfc->vfc_index : MOUNT_PORTAL, mountpt, mntflags, &args);
+ rc = mount(vfc.vfc_name, mountpt, mntflags, &args);
if (rc < 0)
err(1, NULL);
-#ifdef notdef
/*
* Everything is ready to go - now is a good time to fork
*/
daemon(0, 0);
-#endif
/*
* Start logging (and change name)
@@ -272,7 +270,7 @@ main(argc, argv)
case 0:
(void) close(so);
activate(&q, so2);
- exit(0); /* stupid errors.... tidied up... wrtp*/
+ exit(0);
default:
(void) close(so2);
break;
diff --git a/sbin/mount_portal/pt_file.c b/sbin/mount_portal/pt_file.c
index 1c29e6d..9d71bc7 100644
--- a/sbin/mount_portal/pt_file.c
+++ b/sbin/mount_portal/pt_file.c
@@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)pt_file.c 8.2 (Berkeley) 3/27/94
+ * @(#)pt_file.c 8.3 (Berkeley) 7/3/94
*
- * $Id$
+ * $Id: pt_file.c,v 1.5 1997/02/22 14:32:56 peter Exp $
*/
#include <stdio.h>
diff --git a/sbin/mount_portal/pt_tcp.c b/sbin/mount_portal/pt_tcp.c
index 3c4962c..ea7ac31 100644
--- a/sbin/mount_portal/pt_tcp.c
+++ b/sbin/mount_portal/pt_tcp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1992, 1993
+ * Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
* All rights reserved.
*
@@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)pt_tcp.c 8.3 (Berkeley) 3/27/94
+ * @(#)pt_tcp.c 8.5 (Berkeley) 4/28/95
*
- * $Id$
+ * $Id: pt_tcp.c,v 1.4 1997/02/22 14:32:56 peter Exp $
*/
#include <stdio.h>
@@ -62,11 +62,11 @@
* An unrecognised suffix is an error.
*/
int portal_tcp(pcr, key, v, kso, fdp)
-struct portal_cred *pcr;
-char *key;
-char **v;
-int kso;
-int *fdp;
+ struct portal_cred *pcr;
+ char *key;
+ char **v;
+ int kso;
+ int *fdp;
{
char host[MAXHOSTNAMELEN];
char port[MAXHOSTNAMELEN];
@@ -125,15 +125,16 @@ int *fdp;
if (sp != NULL)
s_port = (u_short)sp->s_port;
else {
- s_port = htons ((u_short)strtol (port, (char**)NULL, 10));
- if (s_port == 0)
+ s_port = strtoul(port, &p, 0);
+ if (s_port == 0 || *p != '\0')
return (EINVAL);
+ s_port = htons(s_port);
}
#ifdef DEBUG
printf ("port number for %s is %d\n", port, s_port);
#endif
- bzero(&sain, sizeof(sain));
+ memset(&sain, 0, sizeof(sain));
sain.sin_len = sizeof(sain);
sain.sin_family = AF_INET;
sain.sin_port = s_port;
diff --git a/sbin/mount_portalfs/Makefile b/sbin/mount_portalfs/Makefile
index 85eca12..fd0e416 100644
--- a/sbin/mount_portalfs/Makefile
+++ b/sbin/mount_portalfs/Makefile
@@ -1,5 +1,5 @@
# From: @(#)Makefile 8.3 (Berkeley) 3/27/94
-# $Id$
+# $Id: Makefile,v 1.6 1997/02/22 14:32:52 peter Exp $
PROG= mount_portal
SRCS= mount_portal.c activate.c conf.c getmntopts.c pt_conf.c \
@@ -7,6 +7,7 @@ SRCS= mount_portal.c activate.c conf.c getmntopts.c pt_conf.c \
MAN8= mount_portal.8
MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}
diff --git a/sbin/mount_portalfs/activate.c b/sbin/mount_portalfs/activate.c
index 18e30ab..f14a4a3 100644
--- a/sbin/mount_portalfs/activate.c
+++ b/sbin/mount_portalfs/activate.c
@@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)activate.c 8.2 (Berkeley) 3/27/94
+ * @(#)activate.c 8.3 (Berkeley) 4/28/95
*
- * $Id$
+ * $Id: activate.c,v 1.3 1997/02/22 14:32:53 peter Exp $
*/
#include <stdio.h>
@@ -89,7 +89,7 @@ int klen;
iov[1].iov_base = key;
iov[1].iov_len = klen;
- bzero((char *) &msg, sizeof(msg));
+ memset(&msg, 0, sizeof(msg));
msg.msg_iov = iov;
msg.msg_iovlen = 2;
@@ -129,7 +129,7 @@ int error;
/*
* Build a msghdr
*/
- bzero((char *) &msg, sizeof(msg));
+ memset(&msg, 0, sizeof(msg));
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
diff --git a/sbin/mount_portalfs/mount_portalfs.c b/sbin/mount_portalfs/mount_portalfs.c
index 9ed05e5..cf77264 100644
--- a/sbin/mount_portalfs/mount_portalfs.c
+++ b/sbin/mount_portalfs/mount_portalfs.c
@@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
-static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
+static char sccsid[] = "@(#)mount_portal.c 8.6 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
- "$Id$";
+ "$Id: mount_portal.c,v 1.9 1997/02/22 14:32:53 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -93,7 +93,7 @@ int sig;
;
/* wrtp - waitpid _doesn't_ return 0 when no children! */
#ifdef notdef
- if (pid < 0)
+ if (pid < 0 && errno != ECHILD)
syslog(LOG_WARNING, "waitpid: %s", strerror(errno));
#endif
}
@@ -109,7 +109,7 @@ main(argc, argv)
char *mountpt;
int mntflags = 0;
char tag[32];
- struct vfsconf *vfc;
+ struct vfsconf vfc;
qelem q;
int rc;
@@ -171,26 +171,24 @@ main(argc, argv)
sprintf(tag, "portal:%d", getpid());
args.pa_config = tag;
- vfc = getvfsbyname("portal");
- if(!vfc && vfsisloadable("portal")) {
- if(vfsload("portal"))
+ error = getvfsbyname("portal", &vfc);
+ if (error && vfsisloadable("portal")) {
+ if (vfsload("portal"))
err(EX_OSERR, "vfsload(portal)");
- endvfsent(); /* flush cache */
- vfc = getvfsbyname("portal");
+ endvfsent();
+ error = getvfsbyname("portal", &vfc);
}
- if (!vfc)
+ if (error)
errx(EX_OSERR, "portal filesystem is not available");
- rc = mount(vfc ? vfc->vfc_index : MOUNT_PORTAL, mountpt, mntflags, &args);
+ rc = mount(vfc.vfc_name, mountpt, mntflags, &args);
if (rc < 0)
err(1, NULL);
-#ifdef notdef
/*
* Everything is ready to go - now is a good time to fork
*/
daemon(0, 0);
-#endif
/*
* Start logging (and change name)
@@ -272,7 +270,7 @@ main(argc, argv)
case 0:
(void) close(so);
activate(&q, so2);
- exit(0); /* stupid errors.... tidied up... wrtp*/
+ exit(0);
default:
(void) close(so2);
break;
diff --git a/sbin/mount_portalfs/pt_file.c b/sbin/mount_portalfs/pt_file.c
index 1c29e6d..9d71bc7 100644
--- a/sbin/mount_portalfs/pt_file.c
+++ b/sbin/mount_portalfs/pt_file.c
@@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)pt_file.c 8.2 (Berkeley) 3/27/94
+ * @(#)pt_file.c 8.3 (Berkeley) 7/3/94
*
- * $Id$
+ * $Id: pt_file.c,v 1.5 1997/02/22 14:32:56 peter Exp $
*/
#include <stdio.h>
diff --git a/sbin/mount_portalfs/pt_tcp.c b/sbin/mount_portalfs/pt_tcp.c
index 3c4962c..ea7ac31 100644
--- a/sbin/mount_portalfs/pt_tcp.c
+++ b/sbin/mount_portalfs/pt_tcp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1992, 1993
+ * Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
* All rights reserved.
*
@@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)pt_tcp.c 8.3 (Berkeley) 3/27/94
+ * @(#)pt_tcp.c 8.5 (Berkeley) 4/28/95
*
- * $Id$
+ * $Id: pt_tcp.c,v 1.4 1997/02/22 14:32:56 peter Exp $
*/
#include <stdio.h>
@@ -62,11 +62,11 @@
* An unrecognised suffix is an error.
*/
int portal_tcp(pcr, key, v, kso, fdp)
-struct portal_cred *pcr;
-char *key;
-char **v;
-int kso;
-int *fdp;
+ struct portal_cred *pcr;
+ char *key;
+ char **v;
+ int kso;
+ int *fdp;
{
char host[MAXHOSTNAMELEN];
char port[MAXHOSTNAMELEN];
@@ -125,15 +125,16 @@ int *fdp;
if (sp != NULL)
s_port = (u_short)sp->s_port;
else {
- s_port = htons ((u_short)strtol (port, (char**)NULL, 10));
- if (s_port == 0)
+ s_port = strtoul(port, &p, 0);
+ if (s_port == 0 || *p != '\0')
return (EINVAL);
+ s_port = htons(s_port);
}
#ifdef DEBUG
printf ("port number for %s is %d\n", port, s_port);
#endif
- bzero(&sain, sizeof(sain));
+ memset(&sain, 0, sizeof(sain));
sain.sin_len = sizeof(sain);
sain.sin_family = AF_INET;
sain.sin_port = s_port;
diff --git a/sbin/mount_umap/Makefile b/sbin/mount_umap/Makefile
index 780b52c..fce19db 100644
--- a/sbin/mount_umap/Makefile
+++ b/sbin/mount_umap/Makefile
@@ -5,6 +5,7 @@ SRCS= mount_umap.c getmntopts.c
MAN8= mount_umap.8
MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}
diff --git a/sbin/mount_umap/mount_umap.8 b/sbin/mount_umap/mount_umap.8
index b6cced9..d0ecb29 100644
--- a/sbin/mount_umap/mount_umap.8
+++ b/sbin/mount_umap/mount_umap.8
@@ -33,9 +33,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)mount_umap.8 8.3 (Berkeley) 3/27/94
+.\" @(#)mount_umap.8 8.4 (Berkeley) 5/1/95
.\"
-.Dd "March 27, 1994"
+.Dd "May 1, 1995"
.Dt MOUNT_UMAP 8
.Os BSD 4.4
.Sh NAME
diff --git a/sbin/mount_umap/mount_umap.c b/sbin/mount_umap/mount_umap.c
index 5d884ff..9872395 100644
--- a/sbin/mount_umap/mount_umap.c
+++ b/sbin/mount_umap/mount_umap.c
@@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
-static char sccsid[] = "@(#)mount_umap.c 8.3 (Berkeley) 3/27/94";
+static char sccsid[] = "@(#)mount_umap.c 8.5 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
- "$Id$";
+ "$Id: mount_umap.c,v 1.9 1997/02/22 14:33:00 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -100,7 +100,8 @@ main(argc, argv)
u_long gmapdata[GMAPFILEENTRIES][2], mapdata[MAPFILEENTRIES][2];
int ch, count, gnentries, mntflags, nentries;
char *gmapfile, *mapfile, *source, *target, buf[20];
- struct vfsconf *vfc;
+ struct vfsconf vfc;
+ int error;
mntflags = 0;
mapfile = gmapfile = NULL;
@@ -224,18 +225,17 @@ main(argc, argv)
args.gnentries = gnentries;
args.gmapdata = gmapdata;
- vfc = getvfsbyname("umap");
- if(!vfc && vfsisloadable("umap")) {
+ error = getvfsbyname("umap", &vfc);
+ if (error && vfsisloadable("umap")) {
if(vfsload("umap"))
err(1, "vfsload(umap)");
- endvfsent(); /* flush cache */
- vfc = getvfsbyname("umap");
- }
- if (!vfc) {
- errx(1, "umap filesystem not available");
+ endvfsent();
+ error = getvfsbyname("umap", &vfc);
}
+ if (error)
+ errx(1, "umap filesystem is not available");
- if (mount(vfc->vfc_index, argv[1], mntflags, &args))
+ if (mount(vfc.vfc_name, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_umapfs/Makefile b/sbin/mount_umapfs/Makefile
index 780b52c..fce19db 100644
--- a/sbin/mount_umapfs/Makefile
+++ b/sbin/mount_umapfs/Makefile
@@ -5,6 +5,7 @@ SRCS= mount_umap.c getmntopts.c
MAN8= mount_umap.8
MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}
diff --git a/sbin/mount_umapfs/mount_umapfs.8 b/sbin/mount_umapfs/mount_umapfs.8
index b6cced9..d0ecb29 100644
--- a/sbin/mount_umapfs/mount_umapfs.8
+++ b/sbin/mount_umapfs/mount_umapfs.8
@@ -33,9 +33,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)mount_umap.8 8.3 (Berkeley) 3/27/94
+.\" @(#)mount_umap.8 8.4 (Berkeley) 5/1/95
.\"
-.Dd "March 27, 1994"
+.Dd "May 1, 1995"
.Dt MOUNT_UMAP 8
.Os BSD 4.4
.Sh NAME
diff --git a/sbin/mount_umapfs/mount_umapfs.c b/sbin/mount_umapfs/mount_umapfs.c
index 5d884ff..9872395 100644
--- a/sbin/mount_umapfs/mount_umapfs.c
+++ b/sbin/mount_umapfs/mount_umapfs.c
@@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
-static char sccsid[] = "@(#)mount_umap.c 8.3 (Berkeley) 3/27/94";
+static char sccsid[] = "@(#)mount_umap.c 8.5 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
- "$Id$";
+ "$Id: mount_umap.c,v 1.9 1997/02/22 14:33:00 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -100,7 +100,8 @@ main(argc, argv)
u_long gmapdata[GMAPFILEENTRIES][2], mapdata[MAPFILEENTRIES][2];
int ch, count, gnentries, mntflags, nentries;
char *gmapfile, *mapfile, *source, *target, buf[20];
- struct vfsconf *vfc;
+ struct vfsconf vfc;
+ int error;
mntflags = 0;
mapfile = gmapfile = NULL;
@@ -224,18 +225,17 @@ main(argc, argv)
args.gnentries = gnentries;
args.gmapdata = gmapdata;
- vfc = getvfsbyname("umap");
- if(!vfc && vfsisloadable("umap")) {
+ error = getvfsbyname("umap", &vfc);
+ if (error && vfsisloadable("umap")) {
if(vfsload("umap"))
err(1, "vfsload(umap)");
- endvfsent(); /* flush cache */
- vfc = getvfsbyname("umap");
- }
- if (!vfc) {
- errx(1, "umap filesystem not available");
+ endvfsent();
+ error = getvfsbyname("umap", &vfc);
}
+ if (error)
+ errx(1, "umap filesystem is not available");
- if (mount(vfc->vfc_index, argv[1], mntflags, &args))
+ if (mount(vfc.vfc_name, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_union/Makefile b/sbin/mount_union/Makefile
index e213137..6ac36c9 100644
--- a/sbin/mount_union/Makefile
+++ b/sbin/mount_union/Makefile
@@ -5,6 +5,7 @@ SRCS= mount_union.c getmntopts.c
MAN8= mount_union.8
MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}
diff --git a/sbin/mount_union/mount_union.c b/sbin/mount_union/mount_union.c
index 54c4647..cb5e406 100644
--- a/sbin/mount_union/mount_union.c
+++ b/sbin/mount_union/mount_union.c
@@ -74,7 +74,8 @@ main(argc, argv)
struct union_args args;
int ch, mntflags;
char target[MAXPATHLEN];
- struct vfsconf *vfc;
+ struct vfsconf vfc;
+ int error;
mntflags = 0;
args.mntflags = UNMNT_ABOVE;
@@ -111,17 +112,17 @@ main(argc, argv)
args.target = target;
- vfc = getvfsbyname("union");
- if(!vfc && vfsisloadable("union")) {
- if(vfsload("union"))
- err(1, "vfsload(union)");
+ error = getvfsbyname("union", &vfc);
+ if (error && vfsisloadable("union")) {
+ if (vfsload("union"))
+ err(EX_OSERR, "vfsload(union)");
endvfsent(); /* flush cache */
- vfc = getvfsbyname("union");
+ error = getvfsbyname("union", &vfc);
}
- if (!vfc)
+ if (error)
errx(EX_OSERR, "union filesystem is not available");
- if (mount(vfc->vfc_index, argv[1], mntflags, &args))
+ if (mount(vfc.vfc_name, argv[1], mntflags, &args))
err(EX_OSERR, target);
exit(0);
}
diff --git a/sbin/mount_unionfs/Makefile b/sbin/mount_unionfs/Makefile
index e213137..6ac36c9 100644
--- a/sbin/mount_unionfs/Makefile
+++ b/sbin/mount_unionfs/Makefile
@@ -5,6 +5,7 @@ SRCS= mount_union.c getmntopts.c
MAN8= mount_union.8
MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}
diff --git a/sbin/mount_unionfs/mount_unionfs.c b/sbin/mount_unionfs/mount_unionfs.c
index 54c4647..cb5e406 100644
--- a/sbin/mount_unionfs/mount_unionfs.c
+++ b/sbin/mount_unionfs/mount_unionfs.c
@@ -74,7 +74,8 @@ main(argc, argv)
struct union_args args;
int ch, mntflags;
char target[MAXPATHLEN];
- struct vfsconf *vfc;
+ struct vfsconf vfc;
+ int error;
mntflags = 0;
args.mntflags = UNMNT_ABOVE;
@@ -111,17 +112,17 @@ main(argc, argv)
args.target = target;
- vfc = getvfsbyname("union");
- if(!vfc && vfsisloadable("union")) {
- if(vfsload("union"))
- err(1, "vfsload(union)");
+ error = getvfsbyname("union", &vfc);
+ if (error && vfsisloadable("union")) {
+ if (vfsload("union"))
+ err(EX_OSERR, "vfsload(union)");
endvfsent(); /* flush cache */
- vfc = getvfsbyname("union");
+ error = getvfsbyname("union", &vfc);
}
- if (!vfc)
+ if (error)
errx(EX_OSERR, "union filesystem is not available");
- if (mount(vfc->vfc_index, argv[1], mntflags, &args))
+ if (mount(vfc.vfc_name, argv[1], mntflags, &args))
err(EX_OSERR, target);
exit(0);
}
diff --git a/usr.sbin/mount_portalfs/Makefile b/usr.sbin/mount_portalfs/Makefile
index 85eca12..fd0e416 100644
--- a/usr.sbin/mount_portalfs/Makefile
+++ b/usr.sbin/mount_portalfs/Makefile
@@ -1,5 +1,5 @@
# From: @(#)Makefile 8.3 (Berkeley) 3/27/94
-# $Id$
+# $Id: Makefile,v 1.6 1997/02/22 14:32:52 peter Exp $
PROG= mount_portal
SRCS= mount_portal.c activate.c conf.c getmntopts.c pt_conf.c \
@@ -7,6 +7,7 @@ SRCS= mount_portal.c activate.c conf.c getmntopts.c pt_conf.c \
MAN8= mount_portal.8
MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -D_NEW_VFSCONF
CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
.PATH: ${MOUNT}
diff --git a/usr.sbin/mount_portalfs/activate.c b/usr.sbin/mount_portalfs/activate.c
index 18e30ab..f14a4a3 100644
--- a/usr.sbin/mount_portalfs/activate.c
+++ b/usr.sbin/mount_portalfs/activate.c
@@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)activate.c 8.2 (Berkeley) 3/27/94
+ * @(#)activate.c 8.3 (Berkeley) 4/28/95
*
- * $Id$
+ * $Id: activate.c,v 1.3 1997/02/22 14:32:53 peter Exp $
*/
#include <stdio.h>
@@ -89,7 +89,7 @@ int klen;
iov[1].iov_base = key;
iov[1].iov_len = klen;
- bzero((char *) &msg, sizeof(msg));
+ memset(&msg, 0, sizeof(msg));
msg.msg_iov = iov;
msg.msg_iovlen = 2;
@@ -129,7 +129,7 @@ int error;
/*
* Build a msghdr
*/
- bzero((char *) &msg, sizeof(msg));
+ memset(&msg, 0, sizeof(msg));
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
diff --git a/usr.sbin/mount_portalfs/mount_portalfs.c b/usr.sbin/mount_portalfs/mount_portalfs.c
index 9ed05e5..cf77264 100644
--- a/usr.sbin/mount_portalfs/mount_portalfs.c
+++ b/usr.sbin/mount_portalfs/mount_portalfs.c
@@ -42,10 +42,10 @@ char copyright[] =
#ifndef lint
/*
-static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
+static char sccsid[] = "@(#)mount_portal.c 8.6 (Berkeley) 4/26/95";
*/
static const char rcsid[] =
- "$Id$";
+ "$Id: mount_portal.c,v 1.9 1997/02/22 14:32:53 peter Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -93,7 +93,7 @@ int sig;
;
/* wrtp - waitpid _doesn't_ return 0 when no children! */
#ifdef notdef
- if (pid < 0)
+ if (pid < 0 && errno != ECHILD)
syslog(LOG_WARNING, "waitpid: %s", strerror(errno));
#endif
}
@@ -109,7 +109,7 @@ main(argc, argv)
char *mountpt;
int mntflags = 0;
char tag[32];
- struct vfsconf *vfc;
+ struct vfsconf vfc;
qelem q;
int rc;
@@ -171,26 +171,24 @@ main(argc, argv)
sprintf(tag, "portal:%d", getpid());
args.pa_config = tag;
- vfc = getvfsbyname("portal");
- if(!vfc && vfsisloadable("portal")) {
- if(vfsload("portal"))
+ error = getvfsbyname("portal", &vfc);
+ if (error && vfsisloadable("portal")) {
+ if (vfsload("portal"))
err(EX_OSERR, "vfsload(portal)");
- endvfsent(); /* flush cache */
- vfc = getvfsbyname("portal");
+ endvfsent();
+ error = getvfsbyname("portal", &vfc);
}
- if (!vfc)
+ if (error)
errx(EX_OSERR, "portal filesystem is not available");
- rc = mount(vfc ? vfc->vfc_index : MOUNT_PORTAL, mountpt, mntflags, &args);
+ rc = mount(vfc.vfc_name, mountpt, mntflags, &args);
if (rc < 0)
err(1, NULL);
-#ifdef notdef
/*
* Everything is ready to go - now is a good time to fork
*/
daemon(0, 0);
-#endif
/*
* Start logging (and change name)
@@ -272,7 +270,7 @@ main(argc, argv)
case 0:
(void) close(so);
activate(&q, so2);
- exit(0); /* stupid errors.... tidied up... wrtp*/
+ exit(0);
default:
(void) close(so2);
break;
diff --git a/usr.sbin/mount_portalfs/pt_file.c b/usr.sbin/mount_portalfs/pt_file.c
index 1c29e6d..9d71bc7 100644
--- a/usr.sbin/mount_portalfs/pt_file.c
+++ b/usr.sbin/mount_portalfs/pt_file.c
@@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)pt_file.c 8.2 (Berkeley) 3/27/94
+ * @(#)pt_file.c 8.3 (Berkeley) 7/3/94
*
- * $Id$
+ * $Id: pt_file.c,v 1.5 1997/02/22 14:32:56 peter Exp $
*/
#include <stdio.h>
diff --git a/usr.sbin/mount_portalfs/pt_tcp.c b/usr.sbin/mount_portalfs/pt_tcp.c
index 3c4962c..ea7ac31 100644
--- a/usr.sbin/mount_portalfs/pt_tcp.c
+++ b/usr.sbin/mount_portalfs/pt_tcp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1992, 1993
+ * Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
* All rights reserved.
*
@@ -34,9 +34,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)pt_tcp.c 8.3 (Berkeley) 3/27/94
+ * @(#)pt_tcp.c 8.5 (Berkeley) 4/28/95
*
- * $Id$
+ * $Id: pt_tcp.c,v 1.4 1997/02/22 14:32:56 peter Exp $
*/
#include <stdio.h>
@@ -62,11 +62,11 @@
* An unrecognised suffix is an error.
*/
int portal_tcp(pcr, key, v, kso, fdp)
-struct portal_cred *pcr;
-char *key;
-char **v;
-int kso;
-int *fdp;
+ struct portal_cred *pcr;
+ char *key;
+ char **v;
+ int kso;
+ int *fdp;
{
char host[MAXHOSTNAMELEN];
char port[MAXHOSTNAMELEN];
@@ -125,15 +125,16 @@ int *fdp;
if (sp != NULL)
s_port = (u_short)sp->s_port;
else {
- s_port = htons ((u_short)strtol (port, (char**)NULL, 10));
- if (s_port == 0)
+ s_port = strtoul(port, &p, 0);
+ if (s_port == 0 || *p != '\0')
return (EINVAL);
+ s_port = htons(s_port);
}
#ifdef DEBUG
printf ("port number for %s is %d\n", port, s_port);
#endif
- bzero(&sain, sizeof(sain));
+ memset(&sain, 0, sizeof(sain));
sain.sin_len = sizeof(sain);
sain.sin_family = AF_INET;
sain.sin_port = s_port;
OpenPOWER on IntegriCloud