mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-12-27 09:38:26 +00:00
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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user