* @brief Recursively traverse the mount point tree and apply a callback function. * * This function performs a depth-first traversal of the mount point tree starting from the given mount point. * It applies the specified callback function to each mount point in the tree. If the callback function returns * a non-NULL pointer, the traversal stops and the result is returned immediately. * * @pa
| 456 | * Otherwise, returns RT_NULL. |
| 457 | */ |
| 458 | static struct dfs_mnt* _dfs_mnt_foreach(struct dfs_mnt *mnt, struct dfs_mnt* (*func)(struct dfs_mnt *mnt, void *parameter), void *parameter) |
| 459 | { |
| 460 | struct dfs_mnt *iter, *ret = NULL; |
| 461 | |
| 462 | if (mnt) |
| 463 | { |
| 464 | ret = func(mnt, parameter); |
| 465 | if (ret == RT_NULL) |
| 466 | { |
| 467 | if (!rt_list_isempty(&mnt->child)) |
| 468 | { |
| 469 | /* for each in mount point list */ |
| 470 | rt_list_for_each_entry(iter, &mnt->child, sibling) |
| 471 | { |
| 472 | ret = _dfs_mnt_foreach(iter, func, parameter); |
| 473 | if (ret != RT_NULL) |
| 474 | { |
| 475 | break; |
| 476 | } |
| 477 | } |
| 478 | } |
| 479 | } |
| 480 | } |
| 481 | else |
| 482 | { |
| 483 | ret = RT_NULL; |
| 484 | } |
| 485 | |
| 486 | return ret; |
| 487 | } |
| 488 | |
| 489 | /** |
| 490 | * @brief Compare a mount point's device ID with a given device object. |
no test coverage detected