diff --git a/lfs.c b/lfs.c index 1a8f24e2..bf3bc9a5 100644 --- a/lfs.c +++ b/lfs.c @@ -8265,7 +8265,7 @@ static inline bool lfsr_t_isckmeta(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) { @@ -8604,6 +8604,7 @@ static int lfsr_mtree_traverse(lfs_t *lfs, lfsr_traversal_t *t, // validate btree nodes? note mdirs are already validated 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 || lfsr_t_iscompact(t->o.o.flags)) && 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) { - return flags & (LFS_O_SYNC ^ LFS_O_FLUSH); + return flags & LFS_O_SYNC; } static inline bool lfsr_o_isdesync(uint32_t flags) { diff --git a/lfs.h b/lfs.h index ff0eab9e..0e1eeadb 100644 --- a/lfs.h +++ b/lfs.h @@ -137,7 +137,7 @@ enum lfs_open_flags { 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_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 #endif @@ -173,10 +173,10 @@ enum lfs_traversal_flags { LFS_T_LOOKAHEAD = 0x0040, // Populate lookahead buffer LFS_T_COMPACT = 0x0080, // Compact metadata logs LFS_T_CKMETA = 0x0100, // Check metadata checksums - LFS_T_CKDATA = 0x0300, // Check metadata + data checksums + LFS_T_CKDATA = 0x0200, // Check metadata + data checksums // TODO // 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 LFS_F_DIRTY = 0x1000, // Filesystem modified during traversal