From 2e8012681bb9d3a0e39ae59821237c7c68e3d249 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Fri, 24 May 2024 02:49:39 -0500 Subject: [PATCH] Tweaked dbg script headers to match the mount info log The main difference being rendering the weight with a single letter "w" prefix: $ ./scripts/dbglfs.py disk -b4096 littlefs v0.0 4096x256 0x{1,0}.8b w2.512, rev eb7f2a0d ... This lets us add valuable weight info without too much noise. Adopting this in the dbg scripts is nice for consistency. --- scripts/dbgbtree.py | 7 +++++-- scripts/dbglfs.py | 6 ++++-- scripts/dbgmtree.py | 4 ++-- scripts/dbgrbyd.py | 7 +++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/scripts/dbgbtree.py b/scripts/dbgbtree.py index 8c47c37a..52e9b74f 100755 --- a/scripts/dbgbtree.py +++ b/scripts/dbgbtree.py @@ -610,8 +610,11 @@ def main(disk, roots=None, *, # fetch the root btree = Rbyd.fetch(f, block_size, roots, trunk) - print('btree %s, rev %08x, weight %d, cksum %08x' % ( - btree.addr(), btree.rev, btree.weight, btree.cksum)) + print('btree %s w%d, rev %08x, cksum %08x' % ( + btree.addr(), + btree.weight, + btree.rev, + btree.cksum)) # look up a bid, while keeping track of the search path def btree_lookup(bid, *, diff --git a/scripts/dbglfs.py b/scripts/dbglfs.py index d9a7a6cf..cde560aa 100755 --- a/scripts/dbglfs.py +++ b/scripts/dbglfs.py @@ -1884,11 +1884,13 @@ def main(disk, mroots=None, *, #### actual debugging begins here # print some information about the filesystem - print('littlefs v%s.%s %dx%d %s, rev %08x, weight %d.%d' % ( + print('littlefs v%s.%s %dx%d %s w%d.%d, rev %08x' % ( config.version[0] if config.version[0] is not None else '?', config.version[1] if config.version[1] is not None else '?', (config.geometry[0] or 0), (config.geometry[1] or 0), - mroot.addr(), mroot.rev, bweight//mleaf_weight, 1*mleaf_weight)) + mroot.addr(), + bweight//mleaf_weight, 1*mleaf_weight, + mroot.rev)) # dynamically size the id field w_width = max( diff --git a/scripts/dbgmtree.py b/scripts/dbgmtree.py index a2460a3b..cfd04677 100755 --- a/scripts/dbgmtree.py +++ b/scripts/dbgmtree.py @@ -1500,10 +1500,10 @@ def main(disk, mroots=None, *, #### actual debugging begins here # print some information about the mtree - print('mtree %s, rev %08x, weight %d.%d, cksum %08x' % ( + print('mtree %s w%d.%d, rev %08x, cksum %08x' % ( mroot.addr(), - mroot.rev, bweight//mleaf_weight, 1*mleaf_weight, + mroot.rev, mroot.cksum)) # dynamically size the id field diff --git a/scripts/dbgrbyd.py b/scripts/dbgrbyd.py index 4e3cb8bd..6832dcd0 100755 --- a/scripts/dbgrbyd.py +++ b/scripts/dbgrbyd.py @@ -1030,7 +1030,7 @@ def main(disk, blocks=None, *, weights[i], cksums[i]) - print('rbyd %s, rev %08x, size %d, weight %d, cksum %08x' % ( + print('rbyd %s w%d, rev %08x, size %d, cksum %08x' % ( '0x%x.%x' % (block, trunk_) if len(blocks) == 1 else '0x{%x,%s}.%x' % ( @@ -1038,7 +1038,10 @@ def main(disk, blocks=None, *, ','.join('%x' % blocks[(i+1+j) % len(blocks)] for j in range(len(blocks)-1)), trunk_), - rev, eoff, weight, cksum)) + weight, + rev, + eoff, + cksum)) if args.get('log'): dbg_log(data, block_size, rev, eoff, weight,