MOS Source Code
Loading...
Searching...
No Matches
dentry.cpp File Reference
Include dependency graph for dentry.cpp:

Go to the source code of this file.

Functions

static PtrResult< dentry_tdentry_resolve_lastseg (dentry_t *parent, mos::string leaf, const LastSegmentResolveFlags flags, bool *is_symlink)
static PtrResult< dentry_tdentry_resolve_follow_symlink (dentry_t *dentry, LastSegmentResolveFlags flags)
static std::pair< PtrResult< dentry_t >, std::optional< mos::string > > dentry_resolve_to_parent (dentry_t *base_dir, dentry_t *root_dir, mos::string_view path)
 Lookup the parent directory of a given path, and return the last segment of the path in last_seg_out.
void dentry_attach (dentry_t *d, inode_t *inode)
 Attach an inode to a dentry.
void dentry_detach (dentry_t *d)
 Detach the inode from a dentry.
PtrResult< dentry_tdentry_from_fd (fd_t fd)
 Get the dentry from a file descriptor.
PtrResult< dentry_tdentry_lookup_child (dentry_t *parent, mos::string_view name)
 Get a child dentry from a parent dentry.
PtrResult< dentry_tdentry_resolve (dentry_t *starting_dir, dentry_t *root_dir, mos::string_view path, LastSegmentResolveFlags flags)
 Lookup a path in the filesystem.
static void dirter_add (vfs_listdir_state_t *state, u64 ino, mos::string_view name, file_type_t type)
void vfs_populate_listdir_buf (dentry_t *dir, vfs_listdir_state_t *state)
 List the contents of a directory.

Function Documentation

◆ dentry_resolve_lastseg()

PtrResult< dentry_t > dentry_resolve_lastseg ( dentry_t * parent,
mos::string leaf,
const LastSegmentResolveFlags flags,
bool * is_symlink )
static

Definition at line 184 of file dentry.cpp.

Referenced by dentry_resolve(), and dentry_resolve_follow_symlink().

Here is the call graph for this function:

◆ dentry_resolve_follow_symlink()

PtrResult< dentry_t > dentry_resolve_follow_symlink ( dentry_t * dentry,
LastSegmentResolveFlags flags )
static

Definition at line 142 of file dentry.cpp.

Referenced by dentry_resolve_lastseg(), and dentry_resolve_to_parent().

Here is the call graph for this function:

◆ dentry_resolve_to_parent()

std::pair< PtrResult< dentry_t >, std::optional< mos::string > > dentry_resolve_to_parent ( dentry_t * base_dir,
dentry_t * root_dir,
mos::string_view path )
static

Lookup the parent directory of a given path, and return the last segment of the path in last_seg_out.

Parameters
base_dirA directory to start the lookup from
root_dirThe root directory of the filesystem, the lookup will not go above this directory
original_pathThe path to lookup
last_seg_outThe last segment of the path will be returned in this parameter, the caller is responsible for freeing it
Returns
dentry_t* The parent directory of the path, or NULL if the path is invalid, the dentry will be referenced

Definition at line 48 of file dentry.cpp.

Referenced by dentry_resolve(), and dentry_resolve_follow_symlink().

Here is the call graph for this function:

◆ dirter_add()

void dirter_add ( vfs_listdir_state_t * state,
u64 ino,
mos::string_view name,
file_type_t type )
static

Definition at line 405 of file dentry.cpp.

Referenced by vfs_populate_listdir_buf().

Here is the call graph for this function: