From 187248696e4398d00e703d97bdf8cd281bb79a05 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 15 Oct 2023 07:04:27 +0200 Subject: _mountinfo: add parent reference to mounts --- lbup/_mountinfo.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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)) -- cgit v1.2.3