[PATCH 1/2] qemuMonitorJSONQueryRxFilter: Allow @filter to be NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sometimes it may be handy to just issue the query-rx-filter
monitor command without actually parsing the output. Adapt
qemuMonitorJSONQueryRxFilter() to this behavior.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_monitor.c      | 12 ++++++++++++
 src/qemu/qemu_monitor_json.c |  3 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index ec586b9036..dfad4ee1ea 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2536,6 +2536,18 @@ qemuMonitorRemoveNetdev(qemuMonitor *mon,
 }
 
 
+/**
+ * qemuMonitorQueryRxFilter:
+ * @mon: monitor object
+ * @alias: alias of the network interface
+ * @filter: where to store the result (can be NULL)
+ *
+ * Issues query-rx-filter command for given device (@alias) and stores parsed
+ * output at @filter (if not NULL). If @filter is NULL, the command is executed
+ * but nothing is parsed.
+ *
+ * Returns 0 on success, -1 otherwise.
+ */
 int
 qemuMonitorQueryRxFilter(qemuMonitor *mon, const char *alias,
                          virNetDevRxFilter **filter)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index a9133793f6..1574723624 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -3753,7 +3753,8 @@ qemuMonitorJSONQueryRxFilter(qemuMonitor *mon, const char *alias,
     if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0)
         return -1;
 
-    if (qemuMonitorJSONQueryRxFilterParse(reply, filter) < 0)
+    if (filter &&
+        qemuMonitorJSONQueryRxFilterParse(reply, filter) < 0)
         return -1;
 
     return 0;
-- 
2.41.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux