interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / vendor / uefi / src / fs / path / mod.rs

53 lines · 1518 bytes Raw Blame History
1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3//! This module offers the [`Path`] and [`PathBuf`] abstractions.
4//!
5//! # Interoperability with Rust Strings
6//!
7//! To use Rust strings - `String` and `str` - with this API, first convert them
8//! to [`CString16`] or [`CStr16`]. Rust strings do not directly convert to
9//! [`Path`] or [`PathBuf`].
10//!
11//! # Path Structure
12//!
13//! Paths use the [`SEPARATOR`] character as separator. Paths are absolute and
14//! do not contain `.` or `..` components. However, this can be implemented in
15//! the future.
16//!
17//! [`CString16`]: uefi::data_types::CString16
18
19mod path;
20mod pathbuf;
21mod validation;
22
23pub use path::{Components, Path};
24pub use pathbuf::PathBuf;
25
26use crate::data_types::chars::NUL_16;
27use crate::{CStr16, Char16, char16, cstr16};
28pub use validation::PathError;
29pub(super) use validation::validate_path;
30
31/// The default separator for paths.
32pub const SEPARATOR: Char16 = char16!('\\');
33
34/// Stringified version of [`SEPARATOR`].
35pub const SEPARATOR_STR: &CStr16 = cstr16!("\\");
36
37/// Deny list of characters for path components. UEFI supports FAT-like file
38/// systems. According to <https://en.wikipedia.org/wiki/Comparison_of_file_systems>,
39/// paths should not contain these symbols.
40pub const CHARACTER_DENY_LIST: [Char16; 10] = {
41 [
42 NUL_16,
43 char16!('"'),
44 char16!('*'),
45 char16!('/'),
46 char16!(':'),
47 char16!('<'),
48 char16!('>'),
49 char16!('?'),
50 SEPARATOR,
51 char16!('|'),
52 ]
53};