Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/uefi/src/fs/mod.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / uefi / src / fs / mod.rs` 62 lines ยท 2268 bytes Raw Blame History 1 // SPDX-License-Identifier: MIT OR Apache-2.0 2 3 //! A high-level file system API for UEFI applications close to the `std::fs` 4 //! module from Rust's standard library. The main export of this module is 5 //! [`FileSystem`]. 6 //! 7 //! # Differences from Typical File System Abstractions 8 //! 9 //! Operations act on dedicated volumes, such as a boot volume on a CD-ROM, USB 10 //! drive, or other storage device. 11 //! 12 //! Unlike typical UNIX file system APIs, UEFI has no virtual file system. 13 //! Unlike Windows, UEFI has no dedicated volume names. 14 //! 15 //! # Paths 16 //! All paths are absolute and follow the FAT-like file system conventions for 17 //! paths. Thus, there is no current working directory and path components 18 //! like `.` and `..` are not supported. In other words, the current working 19 //! directory is always `/`, i.e., the root, of the opened volume. 20 //! 21 //! Symlinks or hard-links are not supported but only directories and regular 22 //! files with plain linear paths to them. For more information, see 23 //! [`Path`] and [`PathBuf`]. 24 //! 25 //! ## Use `&str` as Path 26 //! A `&str` known at compile time can be converted to a [`Path`] using the 27 //! [`cstr16!`] macro. During runtime, you can create a path like this: 28 //! 29 //! ```no_run 30 //! use uefi::CString16; 31 //! use uefi::fs::{FileSystem, FileSystemResult}; 32 //! use uefi::proto::media::fs::SimpleFileSystem; 33 //! use uefi::boot::{self, ScopedProtocol}; 34 //! 35 //! fn read_file(path: &str) -> FileSystemResult> { 36 //! let path: CString16 = CString16::try_from(path).unwrap(); 37 //! let fs: ScopedProtocol = boot::get_image_file_system(boot::image_handle()).unwrap(); 38 //! let mut fs = FileSystem::new(fs); 39 //! fs.read(path.as_ref()) 40 //! } 41 //! ``` 42 //! 43 //! # API Notes 44 //! There is no `File` abstraction as in the Rust `std` library. Instead, it is 45 //! intended to work with the file system via dedicated functions, similar to 46 //! the public functions of the `std::fs` module. 47 //! 48 //! The file system does not automatically synchronize concurrent access; the 49 //! caller is responsible for synchronization. 50 //! 51 //! [`cstr16!`]: crate::cstr16 52 53 mod dir_entry_iter; 54 mod file_system; 55 mod path; 56 mod uefi_types; 57 58 pub use dir_entry_iter::*; 59 pub use file_system::*; 60 pub use path::*; 61 62 use uefi_types::*;