1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright 2023 Red Hat
6 #ifndef UDS_INDEX_PAGE_MAP_H
7 #define UDS_INDEX_PAGE_MAP_H
10 #include "io-factory.h"
13 * The index maintains a page map which records how the chapter delta lists are distributed among
14 * the index pages for each chapter, allowing the volume to be efficient about reading only pages
15 * that it knows it will need.
18 struct index_page_map {
19 const struct index_geometry *geometry;
21 u32 entries_per_chapter;
25 int __must_check uds_make_index_page_map(const struct index_geometry *geometry,
26 struct index_page_map **map_ptr);
28 void uds_free_index_page_map(struct index_page_map *map);
30 int __must_check uds_read_index_page_map(struct index_page_map *map,
31 struct buffered_reader *reader);
33 int __must_check uds_write_index_page_map(struct index_page_map *map,
34 struct buffered_writer *writer);
36 void uds_update_index_page_map(struct index_page_map *map, u64 virtual_chapter_number,
37 u32 chapter_number, u32 index_page_number,
38 u32 delta_list_number);
40 u32 __must_check uds_find_index_page_number(const struct index_page_map *map,
41 const struct uds_record_name *name,
44 void uds_get_list_number_bounds(const struct index_page_map *map, u32 chapter_number,
45 u32 index_page_number, u32 *lowest_list,
48 u64 uds_compute_index_page_map_save_size(const struct index_geometry *geometry);
50 #endif /* UDS_INDEX_PAGE_MAP_H */