[libvirt] [PATCH 04/13] qemu: monitor: Kill legacy USB monitor code

Peter Krempa pkrempa at redhat.com
Tue Apr 26 13:37:37 UTC 2016


Code was obsoleted by using -device.
---
 src/qemu/qemu_monitor.c      | 47 ---------------------
 src/qemu/qemu_monitor.h      | 14 -------
 src/qemu/qemu_monitor_json.c | 29 -------------
 src/qemu/qemu_monitor_json.h | 11 -----
 src/qemu/qemu_monitor_text.c | 99 --------------------------------------------
 src/qemu/qemu_monitor_text.h | 11 -----
 6 files changed, 211 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index fe8e89f..2ec4222 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2405,53 +2405,6 @@ qemuMonitorGraphicsRelocate(qemuMonitorPtr mon,


 int
-qemuMonitorAddUSBDisk(qemuMonitorPtr mon,
-                      const char *path)
-{
-    VIR_DEBUG("path=%s", path);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    if (mon->json)
-        return qemuMonitorJSONAddUSBDisk(mon, path);
-    else
-        return qemuMonitorTextAddUSBDisk(mon, path);
-}
-
-
-int
-qemuMonitorAddUSBDeviceExact(qemuMonitorPtr mon,
-                             int bus,
-                             int dev)
-{
-    VIR_DEBUG("bus=%d dev=%d", bus, dev);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    if (mon->json)
-        return qemuMonitorJSONAddUSBDeviceExact(mon, bus, dev);
-    else
-        return qemuMonitorTextAddUSBDeviceExact(mon, bus, dev);
-}
-
-
-int
-qemuMonitorAddUSBDeviceMatch(qemuMonitorPtr mon,
-                             int vendor,
-                             int product)
-{
-    VIR_DEBUG("vendor=%d product=%d", vendor, product);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    if (mon->json)
-        return qemuMonitorJSONAddUSBDeviceMatch(mon, vendor, product);
-    else
-        return qemuMonitorTextAddUSBDeviceMatch(mon, vendor, product);
-}
-
-
-int
 qemuMonitorAddPCIHostDevice(qemuMonitorPtr mon,
                             virDevicePCIAddress *hostAddr,
                             virDevicePCIAddress *guestAddr)
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 470c729..7825781 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -628,20 +628,6 @@ int qemuMonitorGraphicsRelocate(qemuMonitorPtr mon,
                                 int tlsPort,
                                 const char *tlsSubject);

-/* XXX disk driver type eg,  qcow/etc.
- * XXX cache mode
- */
-int qemuMonitorAddUSBDisk(qemuMonitorPtr mon,
-                          const char *path);
-
-int qemuMonitorAddUSBDeviceExact(qemuMonitorPtr mon,
-                                 int bus,
-                                 int dev);
-int qemuMonitorAddUSBDeviceMatch(qemuMonitorPtr mon,
-                                 int vendor,
-                                 int product);
-
-
 int qemuMonitorAddPCIHostDevice(qemuMonitorPtr mon,
                                 virDevicePCIAddress *hostAddr,
                                 virDevicePCIAddress *guestAddr);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 7bb9976..5092548 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -3032,35 +3032,6 @@ int qemuMonitorJSONGraphicsRelocate(qemuMonitorPtr mon,
 }


-int qemuMonitorJSONAddUSBDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
-                              const char *path ATTRIBUTE_UNUSED)
-{
-    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("usb_add not supported in JSON mode"));
-    return -1;
-}
-
-
-int qemuMonitorJSONAddUSBDeviceExact(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
-                                     int bus ATTRIBUTE_UNUSED,
-                                     int dev ATTRIBUTE_UNUSED)
-{
-    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("usb_add not supported in JSON mode"));
-    return -1;
-}
-
-
-int qemuMonitorJSONAddUSBDeviceMatch(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
-                                     int vendor ATTRIBUTE_UNUSED,
-                                     int product ATTRIBUTE_UNUSED)
-{
-    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("usb_add not supported in JSON mode"));
-    return -1;
-}
-
-
 int qemuMonitorJSONAddPCIHostDevice(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
                                     virDevicePCIAddress *hostAddr ATTRIBUTE_UNUSED,
                                     virDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 8b5d422..81247f4 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -169,17 +169,6 @@ int qemuMonitorJSONGraphicsRelocate(qemuMonitorPtr mon,
                                     int tlsPort,
                                     const char *tlsSubject);

-int qemuMonitorJSONAddUSBDisk(qemuMonitorPtr mon,
-                              const char *path);
-
-int qemuMonitorJSONAddUSBDeviceExact(qemuMonitorPtr mon,
-                                     int bus,
-                                     int dev);
-int qemuMonitorJSONAddUSBDeviceMatch(qemuMonitorPtr mon,
-                                     int vendor,
-                                     int product);
-
-
 int qemuMonitorJSONAddPCIHostDevice(qemuMonitorPtr mon,
                                     virDevicePCIAddress *hostAddr,
                                     virDevicePCIAddress *guestAddr);
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index ccae02f..707addc 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -1572,105 +1572,6 @@ int qemuMonitorTextGraphicsRelocate(qemuMonitorPtr mon,
 }


-int qemuMonitorTextAddUSBDisk(qemuMonitorPtr mon,
-                              const char *path)
-{
-    char *cmd = NULL;
-    char *safepath;
-    int ret = -1;
-    char *info = NULL;
-
-    safepath = qemuMonitorEscapeArg(path);
-    if (!safepath)
-        return -1;
-
-    if (virAsprintf(&cmd, "usb_add disk:%s", safepath) < 0)
-        goto cleanup;
-
-    if (qemuMonitorHMPCommand(mon, cmd, &info) < 0)
-        goto cleanup;
-
-    /* If the command failed qemu prints:
-     * Could not add ... */
-    if (strstr(info, "Could not add ")) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("unable to add USB disk %s: %s"), path, info);
-        goto cleanup;
-    }
-
-    ret = 0;
-
- cleanup:
-    VIR_FREE(cmd);
-    VIR_FREE(safepath);
-    VIR_FREE(info);
-    return ret;
-}
-
-
-static int qemuMonitorTextAddUSBDevice(qemuMonitorPtr mon,
-                                       const char *addr)
-{
-    char *cmd;
-    char *reply = NULL;
-    int ret = -1;
-
-    if (virAsprintf(&cmd, "usb_add %s", addr) < 0)
-        return -1;
-
-    if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    /* If the command failed qemu prints:
-     * Could not add ... */
-    if (strstr(reply, "Could not add ")) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       "%s", _("adding usb device failed"));
-        goto cleanup;
-    }
-
-    ret = 0;
-
- cleanup:
-    VIR_FREE(cmd);
-    VIR_FREE(reply);
-    return ret;
-}
-
-
-int qemuMonitorTextAddUSBDeviceExact(qemuMonitorPtr mon,
-                                     int bus,
-                                     int dev)
-{
-    int ret;
-    char *addr;
-
-    if (virAsprintf(&addr, "host:%.3d.%.3d", bus, dev) < 0)
-        return -1;
-
-    ret = qemuMonitorTextAddUSBDevice(mon, addr);
-
-    VIR_FREE(addr);
-    return ret;
-}
-
-int qemuMonitorTextAddUSBDeviceMatch(qemuMonitorPtr mon,
-                                     int vendor,
-                                     int product)
-{
-    int ret;
-    char *addr;
-
-    if (virAsprintf(&addr, "host:%.4x:%.4x", vendor, product) < 0)
-        return -1;
-
-    ret = qemuMonitorTextAddUSBDevice(mon, addr);
-
-    VIR_FREE(addr);
-    return ret;
-}
-
-
 static int
 qemuMonitorTextParsePCIAddReply(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
                                 const char *reply,
diff --git a/src/qemu/qemu_monitor_text.h b/src/qemu/qemu_monitor_text.h
index 287a851..d62e668 100644
--- a/src/qemu/qemu_monitor_text.h
+++ b/src/qemu/qemu_monitor_text.h
@@ -119,17 +119,6 @@ int qemuMonitorTextGraphicsRelocate(qemuMonitorPtr mon,
                                     int tlsPort,
                                     const char *tlsSubject);

-int qemuMonitorTextAddUSBDisk(qemuMonitorPtr mon,
-                              const char *path);
-
-int qemuMonitorTextAddUSBDeviceExact(qemuMonitorPtr mon,
-                                     int bus,
-                                     int dev);
-int qemuMonitorTextAddUSBDeviceMatch(qemuMonitorPtr mon,
-                                     int vendor,
-                                     int product);
-
-
 int qemuMonitorTextAddPCIHostDevice(qemuMonitorPtr mon,
                                     virDevicePCIAddress *hostAddr,
                                     virDevicePCIAddress *guestAddr);
-- 
2.8.1




More information about the libvir-list mailing list