|
PatchworkOS
966e257
A non-POSIX operating system.
|
#include <kernel/utils/map.h>#include <alloca.h>#include <ctype.h>#include <stdbool.h>#include <stdint.h>#include <sys/io.h>Go to the source code of this file.
Data Structures | |
| struct | path_t |
| Path structure. More... | |
| struct | pathname_t |
| Pathname structure. More... | |
Macros | |
| #define | PATH_DEFER(path) __attribute__((cleanup(path_defer_cleanup))) path_t* CONCAT(i, __COUNTER__) = (path) |
| Defer path put. | |
| #define | PATH_VALID_CHAR(ch) (strchr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-. ()[]{}~!@#$%^&?',;=+", (ch))) |
| Check if a char is valid. | |
| #define | PATH_HANDLE_DOTDOT_MAX_ITER 1000 |
Maximum iterations to handle .. in a path. | |
| #define | PATHNAME_IS_VALID(pathname) ((pathname) != NULL && (pathname)->isValid) |
| Check if a pathname is valid. | |
| #define | PATHNAME(string) |
| Helper to create a pathname. | |
| #define | PATH_EMPTY |
| Helper to create an empty path. | |
| #define | PATH_CREATE(inMount, inDentry) |
| Helper to create a path. | |
Typedefs | |
| typedef struct path | path_t |
| typedef struct mount | mount_t |
| typedef struct dentry | dentry_t |
Enumerations | |
| enum | mode_t { MODE_NONE = 0 , MODE_READ = 1 << 0 , MODE_WRITE = 1 << 1 , MODE_EXECUTE = 1 << 2 , MODE_NONBLOCK = 1 << 3 , MODE_APPEND = 1 << 4 , MODE_CREATE = 1 << 5 , MODE_EXCLUSIVE = 1 << 6 , MODE_TRUNCATE = 1 << 7 , MODE_DIRECTORY = 1 << 8 , MODE_RECURSIVE = 1 << 9 , MODE_AMOUNT = 10 , MODE_ALL_PERMS = MODE_READ | MODE_WRITE | MODE_EXECUTE } |
| Path flags and permissions. More... | |
Functions | |
| 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. | |
| uint64_t | path_step (path_t *path, const char *name, namespace_t *ns) |
| Walk a single step in a path. | |
| uint64_t | path_walk (path_t *path, const pathname_t *pathname, namespace_t *ns) |
| Walk a pathname to a path. | |
| uint64_t | path_walk_parent (path_t *path, const pathname_t *pathname, char *outLastName, namespace_t *ns) |
| Walk a pathname to its parent and get the name of the last component. | |
| uint64_t | path_walk_parent_and_child (const path_t *from, path_t *outParent, path_t *outChild, const pathname_t *pathname, namespace_t *ns) |
| Traverse a pathname to its parent and child paths. | |
| uint64_t | path_to_name (const path_t *path, pathname_t *pathname) |
| Convert a path to a pathname. | |
| static void | path_defer_cleanup (path_t **path) |