Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
cache.h File Reference
#include <type.h>

Go to the source code of this file.

Data Structures

struct  hlist_node
 
struct  hlist_head
 
struct  vfs_cache
 

Macros

#define VFS_CACHE_SIZE   32
 
#define hlist_for_each(pos, head, member)
 

Functions

struct vfs_cache __attribute__ ((aligned(64)))
 
void hlist_add_head (struct hlist_node *n, struct hlist_head *h)
 
struct vfs_cachecreate_vfs_cache ()
 
struct vfs_cacheget_root_cache ()
 
void vfs_cache_insert (struct vfs_cache *cache, struct dentry *dentry)
 
struct dentrycache_lookup (struct vfs_cache *cache, struct dentry *parent, const char *name)
 
void cache_remove (struct vfs_cache *cache, struct dentry *dentry)
 

Variables

struct hlist_head buckets [32]
 
uint8_t lock
 
int count
 

Macro Definition Documentation

◆ hlist_for_each

#define hlist_for_each ( pos,
head,
member )
Value:
for (pos = (head->first == NULL) ? NULL \
: container_of((head)->first, \
typeof(*pos), member); \
pos != NULL; \
pos = (pos->member.next) ? container_of(pos->member.next, \
typeof(*pos), member) \
: NULL)
uint64_t pos
Definition fd.h:4
uint32_t head
Definition tty.h:10
#define NULL
Definition type.h:76
#define container_of(ptr, type, member)
Definition type.h:108

Definition at line 18 of file cache.h.

◆ VFS_CACHE_SIZE

#define VFS_CACHE_SIZE   32

Definition at line 6 of file cache.h.

Referenced by __attribute__(), cache_lookup(), and cache_remove().

Function Documentation

◆ __attribute__()

struct vfs_cache __attribute__ ( (aligned(64)) )

Definition at line 1 of file core.h.

◆ cache_lookup()

struct dentry * cache_lookup ( struct vfs_cache * cache,
struct dentry * parent,
const char * name )

◆ cache_remove()

void cache_remove ( struct vfs_cache * cache,
struct dentry * dentry )

Definition at line 116 of file cache.c.

References cache, dentry::hash, dentry::hash_node, hlist_del(), idx, and VFS_CACHE_SIZE.

Referenced by delete_dentry(), and vfs_umount_recursive().

◆ create_vfs_cache()

struct vfs_cache * create_vfs_cache ( )

Definition at line 39 of file cache.c.

References cache, kalloc(), memset(), and serial2_printf().

Referenced by INIT().

◆ get_root_cache()

struct vfs_cache * get_root_cache ( )

◆ hlist_add_head()

void hlist_add_head ( struct hlist_node * n,
struct hlist_head * h )

Definition at line 49 of file cache.c.

References h, hlist_node::next, NULL, and hlist_node::prev.

Referenced by __attribute__().

◆ vfs_cache_insert()

void vfs_cache_insert ( struct vfs_cache * cache,
struct dentry * dentry )

References cache, name, and parent.

Variable Documentation

◆ buckets

struct hlist_head buckets[32]

Definition at line 0 of file cache.h.

◆ count

◆ lock