51 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * Copyright 2023 Red Hat4 */5 6#ifndef UDS_INDEX_PAGE_MAP_H7#define UDS_INDEX_PAGE_MAP_H8 9#include "geometry.h"10#include "io-factory.h"11 12/*13 * The index maintains a page map which records how the chapter delta lists are distributed among14 * the index pages for each chapter, allowing the volume to be efficient about reading only pages15 * that it knows it will need.16 */17 18struct index_page_map {19 const struct index_geometry *geometry;20 u64 last_update;21 u32 entries_per_chapter;22 u16 *entries;23};24 25int __must_check uds_make_index_page_map(const struct index_geometry *geometry,26 struct index_page_map **map_ptr);27 28void uds_free_index_page_map(struct index_page_map *map);29 30int __must_check uds_read_index_page_map(struct index_page_map *map,31 struct buffered_reader *reader);32 33int __must_check uds_write_index_page_map(struct index_page_map *map,34 struct buffered_writer *writer);35 36void 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);39 40u32 __must_check uds_find_index_page_number(const struct index_page_map *map,41 const struct uds_record_name *name,42 u32 chapter_number);43 44void uds_get_list_number_bounds(const struct index_page_map *map, u32 chapter_number,45 u32 index_page_number, u32 *lowest_list,46 u32 *highest_list);47 48u64 uds_compute_index_page_map_save_size(const struct index_geometry *geometry);49 50#endif /* UDS_INDEX_PAGE_MAP_H */51