From 9565c0e60d32b764b30a0da8f2731c3e9487e65f Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Tue, 14 Nov 1995 09:37:22 +0000 Subject: [PATCH] Get rid of hostnamelen variable. --- sys/fs/cd9660/cd9660_rrip.c | 6 +++--- sys/isofs/cd9660/cd9660_rrip.c | 6 +++--- sys/kern/kern_sysctl.c | 16 +++------------- sys/miscfs/kernfs/kernfs_vnops.c | 6 +++--- sys/nfs/nfs_vfsops.c | 3 +-- sys/nfsclient/nfs_vfsops.c | 3 +-- 6 files changed, 14 insertions(+), 26 deletions(-) diff --git a/sys/fs/cd9660/cd9660_rrip.c b/sys/fs/cd9660/cd9660_rrip.c index dca898301697..279b8b28fe4b 100644 --- a/sys/fs/cd9660/cd9660_rrip.c +++ b/sys/fs/cd9660/cd9660_rrip.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_rrip.c 8.2 (Berkeley) 1/23/94 - * $Id: cd9660_rrip.c,v 1.6 1995/01/16 17:03:26 joerg Exp $ + * $Id: cd9660_rrip.c,v 1.7 1995/05/30 08:05:00 rgrimes Exp $ */ #include @@ -152,7 +152,7 @@ cd9660_rrip_slink(p,ana) case ISO_SUSP_CFLAG_HOST: /* Inserting hostname i.e. "kurt.tools.de" */ inbuf = hostname; - wlen = hostnamelen; + wlen = strlen(hostname); break; case ISO_SUSP_CFLAG_CONTINUE: @@ -224,7 +224,7 @@ cd9660_rrip_altname(p,ana) case ISO_SUSP_CFLAG_HOST: /* Inserting hostname i.e. "kurt.tools.de" */ inbuf = hostname; - wlen = hostnamelen; + wlen = strlen(hostname); break; case ISO_SUSP_CFLAG_CONTINUE: diff --git a/sys/isofs/cd9660/cd9660_rrip.c b/sys/isofs/cd9660/cd9660_rrip.c index dca898301697..279b8b28fe4b 100644 --- a/sys/isofs/cd9660/cd9660_rrip.c +++ b/sys/isofs/cd9660/cd9660_rrip.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_rrip.c 8.2 (Berkeley) 1/23/94 - * $Id: cd9660_rrip.c,v 1.6 1995/01/16 17:03:26 joerg Exp $ + * $Id: cd9660_rrip.c,v 1.7 1995/05/30 08:05:00 rgrimes Exp $ */ #include @@ -152,7 +152,7 @@ cd9660_rrip_slink(p,ana) case ISO_SUSP_CFLAG_HOST: /* Inserting hostname i.e. "kurt.tools.de" */ inbuf = hostname; - wlen = hostnamelen; + wlen = strlen(hostname); break; case ISO_SUSP_CFLAG_CONTINUE: @@ -224,7 +224,7 @@ cd9660_rrip_altname(p,ana) case ISO_SUSP_CFLAG_HOST: /* Inserting hostname i.e. "kurt.tools.de" */ inbuf = hostname; - wlen = hostnamelen; + wlen = strlen(hostname); break; case ISO_SUSP_CFLAG_CONTINUE: diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 4e4a33fd728f..8556848c1530 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 - * $Id: kern_sysctl.c,v 1.45 1995/11/14 09:26:17 phk Exp $ + * $Id: kern_sysctl.c,v 1.46 1995/11/14 09:29:15 phk Exp $ */ /* @@ -149,19 +149,9 @@ SYSCTL_PROC(_kern, KERN_UPDATEINTERVAL, update, CTLTYPE_INT|CTLFLAG_RW, char hostname[MAXHOSTNAMELEN]; -int hostnamelen; -static int -sysctl_kern_hostname SYSCTL_HANDLER_ARGS -{ - int error = sysctl_handle_string(oidp, - oidp->oid_arg1, oidp->oid_arg2, req); - if (req->newptr && (error == 0 || error == ENOMEM)) - hostnamelen = req->newlen; - return error; -} -SYSCTL_PROC(_kern, KERN_HOSTNAME, hostname, CTLTYPE_STRING|CTLFLAG_RW, - &hostname, sizeof(hostname), sysctl_kern_hostname, ""); +SYSCTL_STRING(_kern, KERN_HOSTNAME, hostname, CTLFLAG_RW, + hostname, sizeof(hostname), ""); static int sysctl_order_cmp(const void *a, const void *b) diff --git a/sys/miscfs/kernfs/kernfs_vnops.c b/sys/miscfs/kernfs/kernfs_vnops.c index e54158881c80..843e8ef347b1 100644 --- a/sys/miscfs/kernfs/kernfs_vnops.c +++ b/sys/miscfs/kernfs/kernfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)kernfs_vnops.c 8.6 (Berkeley) 2/10/94 - * $Id: kernfs_vnops.c,v 1.11 1995/10/29 15:31:37 phk Exp $ + * $Id: kernfs_vnops.c,v 1.12 1995/11/09 08:15:38 bde Exp $ */ /* @@ -137,7 +137,7 @@ kernfs_xread(kt, buf, len, lenp) case KTT_HOSTNAME: { char *cp = hostname; - int xlen = hostnamelen; + int xlen = strlen(hostname); if (xlen >= (len-2)) return (EINVAL); @@ -185,11 +185,11 @@ kernfs_xwrite(kt, buf, len) { switch (kt->kt_tag) { case KTT_HOSTNAME: { + /* XXX BOGUS !!! no check for the length */ if (buf[len-1] == '\n') --len; bcopy(buf, hostname, len); hostname[len] = '\0'; - hostnamelen = len; return (0); } diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index dd09ab9506bf..f6f3dd66c962 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vfsops.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_vfsops.c,v 1.19 1995/08/24 10:17:39 dfr Exp $ + * $Id: nfs_vfsops.c,v 1.20 1995/08/30 17:24:15 dfr Exp $ */ #include @@ -433,7 +433,6 @@ nfs_mountroot() for (i = 0; i < MAXHOSTNAMELEN; i++) if (hostname[i] == '\0') break; - hostnamelen = i; inittodr(ntohl(nd->root_time)); return (0); } diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index dd09ab9506bf..f6f3dd66c962 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vfsops.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_vfsops.c,v 1.19 1995/08/24 10:17:39 dfr Exp $ + * $Id: nfs_vfsops.c,v 1.20 1995/08/30 17:24:15 dfr Exp $ */ #include @@ -433,7 +433,6 @@ nfs_mountroot() for (i = 0; i < MAXHOSTNAMELEN; i++) if (hostname[i] == '\0') break; - hostnamelen = i; inittodr(ntohl(nd->root_time)); return (0); }