-
Notifications
You must be signed in to change notification settings - Fork 0
basic osfp support, combine the powers of reads/parse #305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,4 +57,14 @@ pub trait ParseFromModule: Sized { | |
|
|
||
| /// Parse the result of the above reads into `Self`. | ||
| fn parse<'a>(id: Identifier, reads: impl Iterator<Item = &'a [u8]>) -> Result<Self, Error>; | ||
|
|
||
| /// Use `reads` and `parse` together to collect data from a buffer. | ||
| fn from_buf(id: Identifier, data: &[u8]) -> Result<Self, Error> { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this being or going to be used? It looks like
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm currently using this to parse EEPROM data made available by a Linux kernel driver as a file in sysfs.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know the details of the Linux implementation there, but I don't understand how that can work. The datapath information is spread across many different pages, for example. How does the driver expose the idea of a page? |
||
| let chunks = Self::reads(id)?.into_iter().map(|r| { | ||
| let begin = r.offset() as usize; | ||
| let end = (r.offset() + r.len()) as usize; | ||
| &data[begin..end] | ||
| }); | ||
| Ok(Self::parse(id, chunks.into_iter())?) | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.