Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lfs.h
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2018-07-30 23:15:05 +0300
committerChristopher Haster <chaster@utexas.edu>2018-10-16 15:31:24 +0300
commit105907ba6631654e16605a7818eac34b7a9419f9 (patch)
treec7bead39522bf59040c824bf0f7f2dce276e1fe1 /lfs.h
parentdf1b6073516ce5be6e97cda27412d4dde26243f8 (diff)
Cleaned up config usage in file logic
The main change here was to drop the in-place twiddling of custom attributes to match the internal attribute structures. The original thought was that this could allow the compiler to garbage collect more of the custom attribute logic when not used, but since this occurs in the common lfs_file_opencfg function, gc can't really happen. Not twiddling the user's structure is the polite thing to do, opens up the ability to store the lfs_attr structure in ROM, and avoids surprising the user if they attempt to use the structure for their own purposes. This means we can make the lfs_attr structure const and rely on the list in the lfs_file_config structure, similar to how we rely on the global lfs_config structure. Some other tweaks: - Dropped the global file_buffer, replaced entirely by per-file buffers. - Updated LFS_INLINE_MAX and LFS_ATTR_MAX to correct values - Added workaround for compiler bug related to zero initializer: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
Diffstat (limited to 'lfs.h')
-rw-r--r--lfs.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/lfs.h b/lfs.h
index 647d6c8..62d170d 100644
--- a/lfs.h
+++ b/lfs.h
@@ -54,16 +54,18 @@ typedef uint32_t lfs_block_t;
// read and prog cache, but if a file can be inline it does not need its own
// data block. LFS_ATTR_MAX + LFS_INLINE_MAX must be <= 0xffff. Stored in
// superblock and must be respected by other littlefs drivers.
+// TODO doc
#ifndef LFS_INLINE_MAX
-#define LFS_INLINE_MAX 0x3ff
+#define LFS_INLINE_MAX 0xfff
#endif
// Maximum size of all attributes per file in bytes, may be redefined but a
// a smaller LFS_ATTR_MAX has no benefit. LFS_ATTR_MAX + LFS_INLINE_MAX
// must be <= 0xffff. Stored in superblock and must be respected by other
// littlefs drivers.
+// TODO doc
#ifndef LFS_ATTR_MAX
-#define LFS_ATTR_MAX 0x3f
+#define LFS_ATTR_MAX 0xfff
#endif
// Max name size in bytes, may be redefined to reduce the size of the
@@ -211,10 +213,6 @@ struct lfs_config {
// lookahead block.
void *lookahead_buffer;
- // Optional, statically allocated buffer for files. Must be program sized.
- // If enabled, only one file may be opened at a time.
- void *file_buffer;
-
// Optional upper limit on inlined files in bytes. Large inline files
// require a larger read and prog cache, but if a file can be inlined it
// does not need its own data block. Must be smaller than the read size
@@ -317,7 +315,6 @@ typedef struct lfs_file {
} ctz;
const struct lfs_file_config *cfg;
- const struct lfs_attr *attrs;
uint32_t flags;
lfs_off_t pos;
lfs_block_t block;