fs: Add fs_file_t_init() function

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

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
Dominik Ermel 2021-01-27 09:19:25 +00:00 committed by Anas Nashif
commit 40572fde20
7 changed files with 45 additions and 6 deletions

View file

@ -220,6 +220,20 @@ struct fs_statvfs {
#define FS_FSTAB_DECLARE_ENTRY(node_id) \
extern struct fs_mount_t FS_FSTAB_ENTRY(node_id)
/**
* @brief Initialize fs_file_t object
*
* Initialized the fs_file_t object; the function needs to be invoked
* on object before first use with fs_open.
*
* @param zfp Pointer to file object
*
*/
static inline void fs_file_t_init(struct fs_file_t *zfp)
{
*zfp = (struct fs_file_t){ 0 };
}
/**
* @brief Open or create file
*

View file

@ -45,6 +45,8 @@ struct fs_mount_t;
/**
* @brief File object representing an open file
*
* The object needs to be initialized with function fs_file_t_init().
*
* @param Pointer to FATFS file object structure
* @param mp Pointer to mount point structure
*/