Lines Matching refs:map

37 static struct oalp_entry *sys_hashmap_oa_lp_find(const struct sys_hashmap *map, uint64_t key,  in sys_hashmap_oa_lp_find()  argument
41 const size_t n_buckets = map->data->n_buckets; in sys_hashmap_oa_lp_find()
42 uint32_t hash = map->hash_func(&key, sizeof(key)); in sys_hashmap_oa_lp_find()
43 struct oalp_entry *const buckets = map->data->buckets; in sys_hashmap_oa_lp_find()
76 static int sys_hashmap_oa_lp_insert_no_rehash(struct sys_hashmap *map, uint64_t key, uint64_t value, in sys_hashmap_oa_lp_insert_no_rehash() argument
81 struct sys_hashmap_oa_lp_data *data = (struct sys_hashmap_oa_lp_data *)map->data; in sys_hashmap_oa_lp_insert_no_rehash()
83 entry = sys_hashmap_oa_lp_find(map, key, true, true, true); in sys_hashmap_oa_lp_insert_no_rehash()
113 static int sys_hashmap_oa_lp_rehash(struct sys_hashmap *map, bool grow) in sys_hashmap_oa_lp_rehash() argument
121 struct sys_hashmap_oa_lp_data *data = (struct sys_hashmap_oa_lp_data *)map->data; in sys_hashmap_oa_lp_rehash()
123 if (!sys_hashmap_should_rehash(map, grow, data->n_tombstones, &new_n_buckets)) { in sys_hashmap_oa_lp_rehash()
127 if (map->data->size != SIZE_MAX && map->data->size == map->config->max_size) { in sys_hashmap_oa_lp_rehash()
136 new_buckets = (struct oalp_entry *)map->alloc_func(NULL, new_n_buckets * sizeof(*entry)); in sys_hashmap_oa_lp_rehash()
155 sys_hashmap_oa_lp_insert_no_rehash(map, entry->key, entry->value, NULL); in sys_hashmap_oa_lp_rehash()
161 map->alloc_func(old_buckets, 0); in sys_hashmap_oa_lp_rehash()
170 const struct sys_hashmap *map = (const struct sys_hashmap *)it->map; in sys_hashmap_oa_lp_iter_next() local
171 struct oalp_entry *buckets = map->data->buckets; in sys_hashmap_oa_lp_iter_next()
173 __ASSERT(it->size == map->data->size, "Concurrent modification!"); in sys_hashmap_oa_lp_iter_next()
181 __ASSERT(i < map->data->n_buckets, "Invalid iterator state %p", it->state); in sys_hashmap_oa_lp_iter_next()
183 for (; i < map->data->n_buckets; ++i) { in sys_hashmap_oa_lp_iter_next()
201 static void sys_hashmap_oa_lp_iter(const struct sys_hashmap *map, struct sys_hashmap_iterator *it) in sys_hashmap_oa_lp_iter() argument
203 it->map = map; in sys_hashmap_oa_lp_iter()
206 *((size_t *)&it->size) = map->data->size; in sys_hashmap_oa_lp_iter()
209 static void sys_hashmap_oa_lp_clear(struct sys_hashmap *map, sys_hashmap_callback_t cb, in sys_hashmap_oa_lp_clear() argument
213 struct sys_hashmap_oa_lp_data *data = (struct sys_hashmap_oa_lp_data *)map->data; in sys_hashmap_oa_lp_clear()
225 map->alloc_func(data->buckets, 0); in sys_hashmap_oa_lp_clear()
234 static inline int sys_hashmap_oa_lp_insert(struct sys_hashmap *map, uint64_t key, uint64_t value, in sys_hashmap_oa_lp_insert() argument
239 ret = sys_hashmap_oa_lp_rehash(map, true); in sys_hashmap_oa_lp_insert()
244 return sys_hashmap_oa_lp_insert_no_rehash(map, key, value, old_value); in sys_hashmap_oa_lp_insert()
247 static bool sys_hashmap_oa_lp_remove(struct sys_hashmap *map, uint64_t key, uint64_t *value) in sys_hashmap_oa_lp_remove() argument
250 struct sys_hashmap_oa_lp_data *data = (struct sys_hashmap_oa_lp_data *)map->data; in sys_hashmap_oa_lp_remove()
252 entry = sys_hashmap_oa_lp_find(map, key, true, true, false); in sys_hashmap_oa_lp_remove()
266 (void)sys_hashmap_oa_lp_rehash(map, false); in sys_hashmap_oa_lp_remove()
271 static bool sys_hashmap_oa_lp_get(const struct sys_hashmap *map, uint64_t key, uint64_t *value) in sys_hashmap_oa_lp_get() argument
275 entry = sys_hashmap_oa_lp_find(map, key, true, true, false); in sys_hashmap_oa_lp_get()