[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/13] qgraph: fix qos_node_contains with options
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 02/13] qgraph: fix qos_node_contains with options |
Date: |
Mon, 18 Mar 2019 18:15:10 +0100 |
Currently, if qos_node_contains was passed options, it would still
create an edge without any options. Instead, in that case
NULL acts as a terminator.
Signed-off-by: Paolo Bonzini <address@hidden>
---
tests/libqos/qgraph.c | 12 ++++++++----
tests/libqos/qgraph.h | 15 +++++++++------
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/tests/libqos/qgraph.c b/tests/libqos/qgraph.c
index 122efc1b7b..9f738f1849 100644
--- a/tests/libqos/qgraph.c
+++ b/tests/libqos/qgraph.c
@@ -630,15 +630,19 @@ void qos_node_create_driver(const char *name,
QOSCreateDriverFunc function)
}
void qos_node_contains(const char *container, const char *contained,
- ...)
+ QOSGraphEdgeOptions *opts, ...)
{
va_list va;
- va_start(va, contained);
- QOSGraphEdgeOptions *opts;
+ if (opts == NULL) {
+ add_edge(container, contained, QEDGE_CONTAINS, NULL);
+ return;
+ }
+
+ va_start(va, contained);
do {
- opts = va_arg(va, QOSGraphEdgeOptions *);
add_edge(container, contained, QEDGE_CONTAINS, opts);
+ opts = va_arg(va, QOSGraphEdgeOptions *);
} while (opts != NULL);
va_end(va);
diff --git a/tests/libqos/qgraph.h b/tests/libqos/qgraph.h
index ef0c73837a..ffe009445a 100644
--- a/tests/libqos/qgraph.h
+++ b/tests/libqos/qgraph.h
@@ -457,14 +457,16 @@ void qos_node_create_machine_args(const char *name,
void qos_node_create_driver(const char *name, QOSCreateDriverFunc function);
/**
- * qos_node_contains(): creates an edge of type QEDGE_CONTAINS and
- * adds it to the edge list mapped to @container in the
+ * qos_node_contains(): creates one or more edges of type QEDGE_CONTAINS
+ * and adds them to the edge list mapped to @container in the
* edge hash table.
*
- * This edge will have @container as source and @contained as destination.
+ * The edges will have @container as source and @contained as destination.
*
- * It also has the possibility to add optional NULL-terminated
- * @opts parameters (see %QOSGraphEdgeOptions)
+ * If @opts is NULL, a single edge will be added with no options.
+ * If @opts is non-NULL, the arguments after @contained represent a
+ * NULL-terminated list of %QOSGraphEdgeOptions structs, and an
+ * edge will be added for each of them.
*
* This function can be useful when there are multiple devices
* with the same node name contained in a machine/other node
@@ -484,7 +486,8 @@ void qos_node_create_driver(const char *name,
QOSCreateDriverFunc function);
* For contains, op1.arg and op1.size_arg represent the arg to pass
* to @contained constructor to properly initialize it.
*/
-void qos_node_contains(const char *container, const char *contained, ...);
+void qos_node_contains(const char *container, const char *contained,
+ QOSGraphEdgeOptions *opts, ...);
/**
* qos_node_produces(): creates an edge of type QEDGE_PRODUCES and
--
2.20.1
- [Qemu-devel] [PATCH preliminary for 4.1 00/13] Convert I2C tests to qgraph, Paolo Bonzini, 2019/03/18
- [Qemu-devel] [PATCH 08/13] libqos: convert I2C to qgraph, Paolo Bonzini, 2019/03/18
- [Qemu-devel] [PATCH 09/13] libqos: add ARM n800 machine object, Paolo Bonzini, 2019/03/18
- [Qemu-devel] [PATCH 01/13] qgraph: allow extra_device_opts on bus nodes, Paolo Bonzini, 2019/03/18
- [Qemu-devel] [PATCH 03/13] libqos: move common i2c code to libqos, Paolo Bonzini, 2019/03/18
- [Qemu-devel] [PATCH 13/13] libqos: i2c: move address into QI2CDevice, Paolo Bonzini, 2019/03/18
- [Qemu-devel] [PATCH 11/13] tests: convert OMAP i2c tests to qgraph, Paolo Bonzini, 2019/03/18
- [Qemu-devel] [PATCH 10/13] libqos: add ARM imx25-pdk machine object, Paolo Bonzini, 2019/03/18
- [Qemu-devel] [PATCH 05/13] pca9552-test: do not rely on state across tests, Paolo Bonzini, 2019/03/18
- [Qemu-devel] [PATCH 04/13] libqos: fix omap-i2c receiving more than 4 bytes, Paolo Bonzini, 2019/03/18
- [Qemu-devel] [PATCH 02/13] qgraph: fix qos_node_contains with options,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 12/13] tests: convert ds1338-test to qtest, Paolo Bonzini, 2019/03/18
- [Qemu-devel] [PATCH 06/13] imx25-pdk: create ds1338 for qtest inside the test, Paolo Bonzini, 2019/03/18
- [Qemu-devel] [PATCH 07/13] libqos: split I2CAdapter initialization and allocation, Paolo Bonzini, 2019/03/18
- Re: [Qemu-devel] [PATCH preliminary for 4.1 00/13] Convert I2C tests to qgraph, no-reply, 2019/03/18