Added API boilerplate for lfs_fs_findfreeblocks and consistent style

This adds the tracing and optional locking for the littlefs API.

Also updated to match the code style, and added LFS_READONLY guards
where necessary.
This commit is contained in:
Christopher Haster
2023-09-11 23:42:37 -05:00
parent d85a0fe2e2
commit dbe4598c12
2 changed files with 43 additions and 21 deletions

9
lfs.h
View File

@@ -712,9 +712,12 @@ lfs_ssize_t lfs_fs_size(lfs_t *lfs);
// Returns a negative error code on failure.
int lfs_fs_traverse(lfs_t *lfs, int (*cb)(void*, lfs_block_t), void *data);
// Use Traverse function and try to find free blocks. LittleFS free blocks search is unpredictable.
// Search is costly operation which may delay write. In realtime write scenarios can be better to find them before a write.
int lfs_find_free_blocks(lfs_t *lfs);
// Use Traverse function and try to find free blocks. LittleFS free blocks
// search is unpredictable.
//
// Search is costly operation which may delay write. In realtime write
// scenarios can be better to find them before a write.
int lfs_fs_findfreeblocks(lfs_t *lfs);
#ifndef LFS_READONLY
// Attempt to make the filesystem consistent and ready for writing