diff --git a/sbin/mount_cd9660/Makefile b/sbin/mount_cd9660/Makefile index fc192a51720..61129f30992 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 463b6601a5a..9434f3c0a9f 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 -#define CD9660 #include +#include #include #include @@ -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 cacee97415c..9a463a4b15a 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 46bfbdaadfd..8f3be49f38c 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 @@ -55,6 +55,8 @@ static const char rcsid[] = #include #include +#include + #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 0020b8bfeba..bcd1f510bfc 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 c252b0fa0f8..0ea35df2301 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 #include +#include #include #include @@ -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 ebf516b2c41..090d37cedef 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 5048d4af272..cf280592b45 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 33788257654..31061c02a34 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 @@ -64,15 +64,15 @@ static const char rcsid[] = #endif #ifdef NFSKERB -#include +#include #include #endif #include #include -#define _KERNEL +#define KERNEL #include -#undef _KERNEL +#undef KERNEL #include #include @@ -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)) -#else - if (mount(MOUNT_NFS, name, mntflags, nfsargsp)) -#endif + if (mount(vfc.vfc_name, name, mntflags, nfsargsp)) err(1, "%s", name); +#else + 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 3f8b3ef94b0..97f3c624d66 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 1a47b27d9d6..38473fa0c0d 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 2d654c67240..9269a718e0e 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 @@ -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 3f8b3ef94b0..97f3c624d66 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 1a47b27d9d6..38473fa0c0d 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 2d654c67240..9269a718e0e 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 @@ -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 85eca128f4d..fd0e416b196 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 18e30abd1f7..f14a4a3269c 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 @@ -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 9ed05e52b57..cf77264266a 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 @@ -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 1c29e6d73ad..9d71bc72997 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 diff --git a/sbin/mount_portal/pt_tcp.c b/sbin/mount_portal/pt_tcp.c index 3c4962c7548..ea7ac3166e5 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 @@ -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 85eca128f4d..fd0e416b196 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 18e30abd1f7..f14a4a3269c 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 @@ -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 9ed05e52b57..cf77264266a 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 @@ -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 1c29e6d73ad..9d71bc72997 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 diff --git a/sbin/mount_portalfs/pt_tcp.c b/sbin/mount_portalfs/pt_tcp.c index 3c4962c7548..ea7ac3166e5 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 @@ -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 780b52cf727..fce19db5f4d 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 b6cced99dd1..d0ecb29dd75 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 5d884ff3dc7..9872395eca1 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 @@ -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 780b52cf727..fce19db5f4d 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 b6cced99dd1..d0ecb29dd75 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 5d884ff3dc7..9872395eca1 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 @@ -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 e213137f168..6ac36c9bdf9 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 54c464714b0..cb5e406b6ad 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 e213137f168..6ac36c9bdf9 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 54c464714b0..cb5e406b6ad 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 85eca128f4d..fd0e416b196 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 18e30abd1f7..f14a4a3269c 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 @@ -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 9ed05e52b57..cf77264266a 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 @@ -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 1c29e6d73ad..9d71bc72997 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 diff --git a/usr.sbin/mount_portalfs/pt_tcp.c b/usr.sbin/mount_portalfs/pt_tcp.c index 3c4962c7548..ea7ac3166e5 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 @@ -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;