diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-10-16 16:42:27 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-10-16 16:42:27 +0200 |
commit | c8dbad5856170e32554db2345acd43c2bb0bd729 (patch) | |
tree | 5cdacbafc9c315cc138c5e7ca3f56903c01203ad /lbup | |
parent | 5104d016a178a0ad1938bd15baaa1170fede6a89 (diff) |
Track each entry's index.
Diffstat (limited to 'lbup')
-rw-r--r-- | lbup/_mountinfo.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lbup/_mountinfo.py b/lbup/_mountinfo.py index 0328131..d2640ce 100644 --- a/lbup/_mountinfo.py +++ b/lbup/_mountinfo.py @@ -24,6 +24,8 @@ class NotAbsRoot(Exception): pass class _MountEntry: + index = None + "index of this entry in mountinfo" mount_id = None "mount ID, bytes" parent_id = None @@ -51,7 +53,8 @@ class _MountEntry: parent = None "parent mountinfo entry, None if it does not exit" - def __init__(self, line): + def __init__(self, index, line): + self.index = index self.raw_entry = line items = line.split() @@ -111,9 +114,9 @@ class MountInfo: def __init__(self, data): mounts = OrderedDict() - for line in data.splitlines(): + for i, line in enumerate(data.splitlines()): try: - e = _MountEntry(line) + e = _MountEntry(i, line) except NotAbsRoot: pass |