Merge commit '7e3488dc6cdcb0c04e1ce167a1a3bfef83b5f2e0'
[unleashed.git] / include / sys / nvpair_impl.h
blobc9874b3e4db7eeb0c3442cc2f8c73f56990f20c5
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 * Copyright (c) 2017 by Delphix. All rights reserved.
31 #ifndef _NVPAIR_IMPL_H
32 #define _NVPAIR_IMPL_H
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 #include <sys/nvpair.h>
41 * The structures here provided for information and debugging purposes only
42 * may be changed in the future.
46 * implementation linked list for pre-packed data
48 typedef struct i_nvp i_nvp_t;
50 struct i_nvp {
51 union {
52 /* ensure alignment */
53 uint64_t _nvi_align;
55 struct {
56 /* pointer to next nvpair */
57 i_nvp_t *_nvi_next;
59 /* pointer to prev nvpair */
60 i_nvp_t *_nvi_prev;
62 /* next pair in table bucket */
63 i_nvp_t *_nvi_hashtable_next;
64 } _nvi;
65 } _nvi_un;
67 /* nvpair */
68 nvpair_t nvi_nvp;
70 #define nvi_next _nvi_un._nvi._nvi_next
71 #define nvi_prev _nvi_un._nvi._nvi_prev
72 #define nvi_hashtable_next _nvi_un._nvi._nvi_hashtable_next
74 typedef struct {
75 i_nvp_t *nvp_list; /* linked list of nvpairs */
76 i_nvp_t *nvp_last; /* last nvpair */
77 i_nvp_t *nvp_curr; /* current walker nvpair */
78 nv_alloc_t *nvp_nva; /* pluggable allocator */
79 uint32_t nvp_stat; /* internal state */
81 i_nvp_t **nvp_hashtable; /* table of entries used for lookup */
82 uint32_t nvp_nbuckets; /* # of buckets in hash table */
83 uint32_t nvp_nentries; /* # of entries in hash table */
84 } nvpriv_t;
86 #ifdef __cplusplus
88 #endif
90 #endif /* _NVPAIR_IMPL_H */