-
Notifications
You must be signed in to change notification settings - Fork 3
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
9pfs: root device #7
base: main
Are you sure you want to change the base?
Conversation
This was done using the unstable rustfmt option[1] group_imports that requires a nightly toolchain, thus it was run manually. [1]: https://rust-lang.github.io/rustfmt/?version=v1.8.0&search=import#group_imports Signed-off-by: Stefan Kerkmann <[email protected]>
mkdir, read_file write_file augment the error case with the path in the error case. This is useful as we otherwise don't know which location failed. This commit refactors the functions to take any argument that coerces into a Path - which is implemented by many types. mkdir now uses create_dir_all as it is not meant to fail if the directory already exists. Signed-off-by: Stefan Kerkmann <[email protected]>
eadc41b
to
592fac3
Compare
} | ||
.as_bytes() | ||
.escape_ascii() | ||
.to_string(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks wrong. In the else case, the string is converted multiple times.
let function = format!("/sys/kernel/config/usb_gadget/9pfs/functions/usb9pfs.{device}"); | ||
let link = format!("/sys/kernel/config/usb_gadget/9pfs/configs/c.1/usb9pfs.{device}"); | ||
let function = format!("/sys/kernel/config/usb_gadget/9pfs/functions/usb9pfs.{udc}"); | ||
let link = format!("/sys/kernel/config/usb_gadget/9pfs/configs/c.1/usb9pfs.{udc}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
udc.as_encoded_bytes(), | ||
)?; | ||
debug!("Attaching 9pfs gatget to UDC {udc}",); | ||
write_file("/sys/kernel/config/usb_gadget/9pfs/UDC", &udc)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, the file name read above is not necessarily UTF-8, so converting it into a String is technically not correct.
|
||
let d = time::Duration::new(1, 0); | ||
thread::sleep(d); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated, this should be a separate commit.
@michaelolbrich Thanks for having a look, the PR is still in draft and only a quick "hack job" at this point. |
For @a3f ;-)