Tweaked debug prints to show more information during mount

Now when you mount littlefs, the debug print shows a bit more info:

  lfs.c:7881:debug: Mounted littlefs v2.0 0x{0,1}.c63 w43.256, bd 4096x256

To dissassemble this a bit:

  littlefs v2.0 0x{0,1}.c63 w43.256, bd 4096x256
            ^ ^   '-+-'  ^   ^   ^        ^   ^
            '-|-----|----|---|---|--------|---|-- major version
              '-----|----|---|---|--------|---|-- minor version
                    '----|---|---|--------|---|-- mroot blocks
                         |   |   |        |   |   (1st is active)
                         '---|---|--------|---|-- mroot trunk
                             '---|--------|---|-- mtree weight
                                 '--------|---|-- mleaf weight
                                          '---|-- block size
                                              '-- block count

dbglfs.py also shows the block device geometry now, as read from the
mroot:

  $ ./scripts/dbglfs.py disk -B4096
  littlefs v2.0 0x{0,1}.c63, rev 1, weight 43.256, bd 4096x256
  ...

This may be over-optimizing for testing, but the reason the mount debug
is only one line is to avoid slowing down/messying test output. Both
powerloss testing and remounts completely fill the output with mount
prints that aren't actually all that useful.

Also switching to prefering parens in debug info mainly for mismatched
things.
This commit is contained in:
Christopher Haster
2023-10-10 17:31:43 -05:00
parent 5ecd6d59cd
commit 57aa513163
2 changed files with 20 additions and 12 deletions

View File

@@ -1760,10 +1760,11 @@ def main(disk, mroots=None, *,
#### actual debugging begins here
# print some information about the filesystem
print('littlefs v%s.%s %s, rev %d, weight %d.%d' % (
print('littlefs v%s.%s %s, rev %d, weight %d.%d, bd %dx%d' % (
config.version[0] if config.version[0] is not None else '?',
config.version[1] if config.version[1] is not None else '?',
mroot.addr(), mroot.rev, bweight//mleaf_weight, 1*mleaf_weight))
mroot.addr(), mroot.rev, bweight//mleaf_weight, 1*mleaf_weight,
config.block_limit+1, config.disk_limit+1))
# dynamically size the id field
w_width = max(