mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-11-16 12:34:34 +00:00
Simplified the internal xored-globals implementation
There wasn't much use (and inconsistent compiler support) for storing small values next to the unaligned lfs_global_t struct. So instead, I've rounded the struct up to the nearest word to try to take advantage of the alignment in xor and memset operations. I've also moved the global fetching into lfs_mount, since that was the only use of the operation. This allows for some variable reuse in the mount function.
This commit is contained in:
9
lfs.h
9
lfs.h
@@ -287,18 +287,23 @@ typedef struct lfs_cache {
|
||||
} lfs_cache_t;
|
||||
|
||||
typedef union lfs_global {
|
||||
uint16_t u16[5];
|
||||
uint32_t u32[3];
|
||||
struct {
|
||||
lfs_block_t movepair[2];
|
||||
uint16_t moveid;
|
||||
bool deorphaned;
|
||||
} s;
|
||||
} lfs_global_t;
|
||||
|
||||
typedef struct lfs_mdir {
|
||||
lfs_block_t pair[2];
|
||||
lfs_block_t tail[2];
|
||||
uint32_t rev;
|
||||
uint32_t etag;
|
||||
lfs_off_t off;
|
||||
uint16_t count;
|
||||
bool erased;
|
||||
bool split;
|
||||
lfs_block_t tail[2];
|
||||
lfs_global_t locals;
|
||||
} lfs_mdir_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user