t: Renamed LFS_T_CK -> LFS_T_CKDATA, kept implied LFS_T_CKMETA
It still doesn't make sense to check data without checking metadata, but
keeping this named LFS_T_CKDATA should hopefully clarify what it does
differently from LFS_T_CKMETA.
This implication is also now encoded in the bit pattern:
LFS_T_CKMETA 0x0100 ---- ---1 ---- ----
LFS_T_CKDATA 0x0300 ---- --11 ---- ----
In theory a clever user could force only the CKDATA bit to be set, and
such a configuration would _probably_ work fine, but it won't be
supported just to cut down on possible configurations to test.
No code changes:
code stack
before: 35228 2680
after: 35228 (+0.0%) 2680 (+0.0%)
This commit is contained in:
@@ -8261,8 +8261,8 @@ static inline bool lfsr_t_isckmeta(uint32_t flags) {
|
||||
return flags & LFS_T_CKMETA;
|
||||
}
|
||||
|
||||
static inline bool lfsr_t_isck(uint32_t flags) {
|
||||
return flags & LFS_T_CK;
|
||||
static inline bool lfsr_t_isckdata(uint32_t flags) {
|
||||
return flags & (LFS_T_CKDATA ^ LFS_T_CKMETA);
|
||||
}
|
||||
|
||||
static inline bool lfsr_f_isdirty(uint32_t flags) {
|
||||
@@ -8592,7 +8592,6 @@ 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_isck(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) {
|
||||
@@ -8606,7 +8605,7 @@ static int lfsr_mtree_traverse(lfs_t *lfs, lfsr_traversal_t *t,
|
||||
}
|
||||
|
||||
// validate data blocks?
|
||||
if (lfsr_t_isck(t->o.o.flags)
|
||||
if (lfsr_t_isckdata(t->o.o.flags)
|
||||
&& tag == LFSR_TAG_BLOCK) {
|
||||
err = lfsr_bptr_ck(lfs, &bptr);
|
||||
if (err) {
|
||||
@@ -12831,7 +12830,7 @@ int lfsr_traversal_open(lfs_t *lfs, lfsr_traversal_t *t, uint32_t flags) {
|
||||
LFS_ASSERT(!lfsr_omdir_isopen(lfs, &t->o.o));
|
||||
// some flags don't make sense when only traversing the mtree
|
||||
LFS_ASSERT(!lfsr_t_ismtreeonly(flags) || !lfsr_t_islookahead(flags));
|
||||
LFS_ASSERT(!lfsr_t_ismtreeonly(flags) || !lfsr_t_isck(flags));
|
||||
LFS_ASSERT(!lfsr_t_ismtreeonly(flags) || !lfsr_t_isckdata(flags));
|
||||
// these flags are internal and shouldn't be provided by the user
|
||||
LFS_ASSERT(!lfsr_f_isdirty(flags));
|
||||
|
||||
|
||||
@@ -175,10 +175,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_CK = 0x0200, // Check metadata + data checksums
|
||||
LFS_T_CKDATA = 0x0300, // Check metadata + data checksums
|
||||
// TODO
|
||||
// LFS_T_REPAIRMETA = 0x0400, // Repair metadata blocks
|
||||
// LFS_T_REPAIR = 0x0800, // Repair metadata + data blocks
|
||||
// LFS_T_REPAIRDATA = 0x0c00, // Repair metadata + data blocks
|
||||
|
||||
// internally used flags
|
||||
LFS_F_DIRTY = 0x1000, // Filesystem has been modified
|
||||
|
||||
+143
-143
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user