summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authorjamie <jamie@FreeBSD.org>2009-05-29 21:27:12 +0000
committerjamie <jamie@FreeBSD.org>2009-05-29 21:27:12 +0000
commit572db1408a55640213faa331981d20cda01f68d8 (patch)
tree36c53629863ffb1eb32354e9a24549059dd6273f /sys/geom
parent64785ac65985d6800df1bacd80b5a3ba30b36b27 (diff)
downloadFreeBSD-src-572db1408a55640213faa331981d20cda01f68d8.zip
FreeBSD-src-572db1408a55640213faa331981d20cda01f68d8.tar.gz
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)
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/vinum/geom_vinum_create.c6
-rw-r--r--sys/geom/vinum/geom_vinum_drive.c1
2 files changed, 2 insertions, 5 deletions
diff --git a/sys/geom/vinum/geom_vinum_create.c b/sys/geom/vinum/geom_vinum_create.c
index 3f8212c..0ea0ef3 100644
--- a/sys/geom/vinum/geom_vinum_create.c
+++ b/sys/geom/vinum/geom_vinum_create.c
@@ -31,10 +31,10 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/bio.h>
#include <sys/conf.h>
+#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/systm.h>
-#include <sys/vimage.h>
#include <geom/geom.h>
#include <geom/vinum/geom_vinum_var.h>
@@ -157,9 +157,7 @@ gv_create_drive(struct gv_softc *sc, struct gv_drive *d)
hdr = g_malloc(sizeof(*hdr), M_WAITOK | M_ZERO);
hdr->magic = GV_MAGIC;
hdr->config_length = GV_CFG_LEN;
- mtx_lock(&hostname_mtx);
- bcopy(G_hostname, hdr->label.sysname, GV_HOSTNAME_LEN);
- mtx_unlock(&hostname_mtx);
+ getcredhostname(NULL, hdr->label.sysname, GV_HOSTNAME_LEN);
strlcpy(hdr->label.name, d->name, sizeof(hdr->label.name));
microtime(&hdr->label.date_of_birth);
d->hdr = hdr;
diff --git a/sys/geom/vinum/geom_vinum_drive.c b/sys/geom/vinum/geom_vinum_drive.c
index 1e9dd0b..5ab68f3 100644
--- a/sys/geom/vinum/geom_vinum_drive.c
+++ b/sys/geom/vinum/geom_vinum_drive.c
@@ -30,7 +30,6 @@ __FBSDID("$FreeBSD$");
#include <sys/endian.h>
#include <sys/malloc.h>
#include <sys/systm.h>
-#include <sys/vimage.h>
#include <geom/geom.h>
#include <geom/vinum/geom_vinum_var.h>
OpenPOWER on IntegriCloud