FileSystemOps

Trait FileSystemOps 

Source
pub trait FileSystemOps:
    AsAny
    + Send
    + Sync
    + 'static {
    // Required methods
    fn statfs(
        &self,
        _locked: &mut Locked<FileOpsCore>,
        _fs: &FileSystem,
        _current_task: &CurrentTask,
    ) -> Result<statfs, Errno>;
    fn name(&self) -> &'static FsStr;

    // Provided methods
    fn uses_external_node_ids(&self) -> bool { ... }
    fn rename(
        &self,
        _locked: &mut Locked<FileOpsCore>,
        _fs: &FileSystem,
        _current_task: &CurrentTask,
        _old_parent: &FsNodeHandle,
        _old_name: &FsStr,
        _new_parent: &FsNodeHandle,
        _new_name: &FsStr,
        _renamed: &FsNodeHandle,
        _replaced: Option<&FsNodeHandle>,
    ) -> Result<(), Errno> { ... }
    fn exchange(
        &self,
        _fs: &FileSystem,
        _current_task: &CurrentTask,
        _node1: &FsNodeHandle,
        _parent1: &FsNodeHandle,
        _name1: &FsStr,
        _node2: &FsNodeHandle,
        _parent2: &FsNodeHandle,
        _name2: &FsStr,
    ) -> Result<(), Errno> { ... }
    fn unmount(&self) { ... }
    fn manages_timestamps(&self) -> bool { ... }
    fn crypt_service(&self) -> Option<Arc<CryptService>> { ... }
}
Expand description

The filesystem-implementation-specific data for FileSystem.

Required Methods§

Source

fn statfs( &self, _locked: &mut Locked<FileOpsCore>, _fs: &FileSystem, _current_task: &CurrentTask, ) -> Result<statfs, Errno>

Return information about this filesystem.

A typical implementation looks like this:

Ok(statfs::default(FILE_SYSTEM_MAGIC))

or, if the filesystem wants to customize fields:

Ok(statfs {
    f_blocks: self.blocks,
    ..statfs::default(FILE_SYSTEM_MAGIC)
})
Source

fn name(&self) -> &'static FsStr

Provided Methods§

Source

fn uses_external_node_ids(&self) -> bool

Whether this file system uses external node IDs.

If this is true, then the file system is responsible for assigning node IDs to its nodes. Otherwise, the VFS will assign node IDs to the nodes.

Source

fn rename( &self, _locked: &mut Locked<FileOpsCore>, _fs: &FileSystem, _current_task: &CurrentTask, _old_parent: &FsNodeHandle, _old_name: &FsStr, _new_parent: &FsNodeHandle, _new_name: &FsStr, _renamed: &FsNodeHandle, _replaced: Option<&FsNodeHandle>, ) -> Result<(), Errno>

Rename the given node.

The node to be renamed is passed as “renamed”. It currently has old_name in old_parent. After the rename operation, it should have new_name in new_parent.

If new_parent already has a child named new_name, that node is passed as “replaced”. In that case, both “renamed” and “replaced” will be directories and the rename operation should succeed only if “replaced” is empty. The VFS will check that there are no children of “replaced” in the DirEntry cache, but the implementation of this function is responsible for checking that there are no children of replaced that are known only to the file system implementation (e.g., present on-disk but not in the DirEntry cache).

Source

fn exchange( &self, _fs: &FileSystem, _current_task: &CurrentTask, _node1: &FsNodeHandle, _parent1: &FsNodeHandle, _name1: &FsStr, _node2: &FsNodeHandle, _parent2: &FsNodeHandle, _name2: &FsStr, ) -> Result<(), Errno>

Source

fn unmount(&self)

Called when the filesystem is unmounted.

Source

fn manages_timestamps(&self) -> bool

Indicates if the filesystem can manage the timestamps (i.e. ctime and mtime).

Starnix updates the timestamps in FsNode’s info directly. However, if the filesystem can manage the timestamps, then Starnix does not need to do so. info will be refreshed with the timestamps from the filesystem by calling fetch_and_refresh_info(..) on the FsNode.

Source

fn crypt_service(&self) -> Option<Arc<CryptService>>

Returns the crypt service associated with this filesystem, if any.

Implementations on Foreign Types§

Source§

impl FileSystemOps for Arc<TmpFs>

Source§

fn statfs( &self, _locked: &mut Locked<FileOpsCore>, _fs: &FileSystem, _current_task: &CurrentTask, ) -> Result<statfs, Errno>

Source§

fn name(&self) -> &'static FsStr

Source§

fn rename( &self, _locked: &mut Locked<FileOpsCore>, _fs: &FileSystem, _current_task: &CurrentTask, old_parent: &FsNodeHandle, _old_name: &FsStr, new_parent: &FsNodeHandle, _new_name: &FsStr, renamed: &FsNodeHandle, replaced: Option<&FsNodeHandle>, ) -> Result<(), Errno>

Source§

fn exchange( &self, _fs: &FileSystem, _current_task: &CurrentTask, node1: &FsNodeHandle, parent1: &FsNodeHandle, _name1: &FsStr, node2: &FsNodeHandle, parent2: &FsNodeHandle, _name2: &FsStr, ) -> Result<(), Errno>

Implementors§