FILE
int-map.h
File preview with syntax highlighting.
linux-6.19.14/drivers/md/dm-vdo/int-map.h
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright 2023 Red Hat 4 */ 5 6#ifndef VDO_INT_MAP_H 7#define VDO_INT_MAP_H 8 9#include <linux/compiler.h> 10#include <linux/types.h> 11 12/** 13 * DOC: int_map 14 * 15 * An int_map associates pointers (void *) with integer keys (u64). NULL pointer values are 16 * not supported. 17 * 18 * The map is implemented as hash table, which should provide constant-time insert, query, and 19 * remove operations, although the insert may occasionally grow the table, which is linear in the 20 * number of entries in the map. The table will grow as needed to hold new entries, but will not 21 * shrink as entries are removed. 22 */ 23 24struct int_map; 25 26int __must_check vdo_int_map_create(size_t initial_capacity, struct int_map **map_ptr); 27 28void vdo_int_map_free(struct int_map *map); 29 30size_t vdo_int_map_size(const struct int_map *map); 31 32void *vdo_int_map_get(struct int_map *map, u64 key); 33 34int __must_check vdo_int_map_put(struct int_map *map, u64 key, void *new_value, 35 bool update, void **old_value_ptr); 36 37void *vdo_int_map_remove(struct int_map *map, u64 key); 38 39#endif /* VDO_INT_MAP_H */
~/
Read-only file preview.