Merge pull request #8531 from night1rider/zephyr-fs-rewind-fix

Fix for missing rewind function in zephyr
This commit is contained in:
David Garske
2025-03-05 16:04:36 -08:00
committed by GitHub
2 changed files with 11 additions and 1 deletions

View File

@ -1041,6 +1041,15 @@ int z_fs_close(XFILE file)
return ret;
}
/* Rewind the file pointer to the beginning of the file */
/* This is not a 'rewind' is not supported in Zephyr so */
/* use fs_seek to move the file pointer to the beginning of the file */
/* calling it z_fs_rewind to avoid future conflicts if rewind is added */
int z_fs_rewind(XFILE file)
{
return fs_seek(file, 0, FS_SEEK_SET);
}
#endif /* !NO_FILESYSTEM && !WOLFSSL_ZEPHYR */
#if !defined(WOLFSSL_USER_MUTEX)

View File

@ -804,13 +804,14 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
* make the API more POSIX like. */
XFILE z_fs_open(const char* filename, const char* mode);
int z_fs_close(XFILE file);
int z_fs_rewind(XFILE file);
#define XFOPEN z_fs_open
#define XFCLOSE z_fs_close
#define XFFLUSH fs_sync
#define XFSEEK fs_seek
#define XFTELL fs_tell
#define XFREWIND fs_rewind
#define XFREWIND z_fs_rewind
#define XFREAD(P,S,N,F) fs_read(F, P, S*N)
#define XFWRITE(P,S,N,F) fs_write(F, P, S*N)
#define XSEEK_SET FS_SEEK_SET