aboutsummaryrefslogtreecommitdiff
path: root/sys/nfsclient/nfs_vfsops.c
diff options
context:
space:
mode:
authorJamie Gritton <jamie@FreeBSD.org>2009-05-29 21:27:12 +0000
committerJamie Gritton <jamie@FreeBSD.org>2009-05-29 21:27:12 +0000
commit76ca6f88dab430fe415094fb54beb7eaa010d22e (patch)
tree36c53629863ffb1eb32354e9a24549059dd6273f /sys/nfsclient/nfs_vfsops.c
parent88812d9e1dfe430d3387fb39f958373f40b079f2 (diff)
downloadsrc-76ca6f88dab430fe415094fb54beb7eaa010d22e.tar.gz
src-76ca6f88dab430fe415094fb54beb7eaa010d22e.zip
Place hostnames and similar information fully under the prison system.
The system hostname is now stored in prison0, and the global variable "hostname" has been removed, as has the hostname_mtx mutex. Jails may have their own host information, or they may inherit it from the parent/system. The proper way to read the hostname is via getcredhostname(), which will copy either the hostname associated with the passed cred, or the system hostname if you pass NULL. The system hostname can still be accessed directly (and without locking) at prison0.pr_host, but that should be avoided where possible. The "similar information" referred to is domainname, hostid, and hostuuid, which have also become prison parameters and had their associated global variables removed. Approved by: bz (mentor)
Notes
Notes: svn path=/head/; revision=193066
Diffstat (limited to 'sys/nfsclient/nfs_vfsops.c')
-rw-r--r--sys/nfsclient/nfs_vfsops.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c
index 7d4802365d02..5bc5cfdcd788 100644
--- a/sys/nfsclient/nfs_vfsops.c
+++ b/sys/nfsclient/nfs_vfsops.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/bio.h>
#include <sys/buf.h>
+#include <sys/jail.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
@@ -56,7 +57,6 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/vnode.h>
#include <sys/signalvar.h>
-#include <sys/vimage.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
@@ -415,12 +415,11 @@ int
nfs_mountroot(struct mount *mp)
{
struct thread *td = curthread;
- INIT_VPROCG(TD_TO_VPROCG(td));
struct nfsv3_diskless *nd = &nfsv3_diskless;
struct socket *so;
struct vnode *vp;
struct ifreq ir;
- int error, i;
+ int error;
u_long l;
char buf[128];
char *cp;
@@ -524,13 +523,9 @@ nfs_mountroot(struct mount *mp)
* set hostname here and then let the "/etc/rc.xxx" files
* mount the right /var based upon its preset value.
*/
- mtx_lock(&hostname_mtx);
- bcopy(nd->my_hostnam, V_hostname, MAXHOSTNAMELEN);
- V_hostname[MAXHOSTNAMELEN - 1] = '\0';
- for (i = 0; i < MAXHOSTNAMELEN; i++)
- if (V_hostname[i] == '\0')
- break;
- mtx_unlock(&hostname_mtx);
+ mtx_lock(&prison0.pr_mtx);
+ strlcpy(prison0.pr_host, nd->my_hostnam, sizeof (prison0.pr_host));
+ mtx_unlock(&prison0.pr_mtx);
inittodr(ntohl(nd->root_time));
return (0);
}