aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--amdgpu/util_hash_table.c18
-rw-r--r--amdgpu/util_hash_table.h24
2 files changed, 26 insertions, 16 deletions
diff --git a/amdgpu/util_hash_table.c b/amdgpu/util_hash_table.c
index cb7213c3..ce6f1d59 100644
--- a/amdgpu/util_hash_table.c
+++ b/amdgpu/util_hash_table.c
@@ -69,8 +69,9 @@ util_hash_table_item(struct util_hash_iter iter)
69 return (struct util_hash_table_item *)util_hash_iter_data(iter); 69 return (struct util_hash_table_item *)util_hash_iter_data(iter);
70} 70}
71 71
72struct util_hash_table *util_hash_table_create(unsigned (*hash)(void *key), 72drm_private struct util_hash_table *
73 int (*compare)(void *key1, void *key2)) 73util_hash_table_create(unsigned (*hash)(void *key),
74 int (*compare)(void *key1, void *key2))
74{ 75{
75 struct util_hash_table *ht; 76 struct util_hash_table *ht;
76 77
@@ -126,7 +127,8 @@ util_hash_table_find_item(struct util_hash_table *ht,
126 return NULL; 127 return NULL;
127} 128}
128 129
129void util_hash_table_set(struct util_hash_table *ht, void *key, void *value) 130drm_private void
131util_hash_table_set(struct util_hash_table *ht, void *key, void *value)
130{ 132{
131 unsigned key_hash; 133 unsigned key_hash;
132 struct util_hash_table_item *item; 134 struct util_hash_table_item *item;
@@ -159,7 +161,7 @@ void util_hash_table_set(struct util_hash_table *ht, void *key, void *value)
159 } 161 }
160} 162}
161 163
162void *util_hash_table_get(struct util_hash_table *ht, void *key) 164drm_private void *util_hash_table_get(struct util_hash_table *ht, void *key)
163{ 165{
164 unsigned key_hash; 166 unsigned key_hash;
165 struct util_hash_table_item *item; 167 struct util_hash_table_item *item;
@@ -177,7 +179,7 @@ void *util_hash_table_get(struct util_hash_table *ht, void *key)
177 return item->value; 179 return item->value;
178} 180}
179 181
180void util_hash_table_remove(struct util_hash_table *ht, void *key) 182drm_private void util_hash_table_remove(struct util_hash_table *ht, void *key)
181{ 183{
182 unsigned key_hash; 184 unsigned key_hash;
183 struct util_hash_iter iter; 185 struct util_hash_iter iter;
@@ -200,7 +202,7 @@ void util_hash_table_remove(struct util_hash_table *ht, void *key)
200 util_hash_erase(ht->head, iter); 202 util_hash_erase(ht->head, iter);
201} 203}
202 204
203void util_hash_table_clear(struct util_hash_table *ht) 205drm_private void util_hash_table_clear(struct util_hash_table *ht)
204{ 206{
205 struct util_hash_iter iter; 207 struct util_hash_iter iter;
206 struct util_hash_table_item *item; 208 struct util_hash_table_item *item;
@@ -217,7 +219,7 @@ void util_hash_table_clear(struct util_hash_table *ht)
217 } 219 }
218} 220}
219 221
220void util_hash_table_foreach(struct util_hash_table *ht, 222drm_private void util_hash_table_foreach(struct util_hash_table *ht,
221 void (*callback)(void *key, void *value, void *data), 223 void (*callback)(void *key, void *value, void *data),
222 void *data) 224 void *data)
223{ 225{
@@ -236,7 +238,7 @@ void util_hash_table_foreach(struct util_hash_table *ht,
236 } 238 }
237} 239}
238 240
239void util_hash_table_destroy(struct util_hash_table *ht) 241drm_private void util_hash_table_destroy(struct util_hash_table *ht)
240{ 242{
241 struct util_hash_iter iter; 243 struct util_hash_iter iter;
242 struct util_hash_table_item *item; 244 struct util_hash_table_item *item;
diff --git a/amdgpu/util_hash_table.h b/amdgpu/util_hash_table.h
index 04fe7043..e0001289 100644
--- a/amdgpu/util_hash_table.h
+++ b/amdgpu/util_hash_table.h
@@ -34,6 +34,12 @@
34#ifndef U_HASH_TABLE_H_ 34#ifndef U_HASH_TABLE_H_
35#define U_HASH_TABLE_H_ 35#define U_HASH_TABLE_H_
36 36
37#ifdef HAVE_CONFIG_H
38#include "config.h"
39#endif
40
41#include "libdrm_macros.h"
42
37/** 43/**
38 * Generic purpose hash table. 44 * Generic purpose hash table.
39 */ 45 */
@@ -45,21 +51,23 @@ struct util_hash_table;
45 * @param hash hash function 51 * @param hash hash function
46 * @param compare should return 0 for two equal keys. 52 * @param compare should return 0 for two equal keys.
47 */ 53 */
48struct util_hash_table *util_hash_table_create(unsigned (*hash)(void *key), 54drm_private struct util_hash_table *
49 int (*compare)(void *key1, void *key2)); 55util_hash_table_create(unsigned (*hash)(void *key),
56 int (*compare)(void *key1, void *key2));
50 57
51void util_hash_table_set(struct util_hash_table *ht, void *key, void *value); 58drm_private void
59util_hash_table_set(struct util_hash_table *ht, void *key, void *value);
52 60
53void *util_hash_table_get(struct util_hash_table *ht, void *key); 61drm_private void *util_hash_table_get(struct util_hash_table *ht, void *key);
54 62
55void util_hash_table_remove(struct util_hash_table *ht, void *key); 63drm_private void util_hash_table_remove(struct util_hash_table *ht, void *key);
56 64
57void util_hash_table_clear(struct util_hash_table *ht); 65drm_private void util_hash_table_clear(struct util_hash_table *ht);
58 66
59void util_hash_table_foreach(struct util_hash_table *ht, 67drm_private void util_hash_table_foreach(struct util_hash_table *ht,
60 void (*callback)(void *key, void *value, void *data), 68 void (*callback)(void *key, void *value, void *data),
61 void *data); 69 void *data);
62 70
63void util_hash_table_destroy(struct util_hash_table *ht); 71drm_private void util_hash_table_destroy(struct util_hash_table *ht);
64 72
65#endif /* U_HASH_TABLE_H_ */ 73#endif /* U_HASH_TABLE_H_ */