subsys/fs: Make FAT FS write support optional

The commit adds FS_FATFS_READ_ONLY Kconfig option; the option, when
selected, excludes write supporting code within ELM FAT driver.

When write support to FAT FS volumes is not desired, this option may be
selected to slightly reduce code size.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
Dominik Ermel 2020-10-07 14:21:28 +00:00 committed by Anas Nashif
commit e43ec70d4f
3 changed files with 68 additions and 22 deletions

View file

@ -226,7 +226,8 @@ int fs_close(struct fs_file_t *zfp);
* @param path Path to the file or directory to delete
*
* @retval 0 on success;
* @retval <0 a negative errno code on error.
* @retval -ENOTSUP when not implemented by underlying file system driver;
* @retval <0 an other negative errno code on error.
*/
int fs_unlink(const char *path);
@ -248,7 +249,8 @@ int fs_unlink(const char *path);
* @param to The destination path
*
* @retval 0 on success;
* @retval <0 a negative errno code on error.
* @retval -ENOTSUP when not implemented by underlying file system driver;
* @retval <0 an other negative errno code on error.
*/
int fs_rename(const char *from, const char *to);
@ -283,7 +285,8 @@ ssize_t fs_read(struct fs_file_t *zfp, void *ptr, size_t size);
* @param size Number of bytes to be written
*
* @retval >=0 a number of bytes written, on success;
* @retval <0 a negative errno code on error.
* @retval -ENOTSUP when not implemented by underlying file system driver;
* @retval <0 an other negative errno code on error.
*/
ssize_t fs_write(struct fs_file_t *zfp, const void *ptr, size_t size);
@ -337,7 +340,8 @@ off_t fs_tell(struct fs_file_t *zfp);
* @param length New size of the file in bytes
*
* @retval 0 on success;
* @retval <0 a negative errno code on error.
* @retval -ENOTSUP when not implemented by underlying file system driver;
* @retval <0 an other negative errno code on error.
*/
int fs_truncate(struct fs_file_t *zfp, off_t length);
@ -365,7 +369,8 @@ int fs_sync(struct fs_file_t *zfp);
* @param path Path to the directory to create
*
* @retval 0 on success;
* @retval <0 a negative errno code on error
* @retval -ENOTSUP when not implemented by underlying file system driver;
* @retval <0 an other negative errno code on error
*/
int fs_mkdir(const char *path);
@ -492,7 +497,8 @@ int fs_stat(const char *path, struct fs_dirent *entry);
* statistics
*
* @retval 0 on success;
* @retval <0 negative errno code on error.
* @retval -ENOTSUP when not implemented by underlying file system driver;
* @retval <0 an other negative errno code on error.
*/
int fs_statvfs(const char *path, struct fs_statvfs *stat);