PatchworkOS
Loading...
Searching...
No Matches
path.c File Reference
#include <kernel/fs/path.h>
#include <kernel/fs/dentry.h>
#include <kernel/fs/namespace.h>
#include <kernel/fs/vfs.h>
#include <kernel/log/log.h>
#include <kernel/log/panic.h>
#include <kernel/sync/mutex.h>
#include <errno.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  path_flag_entry_t
 

Functions

static path_flag_entry_tpath_flags_get (const char *flag, uint64_t length)
 
void path_flags_init (void)
 Initialize path flags resolution.
 
uint64_t pathname_init (pathname_t *pathname, const char *string)
 Initialize a pathname.
 
void path_set (path_t *path, mount_t *mount, dentry_t *dentry)
 Set a path.
 
void path_copy (path_t *dest, const path_t *src)
 Copy a path.
 
void path_put (path_t *path)
 Put a path.
 
static uint64_t path_handle_dotdot (path_t *current)
 
uint64_t path_walk_single_step (path_t *outPath, const path_t *parent, const char *component, walk_flags_t flags, namespace_t *ns)
 Traverse a single component from a parent path.
 
uint64_t path_walk (path_t *outPath, const pathname_t *pathname, const path_t *start, walk_flags_t flags, namespace_t *ns)
 Traverse a pathname from a specified starting path.
 
uint64_t path_walk_parent (path_t *outPath, const pathname_t *pathname, const path_t *start, char *outLastName, walk_flags_t flags, namespace_t *ns)
 Traverse a pathname to its parent and get the last component name.
 
uint64_t path_to_name (const path_t *path, pathname_t *pathname)
 Convert a path to a pathname.
 

Variables

static map_t flagMap
 
static map_t flagShortMap
 
static path_flag_entry_t flagEntries []
 

Function Documentation

◆ path_flags_get()

static path_flag_entry_t * path_flags_get ( const char *  flag,
uint64_t  length 
)
static

◆ path_handle_dotdot()

static uint64_t path_handle_dotdot ( path_t current)
static

Variable Documentation

◆ flagEntries

path_flag_entry_t flagEntries[]
static
Initial value:
= {
{.flag = PATH_NONBLOCK, .name = "nonblock"},
{.flag = PATH_APPEND, .name = "append"},
{.flag = PATH_CREATE, .name = "create"},
{.flag = PATH_EXCLUSIVE, .name = "excl"},
{.flag = PATH_TRUNCATE, .name = "trunc"},
{.flag = PATH_DIRECTORY, .name = "dir"},
{.flag = PATH_RECURSIVE, .name = "recur"},
}
#define PATH_CREATE(inMount, inDentry)
Helper to create a path.
Definition path.h:195
@ PATH_NONBLOCK
Definition path.h:85
@ PATH_EXCLUSIVE
Definition path.h:88
@ PATH_TRUNCATE
Definition path.h:89
@ PATH_DIRECTORY
Definition path.h:90
@ PATH_RECURSIVE
Definition path.h:91
@ PATH_APPEND
Definition path.h:86

Definition at line 24 of file path.c.

Referenced by path_flags_get(), and path_flags_init().

◆ flagMap

map_t flagMap
static

Definition at line 13 of file path.c.

Referenced by path_flags_get(), and path_flags_init().

◆ flagShortMap

map_t flagShortMap
static

Definition at line 14 of file path.c.

Referenced by path_flags_get(), and path_flags_init().