svn commit: r194118 - in head/sys: cddl/compat/opensolaris/kern cddl/contrib/opensolaris/uts/common/fs/zfs dev/firewire dev/syscons/daemon fs/nfsclient kern netinet6 nfsclient nlm sys

Jamie Gritton jamie at FreeBSD.org
Sat Jun 13 15:39:14 UTC 2009


Author: jamie
Date: Sat Jun 13 15:39:12 2009
New Revision: 194118
URL: http://svn.freebsd.org/changeset/base/194118

Log:
  Rename the host-related prison fields to be the same as the host.*
  parameters they represent, and the variables they replaced, instead of
  abbreviated versions of them.
  
  Approved by:	bz (mentor)

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c
  head/sys/dev/firewire/firewire.c
  head/sys/dev/syscons/daemon/daemon_saver.c
  head/sys/fs/nfsclient/nfs_clvfsops.c
  head/sys/kern/kern_jail.c
  head/sys/kern/kern_mib.c
  head/sys/kern/kern_shutdown.c
  head/sys/netinet6/icmp6.c
  head/sys/netinet6/in6_ifattach.c
  head/sys/nfsclient/bootp_subr.c
  head/sys/nfsclient/nfs_vfsops.c
  head/sys/nlm/nlm_advlock.c
  head/sys/sys/jail.h

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris.c
==============================================================================
--- head/sys/cddl/compat/opensolaris/kern/opensolaris.c	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris.c	Sat Jun 13 15:39:12 2009	(r194118)
@@ -83,7 +83,7 @@ opensolaris_modevent(module_t mod __unus
 
 	switch (type) {
 	case MOD_LOAD:
-		utsname.nodename = prison0.pr_host;
+		utsname.nodename = prison0.pr_hostname;
 		break;
 
 	case MOD_UNLOAD:

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c	Sat Jun 13 15:39:12 2009	(r194118)
@@ -179,9 +179,9 @@ static char *
 spa_history_zone()
 {
 #ifdef _KERNEL
-	/* XXX: pr_host can be changed by default from within a jail! */
+	/* XXX: pr_hostname can be changed by default from within a jail! */
 	if (jailed(curthread->td_ucred))
-		return (curthread->td_ucred->cr_prison->pr_host);
+		return (curthread->td_ucred->cr_prison->pr_hostname);
 #endif
 	return ("global");
 }

Modified: head/sys/dev/firewire/firewire.c
==============================================================================
--- head/sys/dev/firewire/firewire.c	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/dev/firewire/firewire.c	Sat Jun 13 15:39:12 2009	(r194118)
@@ -724,7 +724,7 @@ fw_reset_crom(struct firewire_comm *fc)
 	crom_add_entry(root, CSRKEY_HW, __FreeBSD_version);
 #endif
 	mtx_lock(&prison0.pr_mtx);
-	crom_add_simple_text(src, root, &buf->hw, prison0.pr_host);
+	crom_add_simple_text(src, root, &buf->hw, prison0.pr_hostname);
 	mtx_unlock(&prison0.pr_mtx);
 }
 

Modified: head/sys/dev/syscons/daemon/daemon_saver.c
==============================================================================
--- head/sys/dev/syscons/daemon/daemon_saver.c	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/dev/syscons/daemon/daemon_saver.c	Sat Jun 13 15:39:12 2009	(r194118)
@@ -353,10 +353,10 @@ daemon_init(video_adapter_t *adp)
 {
 
 	mtx_lock(&prison0.pr_mtx);
-	messagelen = strlen(prison0.pr_host) + 3 + strlen(ostype) + 1 + 
+	messagelen = strlen(prison0.pr_hostname) + 3 + strlen(ostype) + 1 + 
 	    strlen(osrelease);
 	message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK);
-	sprintf(message, "%s - %s %s", prison0.pr_host, ostype, osrelease);
+	sprintf(message, "%s - %s %s", prison0.pr_hostname, ostype, osrelease);
 	mtx_unlock(&prison0.pr_mtx);
 	blanked = 0;
 	switch (adp->va_mode) {

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c	Sat Jun 13 15:39:12 2009	(r194118)
@@ -478,7 +478,8 @@ ncl_mountroot(struct mount *mp)
 	 * mount the right /var based upon its preset value.
 	 */
 	mtx_lock(&prison0.pr_mtx);
-	strlcpy(prison0.pr_host, nd->my_hostnam, sizeof(prison0.pr_host));
+	strlcpy(prison0.pr_hostname, nd->my_hostnam,
+	    sizeof(prison0.pr_hostname));
 	mtx_unlock(&prison0.pr_mtx);
 	inittodr(ntohl(nd->root_time));
 	return (0);

Modified: head/sys/kern/kern_jail.c
==============================================================================
--- head/sys/kern/kern_jail.c	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/kern/kern_jail.c	Sat Jun 13 15:39:12 2009	(r194118)
@@ -80,7 +80,7 @@ struct prison prison0 = {
 	.pr_uref	= 1,
 	.pr_path	= "/",
 	.pr_securelevel	= -1,
-	.pr_uuid	= "00000000-0000-0000-0000-000000000000",
+	.pr_hostuuid	= "00000000-0000-0000-0000-000000000000",
 	.pr_children	= LIST_HEAD_INITIALIZER(&prison0.pr_children),
 	.pr_flags	= PR_HOST,
 	.pr_allow	= PR_ALLOW_ALL,
@@ -1073,11 +1073,11 @@ kern_jail_set(struct thread *td, struct 
 			name = "";
 		if (host != NULL || domain != NULL || uuid != NULL || gothid) {
 			if (host == NULL)
-				host = ppr->pr_host;
+				host = ppr->pr_hostname;
 			if (domain == NULL)
-				domain = ppr->pr_domain;
+				domain = ppr->pr_domainname;
 			if (uuid == NULL)
-				uuid = ppr->pr_uuid;
+				uuid = ppr->pr_hostuuid;
 			if (!gothid)
 				hid = ppr->pr_hostid;
 		}
@@ -1525,22 +1525,23 @@ kern_jail_set(struct thread *td, struct 
 			 * it is always set with allprison_lock at least
 			 * shared, and is held exclusively here.
 			 */
-			strlcpy(pr->pr_host, pr->pr_parent->pr_host,
-			    sizeof(pr->pr_host));
-			strlcpy(pr->pr_domain, pr->pr_parent->pr_domain,
-			    sizeof(pr->pr_domain));
-			strlcpy(pr->pr_uuid, pr->pr_parent->pr_uuid,
-			    sizeof(pr->pr_uuid));
+			strlcpy(pr->pr_hostname, pr->pr_parent->pr_hostname,
+			    sizeof(pr->pr_hostname));
+			strlcpy(pr->pr_domainname, pr->pr_parent->pr_domainname,
+			    sizeof(pr->pr_domainname));
+			strlcpy(pr->pr_hostuuid, pr->pr_parent->pr_hostuuid,
+			    sizeof(pr->pr_hostuuid));
 			pr->pr_hostid = pr->pr_parent->pr_hostid;
 		}
 	} else if (host != NULL || domain != NULL || uuid != NULL || gothid) {
 		/* Set this prison, and any descendants without PR_HOST. */
 		if (host != NULL)
-			strlcpy(pr->pr_host, host, sizeof(pr->pr_host));
+			strlcpy(pr->pr_hostname, host, sizeof(pr->pr_hostname));
 		if (domain != NULL)
-			strlcpy(pr->pr_domain, domain, sizeof(pr->pr_domain));
+			strlcpy(pr->pr_domainname, domain, 
+			    sizeof(pr->pr_domainname));
 		if (uuid != NULL)
-			strlcpy(pr->pr_uuid, uuid, sizeof(pr->pr_uuid));
+			strlcpy(pr->pr_hostuuid, uuid, sizeof(pr->pr_hostuuid));
 		if (gothid)
 			pr->pr_hostid = hid;
 		FOREACH_PRISON_DESCENDANT_LOCKED(pr, tpr, descend) {
@@ -1548,14 +1549,17 @@ kern_jail_set(struct thread *td, struct 
 				descend = 0;
 			else {
 				if (host != NULL)
-					strlcpy(tpr->pr_host, pr->pr_host,
-					    sizeof(tpr->pr_host));
+					strlcpy(tpr->pr_hostname,
+					    pr->pr_hostname,
+					    sizeof(tpr->pr_hostname));
 				if (domain != NULL)
-					strlcpy(tpr->pr_domain, pr->pr_domain,
-					    sizeof(tpr->pr_domain));
+					strlcpy(tpr->pr_domainname, 
+					    pr->pr_domainname,
+					    sizeof(tpr->pr_domainname));
 				if (uuid != NULL)
-					strlcpy(tpr->pr_uuid, pr->pr_uuid,
-					    sizeof(tpr->pr_uuid));
+					strlcpy(tpr->pr_hostuuid,
+					    pr->pr_hostuuid,
+					    sizeof(tpr->pr_hostuuid));
 				if (gothid)
 					tpr->pr_hostid = hid;
 			}
@@ -1873,13 +1877,13 @@ kern_jail_get(struct thread *td, struct 
 	    sizeof(pr->pr_securelevel));
 	if (error != 0 && error != ENOENT)
 		goto done_deref;
-	error = vfs_setopts(opts, "host.hostname", pr->pr_host);
+	error = vfs_setopts(opts, "host.hostname", pr->pr_hostname);
 	if (error != 0 && error != ENOENT)
 		goto done_deref;
-	error = vfs_setopts(opts, "host.domainname", pr->pr_domain);
+	error = vfs_setopts(opts, "host.domainname", pr->pr_domainname);
 	if (error != 0 && error != ENOENT)
 		goto done_deref;
-	error = vfs_setopts(opts, "host.hostuuid", pr->pr_uuid);
+	error = vfs_setopts(opts, "host.hostuuid", pr->pr_hostuuid);
 	if (error != 0 && error != ENOENT)
 		goto done_deref;
 #ifdef COMPAT_IA32
@@ -3220,7 +3224,7 @@ getcredhostname(struct ucred *cred, char
 	 */
 	pr = (cred != NULL) ? cred->cr_prison : &prison0;
 	mtx_lock(&pr->pr_mtx);
-	strlcpy(buf, pr->pr_host, size);
+	strlcpy(buf, pr->pr_hostname, size);
 	mtx_unlock(&pr->pr_mtx);
 }
 
@@ -3229,7 +3233,7 @@ getcreddomainname(struct ucred *cred, ch
 {
 
 	mtx_lock(&cred->cr_prison->pr_mtx);
-	strlcpy(buf, cred->cr_prison->pr_domain, size);
+	strlcpy(buf, cred->cr_prison->pr_domainname, size);
 	mtx_unlock(&cred->cr_prison->pr_mtx);
 }
 
@@ -3238,7 +3242,7 @@ getcredhostuuid(struct ucred *cred, char
 {
 
 	mtx_lock(&cred->cr_prison->pr_mtx);
-	strlcpy(buf, cred->cr_prison->pr_uuid, size);
+	strlcpy(buf, cred->cr_prison->pr_hostuuid, size);
 	mtx_unlock(&cred->cr_prison->pr_mtx);
 }
 
@@ -3650,7 +3654,7 @@ sysctl_jail_list(SYSCTL_HANDLER_ARGS)
 		xp->pr_state = cpr->pr_uref > 0
 		    ? PRISON_STATE_ALIVE : PRISON_STATE_DYING;
 		strlcpy(xp->pr_path, prison_path(pr, cpr), sizeof(xp->pr_path));
-		strlcpy(xp->pr_host, cpr->pr_host, sizeof(xp->pr_host));
+		strlcpy(xp->pr_host, cpr->pr_hostname, sizeof(xp->pr_host));
 		strlcpy(xp->pr_name, prison_name(pr, cpr), sizeof(xp->pr_name));
 #ifdef INET
 		xp->pr_ip4s = cpr->pr_ip4s;
@@ -3935,9 +3939,9 @@ db_show_prison(struct prison *pr)
 			db_printf(" %s", pr_allow_names[fi]);
 	db_printf("\n");
 	db_printf(" enforce_statfs  = %d\n", pr->pr_enforce_statfs);
-	db_printf(" host.hostname   = %s\n", pr->pr_host);
-	db_printf(" host.domainname = %s\n", pr->pr_domain);
-	db_printf(" host.hostuuid   = %s\n", pr->pr_uuid);
+	db_printf(" host.hostname   = %s\n", pr->pr_hostname);
+	db_printf(" host.domainname = %s\n", pr->pr_domainname);
+	db_printf(" host.hostuuid   = %s\n", pr->pr_hostuuid);
 	db_printf(" host.hostid     = %lu\n", pr->pr_hostid);
 #ifdef INET
 	db_printf(" ip4s            = %d\n", pr->pr_ip4s);

Modified: head/sys/kern/kern_mib.c
==============================================================================
--- head/sys/kern/kern_mib.c	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/kern/kern_mib.c	Sat Jun 13 15:39:12 2009	(r194118)
@@ -261,15 +261,15 @@ sysctl_hostname(SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC(_kern, KERN_HOSTNAME, hostname,
     CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE,
-    (void *)(offsetof(struct prison, pr_host)), MAXHOSTNAMELEN,
+    (void *)(offsetof(struct prison, pr_hostname)), MAXHOSTNAMELEN,
     sysctl_hostname, "A", "Hostname");
 SYSCTL_PROC(_kern, KERN_NISDOMAINNAME, domainname,
     CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE,
-    (void *)(offsetof(struct prison, pr_domain)), MAXHOSTNAMELEN,
+    (void *)(offsetof(struct prison, pr_domainname)), MAXHOSTNAMELEN,
     sysctl_hostname, "A", "Name of the current YP/NIS domain");
 SYSCTL_PROC(_kern, KERN_HOSTUUID, hostuuid,
     CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE,
-    (void *)(offsetof(struct prison, pr_uuid)), HOSTUUIDLEN,
+    (void *)(offsetof(struct prison, pr_hostuuid)), HOSTUUIDLEN,
     sysctl_hostname, "A", "Host UUID");
 
 static int	regression_securelevel_nonmonotonic = 0;

Modified: head/sys/kern/kern_shutdown.c
==============================================================================
--- head/sys/kern/kern_shutdown.c	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/kern/kern_shutdown.c	Sat Jun 13 15:39:12 2009	(r194118)
@@ -692,7 +692,7 @@ mkdumpheader(struct kerneldumpheader *kd
 	kdh->dumplength = htod64(dumplen);
 	kdh->dumptime = htod64(time_second);
 	kdh->blocksize = htod32(blksz);
-	strncpy(kdh->hostname, prison0.pr_host, sizeof(kdh->hostname));
+	strncpy(kdh->hostname, prison0.pr_hostname, sizeof(kdh->hostname));
 	strncpy(kdh->versionstring, version, sizeof(kdh->versionstring));
 	if (panicstr != NULL)
 		strncpy(kdh->panicstring, panicstr, sizeof(kdh->panicstring));

Modified: head/sys/netinet6/icmp6.c
==============================================================================
--- head/sys/netinet6/icmp6.c	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/netinet6/icmp6.c	Sat Jun 13 15:39:12 2009	(r194118)
@@ -719,7 +719,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 			maxhlen = M_TRAILINGSPACE(n) - maxlen;
 			pr = curthread->td_ucred->cr_prison;
 			mtx_lock(&pr->pr_mtx);
-			hlen = strlen(pr->pr_host);
+			hlen = strlen(pr->pr_hostname);
 			if (maxhlen > hlen)
 				maxhlen = hlen;
 			/*
@@ -731,7 +731,8 @@ icmp6_input(struct mbuf **mp, int *offp,
 			bcopy(icmp6, nicmp6, sizeof(struct icmp6_hdr));
 			p = (u_char *)(nicmp6 + 1);
 			bzero(p, 4);
-			bcopy(pr->pr_host, p + 4, maxhlen); /* meaningless TTL */
+			/* meaningless TTL */
+			bcopy(pr->pr_hostname, p + 4, maxhlen);
 			mtx_unlock(&pr->pr_mtx);
 			noff = sizeof(struct ip6_hdr);
 			n->m_pkthdr.len = n->m_len = sizeof(struct ip6_hdr) +
@@ -1334,7 +1335,8 @@ ni6_input(struct mbuf *m, int off)
 			 */
 			pr = curthread->td_ucred->cr_prison;
 			mtx_lock(&pr->pr_mtx);
-			n = ni6_nametodns(pr->pr_host, strlen(pr->pr_host), 0);
+			n = ni6_nametodns(pr->pr_hostname,
+			    strlen(pr->pr_hostname), 0);
 			mtx_unlock(&pr->pr_mtx);
 			if (!n || n->m_next || n->m_len == 0)
 				goto bad;
@@ -1461,8 +1463,8 @@ ni6_input(struct mbuf *m, int off)
 		 */
 		pr = curthread->td_ucred->cr_prison;
 		mtx_lock(&pr->pr_mtx);
-		n->m_next =
-		    ni6_nametodns(pr->pr_host, strlen(pr->pr_host), oldfqdn);
+		n->m_next = ni6_nametodns(pr->pr_hostname,
+		    strlen(pr->pr_hostname), oldfqdn);
 		mtx_unlock(&pr->pr_mtx);
 		if (n->m_next == NULL)
 			goto bad;

Modified: head/sys/netinet6/in6_ifattach.c
==============================================================================
--- head/sys/netinet6/in6_ifattach.c	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/netinet6/in6_ifattach.c	Sat Jun 13 15:39:12 2009	(r194118)
@@ -110,7 +110,7 @@ get_rand_ifid(struct ifnet *ifp, struct 
 
 	pr = curthread->td_ucred->cr_prison;
 	mtx_lock(&pr->pr_mtx);
-	hostnamelen = strlen(pr->pr_host);
+	hostnamelen = strlen(pr->pr_hostname);
 #if 0
 	/* we need at least several letters as seed for ifid */
 	if (hostnamelen < 3) {
@@ -122,7 +122,7 @@ get_rand_ifid(struct ifnet *ifp, struct 
 	/* generate 8 bytes of pseudo-random value. */
 	bzero(&ctxt, sizeof(ctxt));
 	MD5Init(&ctxt);
-	MD5Update(&ctxt, pr->pr_host, hostnamelen);
+	MD5Update(&ctxt, pr->pr_hostname, hostnamelen);
 	mtx_unlock(&pr->pr_mtx);
 	MD5Final(digest, &ctxt);
 
@@ -637,7 +637,7 @@ in6_nigroup(struct ifnet *ifp, const cha
 	if (!name && namelen == -1) {
 		pr = curthread->td_ucred->cr_prison;
 		mtx_lock(&pr->pr_mtx);
-		name = pr->pr_host;
+		name = pr->pr_hostname;
 		namelen = strlen(name);
 	} else
 		pr = NULL;

Modified: head/sys/nfsclient/bootp_subr.c
==============================================================================
--- head/sys/nfsclient/bootp_subr.c	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/nfsclient/bootp_subr.c	Sat Jun 13 15:39:12 2009	(r194118)
@@ -1563,7 +1563,7 @@ bootpc_decode_reply(struct nfsv3_diskles
 		} else {
 			strcpy(nd->my_hostnam, p);
 			mtx_lock(&prison0.pr_mtx);
-			strcpy(prison0.pr_host, p);
+			strcpy(prison0.pr_hostname, p);
 			mtx_unlock(&prison0.pr_mtx);
 			printf("hostname %s ", p);
 			gctx->sethostname = ifctx;

Modified: head/sys/nfsclient/nfs_vfsops.c
==============================================================================
--- head/sys/nfsclient/nfs_vfsops.c	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/nfsclient/nfs_vfsops.c	Sat Jun 13 15:39:12 2009	(r194118)
@@ -524,7 +524,8 @@ nfs_mountroot(struct mount *mp)
 	 * mount the right /var based upon its preset value.
 	 */
 	mtx_lock(&prison0.pr_mtx);
-	strlcpy(prison0.pr_host, nd->my_hostnam, sizeof (prison0.pr_host));
+	strlcpy(prison0.pr_hostname, nd->my_hostnam,
+	    sizeof (prison0.pr_hostname));
 	mtx_unlock(&prison0.pr_mtx);
 	inittodr(ntohl(nd->root_time));
 	return (0);

Modified: head/sys/nlm/nlm_advlock.c
==============================================================================
--- head/sys/nlm/nlm_advlock.c	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/nlm/nlm_advlock.c	Sat Jun 13 15:39:12 2009	(r194118)
@@ -1226,7 +1226,7 @@ nlm_init_lock(struct flock *fl, int flag
 	oh_len = strlen(oh_space);
 
 	memset(lock, 0, sizeof(*lock));
-	lock->caller_name = prison0.pr_host;
+	lock->caller_name = prison0.pr_hostname;
 	lock->fh.n_len = fhlen;
 	lock->fh.n_bytes = fh;
 	lock->oh.n_len = oh_len;

Modified: head/sys/sys/jail.h
==============================================================================
--- head/sys/sys/jail.h	Sat Jun 13 15:35:22 2009	(r194117)
+++ head/sys/sys/jail.h	Sat Jun 13 15:39:12 2009	(r194118)
@@ -152,7 +152,7 @@ struct prison {
 	char		 pr_path[MAXPATHLEN];		/* (c) chroot path */
 	struct cpuset	*pr_cpuset;			/* (p) cpuset */
 	struct vnode	*pr_root;			/* (c) vnode to rdir */
-	char		 pr_host[MAXHOSTNAMELEN];	/* (p) jail hostname */
+	char		 pr_hostname[MAXHOSTNAMELEN];	/* (p) jail hostname */
 	char		 pr_name[MAXHOSTNAMELEN];	/* (p) admin jail name */
 	struct prison	*pr_parent;			/* (c) containing jail */
 	int		 pr_securelevel;		/* (p) securelevel */
@@ -168,8 +168,8 @@ struct prison {
 	int		 pr_prisoncount;		/* (a) number of child jails */
 	unsigned	 pr_allow;			/* (p) PR_ALLOW_* flags */
 	int		 pr_enforce_statfs;		/* (p) statfs permission */
-	char		 pr_domain[MAXHOSTNAMELEN];	/* (p) jail domainname */
-	char		 pr_uuid[HOSTUUIDLEN];		/* (p) jail hostuuid */
+	char		 pr_domainname[MAXHOSTNAMELEN];	/* (p) jail domainname */
+	char		 pr_hostuuid[HOSTUUIDLEN];	/* (p) jail hostuuid */
 	unsigned long	 pr_hostid;			/* (p) jail hostid */
 };
 #endif /* _KERNEL || _WANT_PRISON */


More information about the svn-src-all mailing list