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.
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.
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]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
34 #define HASH_RATIO (3)
35 #define MAX_LOGSIZE (sizeof (uint32_t) * 8 - 1)
36 #define HVAL_MASK (((uint32_t)1 << MAX_LOGSIZE) - 1)
37 #define BAD_HVAL_MASK ((uint32_t)1 << MAX_LOGSIZE)
38 #define VALID_HVAL(H) ((H) & HVAL_MASK)
39 #define BAD_HVAL(H) (((H) & BAD_HVAL_MASK) == BAD_HVAL_MASK)
41 #define FLAGS_CTRL_MASK (0x10000000)
42 #define FLAGS_CHUNK_MASK (0x00001111)
44 typedef struct htab_item
{
47 struct htab_item
*next
;
50 typedef struct htab_itemx
{
68 /* AVL tree of the object UIDs */
70 /* the biggest UID in the tree */
72 /* fifo list of available UIDs */
77 #define UID_FLAGS_SEQ (0x1)
79 #define FOR_EACH_ITEM(HTAB, UID, STMT) \
81 UID = htab_get_next(HTAB, UID);\
84 UID = htab_get_next(HTAB, UID);\
89 htab_t
*htab_create(int, uint16_t, uint16_t);
90 void htab_destroy(htab_t
*);
91 uint32_t htab_compute_hval(const uchar_t
*);
92 int htab_add(htab_t
*, void *, int, uint32_t *, int *);
93 isns_obj_t
*htab_remove(htab_t
*, void *, uint32_t, int);
94 int htab_lookup(htab_t
*, void *, uint32_t,
95 uint32_t *, int (*)(void *, void *), int);
96 uint32_t htab_get_next(htab_t
*, uint32_t);
98 void htab_dump(htab_t
*);
105 #endif /* _ISNS_HTAB_H */