MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / dfs_mnt_create

Function dfs_mnt_create

components/dfs/dfs_v2/src/dfs_mnt.c:52–71  ·  view source on GitHub ↗

* @brief Create a new dfs_mnt structure instance. * * This function allocates memory to create a new dfs_mnt structure instance and initializes it. * If the memory allocation is successful, it copies the input path string into the instance and initializes related lists and flags. * * @param[in] path The path string to be mounted. This path information will be copied to the newly created dfs_m

Source from the content-addressed store, hash-verified

50 * if the memory allocation fails, returns RT_NULL.
51 */
52struct dfs_mnt *dfs_mnt_create(const char *path)
53{
54 struct dfs_mnt *mnt = rt_calloc(1, sizeof(struct dfs_mnt));
55 if (mnt)
56 {
57 LOG_I("create mnt at %s", path);
58
59 mnt->fullpath = rt_strdup(path);
60 rt_list_init(&mnt->sibling);
61 rt_list_init(&mnt->child);
62 mnt->flags |= MNT_IS_ALLOCED;
63 rt_atomic_store(&(mnt->ref_count), 1);
64 }
65 else
66 {
67 rt_set_errno(-ENOMEM);
68 }
69
70 return mnt;
71}
72
73/**
74 * @brief Insert a child mount point into the mount tree.

Callers 1

dfs_mountFunction · 0.85

Calls 4

rt_callocFunction · 0.85
rt_strdupFunction · 0.85
rt_list_initFunction · 0.85
rt_set_errnoFunction · 0.85

Tested by

no test coverage detected