The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
vfs_path.c File Reference
#include "vfs.h"
#include "common/string.h"

Macros

#define VFS_MAX_PATH_COMPONENTS   128

Functions

bool vfs_resolve_path (const char *cwd, const char *input, char *output, size_t size)
 resolve an input path against the current working directory.
bool vfs_join_path (const char *base, const char *name, char *out, size_t size)
 join two path components into an output buffer.

Macro Definition Documentation

◆ VFS_MAX_PATH_COMPONENTS

#define VFS_MAX_PATH_COMPONENTS   128

Function Documentation

◆ vfs_resolve_path()

bool vfs_resolve_path ( const char * cwd,
const char * input,
char * output,
size_t size )

resolve an input path against the current working directory.

absolute paths are returned as-is, relative paths are prefixed with cwd.

Parameters
cwdcurrent working directory.
inputuser-provided path.
outputdestination buffer for resolved absolute path.
sizesize of destination buffer in bytes.
Returns
true on success, false if inputs are invalid or output would overflow.

◆ vfs_join_path()

bool vfs_join_path ( const char * base,
const char * name,
char * out,
size_t size )

join two path components into an output buffer.

avoids duplicate separators when base already ends with '/'.

Parameters
basebase path component.
namechild path component.
outdestination buffer.
sizedestination buffer size in bytes.
Returns
true on success, false on invalid input or insufficient output size.