xref: /netbsd-src/external/cddl/osnet/dist/uts/common/sys/nvpair_impl.h (revision c1cb2cd89c023350f357f813e12b526f6f71002f)
1*c1cb2cd8Shaad /*
2*c1cb2cd8Shaad  * CDDL HEADER START
3*c1cb2cd8Shaad  *
4*c1cb2cd8Shaad  * The contents of this file are subject to the terms of the
5*c1cb2cd8Shaad  * Common Development and Distribution License, Version 1.0 only
6*c1cb2cd8Shaad  * (the "License").  You may not use this file except in compliance
7*c1cb2cd8Shaad  * with the License.
8*c1cb2cd8Shaad  *
9*c1cb2cd8Shaad  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*c1cb2cd8Shaad  * or http://www.opensolaris.org/os/licensing.
11*c1cb2cd8Shaad  * See the License for the specific language governing permissions
12*c1cb2cd8Shaad  * and limitations under the License.
13*c1cb2cd8Shaad  *
14*c1cb2cd8Shaad  * When distributing Covered Code, include this CDDL HEADER in each
15*c1cb2cd8Shaad  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*c1cb2cd8Shaad  * If applicable, add the following below this CDDL HEADER, with the
17*c1cb2cd8Shaad  * fields enclosed by brackets "[]" replaced with your own identifying
18*c1cb2cd8Shaad  * information: Portions Copyright [yyyy] [name of copyright owner]
19*c1cb2cd8Shaad  *
20*c1cb2cd8Shaad  * CDDL HEADER END
21*c1cb2cd8Shaad  */
22*c1cb2cd8Shaad /*
23*c1cb2cd8Shaad  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*c1cb2cd8Shaad  * Use is subject to license terms.
25*c1cb2cd8Shaad  */
26*c1cb2cd8Shaad 
27*c1cb2cd8Shaad #ifndef	_NVPAIR_IMPL_H
28*c1cb2cd8Shaad #define	_NVPAIR_IMPL_H
29*c1cb2cd8Shaad 
30*c1cb2cd8Shaad #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*c1cb2cd8Shaad 
32*c1cb2cd8Shaad #ifdef __cplusplus
33*c1cb2cd8Shaad extern "C" {
34*c1cb2cd8Shaad #endif
35*c1cb2cd8Shaad 
36*c1cb2cd8Shaad #include <sys/nvpair.h>
37*c1cb2cd8Shaad 
38*c1cb2cd8Shaad /*
39*c1cb2cd8Shaad  * The structures here provided for information and debugging purposes only
40*c1cb2cd8Shaad  * may be changed in the future.
41*c1cb2cd8Shaad  */
42*c1cb2cd8Shaad 
43*c1cb2cd8Shaad /*
44*c1cb2cd8Shaad  * implementation linked list for pre-packed data
45*c1cb2cd8Shaad  */
46*c1cb2cd8Shaad typedef struct i_nvp i_nvp_t;
47*c1cb2cd8Shaad 
48*c1cb2cd8Shaad struct i_nvp {
49*c1cb2cd8Shaad 	union {
50*c1cb2cd8Shaad 		uint64_t	_nvi_align;	/* ensure alignment */
51*c1cb2cd8Shaad 		struct {
52*c1cb2cd8Shaad 			i_nvp_t	*_nvi_next;	/* pointer to next nvpair */
53*c1cb2cd8Shaad 			i_nvp_t	*_nvi_prev;	/* pointer to prev nvpair */
54*c1cb2cd8Shaad 		} _nvi;
55*c1cb2cd8Shaad 	} _nvi_un;
56*c1cb2cd8Shaad 	nvpair_t nvi_nvp;			/* nvpair */
57*c1cb2cd8Shaad };
58*c1cb2cd8Shaad #define	nvi_next	_nvi_un._nvi._nvi_next
59*c1cb2cd8Shaad #define	nvi_prev	_nvi_un._nvi._nvi_prev
60*c1cb2cd8Shaad 
61*c1cb2cd8Shaad typedef struct {
62*c1cb2cd8Shaad 	i_nvp_t		*nvp_list;	/* linked list of nvpairs */
63*c1cb2cd8Shaad 	i_nvp_t		*nvp_last;	/* last nvpair */
64*c1cb2cd8Shaad 	i_nvp_t		*nvp_curr;	/* current walker nvpair */
65*c1cb2cd8Shaad 	nv_alloc_t	*nvp_nva;	/* pluggable allocator */
66*c1cb2cd8Shaad 	uint32_t	nvp_stat;	/* internal state */
67*c1cb2cd8Shaad } nvpriv_t;
68*c1cb2cd8Shaad 
69*c1cb2cd8Shaad #ifdef	__cplusplus
70*c1cb2cd8Shaad }
71*c1cb2cd8Shaad #endif
72*c1cb2cd8Shaad 
73*c1cb2cd8Shaad #endif	/* _NVPAIR_IMPL_H */
74