Skip to content

feat: share the RomFS path hash between the reader and the writer - #6

Merged
LNSD merged 1 commit into
mainfrom
lnsd/romfs-path-hash
Aug 13, 2026
Merged

LNSD merged 1 commit into
mainfrom
lnsd/romfs-path-hash

Conversation

@LNSD

@LNSD LNSD commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

The hash and the chain terminator were private to the writer, so a reader outside this crate had to grow its own copy of arithmetic both sides must agree on exactly; raw is where the format's shared facts belong.

  • Add raw::romfs::path_hash, taking the name as bytes because that is how an image stores it, and raw::romfs::NO_ENTRY for the offset that ends every chain.
  • Point the writer's calc_path_hash and ROMFS_ENTRY_EMPTY at them, along with the reader's four bare u32::MAX comparisons.
  • Make serde optional under filesystem-support: only the NPDM builder derives it, so a raw-only consumer no longer drags it into a no_std build.
  • Pin path_hash with unit tests covering the seed, the parent's effect on the bucket, and a multi-byte name hashing one round per stored byte.

@LNSD
LNSD force-pushed the lnsd/romfs-path-hash branch from 7c3176c to 7d76812 Compare August 13, 2026 10:54
The hash and the chain terminator were private to the writer, so a reader outside this crate had to grow its own copy of arithmetic both sides must agree on exactly; `raw` is where the format's shared facts belong.

- Add `raw::romfs::path_hash`, taking the name as bytes because that is how an image stores it, and `raw::romfs::NO_ENTRY` for the offset that ends every chain.
- Point the writer's `calc_path_hash` and `ROMFS_ENTRY_EMPTY` at them, along with the reader's four bare `u32::MAX` comparisons.
- Make `serde` optional under `filesystem-support`: only the NPDM builder derives it, so a `raw`-only consumer no longer drags it into a `no_std` build.
- Pin `path_hash` with unit tests covering the seed, the parent's effect on the bucket, and a multi-byte name hashing one round per stored byte.

Signed-off-by: Lorenzo Delgado <lnsdev@proton.me>
@LNSD
LNSD force-pushed the lnsd/romfs-path-hash branch from 7d76812 to 6aeb119 Compare August 13, 2026 10:56
@LNSD
LNSD added this pull request to the merge queue Aug 13, 2026
Merged via the queue into main with commit 7a33a95 Aug 13, 2026
5 checks passed
@LNSD
LNSD deleted the lnsd/romfs-path-hash branch August 13, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant