Now that we don't use it for probing at all we can remove all the corresponding monitor code. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_monitor.c | 12 -------- src/qemu/qemu_monitor.h | 2 -- src/qemu/qemu_monitor_json.c | 44 --------------------------- src/qemu/qemu_monitor_json.h | 5 --- tests/qemumonitorjsontest.c | 59 ------------------------------------ 5 files changed, 122 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 73a019e732..c680c4b804 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3308,18 +3308,6 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig) } -int -qemuMonitorGetCommands(qemuMonitor *mon, - char ***commands) -{ - VIR_DEBUG("commands=%p", commands); - - QEMU_CHECK_MONITOR(mon); - - return qemuMonitorJSONGetCommands(mon, commands); -} - - GHashTable * qemuMonitorGetCommandLineOptions(qemuMonitor *mon) { diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 8f1bfc702a..6c590933aa 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1171,8 +1171,6 @@ int qemuMonitorGetCPUModelComparison(qemuMonitor *mon, qemuMonitorCPUModelInfo * qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig); -int qemuMonitorGetCommands(qemuMonitor *mon, - char ***commands); GHashTable *qemuMonitorGetCommandLineOptions(qemuMonitor *mon); int qemuMonitorGetKVMState(qemuMonitor *mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 2ece33a651..d9e9a4481c 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5256,50 +5256,6 @@ qemuMonitorJSONGetCPUModelComparison(qemuMonitor *mon, } -int qemuMonitorJSONGetCommands(qemuMonitor *mon, - char ***commands) -{ - g_autoptr(virJSONValue) cmd = NULL; - g_autoptr(virJSONValue) reply = NULL; - virJSONValue *data; - g_auto(GStrv) commandlist = NULL; - size_t n = 0; - size_t i; - - *commands = NULL; - - if (!(cmd = qemuMonitorJSONMakeCommand("query-commands", NULL))) - return -1; - - if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - return -1; - - if (!(data = qemuMonitorJSONGetReply(cmd, reply, VIR_JSON_TYPE_ARRAY))) - return -1; - - n = virJSONValueArraySize(data); - - /* null-terminated list */ - commandlist = g_new0(char *, n + 1); - - for (i = 0; i < n; i++) { - virJSONValue *child = virJSONValueArrayGet(data, i); - const char *tmp; - - if (!(tmp = virJSONValueObjectGetString(child, "name"))) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("query-commands reply data was missing 'name'")); - return -1; - } - - commandlist[i] = g_strdup(tmp); - } - - *commands = g_steal_pointer(&commandlist); - return n; -} - - static int qemuMonitorJSONGetCommandLineOptionsWorker(size_t pos G_GNUC_UNUSED, virJSONValue *item, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 802f6e7b44..06023b98ea 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -472,11 +472,6 @@ qemuMonitorJSONGetCPUModelComparison(qemuMonitor *mon, char **result) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); -int -qemuMonitorJSONGetCommands(qemuMonitor *mon, - char ***commands) - ATTRIBUTE_NONNULL(2); - GHashTable * qemuMonitorJSONGetCommandLineOptions(qemuMonitor *mon); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 8ef4ea7056..4672b0a8ff 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -491,64 +491,6 @@ testQemuMonitorJSONGetCPUDefinitions(const void *opaque) } -static int -testQemuMonitorJSONGetCommands(const void *opaque) -{ - const testGenericData *data = opaque; - virDomainXMLOption *xmlopt = data->xmlopt; - g_auto(GStrv) commands = NULL; - int ncommands = 0; - g_autoptr(qemuMonitorTest) test = NULL; - - if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema))) - return -1; - - if (qemuMonitorTestAddItem(test, "query-commands", - "{ " - " \"return\": [ " - " { " - " \"name\": \"system_wakeup\" " - " }, " - " { " - " \"name\": \"cont\" " - " }, " - " { " - " \"name\": \"quit\" " - " } " - " ]" - "}") < 0) - return -1; - - if ((ncommands = qemuMonitorGetCommands(qemuMonitorTestGetMonitor(test), - &commands)) < 0) - return -1; - - if (ncommands != 3) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "ncommands %d is not 3", ncommands); - return -1; - } - -#define CHECK(i, wantname) \ - do { \ - if (STRNEQ(commands[i], (wantname))) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "name %s is not %s", \ - commands[i], (wantname)); \ - return -1; \ - } \ - } while (0) - - CHECK(0, "system_wakeup"); - CHECK(1, "cont"); - CHECK(2, "quit"); - -#undef CHECK - - return 0; -} - - static int testQemuMonitorJSONGetTPMModels(const void *opaque) { @@ -2888,7 +2830,6 @@ mymain(void) DO_TEST(GetVersion); DO_TEST(GetMachines); DO_TEST(GetCPUDefinitions); - DO_TEST(GetCommands); DO_TEST(GetTPMModels); if (qemuMonitorJSONTestAttachChardev(driver.xmlopt, qapiData.schema) < 0) ret = -1; -- 2.41.0