Skip to content

Migrate dmffs to 64-bit file offsets and sizes (dmfsi API 2.0) - #26

Merged
JohnAmadis merged 2 commits into
masterfrom
feature/64-bit-file-offsets
Sep 26, 2026
Merged

JohnAmadis merged 2 commits into
masterfrom
feature/64-bit-file-offsets

Conversation

@JaxCalder

Copy link
Copy Markdown
Contributor

Summary

  • dmfsi.h now models file positions/sizes with the 64-bit dmfsi_offset_t/dmfsi_size_t typedefs and bumped _lseek/_tell to interface version 2.0. dmffs still used uint32_t for every flash offset/size and registered the old 1.0 signatures, which no longer matches dmfsi.h.
  • Widened dmffs_file_entry_t.data_offset/data_size, dmffs_file_handle_t.position, dmffs_dir_handle_t.current_offset/dir_end_offset, and the context's flash_size to dmfsi_size_t/dmfsi_offset_t.
  • Bumped _lseek/_tell to interface version 2.0 and _size's return type to dmfsi_size_t.
  • All the TLV-walking helpers (read_tlv_header, parse_file_entry, find_directory_range, etc.) now carry offsets as 64-bit, so a flash image bigger than 4 GiB no longer wraps while walking entries. The on-disk TLV type/length fields themselves stay uint32_t since that's the actual wire format, unrelated to this migration.

Part of choco-technologies/dmod-ecosystem#7.

Test plan

  • cmake -DDMOD_TOOLS_NAME=arch/x86_64 + cmake --build . --target dmffs compiles clean, no new warnings (checked with -Wall -Wextra -Wsign-compare too).
  • Maintainer to validate against a real flash image, especially one crossing the old 4 GiB boundary.

Widen the TLV file-entry/handle offset and size fields to
dmfsi_offset_t/dmfsi_size_t and move _lseek/_tell to dmfsi interface
version 2.0, matching the updated dmfsi.h. TLV wire-format fields
(type/length) stay uint32_t since that is the on-disk format, but the
running offsets used to walk the flash image are now 64-bit so a flash
region larger than 4 GiB no longer wraps.

Part of choco-technologies/dmod-ecosystem#7.
Same drift as dmramfs: dmfsi.h moved these two interfaces to version
2.0 after this branch was cut (dmfsi_dir_entry_t/dmfsi_stat_t now
carry the 64-bit size field). The bodies already used dmfsi_size_t,
only the registered version number was stale.
@JohnAmadis
JohnAmadis merged commit 21f3932 into master Sep 26, 2026
1 check passed
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.

2 participants