diff options
author | jamie <jamie@FreeBSD.org> | 2009-06-13 15:39:12 +0000 |
---|---|---|
committer | jamie <jamie@FreeBSD.org> | 2009-06-13 15:39:12 +0000 |
commit | f419891544e311aa974e0648e0455a9de14ea0fa (patch) | |
tree | f9cfb93ff7fc2f89561efcde362151b31946e095 /sys | |
parent | dbcc94be36eb7e16660d9d09b9885c37b7e22d1d (diff) | |
download | FreeBSD-src-f419891544e311aa974e0648e0455a9de14ea0fa.zip FreeBSD-src-f419891544e311aa974e0648e0455a9de14ea0fa.tar.gz |
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)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/cddl/compat/opensolaris/kern/opensolaris.c | 2 | ||||
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c | 4 | ||||
-rw-r--r-- | sys/dev/firewire/firewire.c | 2 | ||||
-rw-r--r-- | sys/dev/syscons/daemon/daemon_saver.c | 4 | ||||
-rw-r--r-- | sys/fs/nfsclient/nfs_clvfsops.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_jail.c | 62 | ||||
-rw-r--r-- | sys/kern/kern_mib.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_shutdown.c | 2 | ||||
-rw-r--r-- | sys/netinet6/icmp6.c | 12 | ||||
-rw-r--r-- | sys/netinet6/in6_ifattach.c | 6 | ||||
-rw-r--r-- | sys/nfsclient/bootp_subr.c | 2 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vfsops.c | 3 | ||||
-rw-r--r-- | sys/nlm/nlm_advlock.c | 2 | ||||
-rw-r--r-- | sys/sys/jail.h | 6 |
14 files changed, 62 insertions, 54 deletions
diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris.c b/sys/cddl/compat/opensolaris/kern/opensolaris.c index 5595bd1..443ac0a 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris.c @@ -83,7 +83,7 @@ opensolaris_modevent(module_t mod __unused, int type, void *data __unused) switch (type) { case MOD_LOAD: - utsname.nodename = prison0.pr_host; + utsname.nodename = prison0.pr_hostname; break; case MOD_UNLOAD: diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c index 8e20c4d..de520d3 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c @@ -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"); } diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index aff0418..a035959 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -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); } diff --git a/sys/dev/syscons/daemon/daemon_saver.c b/sys/dev/syscons/daemon/daemon_saver.c index 7530b4d..3009d31 100644 --- a/sys/dev/syscons/daemon/daemon_saver.c +++ b/sys/dev/syscons/daemon/daemon_saver.c @@ -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) { diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 01f41df..55f1fa4 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -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); diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 6abf8a3..c13b7d4 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -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 uio *optuio, int flags) 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 uio *optuio, int flags) * 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 uio *optuio, int flags) 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 uio *optuio, int flags) 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 *buf, size_t size) */ 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, char *buf, size_t size) { 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 *buf, size_t size) { 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); diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index 823df6b..d42d31d 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -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; diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 158b92a..80dda97 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -692,7 +692,7 @@ mkdumpheader(struct kerneldumpheader *kdh, char *magic, uint32_t archver, 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)); diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index e2fc21c..11e6cd6 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -719,7 +719,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) 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, int proto) 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; diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index c5d0729..2844f41 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -110,7 +110,7 @@ get_rand_ifid(struct ifnet *ifp, struct in6_addr *in6) 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 in6_addr *in6) /* 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 char *name, int namelen, 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; diff --git a/sys/nfsclient/bootp_subr.c b/sys/nfsclient/bootp_subr.c index 1d7a308..10fc8c4 100644 --- a/sys/nfsclient/bootp_subr.c +++ b/sys/nfsclient/bootp_subr.c @@ -1563,7 +1563,7 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, struct bootpc_ifcontext *ifctx, } 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; diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 5bc5cfd..6a28eab 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -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); diff --git a/sys/nlm/nlm_advlock.c b/sys/nlm/nlm_advlock.c index 029f77b..b179595 100644 --- a/sys/nlm/nlm_advlock.c +++ b/sys/nlm/nlm_advlock.c @@ -1226,7 +1226,7 @@ nlm_init_lock(struct flock *fl, int flags, int svid, 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; diff --git a/sys/sys/jail.h b/sys/sys/jail.h index 501d66e..494a677 100644 --- a/sys/sys/jail.h +++ b/sys/sys/jail.h @@ -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 */ |