42#define VNODE_FLAG_MOUNT_NEW (1 << 0)
43#define VNODE_FLAG_MOUNT_ORIGIN (1 << 1)
45#define V_CREATE (1 << 0)
46#define V_DUMMY (1 << 2)
56#define AT_REMOVEDIR 0x200
65#define MODE_IXUGO 0111
66#define USER_MODE_SHIFT 6
67#define GROUP_MODE_SHIFT 3
68#define UMASK_FULL 0777
175 struct file_operations_vfs *
fop;
双向链表由内联函数实现 http://weharmonyos.com/openharmony/zh-cn/device-dev/kernel/kernel-small-apx-dll....
unsigned attr_chg_size
节点大小
unsigned attr_chg_ctime
节点自身被修改时间
unsigned attr_chg_uid
用户ID
unsigned attr_chg_atime
节点最近访问时间
unsigned int attr_chg_flags
额外的系统与用户标志(flag),用来保护该文件
unsigned attr_chg_mode
确定了文件的类型,以及它的所有者、它的group、其它用户访问此文件的权限 (S_IWUSR | ...)
unsigned attr_chg_mtime
节点对应的文件内容被修改时间
unsigned int attr_chg_valid
节点改变有效性 (CHG_MODE | CHG_UID | ... )
举例: mount /dev/mmcblk0p0 /bin1/vs/sd vfat 将/dev/mmcblk0p0 挂载到/bin1/vs/sd目录
vnode并不包含文件名,因为 vnode和文件名是 1:N 的关系
struct page_mapping mapping
LIST_HEAD childPathCaches
struct file_operations_vfs * fop
struct Mount * originMount
LIST_HEAD parentPathCaches
int(* Setattr)(struct Vnode *vnode, struct stat *st)
设置节点属性
int(* Fscheck)(struct Vnode *vnode, struct fs_dirent_s *dir)
检查功能
int(* Create)(struct Vnode *parent, const char *name, int mode, struct Vnode **vnode)
创建节点
int(* Lookup)(struct Vnode *parent, const char *name, int len, struct Vnode **vnode)
查询节点
int(* Getattr)(struct Vnode *vnode, struct stat *st)
获取节点属性
int(* Opendir)(struct Vnode *vnode, struct fs_dirent_s *dir)
打开目录节点
int(* Open)(struct Vnode *vnode, int fd, int mode, int flags)
打开节点
int(* Reclaim)(struct Vnode *vnode)
回 收节点
int(* Close)(struct Vnode *vnode)
关闭节点
int(* Truncate64)(struct Vnode *vnode, off64_t len)
缩减或扩展大小
int(* Rmdir)(struct Vnode *parent, struct Vnode *vnode, const char *dirName)
删除目录节点
int(* Chattr)(struct Vnode *vnode, struct IATTR *attr)
改变节点属性(change attr)
ssize_t(* WritePage)(struct Vnode *vnode, char *buffer, off_t pos, size_t buflen)
ssize_t(* Readlink)(struct Vnode *vnode, char *buffer, size_t bufLen)
ssize_t(* ReadPage)(struct Vnode *vnode, char *buffer, off_t pos)
int(* Readdir)(struct Vnode *vnode, struct fs_dirent_s *dir)
读目录节点
int(* Rewinddir)(struct Vnode *vnode, struct fs_dirent_s *dir)
定位目录节点
int(* Link)(struct Vnode *src, struct Vnode *dstParent, struct Vnode **dst, const char *dstName)
int(* Closedir)(struct Vnode *vnode, struct fs_dirent_s *dir)
关闭目录节点
int(* Rename)(struct Vnode *src, struct Vnode *dstParent, const char *srcName, const char *dstName)
重命名
int(* Truncate)(struct Vnode *vnode, off_t len)
缩减或扩展大小
int(* Unlink)(struct Vnode *parent, struct Vnode *vnode, const char *fileName)
取消硬链接
int(* Mkdir)(struct Vnode *parent, const char *dirName, mode_t mode, struct Vnode **vnode)
创建目录节点
int(* Symlink)(struct Vnode *parentVnode, struct Vnode **newVnode, const char *path, const char *target)
ARG_NUM_3 ARG_NUM_1 ARG_NUM_2 ARG_NUM_2 ARG_NUM_3 ARG_NUM_1 ARG_NUM_4 ARG_NUM_2 ARG_NUM_2 ARG_NUM_5 ARG_NUM_2 ARG_NUM_0 ARG_NUM_2 ARG_NUM_1 ARG_NUM_2 ARG_NUM_3 ARG_NUM_7 ARG_NUM_2 ARG_NUM_3 ARG_NUM_2 ARG_NUM_4 off64_t
ARG_NUM_3 ARG_NUM_1 ARG_NUM_2 ARG_NUM_2 ARG_NUM_3 ARG_NUM_1 ARG_NUM_4 ARG_NUM_2 ARG_NUM_2 ARG_NUM_5 ARG_NUM_2 ARG_NUM_0 ARG_NUM_2 ARG_NUM_1 ARG_NUM_2 ARG_NUM_3 ARG_NUM_7 ARG_NUM_2 ARG_NUM_3 ARG_NUM_2 ARG_NUM_4 ARG_NUM_5 ARG_NUM_6 ARG_NUM_3 ARG_NUM_5 ARG_NUM_7 ARG_NUM_1 ARG_NUM_4 ARG_NUM_5 ARG_NUM_4 ARG_NUM_7 ARG_NUM_2 ARG_NUM_3 ARG_NUM_7 ARG_NUM_7 ARG_NUM_3 ARG_NUM_3 ARG_NUM_3 ARG_NUM_7 ARG_NUM_3 ARG_NUM_2 char ARG_NUM_2 ARG_NUM_1 ARG_NUM_0 ARG_NUM_0 ARG_NUM_3 void ARG_NUM_1 ARG_NUM_0 unsigned ARG_NUM_0 ARG_NUM_2 ARG_NUM_3 ARG_NUM_2 ARG_NUM_5 ARG_NUM_3 ARG_NUM_3 ARG_NUM_4 ARG_NUM_1 ARG_NUM_1 ARG_NUM_3 ARG_NUM_2 mode_t
LIST_HEAD * GetVnodeVirtualList(void)
int VnodeDevInit(void)
设备初始化,设备结点:/dev目录下,对应一个设备,如/dev/mmcblk0
BOOL VnodeInUseIter(const struct Mount *mount)
mount是否正在被某个索引节点使用
int VfsHashGet(const struct Mount *mount, uint32_t hash, struct Vnode **vnode, VfsHashCmp *fun, void *arg)
通过哈希值获取节点信息
int VfsHashInsert(struct Vnode *vnode, uint32_t hash)
插入哈希表
int VnodeClearCache(void)
int VnodeLookupFullpath(const char *fullpath, struct Vnode **vnode, uint32_t flags)
根节点内部改变
int VnodeFree(struct Vnode *vnode)
是否 vnode 节点
int VfsPermissionCheck(uint fuid, uint fgid, mode_t fileMode, int accMode)
int VnodeHold(void)
拿锁,封装互斥量
int VfsHashCmp(struct Vnode *vnode, void *arg)
mode_t GetUmask(void)
获取用户创建文件掩码
LIST_HEAD * GetVnodeFreeList(void)
uint32_t VfsHashIndex(struct Vnode *vnode)
通过节点获取哈希索引值
int VfsVnodePermissionCheck(const struct Vnode *node, int accMode)
int VnodeLookupAt(const char *path, struct Vnode **vnode, uint32_t flags, struct Vnode *orgVnode)
通过路径 查找索引节点.路径和节点是 N:1的关系, 硬链接
void VfsHashRemove(struct Vnode *vnode)
从哈希链表中摘除索引节点
int VnodeAlloc(struct VnodeOps *vop, struct Vnode **vnode)
申请分配一个 vnode 节点,vop为操作节点的驱动程序
void ChangeRoot(struct Vnode *newRoot)
改变根节点
void VnodeRefDec(struct Vnode *vnode)
LIST_HEAD * GetVnodeActiveList(void)
int VnodeFreeAll(const struct Mount *mnt)
释放mount下所有的索引节点
struct Vnode * VnodeGetRoot(void)
void VnodeMemoryDump(void)
int VnodeLookup(const char *path, struct Vnode **vnode, uint32_t flags)
通过路径查询vnode节点