pub struct VirtualFileSystem { /* private fields */ }Expand description
The virtual file system.
Implementations§
Source§impl VirtualFileSystem
impl VirtualFileSystem
pub fn task_manager(&self) -> &'static Manager
pub fn users_manager(&self) -> &'static Manager
pub fn new( task_manager: &'static Manager, users_manager: &'static Manager, time_manager: &'static Manager<'static>, root_file_system: impl FileSystemOperations + 'static, ) -> Self
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
pub async fn uninitialize(&self)
Sourcepub async fn shutdown_storage(&self) -> Result<()>
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.
Sourcepub async fn mount_file_system(
&'static self,
file_system: impl FileSystemOperations + 'static,
path: impl AsRef<Path>,
task: TaskIdentifier,
) -> Result<()>
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.
Sourcepub async fn mount_file_system_with_options(
&self,
file_system: impl FileSystemOperations + 'static,
path: impl AsRef<Path>,
task: TaskIdentifier,
options: MountOptions,
) -> Result<()>
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.
pub async fn unmount(&self, path: impl AsRef<Path>, force: bool) -> Result<()>
pub async fn unmount_all(&self) -> Result<()>
Sourcepub async fn resolve_directory_root(
&self,
task: TaskIdentifier,
path: impl AsRef<Path>,
) -> Result<PathOwned>
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.
pub async fn open_directory<'a>( &'a self, task: TaskIdentifier, path: &impl AsRef<Path>, ) -> Result<Directory<'a>>
Sourcepub async fn open_directory_with_lookup<'a>(
&'a self,
task: TaskIdentifier,
path: &impl AsRef<Path>,
follow_final: bool,
) -> Result<Directory<'a>>
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.
Sourcepub async fn open_directory_beneath<'a>(
&'a self,
task: TaskIdentifier,
path: &impl AsRef<Path>,
root: &Path,
) -> Result<Directory<'a>>
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.
Sourcepub async fn open_directory_beneath_with_lookup<'a>(
&'a self,
task: TaskIdentifier,
path: &impl AsRef<Path>,
root: &Path,
follow_final: bool,
) -> Result<Directory<'a>>
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.
Sourcepub async fn check_create_file_access(
&self,
task: TaskIdentifier,
path: &impl AsRef<Path>,
) -> Result<()>
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.
pub async fn open<'a>( &'a self, path: &impl AsRef<Path>, flags: Flags, task: TaskIdentifier, ) -> Result<File<'a>>
Sourcepub async fn open_with_permissions<'a>(
&'a self,
path: &impl AsRef<Path>,
flags: Flags,
task: TaskIdentifier,
permissions: Permissions,
) -> Result<File<'a>>
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.
Sourcepub async fn open_with_lookup<'a>(
&'a self,
path: &impl AsRef<Path>,
flags: Flags,
task: TaskIdentifier,
follow_final: bool,
) -> Result<File<'a>>
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.
Sourcepub async fn open_beneath<'a>(
&'a self,
path: &impl AsRef<Path>,
flags: Flags,
task: TaskIdentifier,
root: &Path,
) -> Result<File<'a>>
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.
Sourcepub 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>>
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.
pub async fn mount_static( &self, task: TaskIdentifier, path: impl AsRef<Path>, item: ItemStatic, ) -> Result<()>
Sourcepub async fn mount_static_with_permissions(
&self,
task: TaskIdentifier,
path: impl AsRef<Path>,
item: ItemStatic,
permissions: Permissions,
) -> Result<()>
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.
pub async fn mount_block_device( &self, task: TaskIdentifier, path: impl AsRef<Path>, device: impl BlockDevice + 'static, ) -> Result<()>
pub async fn mount_character_device( &self, task: TaskIdentifier, path: impl AsRef<Path>, device: impl CharacterDevice + 'static, ) -> Result<()>
pub async fn create_named_pipe( &self, path: &impl AsRef<Path>, size: usize, task: TaskIdentifier, ) -> Result<()>
pub async fn create_unnamed_pipe<'a>( &'a self, size: usize, status: StateFlags, ) -> Result<(File<'a>, File<'a>)>
pub async fn remove( &self, task: TaskIdentifier, path: impl AsRef<Path>, ) -> Result<()>
Sourcepub async fn remove_beneath(
&self,
task: TaskIdentifier,
path: impl AsRef<Path>,
root: &Path,
) -> Result<()>
pub async fn remove_beneath( &self, task: TaskIdentifier, path: impl AsRef<Path>, root: &Path, ) -> Result<()>
Resolve relative paths beneath the supplied root directory.
pub async fn create_directory( &self, task: TaskIdentifier, path: &impl AsRef<Path>, ) -> Result<()>
Sourcepub async fn create_directory_with_permissions(
&self,
task: TaskIdentifier,
path: &impl AsRef<Path>,
permissions: Permissions,
) -> Result<()>
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.
Sourcepub async fn create_directory_beneath(
&self,
task: TaskIdentifier,
path: &impl AsRef<Path>,
root: &Path,
) -> Result<()>
pub async fn create_directory_beneath( &self, task: TaskIdentifier, path: &impl AsRef<Path>, root: &Path, ) -> Result<()>
Resolve relative paths beneath the supplied root directory.
Sourcepub async fn create_symlink(
&self,
task: TaskIdentifier,
target: &Path,
link: &Path,
) -> Result<()>
pub async fn create_symlink( &self, task: TaskIdentifier, target: &Path, link: &Path, ) -> Result<()>
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.
Sourcepub async fn create_symlink_beneath(
&self,
task: TaskIdentifier,
target: &Path,
link: &Path,
root: &Path,
) -> Result<()>
pub async fn create_symlink_beneath( &self, task: TaskIdentifier, target: &Path, link: &Path, root: &Path, ) -> Result<()>
Resolve relative paths beneath the supplied root directory.
Sourcepub async fn read_symlink(
&self,
task: TaskIdentifier,
link: &Path,
buffer: &mut [u8],
) -> Result<usize>
pub async fn read_symlink( &self, task: TaskIdentifier, link: &Path, buffer: &mut [u8], ) -> Result<usize>
Read a symbolic link target without following it into caller-owned, bounded storage. Returns the number of bytes written.
Sourcepub async fn read_symlink_beneath(
&self,
task: TaskIdentifier,
link: &Path,
buffer: &mut [u8],
root: &Path,
) -> Result<usize>
pub async fn read_symlink_beneath( &self, task: TaskIdentifier, link: &Path, buffer: &mut [u8], root: &Path, ) -> Result<usize>
Resolve relative paths beneath the supplied root directory.
pub async fn rename( &self, task: TaskIdentifier, old_path: &impl AsRef<Path>, new_path: &impl AsRef<Path>, ) -> Result<()>
Sourcepub async fn rename_beneath(
&self,
task: TaskIdentifier,
old_path: &impl AsRef<Path>,
new_path: &impl AsRef<Path>,
old_root: &Path,
new_root: &Path,
) -> Result<()>
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.
Sourcepub async fn link(
&self,
task: TaskIdentifier,
existing: &impl AsRef<Path>,
follow_existing: bool,
new_path: &impl AsRef<Path>,
) -> Result<()>
pub async fn link( &self, task: TaskIdentifier, existing: &impl AsRef<Path>, follow_existing: bool, new_path: &impl AsRef<Path>, ) -> Result<()>
Create new_path as a hard link to the non-directory object at existing.
Sourcepub async fn link_beneath(
&self,
task: TaskIdentifier,
existing: &impl AsRef<Path>,
follow_existing: bool,
new_path: &impl AsRef<Path>,
existing_root: &Path,
new_root: &Path,
) -> Result<()>
pub async fn link_beneath( &self, task: TaskIdentifier, existing: &impl AsRef<Path>, follow_existing: bool, new_path: &impl AsRef<Path>, existing_root: &Path, new_root: &Path, ) -> Result<()>
Resolve both paths beneath their supplied root directories.
pub async fn get_statistics( &self, path: &impl AsRef<Path>, ) -> Result<Statistics>
Sourcepub async fn get_statistics_for_task(
&self,
task: TaskIdentifier,
path: &impl AsRef<Path>,
) -> Result<Statistics>
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.
Sourcepub async fn get_link_statistics_for_task(
&self,
task: TaskIdentifier,
path: &impl AsRef<Path>,
) -> Result<Statistics>
pub async fn get_link_statistics_for_task( &self, task: TaskIdentifier, path: &impl AsRef<Path>, ) -> Result<Statistics>
Read metadata for the directory entry itself without following its final link.
Sourcepub async fn get_link_statistics(
&self,
path: &impl AsRef<Path>,
) -> Result<Statistics>
pub async fn get_link_statistics( &self, path: &impl AsRef<Path>, ) -> Result<Statistics>
Return metadata for the directory entry itself without following a final symbolic link.
Sourcepub async fn get_statistics_beneath(
&self,
task: TaskIdentifier,
path: &impl AsRef<Path>,
follow_final: bool,
root: &Path,
) -> Result<Statistics>
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.
Sourcepub async fn close(
&self,
item: &ItemStatic,
device_inode: Option<Inode>,
context: &mut Context,
) -> Result<()>
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.
Sourcepub fn close_without_waiting(
&self,
item: &ItemStatic,
device_inode: Option<Inode>,
context: &mut Context,
) -> Result<()>
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.
Sourcepub async fn set_times_beneath(
&self,
task: TaskIdentifier,
path: &impl AsRef<Path>,
follow_final: bool,
root: &Path,
access: Option<Time>,
modification: Option<Time>,
) -> Result<()>
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.
pub async fn set_ownership( &self, task: TaskIdentifier, path: impl AsRef<Path>, user: Option<UserIdentifier>, group: Option<GroupIdentifier>, ) -> Result<()>
pub async fn set_permissions( &self, task: TaskIdentifier, path: impl AsRef<Path>, permissions: Permissions, ) -> Result<()>
Source§impl VirtualFileSystem
impl VirtualFileSystem
Sourcepub async fn get_user_home(&self, user: UserIdentifier) -> Result<PathOwned>
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.
Sourcepub async fn get_user_application_directory(
&self,
user: UserIdentifier,
application_id: &str,
) -> Result<PathOwned>
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.
Sourcepub async fn ensure_user_application_directories(
&self,
task: TaskIdentifier,
user: UserIdentifier,
application_id: &str,
) -> Result<PathOwned>
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.
Sourcepub async fn ensure_user_home(
&self,
task: TaskIdentifier,
user: UserIdentifier,
) -> Result<PathOwned>
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.