Skip to content

Debugfs #885

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

Open
wants to merge 2 commits into
base: rust
Choose a base branch
from
Open

Debugfs #885

wants to merge 2 commits into from

Conversation

adamrk
Copy link

@adamrk adamrk commented Sep 19, 2022

Re-doing the debugfs implementation without seq_file.

let has_parent = parent.is_some();
let name = name.as_char_ptr();
let boxed1: Box<dyn Any> = Box::try_new(data)?;
let boxed2 = Box::try_new(boxed1)?;
Copy link
Author

Choose a reason for hiding this comment

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

Note that we're boxing twice here because Box<dyn Any> doesn't implement PointerWrapper since dyn Any is !Sized. I can look into making a Box-like PointerWrapper for unsized types if it would be generally useful.

Comment on lines +91 to +92
let string = CString::try_from_fmt(fmt!("Debugfs file read count: {}\n", read_count))?;
data.write_slice(string.as_bytes())?;
Copy link
Author

Choose a reason for hiding this comment

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

Note that here we're first creating the CString and then copying it into the IoBufferWriter because I don't think we currently have a way to directly write format strings to an IoBufferWriter (unless I'm missing something?).

Add a Rust API to create directories and files in `debugfs`.

Signed-off-by: Adam Bratschi-Kaye <ark.email@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant