3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24
25 #ifndef _SYS_ZAP_LEAF_H
26 #define _SYS_ZAP_LEAF_H
27
28 #include <sys/zap.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 struct zap;
35 struct zap_name;
36 struct zap_stats;
37
38 #define ZAP_LEAF_MAGIC 0x2AB1EAF
39
40 /* chunk size = 24 bytes */
41 #define ZAP_LEAF_CHUNKSIZE 24
42
135 uint16_t le_name_chunk; /* first chunk of the name */
136 uint16_t le_name_numints; /* ints in name (incl null) */
137 uint16_t le_value_chunk; /* first chunk of the value */
138 uint16_t le_value_numints; /* value length in ints */
139 uint32_t le_cd; /* collision differentiator */
140 uint64_t le_hash; /* hash value of the name */
141 } l_entry;
142 struct zap_leaf_array {
143 uint8_t la_type; /* always ZAP_CHUNK_ARRAY */
144 uint8_t la_array[ZAP_LEAF_ARRAY_BYTES];
145 uint16_t la_next; /* next blk or CHAIN_END */
146 } l_array;
147 struct zap_leaf_free {
148 uint8_t lf_type; /* always ZAP_CHUNK_FREE */
149 uint8_t lf_pad[ZAP_LEAF_ARRAY_BYTES];
150 uint16_t lf_next; /* next in free list, or CHAIN_END */
151 } l_free;
152 } zap_leaf_chunk_t;
153
154 typedef struct zap_leaf {
155 krwlock_t l_rwlock;
156 uint64_t l_blkid; /* 1<<ZAP_BLOCK_SHIFT byte block off */
157 int l_bs; /* block size shift */
158 dmu_buf_t *l_dbuf;
159 } zap_leaf_t;
160
161 inline zap_leaf_phys_t *
162 zap_leaf_phys(zap_leaf_t *l)
163 {
164 return (l->l_dbuf->db_data);
165 }
166
167 typedef struct zap_entry_handle {
168 /* Set by zap_leaf and public to ZAP */
169 uint64_t zeh_num_integers;
170 uint64_t zeh_hash;
171 uint32_t zeh_cd;
172 uint8_t zeh_integer_size;
173
174 /* Private to zap_leaf */
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
24 */
25
26 #ifndef _SYS_ZAP_LEAF_H
27 #define _SYS_ZAP_LEAF_H
28
29 #include <sys/zap.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 struct zap;
36 struct zap_name;
37 struct zap_stats;
38
39 #define ZAP_LEAF_MAGIC 0x2AB1EAF
40
41 /* chunk size = 24 bytes */
42 #define ZAP_LEAF_CHUNKSIZE 24
43
136 uint16_t le_name_chunk; /* first chunk of the name */
137 uint16_t le_name_numints; /* ints in name (incl null) */
138 uint16_t le_value_chunk; /* first chunk of the value */
139 uint16_t le_value_numints; /* value length in ints */
140 uint32_t le_cd; /* collision differentiator */
141 uint64_t le_hash; /* hash value of the name */
142 } l_entry;
143 struct zap_leaf_array {
144 uint8_t la_type; /* always ZAP_CHUNK_ARRAY */
145 uint8_t la_array[ZAP_LEAF_ARRAY_BYTES];
146 uint16_t la_next; /* next blk or CHAIN_END */
147 } l_array;
148 struct zap_leaf_free {
149 uint8_t lf_type; /* always ZAP_CHUNK_FREE */
150 uint8_t lf_pad[ZAP_LEAF_ARRAY_BYTES];
151 uint16_t lf_next; /* next in free list, or CHAIN_END */
152 } l_free;
153 } zap_leaf_chunk_t;
154
155 typedef struct zap_leaf {
156 dmu_buf_user_t l_dbu;
157 krwlock_t l_rwlock;
158 uint64_t l_blkid; /* 1<<ZAP_BLOCK_SHIFT byte block off */
159 int l_bs; /* block size shift */
160 dmu_buf_t *l_dbuf;
161 } zap_leaf_t;
162
163 inline zap_leaf_phys_t *
164 zap_leaf_phys(zap_leaf_t *l)
165 {
166 return (l->l_dbuf->db_data);
167 }
168
169 typedef struct zap_entry_handle {
170 /* Set by zap_leaf and public to ZAP */
171 uint64_t zeh_num_integers;
172 uint64_t zeh_hash;
173 uint32_t zeh_cd;
174 uint8_t zeh_integer_size;
175
176 /* Private to zap_leaf */
|