Skip to content

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 <[email protected]>
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