PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
dentry.c File Reference
#include <kernel/fs/dentry.h>
#include <kernel/sync/seqlock.h>
#include <stdio.h>
#include <kernel/fs/inode.h>
#include <kernel/fs/vfs.h>
#include <kernel/log/log.h>
#include <kernel/log/panic.h>
#include <kernel/sched/thread.h>
#include <kernel/sync/lock.h>
#include <kernel/sync/mutex.h>
#include <stdlib.h>
Include dependency graph for dentry.c:

Go to the source code of this file.

Data Structures

struct  getdents_ctx_t
 

Functions

static map_key_t dentry_cache_key (dentry_id_t parentId, const char *name)
 
static uint64_t dentry_cache_add (dentry_t *dentry)
 
static void dentry_cache_remove (dentry_t *dentry)
 
static dentry_tdentry_cache_get (map_key_t *key)
 
static void dentry_free (dentry_t *dentry)
 
dentry_tdentry_new (superblock_t *superblock, dentry_t *parent, const char *name)
 Create a new dentry.
 
dentry_tdentry_get (const dentry_t *parent, const char *name)
 Get a dentry for the given name. Will NOT traverse mountpoints.
 
dentry_tdentry_lookup (const path_t *parent, const char *name)
 Lookup a dentry for the given name. Will NOT traverse mountpoints.
 
void dentry_make_positive (dentry_t *dentry, inode_t *inode)
 Make a dentry positive by associating it with an inode.
 
bool dentry_is_positive (dentry_t *dentry)
 Check if a dentry is positive.
 
bool dentry_is_file (dentry_t *dentry)
 Check if the inode associated with a dentry is a file.
 
bool dentry_is_dir (dentry_t *dentry)
 Check if the inode associated with a dentry is a directory.
 
static void getdents_write (getdents_ctx_t *ctx, inode_number_t number, inode_type_t type, const char *name)
 
static void getdents_recursive_traversal (getdents_ctx_t *ctx, dentry_t *dentry)
 
uint64_t dentry_generic_getdents (dentry_t *dentry, dirent_t *buffer, uint64_t count, uint64_t *offset, mode_t mode)
 Helper function for a basic getdents.
 

Variables

static map_t dentryCache = MAP_CREATE()
 
static rwlock_t dentryCacheLock = RWLOCK_CREATE()
 

Function Documentation

◆ dentry_cache_key()

static map_key_t dentry_cache_key ( dentry_id_t  parentId,
const char *  name 
)
static

Definition at line 19 of file dentry.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dentry_cache_add()

static uint64_t dentry_cache_add ( dentry_t dentry)
static

Definition at line 33 of file dentry.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dentry_cache_remove()

static void dentry_cache_remove ( dentry_t dentry)
static

Definition at line 46 of file dentry.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dentry_cache_get()

static dentry_t * dentry_cache_get ( map_key_t key)
static

Definition at line 52 of file dentry.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dentry_free()

static void dentry_free ( dentry_t dentry)
static

Definition at line 72 of file dentry.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getdents_write()

static void getdents_write ( getdents_ctx_t ctx,
inode_number_t  number,
inode_type_t  type,
const char *  name 
)
static

Definition at line 293 of file dentry.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getdents_recursive_traversal()

static void getdents_recursive_traversal ( getdents_ctx_t ctx,
dentry_t dentry 
)
static

Definition at line 310 of file dentry.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ dentryCache

map_t dentryCache = MAP_CREATE()
static

Definition at line 16 of file dentry.c.

◆ dentryCacheLock

rwlock_t dentryCacheLock = RWLOCK_CREATE()
static

Definition at line 17 of file dentry.c.