diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-10-15 07:04:27 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-10-15 07:05:08 +0200 |
commit | 187248696e4398d00e703d97bdf8cd281bb79a05 (patch) | |
tree | ce682278dbc5471686ad454be4f309d3cf51a701 /lbup | |
parent | 0fa705c1171557e59f0c35eb14e42f7d5efec326 (diff) |
_mountinfo: add parent reference to mounts
Diffstat (limited to 'lbup')
-rw-r--r-- | lbup/_mountinfo.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lbup/_mountinfo.py b/lbup/_mountinfo.py index 35be209..973e135 100644 --- a/lbup/_mountinfo.py +++ b/lbup/_mountinfo.py @@ -48,6 +48,9 @@ class _MountEntry: raw_entry = None "raw mountinfo line, bytes" + parent = None + "parent mountinfo entry, None if it does not exit" + def __init__(self, line): self.raw_entry = line @@ -118,6 +121,13 @@ class MountInfo: self.mounts = mounts + for e in mounts.values(): + try: + e.parent = mounts[e.parent_id] + except KeyError: + pass + + def __str__(self): return '%s(%d entries)' % (self.__class__.__name__, len(self.mounts)) |