scripts: Dropped list/tuple distinction in Rbyd.fetch

Also tweaked how we fetch shrubs, adding Rbyd.fetchshrub and
Btree.fetchshrub instead of overloading the bd argument.

Oh, and also added --trunk to dbgmtree.py and dbglfs.py. Actually
_using_ --trunk isn't advised, since it will probably just result in a
corrupted filesystem, but these scripts are for accessing things that
aren't normally allowed anyways.

The reason for dropping the list/tuple distinction is because it was a
big ugly hack, unpythonic, and likely to catch users (and myself) by
surprise. Now, Rbyd.fetch and friends always require separate
block/trunk arguments, and the exercise of deciding which trunk to use
is left up to the caller.
This commit is contained in:
Christopher Haster
2025-03-31 18:09:49 -05:00
parent 1ac3aae92b
commit 82f4fd3c0f
8 changed files with 350 additions and 361 deletions
+5 -5
View File
@@ -97,10 +97,10 @@ def bdgeom(s):
return int(s, b)
# parse some rbyd addr encodings
# 0xa -> [0xa]
# 0xa.c -> [(0xa, 0xc)]
# 0x{a,b} -> [0xa, 0xb]
# 0x{a,b}.c -> [(0xa, 0xc), (0xb, 0xc)]
# 0xa -> (0xa,)
# 0xa.c -> ((0xa, 0xc),)
# 0x{a,b} -> (0xa, 0xb)
# 0x{a,b}.c -> ((0xa, 0xc), (0xb, 0xc))
def rbydaddr(s):
s = s.strip()
b = 10
@@ -131,7 +131,7 @@ def rbydaddr(s):
else:
addr.append(int(s, b))
return addr
return tuple(addr)
def crc32c(data, crc=0):
crc ^= 0xffffffff