Skip to main content

VirtualFileSystem

Struct VirtualFileSystem 

Source
pub struct VirtualFileSystem { /* private fields */ }
Expand description

The virtual file system.

Implementations§

Source§

impl VirtualFileSystem

Source

pub fn task_manager(&self) -> &'static Manager

Source

pub fn users_manager(&self) -> &'static Manager

Source

pub fn new( task_manager: &'static Manager, users_manager: &'static Manager, time_manager: &'static Manager<'static>, root_file_system: impl FileSystemOperations + 'static, ) -> Self

Source

pub fn new_with_options( task_manager: &'static Manager, users_manager: &'static Manager, time_manager: &'static Manager<'static>, root_file_system: impl FileSystemOperations + 'static, options: MountOptions, ) -> Self

Source

pub async fn uninitialize(&self)

Source

pub async fn shutdown_storage(&self) -> Result<()>

Commit and unmount every mounted filesystem for a system shutdown.

Requires quiescence: if any filesystem still has an open file or directory, nothing changes and ResourceBusy is returned. Otherwise new writes are frozen for good, then mounts are unmounted deepest first with the root last; each filesystem flushes its backing device. The first failure is returned and the remaining mounts stay mounted (and readable) for diagnosis. Nothing is deallocated: tasks that still hold static references keep valid memory.

Source

pub async fn mount_file_system( &'static self, file_system: impl FileSystemOperations + 'static, path: impl AsRef<Path>, task: TaskIdentifier, ) -> Result<()>

Mount a file system at a given mount point.

Source

pub async fn mount_file_system_with_options( &self, file_system: impl FileSystemOperations + 'static, path: impl AsRef<Path>, task: TaskIdentifier, options: MountOptions, ) -> Result<()>

Mount a file system at a given mount point with explicit mount options.

Source

pub async fn unmount(&self, path: impl AsRef<Path>, force: bool) -> Result<()>

Source

pub async fn unmount_all(&self) -> Result<()>

Source

pub async fn resolve_directory_root( &self, task: TaskIdentifier, path: impl AsRef<Path>, ) -> Result<PathOwned>

Resolve a directory path once, following symbolic links and verifying that it names an accessible directory on a mount with confined namespace guarantees.

Callers can keep the returned canonical path as the root argument to *_beneath operations; subsequent revalidation of that root does not follow symbolic links.

Source

pub async fn open_directory<'a>( &'a self, task: TaskIdentifier, path: &impl AsRef<Path>, ) -> Result<Directory<'a>>

Source

pub async fn open_directory_with_lookup<'a>( &'a self, task: TaskIdentifier, path: &impl AsRef<Path>, follow_final: bool, ) -> Result<Directory<'a>>

Open a directory, controlling whether a final symbolic link is followed.

Source

pub async fn open_directory_beneath<'a>( &'a self, task: TaskIdentifier, path: &impl AsRef<Path>, root: &Path, ) -> Result<Directory<'a>>

Resolve relative paths beneath the supplied root directory.

Source

pub async fn open_directory_beneath_with_lookup<'a>( &'a self, task: TaskIdentifier, path: &impl AsRef<Path>, root: &Path, follow_final: bool, ) -> Result<Directory<'a>>

Resolve relative paths beneath the supplied root directory, controlling whether a final symbolic link is followed.

Source

pub async fn check_create_file_access( &self, task: TaskIdentifier, path: &impl AsRef<Path>, ) -> Result<()>

Check the caller’s parent-directory authorization for creating a file. Resolves paths exactly as a nonexclusive create would, without creating or opening a file. This is a UI preflight, not a reservation: the actual create must still enforce access when it executes.

Source

pub async fn open<'a>( &'a self, path: &impl AsRef<Path>, flags: Flags, task: TaskIdentifier, ) -> Result<File<'a>>

Source

pub async fn open_with_permissions<'a>( &'a self, path: &impl AsRef<Path>, flags: Flags, task: TaskIdentifier, permissions: Permissions, ) -> Result<File<'a>>

Open a file; a file that the call creates gets permissions instead of Permissions::FILE_DEFAULT, from its creation on. An existing file keeps its permissions.

Source

pub async fn open_with_lookup<'a>( &'a self, path: &impl AsRef<Path>, flags: Flags, task: TaskIdentifier, follow_final: bool, ) -> Result<File<'a>>

Open a file, controlling whether a final symbolic link is followed.

Source

pub async fn open_beneath<'a>( &'a self, path: &impl AsRef<Path>, flags: Flags, task: TaskIdentifier, root: &Path, ) -> Result<File<'a>>

Resolve relative paths beneath the supplied root directory.

Source

pub async fn open_beneath_with_lookup<'a>( &'a self, path: &impl AsRef<Path>, flags: Flags, task: TaskIdentifier, root: &Path, follow_final: bool, ) -> Result<File<'a>>

Resolve relative paths beneath the supplied root directory, atomically enforcing follow_final for the final component under the namespace lock.

Source

pub async fn mount_static( &self, task: TaskIdentifier, path: impl AsRef<Path>, item: ItemStatic, ) -> Result<()>

Source

pub async fn mount_static_with_permissions( &self, task: TaskIdentifier, path: impl AsRef<Path>, item: ItemStatic, permissions: Permissions, ) -> Result<()>

Publish a mount with its final permissions under the namespace lock. Sensitive devices must not become briefly accessible with default modes.

Source

pub async fn mount_block_device( &self, task: TaskIdentifier, path: impl AsRef<Path>, device: impl BlockDevice + 'static, ) -> Result<()>

Source

pub async fn mount_character_device( &self, task: TaskIdentifier, path: impl AsRef<Path>, device: impl CharacterDevice + 'static, ) -> Result<()>

Source

pub async fn create_named_pipe( &self, path: &impl AsRef<Path>, size: usize, task: TaskIdentifier, ) -> Result<()>

Source

pub async fn create_unnamed_pipe<'a>( &'a self, size: usize, status: StateFlags, ) -> Result<(File<'a>, File<'a>)>

Source

pub async fn remove( &self, task: TaskIdentifier, path: impl AsRef<Path>, ) -> Result<()>

Source

pub async fn remove_beneath( &self, task: TaskIdentifier, path: impl AsRef<Path>, root: &Path, ) -> Result<()>

Resolve relative paths beneath the supplied root directory.

Source

pub async fn create_directory( &self, task: TaskIdentifier, path: &impl AsRef<Path>, ) -> Result<()>

Source

pub async fn create_directory_with_permissions( &self, task: TaskIdentifier, path: &impl AsRef<Path>, permissions: Permissions, ) -> Result<()>

Create a directory with the specified permissions from the start.

Source

pub async fn create_directory_beneath( &self, task: TaskIdentifier, path: &impl AsRef<Path>, root: &Path, ) -> Result<()>

Resolve relative paths beneath the supplied root directory.

Create a symbolic link at link whose target is interpreted in the caller’s virtual namespace. The target may be dangling or cross mounts.

Invalid caller input is reported as InvalidPath (unusable target or link path), NameTooLong (target over the link limit) and NotFound for an empty target, which is POSIX symlink("") failing with ENOENT.

Resolve relative paths beneath the supplied root directory.

Read a symbolic link target without following it into caller-owned, bounded storage. Returns the number of bytes written.

Resolve relative paths beneath the supplied root directory.

Source

pub async fn rename( &self, task: TaskIdentifier, old_path: &impl AsRef<Path>, new_path: &impl AsRef<Path>, ) -> Result<()>

Source

pub async fn rename_beneath( &self, task: TaskIdentifier, old_path: &impl AsRef<Path>, new_path: &impl AsRef<Path>, old_root: &Path, new_root: &Path, ) -> Result<()>

Resolve relative paths beneath the supplied root directory.

Create new_path as a hard link to the non-directory object at existing.

Resolve both paths beneath their supplied root directories.

Source

pub async fn get_statistics( &self, path: &impl AsRef<Path>, ) -> Result<Statistics>

Source

pub async fn get_statistics_for_task( &self, task: TaskIdentifier, path: &impl AsRef<Path>, ) -> Result<Statistics>

Read path metadata for an explicit task, including from synchronous adapters whose polling context does not carry an Embassy task waker.

Read metadata for the directory entry itself without following its final link.

Return metadata for the directory entry itself without following a final symbolic link.

Source

pub async fn get_statistics_beneath( &self, task: TaskIdentifier, path: &impl AsRef<Path>, follow_final: bool, root: &Path, ) -> Result<Statistics>

Resolve relative paths beneath the supplied root directory.

Source

pub async fn close( &self, item: &ItemStatic, device_inode: Option<Inode>, context: &mut Context, ) -> Result<()>

Release the reference item took when it was opened, then close it.

device_inode is the inode a device opening took its reference on; it is required for devices, because two mounted devices may share a pointer.

Source

pub fn close_without_waiting( &self, item: &ItemStatic, device_inode: Option<Inode>, context: &mut Context, ) -> Result<()>

Close like Self::close, but without ever waiting, for a destructor: closing in a drop must not suspend, or a cancellation could abandon it halfway. The item’s own context is closed at once. Its reference is given back at once if the lock it is counted under is free, and otherwise owed: whoever takes that lock next to look at the counts (a close, an unmount, the storage shutdown) gives it back first.

Source

pub async fn set_times_beneath( &self, task: TaskIdentifier, path: &impl AsRef<Path>, follow_final: bool, root: &Path, access: Option<Time>, modification: Option<Time>, ) -> Result<()>

Update timestamps after resolving beneath an immutable preopen authority.

Source

pub async fn set_ownership( &self, task: TaskIdentifier, path: impl AsRef<Path>, user: Option<UserIdentifier>, group: Option<GroupIdentifier>, ) -> Result<()>

Source

pub async fn set_permissions( &self, task: TaskIdentifier, path: impl AsRef<Path>, permissions: Permissions, ) -> Result<()>

Source§

impl VirtualFileSystem

Source

pub async fn get_user_home(&self, user: UserIdentifier) -> Result<PathOwned>

The home recorded in the user’s account.

Accounts record their home when they are created (/users/<user name>), and accounts saved before homes were recorded keep /users/<identifier>. The home is read from the account, never derived from the current user name, so renaming a user does not move or lose their home. Recorded homes are always a single entry directly below /users.

Source

pub async fn get_user_application_directory( &self, user: UserIdentifier, application_id: &str, ) -> Result<PathOwned>

The private directory of an application inside the user’s recorded home.

Source

pub async fn ensure_user_application_directories( &self, task: TaskIdentifier, user: UserIdentifier, application_id: &str, ) -> Result<PathOwned>

Lazily create the user’s private application configuration, data and cache directories.

Source

pub async fn ensure_user_home( &self, task: TaskIdentifier, user: UserIdentifier, ) -> Result<PathOwned>

Provision a private home before dropping login’s privileges. Existing homes must belong to the expected user; their contents are preserved.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.