linux/drivers/md/dm-vdo/indexer/chapter-index.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright 2023 Red Hat
 */

#include "chapter-index.h"

#include "errors.h"
#include "logger.h"
#include "memory-alloc.h"
#include "permassert.h"

#include "hash-utils.h"
#include "indexer.h"

int uds_make_open_chapter_index(struct open_chapter_index **chapter_index,
				const struct index_geometry *geometry, u64 volume_nonce)
{}

void uds_free_open_chapter_index(struct open_chapter_index *chapter_index)
{}

/* Re-initialize an open chapter index for a new chapter. */
void uds_empty_open_chapter_index(struct open_chapter_index *chapter_index,
				  u64 virtual_chapter_number)
{}

static inline bool was_entry_found(const struct delta_index_entry *entry, u32 address)
{}

/* Associate a record name with the record page containing its metadata. */
int uds_put_open_chapter_index_record(struct open_chapter_index *chapter_index,
				      const struct uds_record_name *name,
				      u32 page_number)
{}

/*
 * Pack a section of an open chapter index into a chapter index page. A range of delta lists
 * (starting with a specified list index) is copied from the open chapter index into a memory page.
 * The number of lists copied onto the page is returned to the caller on success.
 *
 * @chapter_index: The open chapter index
 * @memory: The memory page to use
 * @first_list: The first delta list number to be copied
 * @last_page: If true, this is the last page of the chapter index and all the remaining lists must
 *             be packed onto this page
 * @lists_packed: The number of delta lists that were packed onto this page
 */
int uds_pack_open_chapter_index_page(struct open_chapter_index *chapter_index,
				     u8 *memory, u32 first_list, bool last_page,
				     u32 *lists_packed)
{}

/* Make a new chapter index page, initializing it with the data from a given index_page buffer. */
int uds_initialize_chapter_index_page(struct delta_index_page *index_page,
				      const struct index_geometry *geometry,
				      u8 *page_buffer, u64 volume_nonce)
{}

/* Validate a chapter index page read during rebuild. */
int uds_validate_chapter_index_page(const struct delta_index_page *index_page,
				    const struct index_geometry *geometry)
{}

/*
 * Search a chapter index page for a record name, returning the record page number that may contain
 * the name.
 */
int uds_search_chapter_index_page(struct delta_index_page *index_page,
				  const struct index_geometry *geometry,
				  const struct uds_record_name *name,
				  u16 *record_page_ptr)
{}