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-09-15 06:02:39 +0300
committerChristopher Haster <chaster@utexas.edu>2018-10-18 18:00:49 +0300
commit29b881017df353bb8a387fb59832c34a802db761 (patch)
tree78ff2132b0314bd82b26b8f90515099b312f63e8 /lfs.h
parentcf87ba537598d13b0884751bee8d4ad71e782450 (diff)
Revisited xored-globals and related logic
Added separate bit for "hasmove", which means we don't need to check the move id, and allows us to add more sync-related global states in the future, as long as they never happen simultaneously (such as orphans and moves). Also refactored some of the logic and removed the union in the global structure, which didn't really add anything of value.
Diffstat (limited to 'lfs.h')
-rw-r--r--lfs.h23
1 files changed, 7 insertions, 16 deletions
diff --git a/lfs.h b/lfs.h
index 5acb484..23b0bc6 100644
--- a/lfs.h
+++ b/lfs.h
@@ -290,20 +290,6 @@ typedef struct lfs_cache {
uint8_t *buffer;
} lfs_cache_t;
-typedef union lfs_global {
- uint32_t u32[3];
- struct {
- lfs_block_t movepair[2];
- uint16_t moveid;
- uint8_t deorphaned;
- } l;
- struct {
- lfs_block_t movepair[2];
- uint16_t moveid;
- uint8_t orphans;
- } g;
-} lfs_global_t;
-
typedef struct lfs_mdir {
lfs_block_t pair[2];
uint32_t rev;
@@ -373,8 +359,13 @@ typedef struct lfs {
} *mlist;
uint32_t seed;
- lfs_global_t globals;
- lfs_global_t locals;
+ struct lfs_globals {
+ lfs_block_t pair[2];
+ uint16_t id;
+ bool hasmove;
+ uint8_t orphans;
+ } globals, locals;
+
struct lfs_free {
lfs_block_t off;
lfs_block_t size;