xref: /titanic_44/usr/src/lib/libfakekernel/common/sys/zone.h (revision b819cea2f73f98c5662230cc9affc8cc84f77fcf)
1*b819cea2SGordon Ross /*
2*b819cea2SGordon Ross  * CDDL HEADER START
3*b819cea2SGordon Ross  *
4*b819cea2SGordon Ross  * The contents of this file are subject to the terms of the
5*b819cea2SGordon Ross  * Common Development and Distribution License (the "License").
6*b819cea2SGordon Ross  * You may not use this file except in compliance with the License.
7*b819cea2SGordon Ross  *
8*b819cea2SGordon Ross  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*b819cea2SGordon Ross  * or http://www.opensolaris.org/os/licensing.
10*b819cea2SGordon Ross  * See the License for the specific language governing permissions
11*b819cea2SGordon Ross  * and limitations under the License.
12*b819cea2SGordon Ross  *
13*b819cea2SGordon Ross  * When distributing Covered Code, include this CDDL HEADER in each
14*b819cea2SGordon Ross  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*b819cea2SGordon Ross  * If applicable, add the following below this CDDL HEADER, with the
16*b819cea2SGordon Ross  * fields enclosed by brackets "[]" replaced with your own identifying
17*b819cea2SGordon Ross  * information: Portions Copyright [yyyy] [name of copyright owner]
18*b819cea2SGordon Ross  *
19*b819cea2SGordon Ross  * CDDL HEADER END
20*b819cea2SGordon Ross  */
21*b819cea2SGordon Ross /*
22*b819cea2SGordon Ross  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
23*b819cea2SGordon Ross  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
24*b819cea2SGordon Ross  */
25*b819cea2SGordon Ross 
26*b819cea2SGordon Ross #ifndef _SYS_ZONE_H
27*b819cea2SGordon Ross #define	_SYS_ZONE_H
28*b819cea2SGordon Ross 
29*b819cea2SGordon Ross #include <sys/types.h>
30*b819cea2SGordon Ross #include <sys/mutex.h>
31*b819cea2SGordon Ross #include <sys/param.h>
32*b819cea2SGordon Ross #include <sys/cred.h>
33*b819cea2SGordon Ross #include <sys/rctl.h>
34*b819cea2SGordon Ross #include <sys/ksynch.h>
35*b819cea2SGordon Ross 
36*b819cea2SGordon Ross #ifdef	__cplusplus
37*b819cea2SGordon Ross extern "C" {
38*b819cea2SGordon Ross #endif
39*b819cea2SGordon Ross 
40*b819cea2SGordon Ross /*
41*b819cea2SGordon Ross  * NOTE
42*b819cea2SGordon Ross  *
43*b819cea2SGordon Ross  * The contents of this file are private to the implementation of
44*b819cea2SGordon Ross  * Solaris and are subject to change at any time without notice.
45*b819cea2SGordon Ross  * Applications and drivers using these interfaces may fail to
46*b819cea2SGordon Ross  * run on future releases.
47*b819cea2SGordon Ross  */
48*b819cea2SGordon Ross 
49*b819cea2SGordon Ross #define	GLOBAL_ZONEID	0
50*b819cea2SGordon Ross #define	ZONENAME_MAX	64
51*b819cea2SGordon Ross 
52*b819cea2SGordon Ross #if defined(_KERNEL) || defined(_FAKE_KERNEL)
53*b819cea2SGordon Ross 
54*b819cea2SGordon Ross #include <sys/list.h>
55*b819cea2SGordon Ross 
56*b819cea2SGordon Ross typedef struct zone_ref {
57*b819cea2SGordon Ross 	struct zone	*zref_zone; /* the zone to which the reference refers */
58*b819cea2SGordon Ross 	list_node_t	zref_linkage; /* linkage for zone_t::zone_ref_list */
59*b819cea2SGordon Ross } zone_ref_t;
60*b819cea2SGordon Ross 
61*b819cea2SGordon Ross typedef struct zone {
62*b819cea2SGordon Ross 	char		*zone_name;	/* zone's configuration name */
63*b819cea2SGordon Ross 	zoneid_t	zone_id;	/* ID of zone */
64*b819cea2SGordon Ross 	struct proc	*zone_zsched;	/* Dummy kernel "zsched" process */
65*b819cea2SGordon Ross 	time_t		zone_boot_time;
66*b819cea2SGordon Ross 	struct vnode	*zone_rootvp;	/* zone's root vnode */
67*b819cea2SGordon Ross 	char		*zone_rootpath;	/* Path to zone's root + '/' */
68*b819cea2SGordon Ross 	int fake_zone[10];
69*b819cea2SGordon Ross } zone_t;
70*b819cea2SGordon Ross 
71*b819cea2SGordon Ross extern zone_t zone0;
72*b819cea2SGordon Ross extern zone_t *global_zone;
73*b819cea2SGordon Ross extern uint_t maxzones;
74*b819cea2SGordon Ross 
75*b819cea2SGordon Ross /*
76*b819cea2SGordon Ross  * Zone-specific data (ZSD) APIs
77*b819cea2SGordon Ross  */
78*b819cea2SGordon Ross /*
79*b819cea2SGordon Ross  * The following is what code should be initializing its zone_key_t to if it
80*b819cea2SGordon Ross  * calls zone_getspecific() without necessarily knowing that zone_key_create()
81*b819cea2SGordon Ross  * has been called on the key.
82*b819cea2SGordon Ross  */
83*b819cea2SGordon Ross #define	ZONE_KEY_UNINITIALIZED	0
84*b819cea2SGordon Ross 
85*b819cea2SGordon Ross typedef uint_t zone_key_t;
86*b819cea2SGordon Ross 
87*b819cea2SGordon Ross extern void	zone_key_create(zone_key_t *, void *(*)(zoneid_t),
88*b819cea2SGordon Ross     void (*)(zoneid_t, void *), void (*)(zoneid_t, void *));
89*b819cea2SGordon Ross extern int 	zone_key_delete(zone_key_t);
90*b819cea2SGordon Ross extern void	*zone_getspecific(zone_key_t, zone_t *);
91*b819cea2SGordon Ross extern int	zone_setspecific(zone_key_t, zone_t *, const void *);
92*b819cea2SGordon Ross 
93*b819cea2SGordon Ross extern zoneid_t getzoneid(void);
94*b819cea2SGordon Ross 
95*b819cea2SGordon Ross #endif	/* _KERNEL || _FAKE_KERNEL */
96*b819cea2SGordon Ross 
97*b819cea2SGordon Ross #ifdef	__cplusplus
98*b819cea2SGordon Ross }
99*b819cea2SGordon Ross #endif
100*b819cea2SGordon Ross 
101*b819cea2SGordon Ross #endif	/* _SYS_ZONE_H */
102