Barrelfish
Functions
vfs_path.c File Reference

VFS-related path manipulation. More...

Functions

void vfs_path_normalise (char *path)
 Normalise the given path, in-place. More...
 
char * vfs_path_mkabsolute (const char *cwd, const char *path)
 Generate an absolute path, given the current directory. More...
 
char * vfs_path_mkabs (const char *path)
 Shorthand version of vfs_path_mkabsolute() that "knows" the current directory. More...
 

Detailed Description

VFS-related path manipulation.

Function Documentation

char* vfs_path_mkabs ( const char *  path)

Shorthand version of vfs_path_mkabsolute() that "knows" the current directory.

Returns
Path in malloc'ed buffer, which must be freed by caller.
char* vfs_path_mkabsolute ( const char *  cwd,
const char *  path 
)

Generate an absolute path, given the current directory.

This function constructs an absolute path, given the current directory and a path which may be relative or absolute (starts with '/').

Returns
Path in malloc'ed buffer, which must be freed by the caller
void vfs_path_normalise ( char *  path)

Normalise the given path, in-place.

Modifies the provided path, performing the following substitutions:

  1. successive separators are suppressed: A//B -> A/B
  2. the self-referential directory element is suppressed: A/./B -> A/B
  3. references to the parent directory are collapsed where possible: A/foo/../B -> A/B
  4. a trailing / is elided