]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/sys/nvpair_impl.h
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / include / sys / nvpair_impl.h
1 /*
2  * CDDL HEADER START
3  *
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.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26
27 /*
28  * Copyright (c) 2017 by Delphix. All rights reserved.
29  */
30
31 #ifndef _NVPAIR_IMPL_H
32 #define _NVPAIR_IMPL_H
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #include <sys/nvpair.h>
39
40 /*
41  * The structures here provided for information and debugging purposes only
42  * may be changed in the future.
43  */
44
45 /*
46  * implementation linked list for pre-packed data
47  */
48 typedef struct i_nvp i_nvp_t;
49
50 struct i_nvp {
51         union {
52                 /* ensure alignment */
53                 uint64_t        _nvi_align;
54
55                 struct {
56                         /* pointer to next nvpair */
57                         i_nvp_t *_nvi_next;
58
59                         /* pointer to prev nvpair */
60                         i_nvp_t *_nvi_prev;
61
62                         /* next pair in table bucket */
63                         i_nvp_t *_nvi_hashtable_next;
64                 } _nvi;
65         } _nvi_un;
66
67         /* nvpair */
68         nvpair_t nvi_nvp;
69 };
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
73
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 */
80
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;
85
86 #ifdef  __cplusplus
87 }
88 #endif
89
90 #endif  /* _NVPAIR_IMPL_H */