Unleashed v1.4
[unleashed.git] / usr / src / lib / udapl / udapl_tavor / include / dapl_hash.h
blob93d15ba047743c7f42e7756d2a7f923ab7302302
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
23 * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
27 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
33 * HEADER: dapl_hash.h
35 * PURPOSE: Utility defs & routines for the hash data structure
37 * $Id: dapl_hash.h,v 1.4 2003/06/13 12:21:09 sjs2 Exp $
40 #ifndef _DAPL_HASH_H_
41 #define _DAPL_HASH_H_
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
47 #include "dapl.h"
52 * Defines
57 * Hash table size.
59 * Default is small; use the larger sample values for hash tables
60 * known to be heavily used. The sample values chosen are the
61 * largest primes below 2^8, 2^9, and 2^10.
63 #define DAPL_DEF_HASHSIZE 251
64 #define DAPL_MED_HASHSIZE 509
65 #define DAPL_LRG_HASHSIZE 1021
67 #define DAPL_HASH_TABLE_DEFAULT_CAPACITY DAPL_DEF_HASHSIZE
69 typedef enum {
70 DAPL_HASH_ITERATE_INIT = 1,
71 DAPL_HASH_ITERATE_NEXT
72 } DAPL_HASH_ITERATOR;
77 * Function Prototypes
81 extern DAT_RETURN
82 dapls_hash_create(
83 IN DAT_COUNT capacity,
84 IN DAT_BOOLEAN locking_required,
85 OUT DAPL_HASH_TABLE **pp_table);
87 extern DAT_RETURN
88 dapls_hash_free(
89 IN DAPL_HASH_TABLE *p_table);
91 extern DAT_RETURN
92 dapls_hash_size(
93 IN DAPL_HASH_TABLE *p_table,
94 OUT DAT_COUNT *p_size);
96 extern DAT_RETURN
97 dapls_hash_insert(
98 IN DAPL_HASH_TABLE *p_table,
99 IN DAPL_HASH_KEY key,
100 IN DAPL_HASH_DATA data);
102 extern DAT_RETURN
103 dapls_hash_search(
104 IN DAPL_HASH_TABLE *p_table,
105 IN DAPL_HASH_KEY key,
106 OUT DAPL_HASH_DATA *p_data);
108 extern DAT_RETURN
109 dapls_hash_remove(
110 IN DAPL_HASH_TABLE *p_table,
111 IN DAPL_HASH_KEY key,
112 OUT DAPL_HASH_DATA *p_data);
114 extern DAT_RETURN
115 dapls_hash_iterate(
116 IN DAPL_HASH_TABLE *p_table,
117 IN DAPL_HASH_ITERATOR op,
118 OUT DAPL_HASH_DATA *p_data);
120 #ifdef __cplusplus
122 #endif
124 #endif /* _DAPL_HASH_H_ */