From 73127470f97fb8d31f1ab87b60b8c1c66941dbbe Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Tue, 18 Mar 2025 12:49:32 -0500 Subject: [PATCH] scripts: Adopted rbydaddr/tagrepr changes across scripts Just some minor tweaks: - rbydaddr: Return list instead of tuple, note we rely on the type distinction in Rbyd.fetch now. - tagrepr: Rename w -> weight. --- scripts/dbgblock.py | 10 +++++----- scripts/dbgbmap.py | 10 +++++----- scripts/dbgbtree.py | 36 ++++++++++++++++++------------------ scripts/dbgcat.py | 10 +++++----- scripts/dbglfs.py | 36 ++++++++++++++++++------------------ scripts/dbgmtree.py | 36 ++++++++++++++++++------------------ scripts/dbgrbyd.py | 4 +--- scripts/dbgtag.py | 26 +++++++++++++------------- scripts/tracebd.py | 10 +++++----- 9 files changed, 88 insertions(+), 90 deletions(-) diff --git a/scripts/dbgblock.py b/scripts/dbgblock.py index c291e88d..45b02261 100755 --- a/scripts/dbgblock.py +++ b/scripts/dbgblock.py @@ -32,10 +32,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 @@ -66,7 +66,7 @@ def rbydaddr(s): else: addr.append(int(s, b)) - return tuple(addr) + return addr def xxd(data, width=16): for i in range(0, len(data), width): diff --git a/scripts/dbgbmap.py b/scripts/dbgbmap.py index 0898dd0a..9320ef4b 100755 --- a/scripts/dbgbmap.py +++ b/scripts/dbgbmap.py @@ -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 tuple(addr) + return addr def crc32c(data, crc=0): crc ^= 0xffffffff diff --git a/scripts/dbgbtree.py b/scripts/dbgbtree.py index ed78de37..4307501b 100755 --- a/scripts/dbgbtree.py +++ b/scripts/dbgbtree.py @@ -79,10 +79,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 @@ -113,7 +113,7 @@ def rbydaddr(s): else: addr.append(int(s, b)) - return tuple(addr) + return addr def crc32c(data, crc=0): crc ^= 0xffffffff @@ -165,11 +165,11 @@ def xxd(data, width=16): b if b >= ' ' and b <= '~' else '.' for b in map(chr, data[i:i+width]))) -def tagrepr(tag, w=None, size=None, off=None): +def tagrepr(tag, weight=None, size=None, off=None): if (tag & 0x6fff) == TAG_NULL: return '%snull%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %d' % size if size else '') elif (tag & 0x6f00) == TAG_CONFIG: return '%s%s%s%s' % ( @@ -183,14 +183,14 @@ def tagrepr(tag, w=None, size=None, off=None): else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT else 'config 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6f00) == TAG_GDELTA: return '%s%s%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', 'grmdelta' if (tag & 0xfff) == TAG_GRMDELTA else 'gdelta 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6f00) == TAG_NAME: return '%s%s%s%s' % ( @@ -201,7 +201,7 @@ def tagrepr(tag, w=None, size=None, off=None): else 'bookmark' if (tag & 0xfff) == TAG_BOOKMARK else 'stickynote' if (tag & 0xfff) == TAG_STICKYNOTE else 'name 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6f00) == TAG_STRUCT: return '%s%s%s%s' % ( @@ -216,21 +216,21 @@ def tagrepr(tag, w=None, size=None, off=None): else 'did' if (tag & 0xfff) == TAG_DID else 'branch' if (tag & 0xfff) == TAG_BRANCH else 'struct 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6e00) == TAG_ATTR: return '%s%sattr 0x%02x%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', 's' if tag & 0x100 else 'u', ((tag & 0x100) >> 1) ^ (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif tag & TAG_ALT: return 'alt%s%s 0x%03x%s%s' % ( 'r' if tag & TAG_R else 'b', 'gt' if tag & TAG_GT else 'le', tag & 0x0fff, - ' w%d' % w if w is not None else '', + ' w%d' % weight if weight is not None else '', ' 0x%x' % (0xffffffff & (off-size)) if size and off is not None else ' -%d' % size if size @@ -239,27 +239,27 @@ def tagrepr(tag, w=None, size=None, off=None): return 'cksum%s%s%s%s' % ( 'p' if not tag & 0xfe and tag & TAG_P else '', ' 0x%02x' % (tag & 0xff) if tag & 0xfe else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x7f00) == TAG_NOTE: return 'note%s%s%s' % ( ' 0x%02x' % (tag & 0xff) if tag & 0xff else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x7f00) == TAG_ECKSUM: return 'ecksum%s%s%s' % ( ' 0x%02x' % (tag & 0xff) if tag & 0xff else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x7f00) == TAG_GCKSUMDELTA: return 'gcksumdelta%s%s%s' % ( ' 0x%02x' % (tag & 0xff) if tag & 0xff else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') else: return '0x%04x%s%s' % ( tag, - ' w%d' % w if w is not None else '', + ' w%d' % weight if weight is not None else '', ' %d' % size if size is not None else '') diff --git a/scripts/dbgcat.py b/scripts/dbgcat.py index ec642635..e34ba1cb 100755 --- a/scripts/dbgcat.py +++ b/scripts/dbgcat.py @@ -32,10 +32,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 @@ -66,7 +66,7 @@ def rbydaddr(s): else: addr.append(int(s, b)) - return tuple(addr) + return addr def xxd(data, width=16): for i in range(0, len(data), width): diff --git a/scripts/dbglfs.py b/scripts/dbglfs.py index 8a289acf..f629b2bb 100755 --- a/scripts/dbglfs.py +++ b/scripts/dbglfs.py @@ -80,10 +80,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 @@ -114,7 +114,7 @@ def rbydaddr(s): else: addr.append(int(s, b)) - return tuple(addr) + return addr def crc32c(data, crc=0): crc ^= 0xffffffff @@ -211,11 +211,11 @@ def xxd(data, width=16): b if b >= ' ' and b <= '~' else '.' for b in map(chr, data[i:i+width]))) -def tagrepr(tag, w=None, size=None, off=None): +def tagrepr(tag, weight=None, size=None, off=None): if (tag & 0x6fff) == TAG_NULL: return '%snull%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %d' % size if size else '') elif (tag & 0x6f00) == TAG_CONFIG: return '%s%s%s%s' % ( @@ -229,14 +229,14 @@ def tagrepr(tag, w=None, size=None, off=None): else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT else 'config 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6f00) == TAG_GDELTA: return '%s%s%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', 'grmdelta' if (tag & 0xfff) == TAG_GRMDELTA else 'gdelta 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6f00) == TAG_NAME: return '%s%s%s%s' % ( @@ -247,7 +247,7 @@ def tagrepr(tag, w=None, size=None, off=None): else 'bookmark' if (tag & 0xfff) == TAG_BOOKMARK else 'stickynote' if (tag & 0xfff) == TAG_STICKYNOTE else 'name 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6f00) == TAG_STRUCT: return '%s%s%s%s' % ( @@ -262,21 +262,21 @@ def tagrepr(tag, w=None, size=None, off=None): else 'did' if (tag & 0xfff) == TAG_DID else 'branch' if (tag & 0xfff) == TAG_BRANCH else 'struct 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6e00) == TAG_ATTR: return '%s%sattr 0x%02x%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', 's' if tag & 0x100 else 'u', ((tag & 0x100) >> 1) ^ (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif tag & TAG_ALT: return 'alt%s%s 0x%03x%s%s' % ( 'r' if tag & TAG_R else 'b', 'gt' if tag & TAG_GT else 'le', tag & 0x0fff, - ' w%d' % w if w is not None else '', + ' w%d' % weight if weight is not None else '', ' 0x%x' % (0xffffffff & (off-size)) if size and off is not None else ' -%d' % size if size @@ -285,27 +285,27 @@ def tagrepr(tag, w=None, size=None, off=None): return 'cksum%s%s%s%s' % ( 'p' if not tag & 0xfe and tag & TAG_P else '', ' 0x%02x' % (tag & 0xff) if tag & 0xfe else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x7f00) == TAG_NOTE: return 'note%s%s%s' % ( ' 0x%02x' % (tag & 0xff) if tag & 0xff else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x7f00) == TAG_ECKSUM: return 'ecksum%s%s%s' % ( ' 0x%02x' % (tag & 0xff) if tag & 0xff else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x7f00) == TAG_GCKSUMDELTA: return 'gcksumdelta%s%s%s' % ( ' 0x%02x' % (tag & 0xff) if tag & 0xff else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') else: return '0x%04x%s%s' % ( tag, - ' w%d' % w if w is not None else '', + ' w%d' % weight if weight is not None else '', ' %d' % size if size is not None else '') diff --git a/scripts/dbgmtree.py b/scripts/dbgmtree.py index f46330e3..3be7532a 100755 --- a/scripts/dbgmtree.py +++ b/scripts/dbgmtree.py @@ -79,10 +79,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 @@ -113,7 +113,7 @@ def rbydaddr(s): else: addr.append(int(s, b)) - return tuple(addr) + return addr def crc32c(data, crc=0): crc ^= 0xffffffff @@ -180,11 +180,11 @@ def xxd(data, width=16): b if b >= ' ' and b <= '~' else '.' for b in map(chr, data[i:i+width]))) -def tagrepr(tag, w=None, size=None, off=None): +def tagrepr(tag, weight=None, size=None, off=None): if (tag & 0x6fff) == TAG_NULL: return '%snull%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %d' % size if size else '') elif (tag & 0x6f00) == TAG_CONFIG: return '%s%s%s%s' % ( @@ -198,14 +198,14 @@ def tagrepr(tag, w=None, size=None, off=None): else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT else 'config 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6f00) == TAG_GDELTA: return '%s%s%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', 'grmdelta' if (tag & 0xfff) == TAG_GRMDELTA else 'gdelta 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6f00) == TAG_NAME: return '%s%s%s%s' % ( @@ -216,7 +216,7 @@ def tagrepr(tag, w=None, size=None, off=None): else 'bookmark' if (tag & 0xfff) == TAG_BOOKMARK else 'stickynote' if (tag & 0xfff) == TAG_STICKYNOTE else 'name 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6f00) == TAG_STRUCT: return '%s%s%s%s' % ( @@ -231,21 +231,21 @@ def tagrepr(tag, w=None, size=None, off=None): else 'did' if (tag & 0xfff) == TAG_DID else 'branch' if (tag & 0xfff) == TAG_BRANCH else 'struct 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6e00) == TAG_ATTR: return '%s%sattr 0x%02x%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', 's' if tag & 0x100 else 'u', ((tag & 0x100) >> 1) ^ (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif tag & TAG_ALT: return 'alt%s%s 0x%03x%s%s' % ( 'r' if tag & TAG_R else 'b', 'gt' if tag & TAG_GT else 'le', tag & 0x0fff, - ' w%d' % w if w is not None else '', + ' w%d' % weight if weight is not None else '', ' 0x%x' % (0xffffffff & (off-size)) if size and off is not None else ' -%d' % size if size @@ -254,27 +254,27 @@ def tagrepr(tag, w=None, size=None, off=None): return 'cksum%s%s%s%s' % ( 'p' if not tag & 0xfe and tag & TAG_P else '', ' 0x%02x' % (tag & 0xff) if tag & 0xfe else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x7f00) == TAG_NOTE: return 'note%s%s%s' % ( ' 0x%02x' % (tag & 0xff) if tag & 0xff else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x7f00) == TAG_ECKSUM: return 'ecksum%s%s%s' % ( ' 0x%02x' % (tag & 0xff) if tag & 0xff else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x7f00) == TAG_GCKSUMDELTA: return 'gcksumdelta%s%s%s' % ( ' 0x%02x' % (tag & 0xff) if tag & 0xff else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') else: return '0x%04x%s%s' % ( tag, - ' w%d' % w if w is not None else '', + ' w%d' % weight if weight is not None else '', ' %d' % size if size is not None else '') diff --git a/scripts/dbgrbyd.py b/scripts/dbgrbyd.py index 6c1886e9..f441bab0 100755 --- a/scripts/dbgrbyd.py +++ b/scripts/dbgrbyd.py @@ -88,7 +88,6 @@ def bdgeom(s): else: return int(s, b) -# TODO sync across scripts # parse some rbyd addr encodings # 0xa -> [0xa] # 0xa.c -> [(0xa, 0xc)] @@ -169,7 +168,6 @@ def xxd(data, width=16): b if b >= ' ' and b <= '~' else '.' for b in map(chr, data[i:i+width]))) -# TODO sync across scripts def tagrepr(tag, weight=None, size=None, off=None): if (tag & 0x6fff) == TAG_NULL: return '%snull%s%s' % ( @@ -387,7 +385,7 @@ class Rbyd: @classmethod def fetch(cls, data, block, trunk=None, cksum=None): - # multiple blocks? + # multiple blocks? unfortunately this must be a list if isinstance(block, list): # fetch all blocks rbyds = [cls.fetch(data, block, trunk, cksum) for block in block] diff --git a/scripts/dbgtag.py b/scripts/dbgtag.py index f89ab7af..ea8fc530 100755 --- a/scripts/dbgtag.py +++ b/scripts/dbgtag.py @@ -62,11 +62,11 @@ def fromleb128(data): return word, i+1 return word, len(data) -def tagrepr(tag, w=None, size=None, off=None): +def tagrepr(tag, weight=None, size=None, off=None): if (tag & 0x6fff) == TAG_NULL: return '%snull%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %d' % size if size else '') elif (tag & 0x6f00) == TAG_CONFIG: return '%s%s%s%s' % ( @@ -80,14 +80,14 @@ def tagrepr(tag, w=None, size=None, off=None): else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT else 'filelimit' if (tag & 0xfff) == TAG_FILELIMIT else 'config 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6f00) == TAG_GDELTA: return '%s%s%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', 'grmdelta' if (tag & 0xfff) == TAG_GRMDELTA else 'gdelta 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6f00) == TAG_NAME: return '%s%s%s%s' % ( @@ -98,7 +98,7 @@ def tagrepr(tag, w=None, size=None, off=None): else 'bookmark' if (tag & 0xfff) == TAG_BOOKMARK else 'stickynote' if (tag & 0xfff) == TAG_STICKYNOTE else 'name 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6f00) == TAG_STRUCT: return '%s%s%s%s' % ( @@ -113,21 +113,21 @@ def tagrepr(tag, w=None, size=None, off=None): else 'did' if (tag & 0xfff) == TAG_DID else 'branch' if (tag & 0xfff) == TAG_BRANCH else 'struct 0x%02x' % (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x6e00) == TAG_ATTR: return '%s%sattr 0x%02x%s%s' % ( 'shrub' if tag & TAG_SHRUB else '', 's' if tag & 0x100 else 'u', ((tag & 0x100) >> 1) ^ (tag & 0xff), - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif tag & TAG_ALT: return 'alt%s%s 0x%03x%s%s' % ( 'r' if tag & TAG_R else 'b', 'gt' if tag & TAG_GT else 'le', tag & 0x0fff, - ' w%d' % w if w is not None else '', + ' w%d' % weight if weight is not None else '', ' 0x%x' % (0xffffffff & (off-size)) if size and off is not None else ' -%d' % size if size @@ -136,27 +136,27 @@ def tagrepr(tag, w=None, size=None, off=None): return 'cksum%s%s%s%s' % ( 'p' if not tag & 0xfe and tag & TAG_P else '', ' 0x%02x' % (tag & 0xff) if tag & 0xfe else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x7f00) == TAG_NOTE: return 'note%s%s%s' % ( ' 0x%02x' % (tag & 0xff) if tag & 0xff else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x7f00) == TAG_ECKSUM: return 'ecksum%s%s%s' % ( ' 0x%02x' % (tag & 0xff) if tag & 0xff else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') elif (tag & 0x7f00) == TAG_GCKSUMDELTA: return 'gcksumdelta%s%s%s' % ( ' 0x%02x' % (tag & 0xff) if tag & 0xff else '', - ' w%d' % w if w else '', + ' w%d' % weight if weight else '', ' %s' % size if size is not None else '') else: return '0x%04x%s%s' % ( tag, - ' w%d' % w if w is not None else '', + ' w%d' % weight if weight is not None else '', ' %d' % size if size is not None else '') diff --git a/scripts/tracebd.py b/scripts/tracebd.py index 67d7a329..dd69b616 100755 --- a/scripts/tracebd.py +++ b/scripts/tracebd.py @@ -80,10 +80,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 @@ -114,7 +114,7 @@ def rbydaddr(s): else: addr.append(int(s, b)) - return tuple(addr) + return addr class RingIO: