diff options
-rw-r--r-- | amdgpu/util_hash_table.c | 18 | ||||
-rw-r--r-- | amdgpu/util_hash_table.h | 24 |
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 | ||
72 | struct util_hash_table *util_hash_table_create(unsigned (*hash)(void *key), | 72 | drm_private struct util_hash_table * |
73 | int (*compare)(void *key1, void *key2)) | 73 | util_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 | ||
129 | void util_hash_table_set(struct util_hash_table *ht, void *key, void *value) | 130 | drm_private void |
131 | util_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 | ||
162 | void *util_hash_table_get(struct util_hash_table *ht, void *key) | 164 | drm_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 | ||
180 | void util_hash_table_remove(struct util_hash_table *ht, void *key) | 182 | drm_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 | ||
203 | void util_hash_table_clear(struct util_hash_table *ht) | 205 | drm_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 | ||
220 | void util_hash_table_foreach(struct util_hash_table *ht, | 222 | drm_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 | ||
239 | void util_hash_table_destroy(struct util_hash_table *ht) | 241 | drm_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 | */ |
48 | struct util_hash_table *util_hash_table_create(unsigned (*hash)(void *key), | 54 | drm_private struct util_hash_table * |
49 | int (*compare)(void *key1, void *key2)); | 55 | util_hash_table_create(unsigned (*hash)(void *key), |
56 | int (*compare)(void *key1, void *key2)); | ||
50 | 57 | ||
51 | void util_hash_table_set(struct util_hash_table *ht, void *key, void *value); | 58 | drm_private void |
59 | util_hash_table_set(struct util_hash_table *ht, void *key, void *value); | ||
52 | 60 | ||
53 | void *util_hash_table_get(struct util_hash_table *ht, void *key); | 61 | drm_private void *util_hash_table_get(struct util_hash_table *ht, void *key); |
54 | 62 | ||
55 | void util_hash_table_remove(struct util_hash_table *ht, void *key); | 63 | drm_private void util_hash_table_remove(struct util_hash_table *ht, void *key); |
56 | 64 | ||
57 | void util_hash_table_clear(struct util_hash_table *ht); | 65 | drm_private void util_hash_table_clear(struct util_hash_table *ht); |
58 | 66 | ||
59 | void util_hash_table_foreach(struct util_hash_table *ht, | 67 | drm_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 | ||
63 | void util_hash_table_destroy(struct util_hash_table *ht); | 71 | drm_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_ */ |