RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
dfs_dentry.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2006-2023, RT-Thread Development Team
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date Author Notes
8 * 2023-05-05 Bernard Implement dentry in dfs v2.0
9 */
10
11#ifndef __DFS_DENTRY_H__
12#define __DFS_DENTRY_H__
13
14#include "dfs_file.h"
15#include "dfs_fs.h"
16
17#ifdef __cplusplus
18extern "C"
19{
20#endif
21
22struct dfs_mnt;
23struct dfs_vnode;
24
26{
28
29 uint32_t flags;
30
31#define DENTRY_IS_MOUNTED 0x1 /* dentry is mounted */
32#define DENTRY_IS_ALLOCED 0x2 /* dentry is allocated */
33#define DENTRY_IS_ADDHASH 0x4 /* dentry was added into hash table */
34#define DENTRY_IS_OPENED 0x8 /* dentry was opened. */
35 char *pathname; /* the pathname under mounted file sytem */
36
37 struct dfs_vnode *vnode; /* the vnode of this dentry */
38 struct dfs_mnt *mnt; /* which mounted file system does this dentry belong to */
39
40 rt_atomic_t ref_count; /* the reference count */
41};
42
43struct dfs_dentry *dfs_dentry_create(struct dfs_mnt *mnt, char *fullpath);
44struct dfs_dentry *dfs_dentry_create_rela(struct dfs_mnt *mnt, char *rela_path);
45struct dfs_dentry *dfs_dentry_unref(struct dfs_dentry *dentry);
46struct dfs_dentry *dfs_dentry_ref(struct dfs_dentry *dentry);
47void dfs_dentry_insert(struct dfs_dentry *dentry);
48struct dfs_dentry *dfs_dentry_lookup(struct dfs_mnt *mnt, const char *path, uint32_t flags);
49
50/* get full path of a dentry */
51char* dfs_dentry_full_path(struct dfs_dentry* dentry);
52
53/* get pathname (with mnt path) of a dentry */
54char* dfs_dentry_pathname(struct dfs_dentry* dentry);
55
56/* get full path crc32 */
57uint32_t dfs_dentry_full_path_crc32(struct dfs_dentry* dentry);
58
59int dfs_dentry_init(void);
60
61#ifdef __cplusplus
62}
63#endif
64
65#endif /*__DFS_DENTRY_H__*/
struct dfs_dentry * dfs_dentry_create(struct dfs_mnt *mnt, char *fullpath)
struct dfs_dentry * dfs_dentry_lookup(struct dfs_mnt *mnt, const char *path, uint32_t flags)
int dfs_dentry_init(void)
struct dfs_dentry * dfs_dentry_unref(struct dfs_dentry *dentry)
uint32_t dfs_dentry_full_path_crc32(struct dfs_dentry *dentry)
char * dfs_dentry_full_path(struct dfs_dentry *dentry)
void dfs_dentry_insert(struct dfs_dentry *dentry)
struct dfs_dentry * dfs_dentry_create_rela(struct dfs_mnt *mnt, char *rela_path)
char * dfs_dentry_pathname(struct dfs_dentry *dentry)
struct dfs_dentry * dfs_dentry_ref(struct dfs_dentry *dentry)
rt_base_t rt_atomic_t
struct rt_list_node rt_list_t
rt_atomic_t ref_count
rt_list_t hashlist
struct dfs_mnt * mnt
struct dfs_vnode * vnode