This commit is contained in:
2026-03-09 07:53:06 +00:00
parent 975afaf3f0
commit 470412a1c2
82 changed files with 7094 additions and 5234 deletions

30
src/fs/zvfs_path_entry.h Normal file
View File

@@ -0,0 +1,30 @@
#ifndef __ZVFS_PATH_ENTRY_H__
#define __ZVFS_PATH_ENTRY_H__
#include "common/uthash.h"
#include <stdatomic.h>
#include <stdint.h>
struct zvfs_path_entry {
char *path; // key
struct zvfs_inode *inode;
UT_hash_handle hh;
};
// 插入缓存path 内部 strdupinode->ref_count 不在此处修改
// 需持有 path_mu
int path_cache_insert(const char *path, struct zvfs_inode *inode);
// 查找,未命中返回 NULL需持有 path_mu
struct zvfs_path_entry *path_cache_lookup(const char *path);
// 移除并释放 entry不释放 inode需持有 path_mu
void path_cache_remove(const char *path);
// rename原子替换 key需持有 path_mu
int path_cache_rename(const char *old_path, const char *new_path);
#endif // __ZVFS_PATH_ENTRY_H__