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

Function dfs_mnt_destroy

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

* @brief Destroy a dfs_mnt structure instance and unmount it if necessary. * * This function attempts to destroy the specified dfs_mnt structure instance. * If the mount point is currently mounted, it marks the mount point as unmounted, * sets the unmount flag, and removes it from the mount list if it was added. * Finally, it decreases the reference count of the mount point and frees the * s

Source from the content-addressed store, hash-verified

416 * @return Returns RT_EOK to indicate success.
417 */
418int dfs_mnt_destroy(struct dfs_mnt* mnt)
419{
420 rt_err_t ret = RT_EOK;
421
422 if (mnt)
423 {
424 if (mnt->flags & MNT_IS_MOUNTED)
425 {
426 mnt->flags &= ~MNT_IS_MOUNTED;
427 mnt->flags |= MNT_IS_UMOUNT;
428 /* remote it from mnt list */
429 if (mnt->flags & MNT_IS_ADDLIST)
430 {
431 dfs_mnt_remove(mnt);
432 }
433 }
434
435 dfs_mnt_unref(mnt);
436 }
437
438 return ret;
439}
440
441/**
442 * @brief Recursively traverse the mount point tree and apply a callback function.

Callers 2

dfs_mountFunction · 0.85
dfs_umountFunction · 0.85

Calls 2

dfs_mnt_removeFunction · 0.85
dfs_mnt_unrefFunction · 0.85

Tested by

no test coverage detected