Draft
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 <s.kerkmann@pengutronix.de>
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 <s.kerkmann@pengutronix.de>
eadc41b to
592fac3
Compare
michaelolbrich
requested changes
Feb 1, 2025
| } | ||
| .as_bytes() | ||
| .escape_ascii() | ||
| .to_string(); |
Member
There was a problem hiding this comment.
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}"); |
Member
Member
There was a problem hiding this comment.
I was mistaken. If I change this to something different from the first argument of the mount call, mounting fails.
| udc.as_encoded_bytes(), | ||
| )?; | ||
| debug!("Attaching 9pfs gatget to UDC {udc}",); | ||
| write_file("/sys/kernel/config/usb_gadget/9pfs/UDC", &udc)?; |
Member
There was a problem hiding this comment.
Hmm, the file name read above is not necessarily UTF-8, so converting it into a String is technically not correct.
| options.root = Some(udc); | ||
|
|
||
| let d = time::Duration::new(1, 0); | ||
| thread::sleep(d); |
Member
There was a problem hiding this comment.
Unrelated, this should be a separate commit.
Member
Author
|
@michaelolbrich Thanks for having a look, the PR is still in draft and only a quick "hack job" at this point. |
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.
For @a3f ;-)