[Pdbg] [PATCH v4 07/30] libpdbg: Add a function to check if a target is virtual

Amitay Isaacs amitay at ozlabs.org
Thu Oct 3 14:18:46 AEST 2019


All targets without "compatible" property are treated as virtual targets.

Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 libpdbg/target.c | 6 ++++++
 libpdbg/target.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/libpdbg/target.c b/libpdbg/target.c
index f803ab2..9110b81 100644
--- a/libpdbg/target.c
+++ b/libpdbg/target.c
@@ -467,3 +467,9 @@ void pdbg_target_priv_set(struct pdbg_target *target, void *priv)
 {
 	target->priv = priv;
 }
+
+/* For virtual nodes, compatible property is not set */
+bool target_is_virtual(struct pdbg_target *target)
+{
+	return (!target->compatible);
+}
diff --git a/libpdbg/target.h b/libpdbg/target.h
index 71ffd2f..f5769ea 100644
--- a/libpdbg/target.h
+++ b/libpdbg/target.h
@@ -64,5 +64,6 @@ extern struct list_head target_classes;
 const char *pdbg_get_backend_option(void);
 
 struct sbefifo *pib_to_sbefifo(struct pdbg_target *target);
+bool target_is_virtual(struct pdbg_target *target);
 
 #endif
-- 
2.21.0



More information about the Pdbg mailing list