drivers/md/dm-vdo/indexer/hash-utils.h
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/indexer/hash-utils.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/indexer/hash-utils.h- Extension
.h- Size
- 1960 bytes
- Lines
- 67
- Domain
- Driver Families
- Bucket
- drivers/md
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
numeric.hgeometry.hindexer.h
Detected Declarations
function uds_extract_chapter_index_bytesfunction uds_extract_volume_index_bytesfunction uds_extract_sampling_bytesfunction uds_hash_to_chapter_delta_listfunction uds_hash_to_chapter_delta_addressfunction uds_name_to_hash_slot
Annotated Snippet
#ifndef UDS_HASH_UTILS_H
#define UDS_HASH_UTILS_H
#include "numeric.h"
#include "geometry.h"
#include "indexer.h"
/* Utilities for extracting portions of a request name for various uses. */
/* How various portions of a record name are apportioned. */
enum {
VOLUME_INDEX_BYTES_OFFSET = 0,
VOLUME_INDEX_BYTES_COUNT = 8,
CHAPTER_INDEX_BYTES_OFFSET = 8,
CHAPTER_INDEX_BYTES_COUNT = 6,
SAMPLE_BYTES_OFFSET = 14,
SAMPLE_BYTES_COUNT = 2,
};
static inline u64 uds_extract_chapter_index_bytes(const struct uds_record_name *name)
{
const u8 *chapter_bits = &name->name[CHAPTER_INDEX_BYTES_OFFSET];
u64 bytes = (u64) get_unaligned_be16(chapter_bits) << 32;
bytes |= get_unaligned_be32(chapter_bits + 2);
return bytes;
}
static inline u64 uds_extract_volume_index_bytes(const struct uds_record_name *name)
{
return get_unaligned_be64(&name->name[VOLUME_INDEX_BYTES_OFFSET]);
}
static inline u32 uds_extract_sampling_bytes(const struct uds_record_name *name)
{
return get_unaligned_be16(&name->name[SAMPLE_BYTES_OFFSET]);
}
/* Compute the chapter delta list for a given name. */
static inline u32 uds_hash_to_chapter_delta_list(const struct uds_record_name *name,
const struct index_geometry *geometry)
{
return ((uds_extract_chapter_index_bytes(name) >> geometry->chapter_address_bits) &
((1 << geometry->chapter_delta_list_bits) - 1));
}
/* Compute the chapter delta address for a given name. */
static inline u32 uds_hash_to_chapter_delta_address(const struct uds_record_name *name,
const struct index_geometry *geometry)
{
return uds_extract_chapter_index_bytes(name) & ((1 << geometry->chapter_address_bits) - 1);
}
static inline unsigned int uds_name_to_hash_slot(const struct uds_record_name *name,
unsigned int slot_count)
{
return (unsigned int) (uds_extract_chapter_index_bytes(name) % slot_count);
}
#endif /* UDS_HASH_UTILS_H */
Annotation
- Immediate include surface: `numeric.h`, `geometry.h`, `indexer.h`.
- Detected declarations: `function uds_extract_chapter_index_bytes`, `function uds_extract_volume_index_bytes`, `function uds_extract_sampling_bytes`, `function uds_hash_to_chapter_delta_list`, `function uds_hash_to_chapter_delta_address`, `function uds_name_to_hash_slot`.
- Atlas domain: Driver Families / drivers/md.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.