Renamed LFS_I_* flags to match LFS_GC_*

- LFS_I_INCONSISTENT -> LFS_I_MKCONSISTENT
- LFS_I_CANLOOKAHEAD -> LFS_I_LOOKAHEAD
- LFS_I_UNCOMPACTED  -> LFS_I_COMPACT
- LFS_I_CANCKMETA    -> LFS_I_CKMETA
- LFS_I_CANCKDATA    -> LFS_I_CKDATA

This just makes everything easier to read/pattern match, even if it's
a bit inaccurate english-wise. The imperative transformations were also
wildly inconsistent...
This commit is contained in:
Christopher Haster
2025-01-08 03:23:07 -06:00
parent 585abc87cf
commit a4c74967ec
6 changed files with 395 additions and 397 deletions
+34 -34
View File
@@ -6724,28 +6724,28 @@ static inline bool lfsr_i_isuntidy(uint32_t flags) {
return flags & LFS_I_UNTIDY; return flags & LFS_I_UNTIDY;
} }
static inline bool lfsr_i_isuncompacted(uint32_t flags) { static inline bool lfsr_i_iscompact(uint32_t flags) {
return flags & LFS_I_UNCOMPACTED; return flags & LFS_I_COMPACT;
} }
static inline bool lfsr_i_canckmeta(uint32_t flags) { static inline bool lfsr_i_isckmeta(uint32_t flags) {
return flags & LFS_I_CANCKMETA; return flags & LFS_I_CKMETA;
} }
static inline bool lfsr_i_canckdata(uint32_t flags) { static inline bool lfsr_i_isckdata(uint32_t flags) {
return flags & LFS_I_CANCKDATA; return flags & LFS_I_CKDATA;
} }
// on-demand flags // on-demand flags
// needed in lfsr_fs_isinconsistent // needed in lfsr_fs_ismkconsistent
static inline uint8_t lfsr_grm_count(const lfs_t *lfs); static inline uint8_t lfsr_grm_count(const lfs_t *lfs);
static bool lfsr_fs_isinconsistent(const lfs_t *lfs) { static bool lfsr_fs_ismkconsistent(const lfs_t *lfs) {
return lfsr_grm_count(lfs) > 0 || lfsr_i_isuntidy(lfs->flags); return lfsr_grm_count(lfs) > 0 || lfsr_i_isuntidy(lfs->flags);
} }
static bool lfsr_fs_canlookahead(const lfs_t *lfs) { static bool lfsr_fs_islookahead(const lfs_t *lfs) {
return lfs->lookahead.size < lfs_min( return lfs->lookahead.size < lfs_min(
8*lfs->cfg->lookahead_size, 8*lfs->cfg->lookahead_size,
lfs->cfg->block_size); lfs->cfg->block_size);
@@ -8742,7 +8742,7 @@ static int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir,
// we may have touched any number of mdirs, so assume uncompacted // we may have touched any number of mdirs, so assume uncompacted
// until lfsr_gc can prove otherwise // until lfsr_gc can prove otherwise
lfs->flags |= LFS_I_UNCOMPACTED; lfs->flags |= LFS_I_COMPACT;
// update any gstate changes // update any gstate changes
lfsr_fs_commitgdelta(lfs); lfsr_fs_commitgdelta(lfs);
@@ -9646,7 +9646,7 @@ eot:;
if (lfsr_t_iscompact(t->o.o.flags) if (lfsr_t_iscompact(t->o.o.flags)
&& !lfsr_t_isdirty(t->o.o.flags) && !lfsr_t_isdirty(t->o.o.flags)
&& !lfsr_t_ismutated(t->o.o.flags)) { && !lfsr_t_ismutated(t->o.o.flags)) {
lfs->flags &= ~LFS_I_UNCOMPACTED; lfs->flags &= ~LFS_I_COMPACT;
} }
// was ckmeta/ckdata successful? we only consider our filesystem // was ckmeta/ckdata successful? we only consider our filesystem
@@ -9655,13 +9655,13 @@ eot:;
&& !lfsr_t_ismtreeonly(t->o.o.flags) && !lfsr_t_ismtreeonly(t->o.o.flags)
&& !lfsr_t_isdirty(t->o.o.flags) && !lfsr_t_isdirty(t->o.o.flags)
&& !lfsr_t_ismutated(t->o.o.flags)) { && !lfsr_t_ismutated(t->o.o.flags)) {
lfs->flags &= ~LFS_I_CANCKMETA; lfs->flags &= ~LFS_I_CKMETA;
} }
if (lfsr_t_isckdata(t->o.o.flags) if (lfsr_t_isckdata(t->o.o.flags)
&& !lfsr_t_ismtreeonly(t->o.o.flags) && !lfsr_t_ismtreeonly(t->o.o.flags)
&& !lfsr_t_isdirty(t->o.o.flags) && !lfsr_t_isdirty(t->o.o.flags)
&& !lfsr_t_ismutated(t->o.o.flags)) { && !lfsr_t_ismutated(t->o.o.flags)) {
lfs->flags &= ~LFS_I_CANCKDATA; lfs->flags &= ~LFS_I_CKDATA;
} }
return LFS_ERR_NOENT; return LFS_ERR_NOENT;
@@ -13212,10 +13212,10 @@ static int lfs_init(lfs_t *lfs, uint32_t flags,
| LFS_I_UNTIDY | LFS_I_UNTIDY
// default to assuming we need compaction somewhere, worst case // default to assuming we need compaction somewhere, worst case
// this just makes lfsr_gc read more than is strictly needed // this just makes lfsr_gc read more than is strictly needed
| LFS_I_UNCOMPACTED | LFS_I_COMPACT
// default to needing a ckmeta/ckdata scan // default to needing a ckmeta/ckdata scan
| LFS_I_CANCKMETA | LFS_I_CKMETA
| LFS_I_CANCKDATA; | LFS_I_CKDATA;
// copy block_count so we can mutate it // copy block_count so we can mutate it
lfs->block_count = lfs->cfg->block_count; lfs->block_count = lfs->cfg->block_count;
@@ -14223,12 +14223,12 @@ int lfsr_fs_stat(lfs_t *lfs, struct lfs_fsinfo *fsinfo) {
| LFS_IFDEF_CKFETCHES(LFS_I_CKFETCHES, 0) | LFS_IFDEF_CKFETCHES(LFS_I_CKFETCHES, 0)
| LFS_IFDEF_CKPARITY(LFS_I_CKPARITY, 0) | LFS_IFDEF_CKPARITY(LFS_I_CKPARITY, 0)
| LFS_IFDEF_CKDATACKSUMS(LFS_I_CKDATACKSUMS, 0) | LFS_IFDEF_CKDATACKSUMS(LFS_I_CKDATACKSUMS, 0)
| LFS_I_UNCOMPACTED | LFS_I_COMPACT
| LFS_I_CANCKMETA | LFS_I_CKMETA
| LFS_I_CANCKDATA); | LFS_I_CKDATA);
// some flags we calculate on demand // some flags we calculate on demand
fsinfo->flags |= (lfsr_fs_isinconsistent(lfs)) ? LFS_I_INCONSISTENT : 0; fsinfo->flags |= (lfsr_fs_ismkconsistent(lfs)) ? LFS_I_MKCONSISTENT : 0;
fsinfo->flags |= (lfsr_fs_canlookahead(lfs)) ? LFS_I_CANLOOKAHEAD : 0; fsinfo->flags |= (lfsr_fs_islookahead(lfs)) ? LFS_I_LOOKAHEAD : 0;
// return filesystem config, this may come from disk // return filesystem config, this may come from disk
fsinfo->block_size = lfs->cfg->block_size; fsinfo->block_size = lfs->cfg->block_size;
@@ -14483,10 +14483,10 @@ static int lfsr_fs_gc_(lfs_t *lfs, lfsr_traversal_t *t,
uint32_t pending = flags & ( uint32_t pending = flags & (
(lfs->flags & ( (lfs->flags & (
LFS_I_UNTIDY LFS_I_UNTIDY
| LFS_I_UNCOMPACTED | LFS_I_COMPACT
| LFS_I_CANCKMETA | LFS_I_CKMETA
| LFS_I_CANCKDATA)) | LFS_I_CKDATA))
| ((lfsr_fs_canlookahead(lfs)) ? LFS_GC_LOOKAHEAD : 0)); | ((lfsr_fs_islookahead(lfs)) ? LFS_GC_LOOKAHEAD : 0));
while (pending && (lfs_off_t)steps > 0) { while (pending && (lfs_off_t)steps > 0) {
// checkpoint the allocator to maximize any lookahead scans // checkpoint the allocator to maximize any lookahead scans
@@ -14538,10 +14538,10 @@ static int lfsr_fs_gc_(lfs_t *lfs, lfsr_traversal_t *t,
pending &= ( pending &= (
(lfs->flags & ( (lfs->flags & (
LFS_I_UNTIDY LFS_I_UNTIDY
| LFS_I_UNCOMPACTED | LFS_I_COMPACT
| LFS_I_CANCKMETA | LFS_I_CKMETA
| LFS_I_CANCKDATA)) | LFS_I_CKDATA))
| ((lfsr_fs_canlookahead(lfs)) | ((lfsr_fs_islookahead(lfs))
? LFS_GC_LOOKAHEAD ? LFS_GC_LOOKAHEAD
: 0)); : 0));
} }
@@ -14569,11 +14569,11 @@ int lfsr_fs_gc(lfs_t *lfs) {
int lfsr_fs_unck(lfs_t *lfs, uint32_t flags) { int lfsr_fs_unck(lfs_t *lfs, uint32_t flags) {
// unknown flags? // unknown flags?
LFS_ASSERT((flags & ~( LFS_ASSERT((flags & ~(
LFS_I_INCONSISTENT LFS_I_MKCONSISTENT
| LFS_I_CANLOOKAHEAD | LFS_I_LOOKAHEAD
| LFS_I_UNCOMPACTED | LFS_I_COMPACT
| LFS_I_CANCKMETA | LFS_I_CKMETA
| LFS_I_CANCKDATA)) == 0); | LFS_I_CKDATA)) == 0);
// reset the requested flags // reset the requested flags
lfs->flags |= flags; lfs->flags |= flags;
+5 -7
View File
@@ -223,14 +223,12 @@ enum lfs_type {
0x08000000 // Mounted with LFS_M_CKDATACKSUMS 0x08000000 // Mounted with LFS_M_CKDATACKSUMS
#endif #endif
#define LFS_I_INCONSISTENT \ #define LFS_I_MKCONSISTENT \
0x00001000 // Filesystem needs mkconsistent to write 0x00001000 // Filesystem needs mkconsistent to write
#define LFS_I_CANLOOKAHEAD \ #define LFS_I_LOOKAHEAD 0x00002000 // Lookahead buffer is not full
0x00002000 // Lookahead buffer is not full #define LFS_I_COMPACT 0x00008000 // Filesystem may have uncompacted metadata
#define LFS_I_UNCOMPACTED \ #define LFS_I_CKMETA 0x00010000 // Metadata checksums not checked recently
0x00008000 // Filesystem may have uncompacted metadata #define LFS_I_CKDATA 0x00020000 // Data checksums not checked recently
#define LFS_I_CANCKMETA 0x00010000 // Metadata checksums not checked recently
#define LFS_I_CANCKDATA 0x00020000 // Data checksums not checked recently
// internally used flags, don't use these // internally used flags, don't use these
#define LFS_I_UNTIDY 0x00001000 // Filesystem may have orphaned stickynotes #define LFS_I_UNTIDY 0x00001000 // Filesystem may have orphaned stickynotes
+4 -4
View File
@@ -5318,7 +5318,7 @@ code = '''
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(!(fsinfo.flags & LFS_I_INCONSISTENT)); assert(!(fsinfo.flags & LFS_I_MKCONSISTENT));
// double check the actual disk state, it's easy for littlefs to // double check the actual disk state, it's easy for littlefs to
// lie here // lie here
@@ -5454,7 +5454,7 @@ code = '''
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(!(fsinfo.flags & LFS_I_INCONSISTENT)); assert(!(fsinfo.flags & LFS_I_MKCONSISTENT));
// double check the actual disk state, it's easy for littlefs to // double check the actual disk state, it's easy for littlefs to
// lie here // lie here
@@ -5604,7 +5604,7 @@ code = '''
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(!(fsinfo.flags & LFS_I_INCONSISTENT)); assert(!(fsinfo.flags & LFS_I_MKCONSISTENT));
// double check the actual disk state, it's easy for littlefs to // double check the actual disk state, it's easy for littlefs to
// lie here // lie here
@@ -5760,7 +5760,7 @@ code = '''
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(!(fsinfo.flags & LFS_I_INCONSISTENT)); assert(!(fsinfo.flags & LFS_I_MKCONSISTENT));
// double check the actual disk state, it's easy for littlefs to // double check the actual disk state, it's easy for littlefs to
// lie here // lie here
+29 -29
View File
@@ -44,7 +44,7 @@ code = '''
// expect dirty initial state or else our test doesn't work // expect dirty initial state or else our test doesn't work
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags & LFS_I_CANLOOKAHEAD); assert(fsinfo.flags & LFS_I_LOOKAHEAD);
assert(lfs.omdirs != &lfs.gc.t.o.o); assert(lfs.omdirs != &lfs.gc.t.o.o);
// run GC until we make progress // run GC until we make progress
@@ -55,7 +55,7 @@ code = '''
lfsr_fs_gc(&lfs) => 0; lfsr_fs_gc(&lfs) => 0;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
if (!(fsinfo.flags & LFS_I_CANLOOKAHEAD)) { if (!(fsinfo.flags & LFS_I_LOOKAHEAD)) {
break; break;
} }
} }
@@ -111,7 +111,7 @@ code = '''
// expect dirty initial state or else our test doesn't work // expect dirty initial state or else our test doesn't work
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags & LFS_I_CANLOOKAHEAD); assert(fsinfo.flags & LFS_I_LOOKAHEAD);
assert(lfs.omdirs != &lfs.gc.t.o.o); assert(lfs.omdirs != &lfs.gc.t.o.o);
// run GC one step // run GC one step
@@ -134,7 +134,7 @@ code = '''
// we should _not_ make progress // we should _not_ make progress
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags & LFS_I_CANLOOKAHEAD); assert(fsinfo.flags & LFS_I_LOOKAHEAD);
// check the file contents // check the file contents
lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0; lfsr_file_open(&lfs, &file, "spider", LFS_O_RDONLY) => 0;
@@ -196,7 +196,7 @@ code = '''
// expect dirty initial state or else our test doesn't work // expect dirty initial state or else our test doesn't work
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags & LFS_I_UNCOMPACTED); assert(fsinfo.flags & LFS_I_COMPACT);
assert(lfs.omdirs != &lfs.gc.t.o.o); assert(lfs.omdirs != &lfs.gc.t.o.o);
// run GC until we make progress // run GC until we make progress
@@ -207,7 +207,7 @@ code = '''
lfsr_fs_gc(&lfs) => 0; lfsr_fs_gc(&lfs) => 0;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
if (!(fsinfo.flags & LFS_I_UNCOMPACTED)) { if (!(fsinfo.flags & LFS_I_COMPACT)) {
break; break;
} }
} }
@@ -285,7 +285,7 @@ code = '''
// expect dirty initial state or else our test doesn't work // expect dirty initial state or else our test doesn't work
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags & LFS_I_UNCOMPACTED); assert(fsinfo.flags & LFS_I_COMPACT);
assert(lfs.omdirs != &lfs.gc.t.o.o); assert(lfs.omdirs != &lfs.gc.t.o.o);
// run GC one traversal + one step // run GC one traversal + one step
@@ -315,7 +315,7 @@ code = '''
// we should _not_ make progress // we should _not_ make progress
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags & LFS_I_UNCOMPACTED); assert(fsinfo.flags & LFS_I_COMPACT);
// check we can still read the file // check we can still read the file
for (int remount = 0; remount < 2; remount++) { for (int remount = 0; remount < 2; remount++) {
@@ -406,7 +406,7 @@ code = '''
// expect dirty initial state or else our test doesn't work // expect dirty initial state or else our test doesn't work
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags & LFS_I_INCONSISTENT); assert(fsinfo.flags & LFS_I_MKCONSISTENT);
assert(lfs.omdirs != &lfs.gc.t.o.o); assert(lfs.omdirs != &lfs.gc.t.o.o);
// run GC until we make progress // run GC until we make progress
@@ -417,7 +417,7 @@ code = '''
lfsr_fs_gc(&lfs) => 0; lfsr_fs_gc(&lfs) => 0;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
if (!(fsinfo.flags & LFS_I_INCONSISTENT)) { if (!(fsinfo.flags & LFS_I_MKCONSISTENT)) {
break; break;
} }
} }
@@ -505,7 +505,7 @@ code = '''
// expect dirty initial state or else our test doesn't work // expect dirty initial state or else our test doesn't work
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags & LFS_I_INCONSISTENT); assert(fsinfo.flags & LFS_I_MKCONSISTENT);
#ifdef LFS_GC #ifdef LFS_GC
assert(lfs.omdirs != &lfs.gc.t.o.o); assert(lfs.omdirs != &lfs.gc.t.o.o);
#endif #endif
@@ -515,7 +515,7 @@ code = '''
// we should have made progress // we should have made progress
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(!(fsinfo.flags & LFS_I_INCONSISTENT)); assert(!(fsinfo.flags & LFS_I_MKCONSISTENT));
// check we can still read the files // check we can still read the files
for (int remount = 0; remount < 2; remount++) { for (int remount = 0; remount < 2; remount++) {
@@ -623,7 +623,7 @@ code = '''
// we should now have dirty state // we should now have dirty state
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags & LFS_I_INCONSISTENT); assert(fsinfo.flags & LFS_I_MKCONSISTENT);
// run GC until our traversal is done // run GC until our traversal is done
while (lfs.omdirs == &lfs.gc.t.o.o) { while (lfs.omdirs == &lfs.gc.t.o.o) {
@@ -632,7 +632,7 @@ code = '''
// we should _not_ make progress // we should _not_ make progress
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags & LFS_I_INCONSISTENT); assert(fsinfo.flags & LFS_I_MKCONSISTENT);
// check we can still read the files // check we can still read the files
for (int remount = 0; remount < 2; remount++) { for (int remount = 0; remount < 2; remount++) {
@@ -1107,7 +1107,7 @@ code = '''
while (true) { while (true) {
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
if (!(fsinfo.flags & LFS_I_CANCKMETA)) { if (!(fsinfo.flags & LFS_I_CKMETA)) {
break; break;
} }
@@ -1120,7 +1120,7 @@ code = '''
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(!(fsinfo.flags & LFS_I_CANCKMETA)); assert(!(fsinfo.flags & LFS_I_CKMETA));
// remount with LFS_M_CKMETA // remount with LFS_M_CKMETA
} else if (AFTER == 3) { } else if (AFTER == 3) {
@@ -1129,7 +1129,7 @@ code = '''
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(!(fsinfo.flags & LFS_I_CANCKMETA)); assert(!(fsinfo.flags & LFS_I_CKMETA));
} else { } else {
assert(false); assert(false);
@@ -1175,7 +1175,7 @@ code = '''
clobbered:; clobbered:;
// clear relevant ck flags // clear relevant ck flags
lfsr_fs_unck(&lfs, LFS_I_CANCKMETA) => 0; lfsr_fs_unck(&lfs, LFS_I_CKMETA) => 0;
// running lfsr_fs_gc should eventually find the clobbered block // running lfsr_fs_gc should eventually find the clobbered block
for (lfs_block_t i = 0;; i++) { for (lfs_block_t i = 0;; i++) {
@@ -1255,7 +1255,7 @@ code = '''
while (true) { while (true) {
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
if (!(fsinfo.flags & LFS_I_CANCKDATA)) { if (!(fsinfo.flags & LFS_I_CKDATA)) {
break; break;
} }
@@ -1268,7 +1268,7 @@ code = '''
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(!(fsinfo.flags & LFS_I_CANCKDATA)); assert(!(fsinfo.flags & LFS_I_CKDATA));
// remount with LFS_M_CKDATA // remount with LFS_M_CKDATA
} else if (AFTER == 3) { } else if (AFTER == 3) {
@@ -1277,7 +1277,7 @@ code = '''
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(!(fsinfo.flags & LFS_I_CANCKDATA)); assert(!(fsinfo.flags & LFS_I_CKDATA));
} else { } else {
assert(false); assert(false);
@@ -1324,7 +1324,7 @@ code = '''
clobbered:; clobbered:;
// clear relevant ck flags // clear relevant ck flags
lfsr_fs_unck(&lfs, LFS_I_CANCKDATA) => 0; lfsr_fs_unck(&lfs, LFS_I_CKDATA) => 0;
// running lfsr_fs_gc should eventually find the clobbered block // running lfsr_fs_gc should eventually find the clobbered block
// //
@@ -1531,7 +1531,7 @@ code = '''
// unck to keep things interesting? // unck to keep things interesting?
if (UNCK) { if (UNCK) {
lfsr_fs_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0; lfsr_fs_unck(&lfs, LFS_I_CKMETA | LFS_I_CKDATA) => 0;
} }
} }
@@ -1718,7 +1718,7 @@ code = '''
// unck to keep things interesting? // unck to keep things interesting?
if (UNCK) { if (UNCK) {
lfsr_fs_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0; lfsr_fs_unck(&lfs, LFS_I_CKMETA | LFS_I_CKDATA) => 0;
} }
} }
@@ -1830,7 +1830,7 @@ code = '''
// unck to keep things interesting? // unck to keep things interesting?
if (UNCK) { if (UNCK) {
lfsr_fs_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0; lfsr_fs_unck(&lfs, LFS_I_CKMETA | LFS_I_CKDATA) => 0;
} }
} }
@@ -2038,7 +2038,7 @@ code = '''
// unck to keep things interesting? // unck to keep things interesting?
if (UNCK) { if (UNCK) {
lfsr_fs_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0; lfsr_fs_unck(&lfs, LFS_I_CKMETA | LFS_I_CKDATA) => 0;
} }
} }
@@ -2211,7 +2211,7 @@ code = '''
// unck to keep things interesting? // unck to keep things interesting?
if (UNCK) { if (UNCK) {
lfsr_fs_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0; lfsr_fs_unck(&lfs, LFS_I_CKMETA | LFS_I_CKDATA) => 0;
} }
} }
@@ -2550,7 +2550,7 @@ code = '''
// unck to keep things interesting? // unck to keep things interesting?
if (UNCK) { if (UNCK) {
lfsr_fs_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0; lfsr_fs_unck(&lfs, LFS_I_CKMETA | LFS_I_CKDATA) => 0;
} }
} }
@@ -2977,7 +2977,7 @@ code = '''
// unck to keep things interesting? // unck to keep things interesting?
if (UNCK) { if (UNCK) {
lfsr_fs_unck(&lfs, LFS_I_CANCKMETA | LFS_I_CANCKDATA) => 0; lfsr_fs_unck(&lfs, LFS_I_CKMETA | LFS_I_CKDATA) => 0;
} }
} }
+32 -32
View File
@@ -72,11 +72,11 @@ code = '''
| ((CKDATACKSUMS) | ((CKDATACKSUMS)
? LFS_IFDEF_CKDATACKSUMS(LFS_I_CKDATACKSUMS, -1) ? LFS_IFDEF_CKDATACKSUMS(LFS_I_CKDATACKSUMS, -1)
: 0) : 0)
| ((!MKCONSISTENT) ? LFS_I_INCONSISTENT : 0) | ((!MKCONSISTENT) ? LFS_I_MKCONSISTENT : 0)
| ((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0) | ((!LOOKAHEAD) ? LFS_I_LOOKAHEAD : 0)
| ((!COMPACT) ? LFS_I_UNCOMPACTED : 0) | ((!COMPACT) ? LFS_I_COMPACT : 0)
| ((!CKMETA) ? LFS_I_CANCKMETA : 0) | ((!CKMETA) ? LFS_I_CKMETA : 0)
| ((!CKDATA) ? LFS_I_CANCKDATA : 0))); | ((!CKDATA) ? LFS_I_CKDATA : 0)));
lfsr_unmount(&lfs) => 0; lfsr_unmount(&lfs) => 0;
''' '''
@@ -135,11 +135,11 @@ code = '''
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags == ( assert(fsinfo.flags == (
LFS_I_INCONSISTENT LFS_I_MKCONSISTENT
| LFS_I_CANLOOKAHEAD | LFS_I_LOOKAHEAD
| LFS_I_UNCOMPACTED | LFS_I_COMPACT
| LFS_I_CANCKMETA | LFS_I_CKMETA
| LFS_I_CANCKDATA)); | LFS_I_CKDATA));
lfsr_unmount(&lfs) => 0; lfsr_unmount(&lfs) => 0;
// with LFS_M_LOOKAHEAD, mount performs a lookahead scan // with LFS_M_LOOKAHEAD, mount performs a lookahead scan
@@ -151,10 +151,10 @@ code = '''
CFG) => 0; CFG) => 0;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags == ( assert(fsinfo.flags == (
LFS_I_INCONSISTENT LFS_I_MKCONSISTENT
| LFS_I_UNCOMPACTED | LFS_I_COMPACT
| ((!CKMETA) ? LFS_I_CANCKMETA : 0) | ((!CKMETA) ? LFS_I_CKMETA : 0)
| ((!CKDATA) ? LFS_I_CANCKDATA : 0))); | ((!CKDATA) ? LFS_I_CKDATA : 0)));
lfsr_unmount(&lfs) => 0; lfsr_unmount(&lfs) => 0;
''' '''
@@ -205,11 +205,11 @@ code = '''
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags == ( assert(fsinfo.flags == (
LFS_I_INCONSISTENT LFS_I_MKCONSISTENT
| LFS_I_CANLOOKAHEAD | LFS_I_LOOKAHEAD
| LFS_I_UNCOMPACTED | LFS_I_COMPACT
| LFS_I_CANCKMETA | LFS_I_CKMETA
| LFS_I_CANCKDATA)); | LFS_I_CKDATA));
lfsr_unmount(&lfs) => 0; lfsr_unmount(&lfs) => 0;
// with LFS_M_COMPACT, mount compact any uncompacted blocks // with LFS_M_COMPACT, mount compact any uncompacted blocks
@@ -222,10 +222,10 @@ code = '''
CFG) => 0; CFG) => 0;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags == ( assert(fsinfo.flags == (
LFS_I_INCONSISTENT LFS_I_MKCONSISTENT
| ((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0) | ((!LOOKAHEAD) ? LFS_I_LOOKAHEAD : 0)
| ((!CKMETA) ? LFS_I_CANCKMETA : 0) | ((!CKMETA) ? LFS_I_CKMETA : 0)
| ((!CKDATA) ? LFS_I_CANCKDATA : 0))); | ((!CKDATA) ? LFS_I_CKDATA : 0)));
// mdir should have been compacted // mdir should have been compacted
lfsr_file_open(&lfs, &file, "jellyfish", LFS_O_RDONLY) => 0; lfsr_file_open(&lfs, &file, "jellyfish", LFS_O_RDONLY) => 0;
@@ -303,11 +303,11 @@ code = '''
struct lfs_fsinfo fsinfo; struct lfs_fsinfo fsinfo;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags == ( assert(fsinfo.flags == (
LFS_I_INCONSISTENT LFS_I_MKCONSISTENT
| LFS_I_CANLOOKAHEAD | LFS_I_LOOKAHEAD
| LFS_I_UNCOMPACTED | LFS_I_COMPACT
| LFS_I_CANCKMETA | LFS_I_CKMETA
| LFS_I_CANCKDATA)); | LFS_I_CKDATA));
lfsr_unmount(&lfs) => 0; lfsr_unmount(&lfs) => 0;
// with LFS_M_MKCONSISTENT, mount cleans up orphans eagerly // with LFS_M_MKCONSISTENT, mount cleans up orphans eagerly
@@ -321,10 +321,10 @@ code = '''
CFG) => 0; CFG) => 0;
lfsr_fs_stat(&lfs, &fsinfo) => 0; lfsr_fs_stat(&lfs, &fsinfo) => 0;
assert(fsinfo.flags == ( assert(fsinfo.flags == (
((!LOOKAHEAD) ? LFS_I_CANLOOKAHEAD : 0) ((!LOOKAHEAD) ? LFS_I_LOOKAHEAD : 0)
| ((!COMPACT) ? LFS_I_UNCOMPACTED : 0) | ((!COMPACT) ? LFS_I_COMPACT : 0)
| ((!CKMETA) ? LFS_I_CANCKMETA : 0) | ((!CKMETA) ? LFS_I_CKMETA : 0)
| ((!CKDATA) ? LFS_I_CANCKDATA : 0))); | ((!CKDATA) ? LFS_I_CKDATA : 0)));
// check we can still read the files // check we can still read the files
lfsr_file_open(&lfs, &file, "cuttlefish", LFS_O_RDONLY) => 0; lfsr_file_open(&lfs, &file, "cuttlefish", LFS_O_RDONLY) => 0;
+291 -291
View File
File diff suppressed because it is too large Load Diff