scripts: Reworked dbgrbyd.py, adopted Rbyd class

This reworks dbgrbyd.py to use the Rbyd class (well, a rewrite of the
Rbyd class) as an abstraction of littlefs's rbyd disk structure in
Python.

Duplicating common classes/functions across these scripts has proven
useful for sharing code without preventing these scripts from being
standalone (a problem for _actual_ code sharing, relative imports, etc).
And, because of how these scripts were written, dbgrbyd.py humorously
ended up the only script not sharing the Rbyd class.

I'm also trying to make the actual Rbyd abstraction a bit more concrete
now that the filesystem's design has had some time to mature. This means
more classes for things like Rattrs that reduce the sheer number of
tuples that were flying around.

New classes:

- Rattr - rbyd attrs, tag + weight + data, this includes all relevant
  offsets which is useful for rendering hexdumps/etc.

- Ralt - rbyd alt pointers, useful for building tree representations.

- Rbyd - rbyd abstraction, including lookup/traversal methods

Note also that while the Rbyd class replaces most of the dbg_tree logic,
dbg_log is still pretty low-level and abstractionless.

---

Eventually I hope to have well defined classes for Btrees, Mdirs, Files,
etc, to make it easier to write more interesting debug scripts such as
dbgbmap.py.

Separating Btree, Mdirs, etc also means we shouldn't need the hacky
btree_lookup/tree_lookup methods in every script anymore. Having those
in dbgrbyd.py would've been a bit weird.
This commit is contained in:
Christopher Haster
2025-03-18 02:29:45 -05:00
parent 50e22ac690
commit 21049321a5
+609 -365
View File
File diff suppressed because it is too large Load Diff