fs: Add fs_dir_t_init() function

The fs_dir_t_init() function has been added that should be used
for initialization of fs_dir_t structures before passing them
to fs_open and other functions.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
Andrzej Puzdrowski 2021-01-29 18:05:11 +01:00 committed by Anas Nashif
commit 109f1ab42b
5 changed files with 36 additions and 3 deletions

View file

@ -234,6 +234,20 @@ static inline void fs_file_t_init(struct fs_file_t *zfp)
*zfp = (struct fs_file_t){ 0 };
}
/**
* @brief Initialize fs_dir_t object
*
* Initializes the fs_dir_t object; the function needs to be invoked
* on object before first use with fs_opendir.
*
* @param zdp Pointer to file object
*
*/
static inline void fs_dir_t_init(struct fs_dir_t *zdp)
{
*zdp = (struct fs_dir_t){ 0 };
}
/**
* @brief Open or create file
*

View file

@ -59,6 +59,8 @@ struct fs_file_t {
/**
* @brief Directory object representing an open directory
*
* The object needs to be initialized with function fs_dir_t_init().
*
* @param dirp Pointer to directory object structure
* @param mp Pointer to mount point structure
*/