mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-12-01 12:20:02 +00:00
bmap: scripts: Added on-disk bmap traversal to dbgbmap and friends
And yes, dbgbmapsvg.py's parents are working, thanks to a hacky blocks @property (Python to the rescue!)
This commit is contained in:
@ -2693,6 +2693,11 @@ class Gstate:
|
||||
fillvalue=0))
|
||||
self.data = data
|
||||
|
||||
@property
|
||||
def blocks(self):
|
||||
return tuple(it.chain.from_iterable(
|
||||
gdelta.blocks for _, gdelta in self.gdeltas))
|
||||
|
||||
@property
|
||||
def size(self):
|
||||
return len(self.data)
|
||||
@ -3224,6 +3229,7 @@ class Lfs3:
|
||||
# traverse the filesystem
|
||||
def traverse(self, *,
|
||||
mtree_only=False,
|
||||
gstate=True,
|
||||
shrubs=False,
|
||||
fragments=False,
|
||||
path=False):
|
||||
@ -3285,6 +3291,24 @@ class Lfs3:
|
||||
else:
|
||||
yield data
|
||||
|
||||
# traverse any gstate
|
||||
if not mtree_only and gstate:
|
||||
for gstate_ in self.gstate:
|
||||
if getattr(gstate_, 'btree', None) is None:
|
||||
continue
|
||||
|
||||
for r in gstate_.btree.traverse(
|
||||
path=path):
|
||||
if path:
|
||||
bid, rbyd, path_ = r
|
||||
else:
|
||||
bid, rbyd = r
|
||||
|
||||
if path:
|
||||
yield rbyd, [(self.mid(-1), gstate_)]+path_
|
||||
else:
|
||||
yield rbyd
|
||||
|
||||
# common file operations, note Reg extends this for regular files
|
||||
class File:
|
||||
tag = None
|
||||
|
||||
Reference in New Issue
Block a user