1*8329232eSGordon Ross /*
2*8329232eSGordon Ross  * CDDL HEADER START
3*8329232eSGordon Ross  *
4*8329232eSGordon Ross  * The contents of this file are subject to the terms of the
5*8329232eSGordon Ross  * Common Development and Distribution License (the "License").
6*8329232eSGordon Ross  * You may not use this file except in compliance with the License.
7*8329232eSGordon Ross  *
8*8329232eSGordon Ross  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*8329232eSGordon Ross  * or http://www.opensolaris.org/os/licensing.
10*8329232eSGordon Ross  * See the License for the specific language governing permissions
11*8329232eSGordon Ross  * and limitations under the License.
12*8329232eSGordon Ross  *
13*8329232eSGordon Ross  * When distributing Covered Code, include this CDDL HEADER in each
14*8329232eSGordon Ross  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*8329232eSGordon Ross  * If applicable, add the following below this CDDL HEADER, with the
16*8329232eSGordon Ross  * fields enclosed by brackets "[]" replaced with your own identifying
17*8329232eSGordon Ross  * information: Portions Copyright [yyyy] [name of copyright owner]
18*8329232eSGordon Ross  *
19*8329232eSGordon Ross  * CDDL HEADER END
20*8329232eSGordon Ross  */
21*8329232eSGordon Ross 
22*8329232eSGordon Ross /*
23*8329232eSGordon Ross  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24*8329232eSGordon Ross  * Copyright 2015, Joyent Inc. All rights reserved.
25*8329232eSGordon Ross  * Copyright (c) 2016 by Delphix. All rights reserved.
26*8329232eSGordon Ross  * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
27*8329232eSGordon Ross  */
28*8329232eSGordon Ross 
29*8329232eSGordon Ross /*
30*8329232eSGordon Ross  * Simulating just one zone here (the global zone)
31*8329232eSGordon Ross  */
32*8329232eSGordon Ross 
33*8329232eSGordon Ross #include <sys/types.h>
34*8329232eSGordon Ross #include <sys/zone.h>
35*8329232eSGordon Ross #include <sys/debug.h>
36*8329232eSGordon Ross 
37*8329232eSGordon Ross static void *zone_specific_val;
38*8329232eSGordon Ross static void *(*zkey_create)(zoneid_t);
39*8329232eSGordon Ross // static void (*zkey_shutdown)(zoneid_t, void *);
40*8329232eSGordon Ross // static void (*zkey_destroy)(zoneid_t, void *);
41*8329232eSGordon Ross 
42*8329232eSGordon Ross /* ARGSUSED */
43*8329232eSGordon Ross void
zone_key_create(zone_key_t * keyp,void * (* create)(zoneid_t),void (* shutdown)(zoneid_t,void *),void (* destroy)(zoneid_t,void *))44*8329232eSGordon Ross zone_key_create(zone_key_t *keyp, void *(*create)(zoneid_t),
45*8329232eSGordon Ross     void (*shutdown)(zoneid_t, void *), void (*destroy)(zoneid_t, void *))
46*8329232eSGordon Ross {
47*8329232eSGordon Ross 
48*8329232eSGordon Ross 	zkey_create = create;
49*8329232eSGordon Ross 	// zkey_shutdown = shutdown;
50*8329232eSGordon Ross 	// zkey_destroy = destroy;
51*8329232eSGordon Ross 	*keyp = 1;
52*8329232eSGordon Ross }
53*8329232eSGordon Ross 
54*8329232eSGordon Ross /* ARGSUSED */
55*8329232eSGordon Ross int
zone_key_delete(zone_key_t key)56*8329232eSGordon Ross zone_key_delete(zone_key_t key)
57*8329232eSGordon Ross {
58*8329232eSGordon Ross 	return (-1);
59*8329232eSGordon Ross }
60*8329232eSGordon Ross 
61*8329232eSGordon Ross /* ARGSUSED */
62*8329232eSGordon Ross int
zone_setspecific(zone_key_t key,zone_t * zone,const void * data)63*8329232eSGordon Ross zone_setspecific(zone_key_t key, zone_t *zone, const void *data)
64*8329232eSGordon Ross {
65*8329232eSGordon Ross 	return (-1);
66*8329232eSGordon Ross }
67*8329232eSGordon Ross 
68*8329232eSGordon Ross /* ARGSUSED */
69*8329232eSGordon Ross void *
zone_getspecific(zone_key_t key,zone_t * zone)70*8329232eSGordon Ross zone_getspecific(zone_key_t key, zone_t *zone)
71*8329232eSGordon Ross {
72*8329232eSGordon Ross 	ASSERT(key == 1);
73*8329232eSGordon Ross 	if (zone_specific_val == NULL)
74*8329232eSGordon Ross 		zone_specific_val = (*zkey_create)(zone->zone_id);
75*8329232eSGordon Ross 	return (zone_specific_val);
76*8329232eSGordon Ross }
77