diff --git a/lfs3.c b/lfs3.c index 0696d8d8..bd5af8b3 100644 --- a/lfs3.c +++ b/lfs3.c @@ -1063,10 +1063,9 @@ enum lfs3_tag { LFS3_TAG_MTREE = 0x032c, LFS3_TAG_BMRANGE = 0x0330, LFS3_TAG_BMFREE = 0x0330, - LFS3_TAG_BMINFLIGHT = 0x0331, - LFS3_TAG_BMINUSE = 0x0332, + LFS3_TAG_BMINUSE = 0x0331, + LFS3_TAG_BMERASED = 0x0332, LFS3_TAG_BMBAD = 0x0333, - LFS3_TAG_BMERASED = 0x0334, // user/sys attributes LFS3_TAG_ATTR = 0x0400, diff --git a/scripts/dbgbmap.py b/scripts/dbgbmap.py index 7eaedc77..e6c3388a 100755 --- a/scripts/dbgbmap.py +++ b/scripts/dbgbmap.py @@ -61,10 +61,9 @@ TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_BMRANGE = 0x0330 # 0x033u v--- --11 --11 uuuu TAG_BMFREE = 0x0330 # 0x0330 v--- --11 --11 ---- -TAG_BMINFLIGHT = 0x0331 # 0x0331 v--- --11 --11 ---1 -TAG_BMINUSE = 0x0332 # 0x0332 v--- --11 --11 --1- +TAG_BMINUSE = 0x0331 # 0x0331 v--- --11 --11 ---1 +TAG_BMERASED = 0x0332 # 0x0332 v--- --11 --11 --1- TAG_BMBAD = 0x0333 # 0x0333 v--- --11 --11 --11 -TAG_BMERASED = 0x0334 # 0x0334 v--- --11 --11 -1-- TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -380,10 +379,9 @@ def tagrepr(tag, weight=None, size=None, *, else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE else 'bmfree' if (tag & 0xfff) == TAG_BMFREE - else 'bminflight' if (tag & 0xfff) == TAG_BMINFLIGHT else 'bminuse' if (tag & 0xfff) == TAG_BMINUSE - else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmerased' if (tag & 0xfff) == TAG_BMERASED + else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmrange 0x%x' % (tag & 0xf) if (tag & 0xff0) == TAG_BMRANGE else 'struct 0x%02x' % (tag & 0xff), diff --git a/scripts/dbgbmapsvg.py b/scripts/dbgbmapsvg.py index 2f068f1b..83b9a45e 100755 --- a/scripts/dbgbmapsvg.py +++ b/scripts/dbgbmapsvg.py @@ -59,10 +59,9 @@ TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_BMRANGE = 0x0330 # 0x033u v--- --11 --11 uuuu TAG_BMFREE = 0x0330 # 0x0330 v--- --11 --11 ---- -TAG_BMINFLIGHT = 0x0331 # 0x0331 v--- --11 --11 ---1 -TAG_BMINUSE = 0x0332 # 0x0332 v--- --11 --11 --1- +TAG_BMINUSE = 0x0331 # 0x0331 v--- --11 --11 ---1 +TAG_BMERASED = 0x0332 # 0x0332 v--- --11 --11 --1- TAG_BMBAD = 0x0333 # 0x0333 v--- --11 --11 --11 -TAG_BMERASED = 0x0334 # 0x0334 v--- --11 --11 -1-- TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -410,10 +409,9 @@ def tagrepr(tag, weight=None, size=None, *, else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE else 'bmfree' if (tag & 0xfff) == TAG_BMFREE - else 'bminflight' if (tag & 0xfff) == TAG_BMINFLIGHT else 'bminuse' if (tag & 0xfff) == TAG_BMINUSE - else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmerased' if (tag & 0xfff) == TAG_BMERASED + else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmrange 0x%x' % (tag & 0xf) if (tag & 0xff0) == TAG_BMRANGE else 'struct 0x%02x' % (tag & 0xff), diff --git a/scripts/dbgbtree.py b/scripts/dbgbtree.py index bd36ef93..3150b610 100755 --- a/scripts/dbgbtree.py +++ b/scripts/dbgbtree.py @@ -50,10 +50,9 @@ TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_BMRANGE = 0x0330 # 0x033u v--- --11 --11 uuuu TAG_BMFREE = 0x0330 # 0x0330 v--- --11 --11 ---- -TAG_BMINFLIGHT = 0x0331 # 0x0331 v--- --11 --11 ---1 -TAG_BMINUSE = 0x0332 # 0x0332 v--- --11 --11 --1- +TAG_BMINUSE = 0x0331 # 0x0331 v--- --11 --11 ---1 +TAG_BMERASED = 0x0332 # 0x0332 v--- --11 --11 --1- TAG_BMBAD = 0x0333 # 0x0333 v--- --11 --11 --11 -TAG_BMERASED = 0x0334 # 0x0334 v--- --11 --11 -1-- TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -256,10 +255,9 @@ def tagrepr(tag, weight=None, size=None, *, else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE else 'bmfree' if (tag & 0xfff) == TAG_BMFREE - else 'bminflight' if (tag & 0xfff) == TAG_BMINFLIGHT else 'bminuse' if (tag & 0xfff) == TAG_BMINUSE - else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmerased' if (tag & 0xfff) == TAG_BMERASED + else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmrange 0x%x' % (tag & 0xf) if (tag & 0xff0) == TAG_BMRANGE else 'struct 0x%02x' % (tag & 0xff), diff --git a/scripts/dbglfs3.py b/scripts/dbglfs3.py index 055a4609..d702def6 100755 --- a/scripts/dbglfs3.py +++ b/scripts/dbglfs3.py @@ -51,10 +51,9 @@ TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_BMRANGE = 0x0330 # 0x033u v--- --11 --11 uuuu TAG_BMFREE = 0x0330 # 0x0330 v--- --11 --11 ---- -TAG_BMINFLIGHT = 0x0331 # 0x0331 v--- --11 --11 ---1 -TAG_BMINUSE = 0x0332 # 0x0332 v--- --11 --11 --1- +TAG_BMINUSE = 0x0331 # 0x0331 v--- --11 --11 ---1 +TAG_BMERASED = 0x0332 # 0x0332 v--- --11 --11 --1- TAG_BMBAD = 0x0333 # 0x0333 v--- --11 --11 --11 -TAG_BMERASED = 0x0334 # 0x0334 v--- --11 --11 -1-- TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -305,10 +304,9 @@ def tagrepr(tag, weight=None, size=None, *, else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE else 'bmfree' if (tag & 0xfff) == TAG_BMFREE - else 'bminflight' if (tag & 0xfff) == TAG_BMINFLIGHT else 'bminuse' if (tag & 0xfff) == TAG_BMINUSE - else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmerased' if (tag & 0xfff) == TAG_BMERASED + else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmrange 0x%x' % (tag & 0xf) if (tag & 0xff0) == TAG_BMRANGE else 'struct 0x%02x' % (tag & 0xff), diff --git a/scripts/dbgmtree.py b/scripts/dbgmtree.py index 56f84a69..8bbba8c6 100755 --- a/scripts/dbgmtree.py +++ b/scripts/dbgmtree.py @@ -50,10 +50,9 @@ TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_BMRANGE = 0x0330 # 0x033u v--- --11 --11 uuuu TAG_BMFREE = 0x0330 # 0x0330 v--- --11 --11 ---- -TAG_BMINFLIGHT = 0x0331 # 0x0331 v--- --11 --11 ---1 -TAG_BMINUSE = 0x0332 # 0x0332 v--- --11 --11 --1- +TAG_BMINUSE = 0x0331 # 0x0331 v--- --11 --11 ---1 +TAG_BMERASED = 0x0332 # 0x0332 v--- --11 --11 --1- TAG_BMBAD = 0x0333 # 0x0333 v--- --11 --11 --11 -TAG_BMERASED = 0x0334 # 0x0334 v--- --11 --11 -1-- TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -271,10 +270,9 @@ def tagrepr(tag, weight=None, size=None, *, else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE else 'bmfree' if (tag & 0xfff) == TAG_BMFREE - else 'bminflight' if (tag & 0xfff) == TAG_BMINFLIGHT else 'bminuse' if (tag & 0xfff) == TAG_BMINUSE - else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmerased' if (tag & 0xfff) == TAG_BMERASED + else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmrange 0x%x' % (tag & 0xf) if (tag & 0xff0) == TAG_BMRANGE else 'struct 0x%02x' % (tag & 0xff), diff --git a/scripts/dbgrbyd.py b/scripts/dbgrbyd.py index 864f8cb6..759292e6 100755 --- a/scripts/dbgrbyd.py +++ b/scripts/dbgrbyd.py @@ -60,10 +60,9 @@ TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_BMRANGE = 0x0330 # 0x033u v--- --11 --11 uuuu TAG_BMFREE = 0x0330 # 0x0330 v--- --11 --11 ---- -TAG_BMINFLIGHT = 0x0331 # 0x0331 v--- --11 --11 ---1 -TAG_BMINUSE = 0x0332 # 0x0332 v--- --11 --11 --1- +TAG_BMINUSE = 0x0331 # 0x0331 v--- --11 --11 ---1 +TAG_BMERASED = 0x0332 # 0x0332 v--- --11 --11 --1- TAG_BMBAD = 0x0333 # 0x0333 v--- --11 --11 --11 -TAG_BMERASED = 0x0334 # 0x0334 v--- --11 --11 -1-- TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -259,10 +258,9 @@ def tagrepr(tag, weight=None, size=None, *, else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE else 'bmfree' if (tag & 0xfff) == TAG_BMFREE - else 'bminflight' if (tag & 0xfff) == TAG_BMINFLIGHT else 'bminuse' if (tag & 0xfff) == TAG_BMINUSE - else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmerased' if (tag & 0xfff) == TAG_BMERASED + else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmrange 0x%x' % (tag & 0xf) if (tag & 0xff0) == TAG_BMRANGE else 'struct 0x%02x' % (tag & 0xff), diff --git a/scripts/dbgtag.py b/scripts/dbgtag.py index b1588ff0..9b7df928 100755 --- a/scripts/dbgtag.py +++ b/scripts/dbgtag.py @@ -43,10 +43,9 @@ TAG_MDIR = 0x0325 # 0x0324 v--- --11 --1- -1rr TAG_MTREE = 0x032c # 0x032c v--- --11 --1- 11rr TAG_BMRANGE = 0x0330 # 0x033u v--- --11 --11 uuuu TAG_BMFREE = 0x0330 # 0x0330 v--- --11 --11 ---- -TAG_BMINFLIGHT = 0x0331 # 0x0331 v--- --11 --11 ---1 -TAG_BMINUSE = 0x0332 # 0x0332 v--- --11 --11 --1- +TAG_BMINUSE = 0x0331 # 0x0331 v--- --11 --11 ---1 +TAG_BMERASED = 0x0332 # 0x0332 v--- --11 --11 --1- TAG_BMBAD = 0x0333 # 0x0333 v--- --11 --11 --11 -TAG_BMERASED = 0x0334 # 0x0334 v--- --11 --11 -1-- TAG_ATTR = 0x0400 ## 0x04aa v--- -1-a -aaa aaaa TAG_UATTR = 0x0400 # 0x04aa v--- -1-- -aaa aaaa TAG_SATTR = 0x0500 # 0x05aa v--- -1-1 -aaa aaaa @@ -163,10 +162,9 @@ def tagrepr(tag, weight=None, size=None, *, else 'mdir' if (tag & 0xfff) == TAG_MDIR else 'mtree' if (tag & 0xfff) == TAG_MTREE else 'bmfree' if (tag & 0xfff) == TAG_BMFREE - else 'bminflight' if (tag & 0xfff) == TAG_BMINFLIGHT else 'bminuse' if (tag & 0xfff) == TAG_BMINUSE - else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmerased' if (tag & 0xfff) == TAG_BMERASED + else 'bmbad' if (tag & 0xfff) == TAG_BMBAD else 'bmrange 0x%x' % (tag & 0xf) if (tag & 0xff0) == TAG_BMRANGE else 'struct 0x%02x' % (tag & 0xff), diff --git a/tests/test_bmap.toml b/tests/test_bmap.toml index 96ab895f..e8f3b196 100644 --- a/tests/test_bmap.toml +++ b/tests/test_bmap.toml @@ -83,9 +83,9 @@ code = ''' lfs3_bmap_set(&lfs3, &bmap, 8, LFS3_TAG_BMINUSE) => 0; lfs3_bmap_set(&lfs3, &bmap, 10, LFS3_TAG_BMINUSE) => 0; // replace those blocks as bad, this tests deleting ranges - lfs3_bmap_set(&lfs3, &bmap, 6, LFS3_TAG_BMINFLIGHT) => 0; - lfs3_bmap_set(&lfs3, &bmap, 8, LFS3_TAG_BMINFLIGHT) => 0; - lfs3_bmap_set(&lfs3, &bmap, 10, LFS3_TAG_BMINFLIGHT) => 0; + lfs3_bmap_set(&lfs3, &bmap, 6, LFS3_TAG_BMBAD) => 0; + lfs3_bmap_set(&lfs3, &bmap, 8, LFS3_TAG_BMBAD) => 0; + lfs3_bmap_set(&lfs3, &bmap, 10, LFS3_TAG_BMBAD) => 0; printf("bmap: w%d 0x%x.%x\n", bmap.r.weight, bmap.r.blocks[0], @@ -102,7 +102,7 @@ code = ''' assert(bid_ == 5); assert(weight_ == 6); lfs3_bmap_lookupnext(&lfs3, &bmap, 6, - &bid_, &weight_) => LFS3_TAG_BMINFLIGHT; + &bid_, &weight_) => LFS3_TAG_BMBAD; assert(bid_ == 6); assert(weight_ == 1); lfs3_bmap_lookupnext(&lfs3, &bmap, 7, @@ -110,7 +110,7 @@ code = ''' assert(bid_ == 7); assert(weight_ == 1); lfs3_bmap_lookupnext(&lfs3, &bmap, 8, - &bid_, &weight_) => LFS3_TAG_BMINFLIGHT; + &bid_, &weight_) => LFS3_TAG_BMBAD; assert(bid_ == 8); assert(weight_ == 1); lfs3_bmap_lookupnext(&lfs3, &bmap, 9, @@ -118,7 +118,7 @@ code = ''' assert(bid_ == 9); assert(weight_ == 1); lfs3_bmap_lookupnext(&lfs3, &bmap, 10, - &bid_, &weight_) => LFS3_TAG_BMINFLIGHT; + &bid_, &weight_) => LFS3_TAG_BMBAD; assert(bid_ == 10); assert(weight_ == 1); lfs3_bmap_lookupnext(&lfs3, &bmap, 11,