Files
zvfs/src/fs/zvfs_path_entry.h
2026-03-09 07:53:06 +00:00

30 lines
823 B
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#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__