scripts: dbgmtree.py: Dropped Mtree.lookupnext

I was toying with making this look more like the mtree API in lfs.c (so
no lookupleaf/namelookupleaf, only lookup/namelookup), but dropped the
idea:

- It would be tedious

- The Mtree class's lookupleaf/namelookupleaf are also helpful for
  returning inner btree nodes when printing debug info

- Not embedding mids in the Mdir class would complicate things

It's ok for these classes to not match littlefs's internal API
_exactly_. The goal is easy access for debug info, not to port the
filesystem to Python.

At least dropped Mtree.lookupnext, because that function really makes no
sense.
This commit is contained in:
Christopher Haster
2025-04-28 20:20:51 -05:00
parent 6c8fa28ae4
commit 1f4d7b3b7e
4 changed files with 0 additions and 136 deletions

View File

@@ -1883,40 +1883,6 @@ class Mtree:
else:
return mdir
def lookupnext(self, mid, *,
path=False,
depth=None):
if not isinstance(mid, Mid):
mid = self.mid(mid)
# lookup the relevant mdir
r = self.lookupleaf(mid,
path=path,
depth=depth)
if path:
mdir, path_ = r
else:
mdir = r
if mdir is None:
if path:
return None, None, path_
else:
return None, None
# not in mdir?
if mid.mrid >= mdir.weight:
if path:
return None, None, path_
else:
return None, None
# lookup mid in mdir
rattr = mdir.lookupnext(mid)
if path:
return mdir, rattr, path_+[(mid, mdir, rattr)]
else:
return mdir, rattr
def lookup(self, mid, *,
path=False,
depth=None):