mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 11:29:36 +03:00
FreeBSD: Simplify INGLOBALZONE
FreeBSD's previous ZFS implemented INGLOBALZONE(thread) as (!jailed((thread)->td_ucred)) and passed curthread to INGLOBALZONE. We pass curproc instead of curthread, so we can achieve the same effect with (!jailed((proc)->p_ucred)). The implementation is trivial enough to fit on a single line in a define. We don't really need a whole separate function for something that's already macros all the way down. Eliminate in_globalzone. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes #10851
This commit is contained in:
parent
2f65c7a608
commit
eff621071f
@ -29,6 +29,8 @@
|
|||||||
#ifndef _OPENSOLARIS_SYS_ZONE_H_
|
#ifndef _OPENSOLARIS_SYS_ZONE_H_
|
||||||
#define _OPENSOLARIS_SYS_ZONE_H_
|
#define _OPENSOLARIS_SYS_ZONE_H_
|
||||||
|
|
||||||
|
#include <sys/jail.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Macros to help with zone visibility restrictions.
|
* Macros to help with zone visibility restrictions.
|
||||||
*/
|
*/
|
||||||
@ -36,12 +38,9 @@
|
|||||||
#define GLOBAL_ZONEID 0
|
#define GLOBAL_ZONEID 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is thread in the global zone?
|
* Is proc in the global zone?
|
||||||
*/
|
*/
|
||||||
#define INGLOBALZONE(p) in_globalzone((p))
|
#define INGLOBALZONE(proc) (!jailed((proc)->p_ucred))
|
||||||
|
|
||||||
|
|
||||||
extern boolean_t in_globalzone(struct proc *);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attach the given dataset to the given jail.
|
* Attach the given dataset to the given jail.
|
||||||
|
@ -242,12 +242,6 @@ zone_get_hostid(void *ptr)
|
|||||||
return ((uint32_t)curthread->td_ucred->cr_prison->pr_hostid);
|
return ((uint32_t)curthread->td_ucred->cr_prison->pr_hostid);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean_t
|
|
||||||
in_globalzone(struct proc *p)
|
|
||||||
{
|
|
||||||
return (!jailed(FIRST_THREAD_IN_PROC((p))->td_ucred));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
zone_sysinit(void *arg __unused)
|
zone_sysinit(void *arg __unused)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user