PatchworkOS
Loading...
Searching...
No Matches
vfs_ctx.c File Reference
#include <kernel/fs/vfs_ctx.h>
#include <kernel/fs/vfs.h>
#include <kernel/log/log.h>
#include <kernel/sched/thread.h>
#include <assert.h>
#include <string.h>
#include <sys/io.h>

Go to the source code of this file.

Functions

void vfs_ctx_init (vfs_ctx_t *ctx, const path_t *cwd)
 Initialize a VFS context.
 
void vfs_ctx_deinit (vfs_ctx_t *ctx)
 Deinitialize a VFS context.
 
file_tvfs_ctx_get_file (vfs_ctx_t *ctx, fd_t fd)
 Get a file from a VFS context.
 
uint64_t vfs_ctx_get_cwd (vfs_ctx_t *ctx, path_t *outCwd)
 
uint64_t vfs_ctx_set_cwd (vfs_ctx_t *ctx, const path_t *cwd)
 Set the current working directory of a VFS context.
 
 SYSCALL_DEFINE (SYS_CHDIR, uint64_t, const char *pathString)
 
fd_t vfs_ctx_alloc_fd (vfs_ctx_t *ctx, file_t *file)
 Allocate a new file descriptor in a VFS context.
 
fd_t vfs_ctx_set_fd (vfs_ctx_t *ctx, fd_t fd, file_t *file)
 Allocate a specific file descriptor in a VFS context.
 
uint64_t vfs_ctx_free_fd (vfs_ctx_t *ctx, fd_t fd)
 Free a file descriptor in a VFS context.
 
 SYSCALL_DEFINE (SYS_CLOSE, uint64_t, fd_t fd)
 
fd_t vfs_ctx_dup (vfs_ctx_t *ctx, fd_t oldFd)
 Duplicate a file descriptor in a VFS context.
 
 SYSCALL_DEFINE (SYS_DUP, uint64_t, fd_t oldFd)
 
fd_t vfs_ctx_dup2 (vfs_ctx_t *ctx, fd_t oldFd, fd_t newFd)
 Duplicate a file descriptor in a VFS context to a specific file descriptor.
 
 SYSCALL_DEFINE (SYS_DUP2, uint64_t, fd_t oldFd, fd_t newFd)
 

Function Documentation

◆ SYSCALL_DEFINE() [1/4]

SYSCALL_DEFINE ( SYS_CHDIR  ,
uint64_t  ,
const char *  pathString 
)

◆ SYSCALL_DEFINE() [2/4]

SYSCALL_DEFINE ( SYS_CLOSE  ,
uint64_t  ,
fd_t  fd 
)

Definition at line 213 of file vfs_ctx.c.

References sched_process(), and vfs_ctx_free_fd().

◆ SYSCALL_DEFINE() [3/4]

SYSCALL_DEFINE ( SYS_DUP  ,
uint64_t  ,
fd_t  oldFd 
)

Definition at line 246 of file vfs_ctx.c.

References sched_process(), and vfs_ctx_dup().

◆ SYSCALL_DEFINE() [4/4]

SYSCALL_DEFINE ( SYS_DUP2  ,
uint64_t  ,
fd_t  oldFd,
fd_t  newFd 
)

Definition at line 283 of file vfs_ctx.c.

References sched_process(), and vfs_ctx_dup2().