PatchworkOS  19e446b
A non-POSIX operating system.
Loading...
Searching...
No Matches
dentry.c File Reference
#include <kernel/fs/dentry.h>
#include <kernel/sync/rcu.h>
#include <kernel/sync/seqlock.h>
#include <stdio.h>
#include <kernel/fs/vfs.h>
#include <kernel/fs/vnode.h>
#include <kernel/log/log.h>
#include <kernel/log/panic.h>
#include <kernel/mem/cache.h>
#include <kernel/sched/thread.h>
#include <kernel/sync/lock.h>
#include <kernel/sync/mutex.h>
#include <stdlib.h>
#include <sys/list.h>
Include dependency graph for dentry.c:

Go to the source code of this file.

Macros

#define DENTRY_MAP_SIZE   4096
 

Functions

static uint64_t dentry_hash (dentry_id_t parentId, const char *name, size_t length)
 
static uint64_t dentry_map_add (dentry_t *dentry)
 
static void dentry_map_remove (dentry_t *dentry)
 
static void dentry_free (dentry_t *dentry)
 
static void dentry_ctor (void *ptr)
 
dentry_tdentry_new (superblock_t *superblock, dentry_t *parent, const char *name)
 Create a new dentry.
 
void dentry_remove (dentry_t *dentry)
 Remove a dentry from the dentry cache.
 
dentry_tdentry_rcu_get (const dentry_t *parent, const char *name, size_t length)
 Get a dentry from the dentry cache in an RCU read-side critical section without traversing mountpoints.
 
static dentry_tdentry_get (const dentry_t *parent, const char *name, size_t length)
 
dentry_tdentry_lookup (dentry_t *parent, const char *name, size_t length)
 Lookup a dentry for the given name without traversing mountpoints.
 
void dentry_make_positive (dentry_t *dentry, vnode_t *vnode)
 Make a dentry positive by associating it with an vnode.
 
bool dentry_iterate_dots (dentry_t *dentry, dir_ctx_t *ctx)
 Helper function to iterate over the special entries "." and "..".
 
uint64_t dentry_generic_iterate (dentry_t *dentry, dir_ctx_t *ctx)
 Helper function for a basic iterate.
 

Variables

static dentry_tmap [DENTRY_MAP_SIZE] = {NULL}
 
static seqlock_t lock = SEQLOCK_CREATE()
 
static cache_t cache = CACHE_CREATE(cache, "dentry", sizeof(dentry_t), CACHE_LINE, dentry_ctor, NULL)
 

Macro Definition Documentation

◆ DENTRY_MAP_SIZE

#define DENTRY_MAP_SIZE   4096

Definition at line 20 of file dentry.c.

Function Documentation

◆ dentry_hash()

static uint64_t dentry_hash ( dentry_id_t  parentId,
const char *  name,
size_t  length 
)
static

Definition at line 24 of file dentry.c.

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

◆ dentry_map_add()

static uint64_t dentry_map_add ( dentry_t dentry)
static

Definition at line 31 of file dentry.c.

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

◆ dentry_map_remove()

static void dentry_map_remove ( dentry_t dentry)
static

Definition at line 57 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 76 of file dentry.c.

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

◆ dentry_ctor()

static void dentry_ctor ( void *  ptr)
static

Definition at line 112 of file dentry.c.

Here is the call graph for this function:

◆ dentry_get()

static dentry_t * dentry_get ( const dentry_t parent,
const char *  name,
size_t  length 
)
static

Definition at line 222 of file dentry.c.

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

Variable Documentation

◆ map

dentry_t* map[DENTRY_MAP_SIZE] = {NULL}
static

Definition at line 21 of file dentry.c.

◆ lock

seqlock_t lock = SEQLOCK_CREATE()
static

Definition at line 22 of file dentry.c.

◆ cache

cache_t cache = CACHE_CREATE(cache, "dentry", sizeof(dentry_t), CACHE_LINE, dentry_ctor, NULL)
static

Definition at line 132 of file dentry.c.