Dropped implicit multi-bit flags
- LFS_O_FLUSH 0x0040 -> 0x0040
- LFS_O_SYNC 0x00c0 -> 0x0080
- LFS_T_CKMETA 0x0100 -> 0x0100
- LFS_T_CKDATA 0x0300 -> 0x0200
This is just simpler and should avoid any surprises for both devs and
users.
This has no impact on code size:
code stack
before: 35448 2680
after: 35448 (+0.0%) 2680 (+0.0%)
This commit is contained in:
@@ -8265,7 +8265,7 @@ static inline bool lfsr_t_isckmeta(uint32_t flags) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline bool lfsr_t_isckdata(uint32_t flags) {
|
static inline bool lfsr_t_isckdata(uint32_t flags) {
|
||||||
return flags & (LFS_T_CKDATA ^ LFS_T_CKMETA);
|
return flags & LFS_T_CKDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool lfsr_f_isdirty(uint32_t flags) {
|
static inline bool lfsr_f_isdirty(uint32_t flags) {
|
||||||
@@ -8604,6 +8604,7 @@ static int lfsr_mtree_traverse(lfs_t *lfs, lfsr_traversal_t *t,
|
|||||||
|
|
||||||
// validate btree nodes? note mdirs are already validated
|
// validate btree nodes? note mdirs are already validated
|
||||||
if ((lfsr_t_isckmeta(t->o.o.flags)
|
if ((lfsr_t_isckmeta(t->o.o.flags)
|
||||||
|
|| lfsr_t_isckdata(t->o.o.flags)
|
||||||
// we also need to fetch to know if we need to compact
|
// we also need to fetch to know if we need to compact
|
||||||
|| lfsr_t_iscompact(t->o.o.flags))
|
|| lfsr_t_iscompact(t->o.o.flags))
|
||||||
&& tag == LFSR_TAG_BRANCH) {
|
&& tag == LFSR_TAG_BRANCH) {
|
||||||
@@ -9805,7 +9806,7 @@ static inline bool lfsr_o_isflush(uint32_t flags) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline bool lfsr_o_issync(uint32_t flags) {
|
static inline bool lfsr_o_issync(uint32_t flags) {
|
||||||
return flags & (LFS_O_SYNC ^ LFS_O_FLUSH);
|
return flags & LFS_O_SYNC;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool lfsr_o_isdesync(uint32_t flags) {
|
static inline bool lfsr_o_isdesync(uint32_t flags) {
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ enum lfs_open_flags {
|
|||||||
LFS_O_TRUNC = 0x0010, // Truncate the existing file to zero size
|
LFS_O_TRUNC = 0x0010, // Truncate the existing file to zero size
|
||||||
LFS_O_APPEND = 0x0020, // Move to end of file on every write
|
LFS_O_APPEND = 0x0020, // Move to end of file on every write
|
||||||
LFS_O_FLUSH = 0x0040, // Flush data on every write
|
LFS_O_FLUSH = 0x0040, // Flush data on every write
|
||||||
LFS_O_SYNC = 0x00c0, // Sync metadata on every write
|
LFS_O_SYNC = 0x0080, // Sync metadata on every write
|
||||||
LFS_O_DESYNC = 0x0100, // Do not sync or recieve file updates
|
LFS_O_DESYNC = 0x0100, // Do not sync or recieve file updates
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -173,10 +173,10 @@ enum lfs_traversal_flags {
|
|||||||
LFS_T_LOOKAHEAD = 0x0040, // Populate lookahead buffer
|
LFS_T_LOOKAHEAD = 0x0040, // Populate lookahead buffer
|
||||||
LFS_T_COMPACT = 0x0080, // Compact metadata logs
|
LFS_T_COMPACT = 0x0080, // Compact metadata logs
|
||||||
LFS_T_CKMETA = 0x0100, // Check metadata checksums
|
LFS_T_CKMETA = 0x0100, // Check metadata checksums
|
||||||
LFS_T_CKDATA = 0x0300, // Check metadata + data checksums
|
LFS_T_CKDATA = 0x0200, // Check metadata + data checksums
|
||||||
// TODO
|
// TODO
|
||||||
// LFS_T_REPAIRMETA = 0x0400, // Repair metadata blocks
|
// LFS_T_REPAIRMETA = 0x0400, // Repair metadata blocks
|
||||||
// LFS_T_REPAIRDATA = 0x0c00, // Repair metadata + data blocks
|
// LFS_T_REPAIRDATA = 0x0800, // Repair metadata + data blocks
|
||||||
|
|
||||||
// internally used flags
|
// internally used flags
|
||||||
LFS_F_DIRTY = 0x1000, // Filesystem modified during traversal
|
LFS_F_DIRTY = 0x1000, // Filesystem modified during traversal
|
||||||
|
|||||||
Reference in New Issue
Block a user