-
Notifications
You must be signed in to change notification settings - Fork 162
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
Tracking Issue: High-level API filesystem usability #995
Comments
To give an interesting example, how would you complete this: /// Returns the "default" drop-in directory if it exists.
/// This will be in general $loaded_image_path.extra/
pub fn get_default_dropin_directory(boot_services: &BootServices) -> Option<Directory> {
if let Some(image_file_path) = boot_services
.open_protocol_exclusive::<LoadedImage>(boot_services.image_handle())
.map(|loaded_image| loaded_image.file_path())? {
// We could use LoadedImageDevicePath to get the full device path
// and perform replacement of the last node before END_ENTIRE
// by another node containing the filename + .extra
// But this is as much tedious as performing a conversion to string
// then opening the root directory and finding the new directory.
let image_file_string = image_file_path.to_string(boot_services, DisplayOnly(false), AllowShortcuts(false))?
.expect("Failed to obtain the string representation of the loaded image file path; not enough memory?");
let target_directory: CString16 = format!("{}.extra", image_file_string);
let fs = uefi::fs::FileSystem::new(boot_services.get_image_file_system(
boot_services.image_handle()
)?);
if let Ok(info) = fs.metadata(target_directory.into()) {
if info.is_directory() {
}
}
}
None
} Given that I think having a way to go from high level to low level would be very appreciable because I don't want to move around listing of directories, only a file handle. |
Hi, thanks for filing this. Here are my initial thoughts:
|
Yes, as @nicholasbishop told, our goal for
|
Opened #1008 for the |
Not sure if this is useful, but there have been some developments regarding fs for UEFI in Rust std: Additionally, feel free to chime in the discussion for improving the path situation for uefi (and my proposal): rust-lang/rust#52331 (comment) |
This is a follow-up of #747, I have been playing around with it and I have a bit of wishlist (of course, would love to contribute directly some of them), but want to discuss with you.
FileSystemResult
doesn't compose well withuefi::Result
, maybe we should have a 4th variantUEFIError
or something or transform easily anyFileSystemResult
into auefi::Result
, I don't really know what is the best but what I am seeing is that we need more powerful and user-friendly errors when writing FS code that mixes UEFI code and FS code.std::path::Path
, but I don't :-). It would be interesting to see if we can find an alloc solution for that (maybe it's a Rust upstream issue).is_ascii
is a missing onCStr16
I think (same foris_utf8
), it would be useful to have it for many FS work (where I want to exclude any weird filenames).fs.open_volume
and opening a filesystem with SimpleFilesystem, I can never get aDirectory
this way, how is it envisioned to get a handle on the root directory in the high level API?I think this is all I can think of right now. (feel free to rename the issues or whatever.)
The text was updated successfully, but these errors were encountered: