[Pdbg] [PATCH 2/4] path: Check if all specified class targets are selected

Amitay Isaacs amitay at ozlabs.org
Fri Aug 9 13:20:22 AEST 2019


Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 src/path.c | 15 +++++++++++++++
 src/path.h |  9 +++++++++
 2 files changed, 24 insertions(+)

diff --git a/src/path.c b/src/path.c
index a80a288..a0eb666 100644
--- a/src/path.c
+++ b/src/path.c
@@ -321,6 +321,21 @@ bool path_target_selected(struct pdbg_target *target)
 	return false;
 }
 
+bool path_target_all_selected(const char *classname, struct pdbg_target *parent)
+{
+	struct pdbg_target *target;
+
+	if (!parent)
+		parent = pdbg_target_root();
+
+	pdbg_for_each_target(classname, parent, target) {
+		if (!path_target_selected(target))
+			return false;
+	}
+
+	return true;
+}
+
 void path_target_dump(void)
 {
 	struct pdbg_target *target;
diff --git a/src/path.h b/src/path.h
index c3c20c0..3eb1447 100644
--- a/src/path.h
+++ b/src/path.h
@@ -50,6 +50,15 @@ bool path_target_add(struct pdbg_target *target);
  */
 bool path_target_selected(struct pdbg_target *target);
 
+/**
+ * @brief Check if all the targets of specific class are selected
+ *
+ * @param[in]  classname Class name
+ * @param[in]  parent Parent target
+ * @return true if all the targets are selected, false otherwise
+ */
+bool path_target_all_selected(const char *classname, struct pdbg_target *parent);
+
 /**
  * @brief Print the list of path targets to stdout
  */
-- 
2.21.0



More information about the Pdbg mailing list