fs/ext4/hash-test.c
Source file repositories/reference/linux-study-clean/fs/ext4/hash-test.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ext4/hash-test.c- Extension
.c- Size
- 15166 bytes
- Lines
- 568
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
kunit/test.hkunit/resource.hlinux/fs.hlinux/stddef.hlinux/string.hlinux/unicode.hext4.h
Detected Declarations
struct ext4_dirhash_test_casefunction ext4_hash_init_fake_dirfunction ext4_hash_init_fake_dir_with_sbifunction ext4_hash_init_fake_ext4_dirfunction test_ext4fs_dirhash_vectorsfunction test_ext4fs_dirhash_seed_changes_resultfunction test_ext4fs_dirhash_invalid_version_returns_einvalfunction test_ext4fs_dirhash_siphash_without_key_returns_einvalfunction test_ext4fs_dirhash_signed_unsigned_differ_on_nonasciifunction test_ext4fs_dirhash_casefolded_names_hash_consistentlyfunction test_ext4fs_dirhash_casefold_fallback
Annotated Snippet
struct ext4_dirhash_test_case {
const char *name;
u32 hash_version;
const char *input;
int len;
u32 seed[4];
bool use_seed;
u32 expected_hash;
u32 expected_minor_hash;
};
static const struct ext4_dirhash_test_case ext4_dirhash_test_cases[] = {
{
.name = "legacy_abc",
.hash_version = DX_HASH_LEGACY,
.input = "abc",
.len = 3,
.use_seed = false,
.expected_hash = 0x75afd992,
.expected_minor_hash = 0x00000000,
},
{
.name = "legacy_unsigned_abc",
.hash_version = DX_HASH_LEGACY_UNSIGNED,
.input = "abc",
.len = 3,
.use_seed = false,
.expected_hash = 0x75afd992,
.expected_minor_hash = 0x00000000,
},
{
.name = "half_md4_abc",
.hash_version = DX_HASH_HALF_MD4,
.input = "abc",
.len = 3,
.use_seed = false,
.expected_hash = 0xd196a868,
.expected_minor_hash = 0xc420eb28,
},
{
.name = "half_md4_unsigned_abc",
.hash_version = DX_HASH_HALF_MD4_UNSIGNED,
.input = "abc",
.len = 3,
.use_seed = false,
.expected_hash = 0xd196a868,
.expected_minor_hash = 0xc420eb28,
},
{
.name = "tea_abc",
.hash_version = DX_HASH_TEA,
.input = "abc",
.len = 3,
.use_seed = false,
.expected_hash = 0xb1435ec4,
.expected_minor_hash = 0x3f7eaa0e,
},
{
.name = "tea_unsigned_abc",
.hash_version = DX_HASH_TEA_UNSIGNED,
.input = "abc",
.len = 3,
.use_seed = false,
.expected_hash = 0xb1435ec4,
.expected_minor_hash = 0x3f7eaa0e,
},
{
.name = "empty_half_md4",
.hash_version = DX_HASH_HALF_MD4,
.input = "",
.len = 0,
.use_seed = false,
.expected_hash = 0xefcdab88,
.expected_minor_hash = 0x98badcfe,
},
{
.name = "half_md4_31bytes",
.hash_version = DX_HASH_HALF_MD4,
.input = "1234567890123456789012345678901",
.len = 31,
.use_seed = false,
.expected_hash = 0xc4db1f78,
.expected_minor_hash = 0xea23921b,
},
{
.name = "half_md4_32bytes",
.hash_version = DX_HASH_HALF_MD4,
.input = "12345678901234567890123456789012",
.len = 32,
.use_seed = false,
Annotation
- Immediate include surface: `kunit/test.h`, `kunit/resource.h`, `linux/fs.h`, `linux/stddef.h`, `linux/string.h`, `linux/unicode.h`, `ext4.h`.
- Detected declarations: `struct ext4_dirhash_test_case`, `function ext4_hash_init_fake_dir`, `function ext4_hash_init_fake_dir_with_sbi`, `function ext4_hash_init_fake_ext4_dir`, `function test_ext4fs_dirhash_vectors`, `function test_ext4fs_dirhash_seed_changes_result`, `function test_ext4fs_dirhash_invalid_version_returns_einval`, `function test_ext4fs_dirhash_siphash_without_key_returns_einval`, `function test_ext4fs_dirhash_signed_unsigned_differ_on_nonascii`, `function test_ext4fs_dirhash_casefolded_names_hash_consistently`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- 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.