diff options
author | Karel Zak | 2018-10-23 14:04:55 +0200 |
---|---|---|
committer | Karel Zak | 2018-12-07 12:33:34 +0100 |
commit | 0986f29a3f7c48f86eb3241f94077ba1c52331fa (patch) | |
tree | 3fe31ba9f96172fb3af616c6660a1dd2b905f3d2 /misc-utils/lsblk.h | |
parent | docs: add lsblk --merge to TODO (diff) | |
download | kernel-qcow2-util-linux-0986f29a3f7c48f86eb3241f94077ba1c52331fa.tar.gz kernel-qcow2-util-linux-0986f29a3f7c48f86eb3241f94077ba1c52331fa.tar.xz kernel-qcow2-util-linux-0986f29a3f7c48f86eb3241f94077ba1c52331fa.zip |
lsblk: make devtree dependences more generic
We also need reference from child to parent to implement multi-parent
view. This change allows to walk on tree in both directions.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/lsblk.h')
-rw-r--r-- | misc-utils/lsblk.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/misc-utils/lsblk.h b/misc-utils/lsblk.h index 236c84934..8f8a89dfd 100644 --- a/misc-utils/lsblk.h +++ b/misc-utils/lsblk.h @@ -21,6 +21,7 @@ #define LSBLK_DEBUG_FILTER (1 << 2) #define LSBLK_DEBUG_DEV (1 << 3) #define LSBLK_DEBUG_TREE (1 << 4) +#define LSBLK_DEBUG_DEP (1 << 5) #define LSBLK_DEBUG_ALL 0xFFFF UL_DEBUG_DECLARE_MASK(lsblk); @@ -75,14 +76,18 @@ struct lsblk_devprop { * means we need to allocate list member rather than use @child directly. */ struct lsblk_devdep { - struct list_head ls_deps; /* item in parent->deps */ + struct list_head ls_childs; /* item in parent->childs */ + struct list_head ls_parents; /* item in child->parents */ + struct lsblk_device *child; + struct lsblk_device *parent; }; struct lsblk_device { int refcount; - struct list_head deps; /* list with lsblk_devdep */ + struct list_head childs; /* list with lsblk_devdep */ + struct list_head parents; struct list_head ls_roots; /* item in devtree->roots list */ struct list_head ls_devices; /* item in devtree->devices list */ @@ -186,7 +191,7 @@ struct lsblk_device *lsblk_new_device(void); void lsblk_ref_device(struct lsblk_device *dev); void lsblk_unref_device(struct lsblk_device *dev); int lsblk_device_new_dependence(struct lsblk_device *parent, struct lsblk_device *child); -int lsblk_device_has_dependence(struct lsblk_device *dev, struct lsblk_device *child); +int lsblk_device_has_child(struct lsblk_device *dev, struct lsblk_device *child); int lsblk_device_next_child(struct lsblk_device *dev, struct lsblk_iter *itr, struct lsblk_device **child); |