Changed CKSUM suptype encoding from 0x2000 -> 0x3000
I may be overthinking things, but I'm guessing of all the possible tag modes we may want to add in the future, we will mostly like want to add something that looks vaguely tag like. Like the shrub tags, for example. It's beneficial, ordering wise, for these hypothetical future tags to come before the cksum tags. Current tag modes: 0x0ttt v--- tttt -ttt tttt normal tags 0x1ttt v--1 tttt -ttt tttt shrub tags 0x3tpp v-11 tttt ---- ---p cksum tags 0x4kkk v1dc kkkk -kkk kkkk alt tags
This commit is contained in:
@@ -636,8 +636,8 @@ enum lfsr_tag_type {
|
|||||||
LFSR_TAG_R = 0x1000,
|
LFSR_TAG_R = 0x1000,
|
||||||
|
|
||||||
// checksum tags
|
// checksum tags
|
||||||
LFSR_TAG_CKSUM = 0x2000,
|
LFSR_TAG_CKSUM = 0x3000,
|
||||||
LFSR_TAG_ECKSUM = 0x2100,
|
LFSR_TAG_ECKSUM = 0x3100,
|
||||||
|
|
||||||
// in-device only tags, these should never get written to disk
|
// in-device only tags, these should never get written to disk
|
||||||
LFSR_TAG_INTERNAL = 0x0800,
|
LFSR_TAG_INTERNAL = 0x0800,
|
||||||
@@ -723,7 +723,7 @@ static inline bool lfsr_tag_isshrub(lfsr_tag_t tag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline bool lfsr_tag_istrunk(lfsr_tag_t tag) {
|
static inline bool lfsr_tag_istrunk(lfsr_tag_t tag) {
|
||||||
return (tag & 0xe000) != 0x2000;
|
return lfsr_tag_mode(tag) != LFSR_TAG_CKSUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool lfsr_tag_isinternal(lfsr_tag_t tag) {
|
static inline bool lfsr_tag_isinternal(lfsr_tag_t tag) {
|
||||||
|
|||||||
+3
-3
@@ -42,8 +42,8 @@ TAG_DID = 0x032c
|
|||||||
TAG_UATTR = 0x0400
|
TAG_UATTR = 0x0400
|
||||||
TAG_SATTR = 0x0600
|
TAG_SATTR = 0x0600
|
||||||
TAG_SHRUB = 0x1000
|
TAG_SHRUB = 0x1000
|
||||||
TAG_CKSUM = 0x2000
|
TAG_CKSUM = 0x3000
|
||||||
TAG_ECKSUM = 0x2100
|
TAG_ECKSUM = 0x3100
|
||||||
TAG_ALT = 0x4000
|
TAG_ALT = 0x4000
|
||||||
TAG_GT = 0x2000
|
TAG_GT = 0x2000
|
||||||
TAG_R = 0x1000
|
TAG_R = 0x1000
|
||||||
@@ -320,7 +320,7 @@ class Rbyd:
|
|||||||
weight = weight_
|
weight = weight_
|
||||||
|
|
||||||
# evaluate trunks
|
# evaluate trunks
|
||||||
if (tag & 0xe000) != TAG_CKSUM and (
|
if (tag & 0xf000) != TAG_CKSUM and (
|
||||||
not trunk or trunk >= j_-d or wastrunk):
|
not trunk or trunk >= j_-d or wastrunk):
|
||||||
# new trunk?
|
# new trunk?
|
||||||
if not wastrunk:
|
if not wastrunk:
|
||||||
|
|||||||
+3
-3
@@ -43,8 +43,8 @@ TAG_DID = 0x032c
|
|||||||
TAG_UATTR = 0x0400
|
TAG_UATTR = 0x0400
|
||||||
TAG_SATTR = 0x0600
|
TAG_SATTR = 0x0600
|
||||||
TAG_SHRUB = 0x1000
|
TAG_SHRUB = 0x1000
|
||||||
TAG_CKSUM = 0x2000
|
TAG_CKSUM = 0x3000
|
||||||
TAG_ECKSUM = 0x2100
|
TAG_ECKSUM = 0x3100
|
||||||
TAG_ALT = 0x4000
|
TAG_ALT = 0x4000
|
||||||
TAG_GT = 0x2000
|
TAG_GT = 0x2000
|
||||||
TAG_R = 0x1000
|
TAG_R = 0x1000
|
||||||
@@ -336,7 +336,7 @@ class Rbyd:
|
|||||||
weight = weight_
|
weight = weight_
|
||||||
|
|
||||||
# evaluate trunks
|
# evaluate trunks
|
||||||
if (tag & 0xe000) != TAG_CKSUM and (
|
if (tag & 0xf000) != TAG_CKSUM and (
|
||||||
not trunk or trunk >= j_-d or wastrunk):
|
not trunk or trunk >= j_-d or wastrunk):
|
||||||
# new trunk?
|
# new trunk?
|
||||||
if not wastrunk:
|
if not wastrunk:
|
||||||
|
|||||||
+3
-3
@@ -42,8 +42,8 @@ TAG_DID = 0x032c
|
|||||||
TAG_UATTR = 0x0400
|
TAG_UATTR = 0x0400
|
||||||
TAG_SATTR = 0x0600
|
TAG_SATTR = 0x0600
|
||||||
TAG_SHRUB = 0x1000
|
TAG_SHRUB = 0x1000
|
||||||
TAG_CKSUM = 0x2000
|
TAG_CKSUM = 0x3000
|
||||||
TAG_ECKSUM = 0x2100
|
TAG_ECKSUM = 0x3100
|
||||||
TAG_ALT = 0x4000
|
TAG_ALT = 0x4000
|
||||||
TAG_GT = 0x2000
|
TAG_GT = 0x2000
|
||||||
TAG_R = 0x1000
|
TAG_R = 0x1000
|
||||||
@@ -335,7 +335,7 @@ class Rbyd:
|
|||||||
weight = weight_
|
weight = weight_
|
||||||
|
|
||||||
# evaluate trunks
|
# evaluate trunks
|
||||||
if (tag & 0xe000) != TAG_CKSUM and (
|
if (tag & 0xf000) != TAG_CKSUM and (
|
||||||
not trunk or trunk >= j_-d or wastrunk):
|
not trunk or trunk >= j_-d or wastrunk):
|
||||||
# new trunk?
|
# new trunk?
|
||||||
if not wastrunk:
|
if not wastrunk:
|
||||||
|
|||||||
+8
-8
@@ -51,8 +51,8 @@ TAG_DID = 0x032c
|
|||||||
TAG_UATTR = 0x0400
|
TAG_UATTR = 0x0400
|
||||||
TAG_SATTR = 0x0600
|
TAG_SATTR = 0x0600
|
||||||
TAG_SHRUB = 0x1000
|
TAG_SHRUB = 0x1000
|
||||||
TAG_CKSUM = 0x2000
|
TAG_CKSUM = 0x3000
|
||||||
TAG_ECKSUM = 0x2100
|
TAG_ECKSUM = 0x3100
|
||||||
TAG_ALT = 0x4000
|
TAG_ALT = 0x4000
|
||||||
TAG_GT = 0x2000
|
TAG_GT = 0x2000
|
||||||
TAG_R = 0x1000
|
TAG_R = 0x1000
|
||||||
@@ -339,12 +339,12 @@ def dbg_log(data, block_size, rev, eoff, weight, *,
|
|||||||
j_ += size
|
j_ += size
|
||||||
|
|
||||||
# evaluate trunks
|
# evaluate trunks
|
||||||
if (tag & 0xe000) != TAG_CKSUM:
|
if (tag & 0xf000) != TAG_CKSUM:
|
||||||
if not wastrunk:
|
if not wastrunk:
|
||||||
wastrunk = True
|
wastrunk = True
|
||||||
lower_, upper_ = 0, 0
|
lower_, upper_ = 0, 0
|
||||||
|
|
||||||
if (tag & 0xe000) == TAG_ALT:
|
if (tag & 0xf000) == TAG_ALT:
|
||||||
lower_ += w
|
lower_ += w
|
||||||
else:
|
else:
|
||||||
upper_ += w
|
upper_ += w
|
||||||
@@ -356,7 +356,7 @@ def dbg_log(data, block_size, rev, eoff, weight, *,
|
|||||||
weight_ = lower_+upper_
|
weight_ = lower_+upper_
|
||||||
rid = lower_ + w-1
|
rid = lower_ + w-1
|
||||||
|
|
||||||
if (tag & 0xe000) != TAG_CKSUM and not tag & TAG_ALT:
|
if (tag & 0xf000) != TAG_CKSUM and not tag & TAG_ALT:
|
||||||
# note we ignore out-of-bounds here for debugging
|
# note we ignore out-of-bounds here for debugging
|
||||||
if delta > 0:
|
if delta > 0:
|
||||||
# grow lifetimes
|
# grow lifetimes
|
||||||
@@ -468,7 +468,7 @@ def dbg_log(data, block_size, rev, eoff, weight, *,
|
|||||||
j_ += size
|
j_ += size
|
||||||
|
|
||||||
# evaluate trunks
|
# evaluate trunks
|
||||||
if (tag & 0xe000) != TAG_CKSUM:
|
if (tag & 0xf000) != TAG_CKSUM:
|
||||||
if not wastrunk:
|
if not wastrunk:
|
||||||
wastrunk = True
|
wastrunk = True
|
||||||
weight__ = 0
|
weight__ = 0
|
||||||
@@ -516,7 +516,7 @@ def dbg_log(data, block_size, rev, eoff, weight, *,
|
|||||||
j_ += size
|
j_ += size
|
||||||
|
|
||||||
# evaluate trunks
|
# evaluate trunks
|
||||||
if (tag & 0xe000) != TAG_CKSUM:
|
if (tag & 0xf000) != TAG_CKSUM:
|
||||||
if not wastrunk:
|
if not wastrunk:
|
||||||
wastrunk = True
|
wastrunk = True
|
||||||
lower_, upper_ = 0, 0
|
lower_, upper_ = 0, 0
|
||||||
@@ -923,7 +923,7 @@ def main(disk, blocks=None, *,
|
|||||||
weight = weight_
|
weight = weight_
|
||||||
|
|
||||||
# evaluate trunks
|
# evaluate trunks
|
||||||
if (tag & 0xe000) != TAG_CKSUM and (
|
if (tag & 0xf000) != TAG_CKSUM and (
|
||||||
not trunk or trunk >= j_-d or wastrunk):
|
not trunk or trunk >= j_-d or wastrunk):
|
||||||
# new trunk?
|
# new trunk?
|
||||||
if not wastrunk:
|
if not wastrunk:
|
||||||
|
|||||||
Reference in New Issue
Block a user