20#define DBG_TAG "DFS.mnt"
21#define DBG_LVL DBG_WARNING
46 LOG_I(
"create mnt at %s", path);
56 rt_set_errno(-ENOMEM);
70 if (mnt ==
RT_NULL || (strcmp(
child->fullpath,
"/") == 0))
145 if (iter->dev_id ==
dev_id)
152 ret = _dfs_mnt_dev_lookup(iter,
dev_id);
165 struct dfs_mnt *mnt = _root_mnt;
178 ret = _dfs_mnt_dev_lookup(mnt,
dev_id);
196 struct dfs_mnt *mnt = _root_mnt;
201 int mnt_len = rt_strlen(mnt->
fullpath);
205 (mnt_len == 1 || (
fullpath[mnt_len] ==
'\0') || (
fullpath[mnt_len] ==
'/')))
211 mnt_len = rt_strlen(iter->
fullpath);
220 if (mnt != iter)
break;
231 LOG_D(
"mnt_lookup: %s path @ mount point %p",
fullpath, mnt);
275 DLOG(msg,
"mnt",
"mnt", DLOG_MSG,
"free mnt(%s)", mnt->
fs_ops->
name);
296#ifdef RT_USING_PAGECACHE
297 dfs_pcache_clean(mnt);
327static struct dfs_mnt* _dfs_mnt_foreach(
struct dfs_mnt *mnt,
struct dfs_mnt* (*func)(
struct dfs_mnt *mnt,
void *parameter),
void *parameter)
329 struct dfs_mnt *iter, *ret = NULL;
333 ret = func(mnt, parameter);
341 ret = _dfs_mnt_foreach(iter, func, parameter);
358static struct dfs_mnt* _mnt_cmp_devid(
struct dfs_mnt *mnt,
void *device)
390 mnt = _dfs_mnt_foreach(_root_mnt, _mnt_cmp_devid, device);
399static struct dfs_mnt* _mnt_dump(
struct dfs_mnt *mnt,
void *parameter)
418static struct dfs_mnt* _mnt_cmp_path(
struct dfs_mnt* mnt,
void *parameter)
420 const char*
fullpath = (
const char*)parameter;
440 m = _dfs_mnt_foreach(mnt, _mnt_cmp_path, (
void*)
fullpath);
454 if (!mnt) mnt = _root_mnt;
458 _dfs_mnt_foreach(mnt, _mnt_dump,
RT_NULL);
469 _dfs_mnt_foreach(_root_mnt, func, parameter);
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)
int dfs_mnt_remove(struct dfs_mnt *mnt)
struct dfs_mnt * dfs_mnt_dev_lookup(rt_device_t dev_id)
int dfs_mnt_unref(struct dfs_mnt *mnt)
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)
struct dfs_mnt * dfs_mnt_lookup(const char *fullpath)
int dfs_mnt_list(struct dfs_mnt *mnt)
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
int mkdir(const char *path, mode_t mode)
#define RT_OBJECT_HOOKLIST_CALL(name, argv)
#define RT_OBJECT_HOOKLIST_DEFINE(name)
rt_inline void rt_list_remove(rt_list_t *n)
remove node from list.
rt_weak void * rt_calloc(rt_size_t count, rt_size_t size)
This function will contiguously allocate enough space for count objects that are size bytes of memory...
rt_inline int rt_list_isempty(const rt_list_t *l)
tests whether a list is empty
rt_inline void rt_list_insert_before(rt_list_t *l, rt_list_t *n)
insert a node before a list
rt_inline void rt_list_init(rt_list_t *l)
initialize a list
#define rt_list_for_each_entry(pos, head, member)
rt_weak void rt_free(void *ptr)
This function will release the previously allocated memory block by rt_malloc. The released memory bl...
#define rt_atomic_sub(ptr, v)
#define rt_atomic_add(ptr, v)
#define rt_atomic_store(ptr, v)
#define rt_atomic_load(ptr)
int(* umount)(struct dfs_mnt *mnt)
const struct dfs_filesystem_ops * fs_ops