summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mount_portalfs
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 /usr.sbin/mount_portalfs
parentf461294e0761e04bbc572e265770de9410b31c41 (diff)
downloadFreeBSD-src-1c0f77f024b01c2df41c395b7e5afd760d0a9062.zip
FreeBSD-src-1c0f77f024b01c2df41c395b7e5afd760d0a9062.tar.gz
Merge from Lite2 (use new getvfsbyname() and mount(2) interface)
Diffstat (limited to 'usr.sbin/mount_portalfs')
-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
5 files changed, 32 insertions, 32 deletions
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