diff options
author | zec <zec@FreeBSD.org> | 2009-05-08 14:11:06 +0000 |
---|---|---|
committer | zec <zec@FreeBSD.org> | 2009-05-08 14:11:06 +0000 |
commit | 639797b2e609797fdaf2c8e88b9203bfc7c70b7e (patch) | |
tree | 070fe9c96176ed914dfefc12a45fea29b98c4122 /sys/kern/kern_prot.c | |
parent | f851007175f37de5aec0c77eb852e3444150e653 (diff) | |
download | FreeBSD-src-639797b2e609797fdaf2c8e88b9203bfc7c70b7e.zip FreeBSD-src-639797b2e609797fdaf2c8e88b9203bfc7c70b7e.tar.gz |
Introduce a new virtualization container, provisionally named vprocg, to hold
virtualized instances of hostname and domainname, as well as a new top-level
virtualization struct vimage, which holds pointers to struct vnet and struct
vprocg. Struct vprocg is likely to become replaced in the near future with
a new jail management API import.
As a consequence of this change, change struct ucred to point to a struct
vimage, instead of directly pointing to a vnet.
Merge vnet / vimage / ucred refcounting infrastructure from p4 / vimage
branch.
Permit kldload / kldunload operations to be executed only from the default
vimage context.
This change should have no functional impact on nooptions VIMAGE kernel
builds.
Reviewed by: bz
Approved by: julian (mentor)
Diffstat (limited to 'sys/kern/kern_prot.c')
-rw-r--r-- | sys/kern/kern_prot.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 9f13644..b35f81f 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include <sys/socketvar.h> #include <sys/syscallsubr.h> #include <sys/sysctl.h> +#include <sys/vimage.h> #if defined(INET) || defined(INET6) #include <netinet/in.h> @@ -1824,6 +1825,11 @@ crfree(struct ucred *cr) */ if (jailed(cr)) prison_free(cr->cr_prison); +#ifdef VIMAGE + /* XXX TODO: find out why and when cr_vimage can be NULL here! */ + if (cr->cr_vimage != NULL) + refcount_release(&cr->cr_vimage->vi_ucredrefc); +#endif #ifdef AUDIT audit_cred_destroy(cr); #endif @@ -1859,6 +1865,10 @@ crcopy(struct ucred *dest, struct ucred *src) uihold(dest->cr_ruidinfo); if (jailed(dest)) prison_hold(dest->cr_prison); +#ifdef VIMAGE + KASSERT(src->cr_vimage != NULL, ("cr_vimage == NULL")); + refcount_acquire(&dest->cr_vimage->vi_ucredrefc); +#endif #ifdef AUDIT audit_cred_copy(src, dest); #endif |