Skip to content

feat(isolation/filemap): Use proper tree for all file lookups#1256

Open
fogti wants to merge 2 commits intohermit-os:mainfrom
fogti:file-map-tree
Open

feat(isolation/filemap): Use proper tree for all file lookups#1256
fogti wants to merge 2 commits intohermit-os:mainfrom
fogti:file-map-tree

Conversation

@fogti
Copy link
Contributor

@fogti fogti commented Feb 11, 2026

This changes the implementation of the file map such that it uses an actual tree for file lookup instead of a hashmap of paths with backtracking. This should improve performance in case of an extremely large file map. The motivation for this is that it makes it way easier to represent virtual files in the file map, and is a prerequisite for Hermit image support.

For demo purposes (and to make it obvious how one would build on top of this later), this also adds support for inserting the content of tar files (i.e. decompressed Hermit images) to the file map tree.

Supersedes #1135.

Depends on #1271.

Blocked on hermit-os/hermit-entry#82.

@fogti fogti added enhancement New feature or request rust Pull requests that update Rust code feature/file system labels Feb 11, 2026
@github-actions github-actions bot added the feature/security Concerns security-related behavior, soundness, isolation or reliability. label Feb 11, 2026
@n0toose n0toose self-requested a review February 11, 2026 17:18
@fogti fogti force-pushed the file-map-tree branch 3 times, most recently from 3ba863b to 6eaec42 Compare February 12, 2026 12:56
@github-actions github-actions bot added the feature/uhyve-interface Concerns uhyve-interface. label Feb 12, 2026
@fogti fogti marked this pull request as ready for review February 12, 2026 12:57
@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 76.13293% with 79 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.88%. Comparing base (85df21f) to head (0396ef2).

Files with missing lines Patch % Lines
src/isolation/filemap/tree.rs 74.64% 53 Missing ⚠️
src/hypercall.rs 51.21% 20 Missing ⚠️
src/isolation/filemap/mod.rs 92.40% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1256      +/-   ##
==========================================
- Coverage   78.24%   76.88%   -1.36%     
==========================================
  Files          26       27       +1     
  Lines        3824     3876      +52     
==========================================
- Hits         2992     2980      -12     
- Misses        832      896      +64     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fogti fogti force-pushed the file-map-tree branch 4 times, most recently from bd0c82b to 8625781 Compare February 16, 2026 16:08
@fogti
Copy link
Contributor Author

fogti commented Feb 16, 2026

The only thing I still dislike a bit about this is that the interface of UhyveFileMap is a bit inconsistent (sometimes uses OsString, sometimes CString, sometimes PathBuf): It would make more sense to always use String / &str for guest paths (given that we assume in most places that the guest path is an UTF-8 string anyways), and PathBuf / &Path for host paths.

@fogti fogti changed the title feat(isolation/filemap): Use proper tree for all file lookups feat(isolation/filemap): Use proper tree for all file lookups; add Hermit image support Feb 16, 2026
@fogti fogti requested a review from jounathaen February 17, 2026 15:15
@fogti fogti force-pushed the file-map-tree branch 7 times, most recently from 68cbed2 to 0448912 Compare February 18, 2026 14:28
@fogti fogti marked this pull request as draft February 18, 2026 19:33
@fogti fogti added the blocked label Feb 18, 2026
@fogti fogti removed the blocked label Feb 25, 2026
@fogti fogti marked this pull request as ready for review February 25, 2026 13:58
@fogti
Copy link
Contributor Author

fogti commented Feb 25, 2026

It doesn't make sense to keep this as draft, the change in hermit-entry mentioned in the OP isn't strictly necessary, just "nice to have".

@fogti fogti force-pushed the file-map-tree branch 14 times, most recently from b1af1a9 to 08693f9 Compare February 25, 2026 17:47
@fogti fogti changed the title feat(isolation/filemap): Use proper tree for all file lookups; add Hermit image support feat(isolation/filemap): Use proper tree for all file lookups Feb 25, 2026
@fogti
Copy link
Contributor Author

fogti commented Feb 25, 2026

Split off Hermit image handling into #1282.

This shifts usages of `CStr` and `OsStr` onto API consumers.

All places where guest paths are used now use `&str`,
and all places where host paths are used now use `&Path`
(or the owned variants, respectively).
OnHost(PathBuf),

/// An in-memory file
#[allow(dead_code)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got no clue why this lint triggers on MacOS, but not on Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature/file system feature/security Concerns security-related behavior, soundness, isolation or reliability. feature/uhyve-interface Concerns uhyve-interface. rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants