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

Function dfs_mnt_remove

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

* @brief Remove a mount point from the mount tree. * * This function attempts to remove a specified mount point from the mount tree. * It can only remove a mount point if it has no child mount points. If the mount point * has children, it logs a warning message instead of performing the removal. * * @param[in] mnt Pointer to the dfs_mnt structure representing the mount point to be removed.

Source from the content-addressed store, hash-verified

148 * Returns -RT_ERROR if the mount point has child mount points and cannot be removed.
149 */
150int dfs_mnt_remove(struct dfs_mnt* mnt)
151{
152 int ret = -RT_ERROR;
153
154 if (rt_list_isempty(&mnt->child))
155 {
156 rt_list_remove(&mnt->sibling);
157 if (mnt->parent)
158 {
159 /* parent unref parent */
160 rt_atomic_sub(&(mnt->parent->ref_count), 1);
161 }
162
163 ret = RT_EOK;
164 }
165 else
166 {
167 LOG_W("remove a mnt point:%s with child.", mnt->fullpath);
168 }
169
170 return ret;
171}
172
173/**
174 * @brief Recursively search for a mount point associated with a specific device ID in the mount tree.

Callers 1

dfs_mnt_destroyFunction · 0.85

Calls 2

rt_list_isemptyFunction · 0.85
rt_list_removeFunction · 0.85

Tested by

no test coverage detected