rebuild
This commit is contained in:
30
src/fs/zvfs_path_entry.h
Normal file
30
src/fs/zvfs_path_entry.h
Normal 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 内部 strdup,inode->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__
|
||||
Reference in New Issue
Block a user