Renamed BNAME -> NAME, CCKSUM -> CKSUM

It's probably better to have a separate names for a tag category and any
specific name, but I can't think of a better name for this tag, and I
hadn't noticed that I was already ignoring the C prefix for CCKSUM tags
in many places.

NAME/CKSUM now mean both the specific tag and tag category, which is a
bit of a hack since both happen to be the 0th-subtype of their
categories.
This commit is contained in:
Christopher Haster
2023-10-25 00:26:17 -05:00
parent 240fe4efe4
commit 6dcdf1ed61
6 changed files with 9 additions and 14 deletions
+3 -4
View File
@@ -604,7 +604,6 @@ enum lfsr_tag_type {
// name tags
LFSR_TAG_NAME = 0x0200,
LFSR_TAG_BNAME = 0x0200,
LFSR_TAG_BOOKMARK = 0x0201,
LFSR_TAG_REG = 0x0202,
LFSR_TAG_DIR = 0x0203,
@@ -3735,7 +3734,7 @@ static int lfsr_rbyd_namelookup(lfs_t *lfs, const lfsr_rbyd_t *rbyd,
// if we have no name or a vestigial name, treat this rid as always lt
lfs_scmp_t cmp;
if ((tag__ == LFSR_TAG_BNAME && rid__-(weight__-1) == 0)
if ((tag__ == LFSR_TAG_NAME && rid__-(weight__-1) == 0)
|| lfsr_tag_suptype(tag__) != LFSR_TAG_NAME) {
cmp = LFS_CMP_LT;
@@ -4617,7 +4616,7 @@ static int lfsr_btree_commit(lfs_t *lfs, lfsr_btree_t *btree,
if (lfsr_tag_suptype(split_tag) == LFSR_TAG_NAME) {
*attrs_++ = LFSR_ATTR(
bid+rid - rbyd.weight + rbyd_.weight + sibling.weight,
BNAME, 0, DATA(split_data));
NAME, 0, DATA(split_data));
}
attrs = scratch_attrs;
attr_count = attrs_ - scratch_attrs;
@@ -6232,7 +6231,7 @@ static int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir,
LFSR_ATTR(mdir_.mid | lfsr_midrmask(lfs),
MDIR, 0, FROMMPTR(mdir_.u.m.blocks, mdir_buf)),
LFSR_ATTR((mdir_.mid | lfsr_midrmask(lfs))+1,
BNAME, +lfsr_mleafweight(lfs), DATA(split_data)),
NAME, +lfsr_mleafweight(lfs), DATA(split_data)),
LFSR_ATTR(msibling_.mid | lfsr_midrmask(lfs),
MDIR, 0, FROMMPTR(msibling_.u.m.blocks, msibling_buf))));
if (err) {
+1 -2
View File
@@ -25,7 +25,6 @@ TAG_UATTRLIMIT = 0x000e
TAG_GSTATE = 0x0100
TAG_GRM = 0x0100
TAG_NAME = 0x0200
TAG_BNAME = 0x0200
TAG_BOOKMARK = 0x0201
TAG_REG = 0x0202
TAG_DIR = 0x0203
@@ -166,7 +165,7 @@ def tagrepr(tag, w, size, off=None):
elif (tag & 0xef00) == TAG_NAME:
return '%s%s%s %d' % (
'shrub' if tag & TAG_SHRUB else '',
'bname' if (tag & 0xfff) == TAG_BNAME
'name' if (tag & 0xfff) == TAG_NAME
else 'bookmark' if (tag & 0xfff) == TAG_BOOKMARK
else 'reg' if (tag & 0xfff) == TAG_REG
else 'dir' if (tag & 0xfff) == TAG_DIR
+2 -3
View File
@@ -26,7 +26,6 @@ TAG_UATTRLIMIT = 0x000e
TAG_GSTATE = 0x0100
TAG_GRM = 0x0100
TAG_NAME = 0x0200
TAG_BNAME = 0x0200
TAG_BOOKMARK = 0x0201
TAG_REG = 0x0202
TAG_DIR = 0x0203
@@ -182,7 +181,7 @@ def tagrepr(tag, w, size, off=None):
elif (tag & 0xef00) == TAG_NAME:
return '%s%s%s %d' % (
'shrub' if tag & TAG_SHRUB else '',
'bname' if (tag & 0xfff) == TAG_BNAME
'name' if (tag & 0xfff) == TAG_NAME
else 'bookmark' if (tag & 0xfff) == TAG_BOOKMARK
else 'reg' if (tag & 0xfff) == TAG_REG
else 'dir' if (tag & 0xfff) == TAG_DIR
@@ -837,7 +836,7 @@ class Rbyd:
break
# treat vestigial names as a catch-all
if ((tag == TAG_BNAME and rid-(w-1) == 0)
if ((tag == TAG_NAME and rid-(w-1) == 0)
or (tag & 0xff00) != TAG_NAME):
did_ = 0
name_ = b''
+1 -2
View File
@@ -25,7 +25,6 @@ TAG_UATTRLIMIT = 0x000e
TAG_GSTATE = 0x0100
TAG_GRM = 0x0100
TAG_NAME = 0x0200
TAG_BNAME = 0x0200
TAG_BOOKMARK = 0x0201
TAG_REG = 0x0202
TAG_DIR = 0x0203
@@ -181,7 +180,7 @@ def tagrepr(tag, w, size, off=None):
elif (tag & 0xef00) == TAG_NAME:
return '%s%s%s %d' % (
'shrub' if tag & TAG_SHRUB else '',
'bname' if (tag & 0xfff) == TAG_BNAME
'name' if (tag & 0xfff) == TAG_NAME
else 'bookmark' if (tag & 0xfff) == TAG_BOOKMARK
else 'reg' if (tag & 0xfff) == TAG_REG
else 'dir' if (tag & 0xfff) == TAG_DIR
+1 -2
View File
@@ -34,7 +34,6 @@ TAG_UATTRLIMIT = 0x000e
TAG_GSTATE = 0x0100
TAG_GRM = 0x0100
TAG_NAME = 0x0200
TAG_BNAME = 0x0200
TAG_BOOKMARK = 0x0201
TAG_REG = 0x0202
TAG_DIR = 0x0203
@@ -168,7 +167,7 @@ def tagrepr(tag, w, size, off=None):
elif (tag & 0xef00) == TAG_NAME:
return '%s%s%s %d' % (
'shrub' if tag & TAG_SHRUB else '',
'bname' if (tag & 0xfff) == TAG_BNAME
'name' if (tag & 0xfff) == TAG_NAME
else 'bookmark' if (tag & 0xfff) == TAG_BOOKMARK
else 'reg' if (tag & 0xfff) == TAG_REG
else 'dir' if (tag & 0xfff) == TAG_DIR
+1 -1
View File
@@ -88,7 +88,7 @@ code = '''
LFSR_ATTR(bid-(weight_-1)+weight1-1, TAG(tag1), 0, DATA(data1)),
(lfsr_data_size(&name) > 0
? LFSR_ATTR(bid-(weight_-1)+weight1,
BNAME, +weight2, DATA(name))
NAME, +weight2, DATA(name))
: LFSR_ATTR_NOOP),
(lfsr_data_size(&name) > 0
? LFSR_ATTR(bid-(weight_-1)+weight1+weight2-1,