feat: Add format detection logic#62
Merged
mkroening merged 1 commit intohermit-os:mainfrom Nov 10, 2025
Merged
Conversation
jounathaen
approved these changes
Nov 10, 2025
Member
jounathaen
left a comment
There was a problem hiding this comment.
I think, this could as well be part of #61, but I think this is good.
mkroening
requested changes
Nov 10, 2025
Member
mkroening
left a comment
There was a problem hiding this comment.
Thanks for working on this! :)
This is only relevant for the loader and Uhyve, not the kernel, right? Can we gate this with feature = "loader", then? Maybe move this into a loader module?
src/lib.rs
Outdated
Comment on lines
40
to
42
| if data.len() < 8 { | ||
| None | ||
| } else if data[0] == 0x7f |
Member
There was a problem hiding this comment.
I would personally favor early returns over a long if-else chain, but I don't feel strongly about that in this case.
0ce282a to
fd1aade
Compare
This logic is used both by the loader and by uhyve. Reviewed-by: Martin Kröning <mkroening@posteo.net>
fd1aade to
0662b42
Compare
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.
This logic is used both by the loader and by uhyve.
This is basically the minimally necessary part of #61.
In general, I would appreciate this PR to be reviewed and merged first. Then I'll port the additional changes from hermit-os/uhyve#1135 into #61 (which have diverged a bit by now).