RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
dfs_mnt.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_MNT_H__
12#define DFS_MNT_H__
13
14#include <rtservice.h>
15#include <rtthread.h>
16
17#ifdef __cplusplus
18extern "C"
19{
20#endif
21
22struct dfs_mnt;
23struct dfs_dentry;
25
26struct dfs_mnt
27{
28 struct dfs_mnt *parent; /* the parent mounted file system */
29
30 rt_list_t sibling; /* the sibling node for mounted list */
31 rt_list_t child; /* the child node for mounted list */
32
33 char *fullpath; /* the fullpath of this mounted file system */
34 int flags; /* the falgs of this mounted file system */
35
36#define MNT_IS_ALLOCED 0x1 /* the mnt struct is allocated */
37#define MNT_IS_ADDLIST 0x2 /* the mnt struct is added into list */
38#define MNT_IS_MOUNTED 0x4 /* the mnt struct is mounted */
39#define MNT_IS_UMOUNT 0x8 /* the mnt is unmount */
40#define MNT_IS_LOCKED 0x10 /* the mnt is locked */
41#define MNT_FORCE 0x20 /* the mnt force unmount */
42#define MNT_LAZY_UMNT 0x40 /* the mnt has pending umount */
43#define MNT_RDONLY 0x80 /* the mnt is read only */
44
45 rt_atomic_t ref_count; /* reference count */
46
47 rt_device_t dev_id; /* the mounted device id */
49
50 void *data;
51};
52
53struct dfs_mnt *dfs_mnt_create(const char *path);
54int dfs_mnt_destroy(struct dfs_mnt* mnt);
55int dfs_mnt_list(struct dfs_mnt* mnt);
56int dfs_mnt_insert(struct dfs_mnt* mnt, struct dfs_mnt* child);
57
59struct dfs_mnt *dfs_mnt_lookup(const char *path);
60const char *dfs_mnt_get_mounted_path(struct rt_device *device);
61
62struct dfs_mnt* dfs_mnt_ref(struct dfs_mnt* mnt);
63int dfs_mnt_unref(struct dfs_mnt* mnt);
64
65int dfs_mnt_umount(struct dfs_mnt *mnt, int flags);
66int dfs_mnt_setflags(struct dfs_mnt *mnt, int flags);
67
68rt_bool_t dfs_mnt_has_child_mnt(struct dfs_mnt *mnt, const char* fullpath);
69
70int dfs_mnt_foreach(struct dfs_mnt* (*func)(struct dfs_mnt *mnt, void *parameter), void *parameter);
71int dfs_mnt_umount_iter(rt_bool_t (*filter)(struct dfs_mnt *mnt, void *parameter), void *parameter);
72
73typedef void (*dfs_mnt_umnt_cb_t)(struct dfs_mnt *mnt);
75
76#ifdef __cplusplus
77}
78#endif
79
80#endif
int dfs_mnt_umount(struct dfs_mnt *mnt, int flags)
int dfs_mnt_insert(struct dfs_mnt *mnt, struct dfs_mnt *child)
int dfs_mnt_setflags(struct dfs_mnt *mnt, int flags)
rt_bool_t dfs_mnt_has_child_mnt(struct dfs_mnt *mnt, const char *fullpath)
void(* dfs_mnt_umnt_cb_t)(struct dfs_mnt *mnt)
struct dfs_mnt * dfs_mnt_dev_lookup(rt_device_t dev_id)
int dfs_mnt_unref(struct dfs_mnt *mnt)
struct dfs_mnt * dfs_mnt_lookup(const char *path)
const char * dfs_mnt_get_mounted_path(struct rt_device *device)
int dfs_mnt_destroy(struct dfs_mnt *mnt)
int dfs_mnt_foreach(struct dfs_mnt *(*func)(struct dfs_mnt *mnt, void *parameter), void *parameter)
int dfs_mnt_list(struct dfs_mnt *mnt)
int dfs_mnt_umount_iter(rt_bool_t(*filter)(struct dfs_mnt *mnt, void *parameter), void *parameter)
struct dfs_mnt * dfs_mnt_create(const char *path)
struct dfs_mnt * dfs_mnt_ref(struct dfs_mnt *mnt)
struct rt_device * rt_device_t
#define RT_OBJECT_HOOKLIST_DECLARE(handler_type, name)
int rt_bool_t
rt_base_t rt_atomic_t
struct rt_list_node rt_list_t
char * fullpath
void * data
rt_device_t dev_id
rt_list_t sibling
const struct dfs_filesystem_ops * fs_ops
rt_list_t child
rt_atomic_t ref_count
struct dfs_mnt * parent