Factor out a composefs-erofs crate#247
Closed
cgwalters wants to merge 7 commits intocomposefs:mainfrom
Closed
Conversation
Extract the FsVerityHashValue trait, Sha256HashValue, and Sha512HashValue types from composefs into a new composefs-types internal crate. This is prep work for extracting erofs code into a separate crate that needs these types without depending on all of composefs. The composefs crate re-exports these types from its existing fsverity::hashvalue module so all downstream code continues to work unchanged. The INLINE_CONTENT_MAX constant is also moved to composefs-types and re-exported. Assisted-by: OpenCode (Claude claude-opus-4-6) Signed-off-by: Colin Walters <walters@verbum.org>
Move the EROFS on-disk format definitions (format.rs) into a new composefs-erofs crate. The file is moved with git mv to preserve history and is byte-for-byte identical in the new location. The composefs crate re-exports everything via `pub use composefs_erofs::format::*` so all downstream code continues to compile without changes. The four Debug impls for format types (CompactInodeHeader, ExtendedInodeHeader, ComposefsHeader, Superblock) that lived in composefs's debug.rs are moved to composefs-erofs's debug module to satisfy orphan rules. The XAttrHeader::calculate_n_elems inherent method is converted to a local free function in reader.rs for the same reason. Assisted-by: OpenCode (Claude claude-opus-4-6) Signed-off-by: Colin Walters <walters@verbum.org>
Move the OverlayMetacopy structure from composefs's erofs module into the composefs-erofs crate. This type represents the overlay.metacopy xattr format used for fs-verity digest storage in composefs images. The visibility changes from pub(super) to pub since the type is now in a separate crate and needs to be accessible by both the reader (which will move to composefs-erofs) and the writer (which remains in composefs). The composefs crate re-exports the module for backward compatibility. Assisted-by: OpenCode (Claude claude-opus-4-6) Signed-off-by: Colin Walters <walters@verbum.org>
Move the EROFS image reader and parser code into the composefs-erofs crate. The reader provides safe parsing of EROFS filesystem images, including inode traversal, directory reading, and object reference collection. The XAttrHeader::calculate_n_elems method is restored as an inherent impl now that XAttrHeader and the reader are in the same crate. Debug impls for reader types (XAttr, Inode, DirectoryBlock, DataBlock) move to composefs-erofs since those types now live there. DirectoryEntry::nid() is made public since the type is now part of the crate's public API. Reader tests that depend on composefs-specific utilities (dumpfile parser, mkfs writer) are extracted to crates/composefs/tests/erofs_reader.rs since they cannot live in composefs-erofs without creating a circular dependency. The composefs crate re-exports composefs_erofs::reader::* for backward compatibility. Assisted-by: OpenCode (Claude claude-opus-4-6) Signed-off-by: Colin Walters <walters@verbum.org>
Move the EROFS image debug and analysis code into the composefs-erofs crate. This includes debug_img(), dump_unassigned(), the ImageVisitor tree walker, and SegmentType enum, as well as all Debug trait implementations for erofs types. Consolidate the previously-duplicated utility functions (hexdump, utf8_or_hex, addr! macro) into a single copy in composefs-erofs. The composefs crate re-exports composefs_erofs::debug::* for backward compatibility. Assisted-by: OpenCode (Claude claude-opus-4-6) Signed-off-by: Colin Walters <walters@verbum.org>
The writer remains in the composefs crate (it depends on tree types that can't be extracted without significant restructuring), but now imports format, reader, and composefs modules directly from the composefs-erofs crate rather than through the re-export layer. Assisted-by: OpenCode (Claude claude-opus-4-6) Signed-off-by: Colin Walters <walters@verbum.org>
The erofs-debug binary now depends directly on composefs-erofs rather than going through the composefs crate, since all the erofs debug functionality lives in composefs-erofs. This removes erofs-debug's dependency on the full composefs crate. Assisted-by: OpenCode (Claude claude-opus-4-6) Signed-off-by: Colin Walters <walters@verbum.org>
Collaborator
Author
|
On reflection...nevermind, having even more crates here probably isn't worth it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main motivation here is prep for #225