40 sizeof(
struct dentry), 0, 0);
74 __ATOMIC_RELAXED) == 1) {
101 char* path_ = path_copy->c_str;
102 while (path_ !=
NULL && *path_ !=
'\0') {
103 char* component =
strsep2(&path_,
"/");
105 if (!component || *component ==
'\0')
111 (component[
len - 1] ==
'/' || component[
len - 1] ==
' '))
112 component[--
len] =
'\0';
117 if (
strcmp(component,
".") == 0)
120 if (
strcmp(component,
"..") == 0) {
135 create_dentry(
str(component), 0, curr);
146 auto curr_vnode = curr->
vnode;
226 char* path_iter = temp;
228 while (path_iter && *path_iter !=
'\0') {
229 char* component =
strsep2(&path_iter,
"/");
231 if (!component || component[0] ==
'\0')
238 create_dentry(
str(component), 0, curr);
293 for (
size_t i = 0; i < n; i++)
305 char indent[128] = {0};
306 for (
int i = 0; i < depth; i++) {
308 indent[i * 2 + 1] =
' ';
struct vfs_cache * get_root_cache()
void vfs_cache_insert(struct vfs_cache *cache, struct dentry *dentry)
void cache_remove(struct vfs_cache *cache, struct dentry *dentry)
struct dentry * cache_lookup(struct vfs_cache *cache, struct dentry *parent, const char *name)
int get_reffcount(dentry_ptr dentry)
static dentry_t * root_dentry
static struct slab_cache * dentry_cache
void dentry_get(dentry_ptr dentry)
uint32_t hash_dentry(const char *name, dentry_ptr parent)
void print_dentry_tree(dentry_t *dentry, int depth)
void delete_dentry(dentry_t *node)
void dentry_put(dentry_ptr dentry)
void vxSetDentryAsRoot(dentry_ptr dentry)
kstring get_full_path_from_dentry(dentry_ptr dentry)
static void dentry_free_rcu(struct rcu_head *head)
void vxAttachDentryToVnode(dentry_ptr dentry, vnode_ptr_t vnode)
struct dentry * dentry_ptr
int resolve_dentry(char *path, dentry_ptr parent, dentry_ptr *out, uint8_t flag)
Resolves a path to a directory entry (dentry) with configurable start point and strictness.
int vxnamei(const char *path, dentry_ptr *out)
Resolves a file path to a directory entry (dentry).
dentry_ptr get_root_dentry()
uint32_t hash32(const char *str, size_t max_size)
void serial2_printf(const char *fmt,...)
void kfree(void *ptr, size_t size)
void * kalloc(size_t size)
static void llist_init(struct llist_head *head)
void call_rcu(struct rcu_head *head, void(*func)(struct rcu_head *))
#define LOG2_DEBUG(mod, fmt,...)
void * vxSlabAlloc(struct slab_cache *cache)
void slab_free(struct slab_cache *cache, void *obj)
void vxCreateSlabCache(struct slab_cache **cache, const char *name, const size_t obj_size, size_t alignment, const uintptr_t virt_addr)
void spin_acquire(spinlock_t *lock)
void spin_release(spinlock_t *lock)
int strcmp(const char *s1, const char *s2)
char * strsep2(char **stringp, const char *delim)
size_t strlen(const char *s)
void memset(void *ptr, int value, size_t num)
void memcopy(void *dest, void *src, size_t size)
void str_release(kstring str)
kstring str_concat(kstring s, const char *suffix)
kstring str(const char *str)
kstring str_concat_prefix(kstring s, const char *prefix)
struct hlist_node hash_node
struct llist_head child_list
struct fs_instance * fs_instance
#define container_of(ptr, type, member)