]> xenbits.xensource.com Git - people/aperard/libvirt.git/commitdiff
qemuMonitorJSONQueryRxFilter: Allow @filter to be NULL
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 5 Dec 2023 13:39:58 +0000 (14:39 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 6 Dec 2023 11:30:10 +0000 (12:30 +0100)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor_json.c

index ec586b9036bcb6e8c69046ae38c8fdece18775d0..dfad4ee1ea32dcd8eedd64fae86fe950771e6879 100644 (file)
@@ -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)
index a9133793f6a06c24c05829487a7751ea13c9089e..1574723624784d38fbaf3650693e0c2c0b417ca8 100644 (file)
@@ -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;