* @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
| 416 | * @return Returns RT_EOK to indicate success. |
| 417 | */ |
| 418 | int 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. |
no test coverage detected