Kintsugi OS 0.5.0
x86 Monolithic OS
Loading...
Searching...
No Matches
vfs.c File Reference
#include "vfs.h"
#include "../kklibc/kklibc.h"

Macros

#define RESOLVE(path)
 

Functions

void vfs_mount (const vfs_ops_t *ops)
 
const char * vfs_getcwd (void)
 
int vfs_open (const char *path, vfs_file_t *file)
 
int vfs_file_read (vfs_file_t *file, void *buffer, u32 capacity)
 
int vfs_file_write (vfs_file_t *file, const void *buffer, u32 size)
 
int vfs_seek (vfs_file_t *file, u32 offset)
 
void vfs_close (vfs_file_t *file)
 
int vfs_normalize (const char *path, char out[VFS_PATH_MAX])
 
int vfs_stat (const char *path, vfs_stat_t *stat)
 
int vfs_chdir (const char *path)
 
int vfs_read (const char *path, u32 offset, void *buffer, u32 capacity)
 
int vfs_replace (const char *path, const void *data, u32 size)
 
static int modify (const char *path, u32 offset, const void *data, u32 size, int truncate, int append)
 
int vfs_write (const char *p, u32 o, const void *d, u32 n)
 
int vfs_append (const char *p, const void *d, u32 n)
 
int vfs_truncate (const char *p, u32 n)
 
int vfs_create (const char *path)
 
int vfs_mkdir (const char *path)
 
static int ancestor (const char *parent, const char *child)
 
int vfs_unlink (const char *path)
 
int vfs_rmdir (const char *path)
 
int vfs_rename (const char *source, const char *destination)
 
int vfs_readdir (const char *path, u32 *cursor, vfs_dirent_t *entry)
 
int vfs_copy (const char *source, const char *destination)
 
const char * vfs_error (int e)
 

Variables

static const vfs_ops_t * backend
 
static u32 generation
 
static char cwd [VFS_PATH_MAX] = "/"
 

Macro Definition Documentation

◆ RESOLVE

#define RESOLVE (   path)
Value:
char absolute[VFS_PATH_MAX]; \
if (!backend) \
return VFS_EIO; \
int result = vfs_normalize(path, absolute); \
if (result) \
return result
static const vfs_ops_t * backend
Definition vfs.c:4
int vfs_normalize(const char *path, char out[VFS_PATH_MAX])
Definition vfs.c:78
#define VFS_PATH_MAX
Definition vfs.h:4
@ VFS_EIO
Definition vfs.h:10

Function Documentation

◆ ancestor()

static int ancestor ( const char *  parent,
const char *  child 
)
static

◆ modify()

static int modify ( const char *  path,
u32  offset,
const void *  data,
u32  size,
int  truncate,
int  append 
)
static

◆ vfs_append()

int vfs_append ( const char *  p,
const void *  d,
u32  n 
)

◆ vfs_chdir()

int vfs_chdir ( const char *  path)

◆ vfs_close()

void vfs_close ( vfs_file_t *  file)

◆ vfs_copy()

int vfs_copy ( const char *  source,
const char *  destination 
)

◆ vfs_create()

int vfs_create ( const char *  path)

◆ vfs_error()

const char * vfs_error ( int  e)

◆ vfs_file_read()

int vfs_file_read ( vfs_file_t *  file,
void *  buffer,
u32  capacity 
)

◆ vfs_file_write()

int vfs_file_write ( vfs_file_t *  file,
const void *  buffer,
u32  size 
)

◆ vfs_getcwd()

const char * vfs_getcwd ( void  )

◆ vfs_mkdir()

int vfs_mkdir ( const char *  path)

◆ vfs_mount()

void vfs_mount ( const vfs_ops_t *  ops)

◆ vfs_normalize()

int vfs_normalize ( const char *  path,
char  out[VFS_PATH_MAX] 
)

◆ vfs_open()

int vfs_open ( const char *  path,
vfs_file_t *  file 
)

◆ vfs_read()

int vfs_read ( const char *  path,
u32  offset,
void *  buffer,
u32  capacity 
)

◆ vfs_readdir()

int vfs_readdir ( const char *  path,
u32 *  cursor,
vfs_dirent_t *  entry 
)

◆ vfs_rename()

int vfs_rename ( const char *  source,
const char *  destination 
)

◆ vfs_replace()

int vfs_replace ( const char *  path,
const void *  data,
u32  size 
)

◆ vfs_rmdir()

int vfs_rmdir ( const char *  path)

◆ vfs_seek()

int vfs_seek ( vfs_file_t *  file,
u32  offset 
)

◆ vfs_stat()

int vfs_stat ( const char *  path,
vfs_stat_t *  stat 
)

◆ vfs_truncate()

int vfs_truncate ( const char *  p,
u32  n 
)

◆ vfs_unlink()

int vfs_unlink ( const char *  path)

◆ vfs_write()

int vfs_write ( const char *  p,
u32  o,
const void *  d,
u32  n 
)

Variable Documentation

◆ backend

const vfs_ops_t* backend
static

◆ cwd

char cwd[VFS_PATH_MAX] = "/"
static

◆ generation

u32 generation
static