riot_sys

Function vfs_iterate_mount_dirs

Source
pub unsafe extern "C" fn vfs_iterate_mount_dirs(
    dir: *mut vfs_DIR,
) -> bool
Expand description

@brief Iterate through all mounted file systems by their root directories

Unlike @ref vfs_iterate_mounts, this is thread safe, and allows thread safe access to the mount point’s stats through @ref vfs_dstatvfs. If mounts or unmounts happen while iterating, this is guaranteed to report all file systems that stayed mounted, and may report any that are transiently mounted for up to as often as they are (re)mounted. Note that the volume being reported can not be unmounted as @p dir is an open directory.

Zero-initialize @p dir to start. As long as @c true is returned, @p dir is a valid directory on which the user can call @ref vfs_readdir or @ref vfs_dstatvfs (or even peek at its .mp if they dare ignore the warning in @ref vfs_DIR).

Users MUST NOT call @ref vfs_closedir if they intend to keep iterating, but MUST call it when aborting iteration.

Note that this requires all enumerated file systems to support the opendir @ref vfs_dir_ops; any file system that does not support that will prematurely terminate the mount point enumeration.

@see @c sc_vfs.c (@c df command) for a usage example

@param[inout] dir The root directory of the discovered mount point

@return @c true if another file system is mounted; @p dir then contains an open directory. @return @c false if the file system list is exhausted; @p dir is uninitialized then.