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
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2017-04-01 18:44:17 +0300
committerChristopher Haster <chaster@utexas.edu>2017-04-18 09:44:01 +0300
commit8a674524fcec8db761bc7c3818df58609a28623c (patch)
tree12bf67d9720ebe01c68a2d14a0f83d6507d050db /lfs_config.h
parentca01b72a35f1d8e8bd541dd7e40c1905f0f207f4 (diff)
Added full dir list and rudimentary block allocator
In writing the initial allocator, I ran into the rather difficult problem of trying to iterate through the entire filesystem cheaply and with only constant memory consumption (which prohibits recursive functions). The solution was to simply thread all directory blocks onto a massive linked-list that spans the entire filesystem. With the linked-list it was easy to create a traverse function for all blocks in use on the filesystem (which has potential for other utility), and add the rudimentary block allocator using a bit-vector. While the linked-list may add complexity (especially where needing to maintain atomic operations), the linked-list helps simplify what is currently the most expensive operation in the filesystem, with no cost to space (the linked-list can reuse the pointers used for chained directory blocks).
Diffstat (limited to 'lfs_config.h')
-rw-r--r--lfs_config.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/lfs_config.h b/lfs_config.h
index fd1e6ad..e679409 100644
--- a/lfs_config.h
+++ b/lfs_config.h
@@ -19,7 +19,14 @@ typedef int32_t lfs_soff_t;
typedef uint32_t lfs_block_t;
// Maximum length of file name
+#ifndef LFS_NAME_MAX
#define LFS_NAME_MAX 255
+#endif
+
+// Lookahead distance
+#ifndef LFS_CFG_LOOKAHEAD
+#define LFS_CFG_LOOKAHEAD 128
+#endif
// Logging operations
#include <stdio.h>