Re: [PATCH 47/80] qemu: monitor: Remove unused qemuMonitorDiskNameLookup

2022-08-05 Thread Pavel Hrdina
On Tue, Jul 26, 2022 at 04:37:25PM +0200, Peter Krempa wrote:
> Signed-off-by: Peter Krempa 
> ---
>  src/qemu/qemu_monitor.c  | 14 ---
>  src/qemu/qemu_monitor.h  |  5 ---
>  src/qemu/qemu_monitor_json.c | 77 
>  src/qemu/qemu_monitor_json.h |  8 
>  4 files changed, 104 deletions(-)

Reviewed-by: Pavel Hrdina 


signature.asc
Description: PGP signature


[PATCH 47/80] qemu: monitor: Remove unused qemuMonitorDiskNameLookup

2022-07-26 Thread Peter Krempa
Signed-off-by: Peter Krempa 
---
 src/qemu/qemu_monitor.c  | 14 ---
 src/qemu/qemu_monitor.h  |  5 ---
 src/qemu/qemu_monitor_json.c | 77 
 src/qemu/qemu_monitor_json.h |  8 
 4 files changed, 104 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 15fe6690e9..f7dade5d79 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2929,20 +2929,6 @@ qemuMonitorBlockCommit(qemuMonitor *mon,
 }


-/* Determine the name that qemu is using for tracking the backing
- * element TARGET within the chain starting at TOP.  */
-char *
-qemuMonitorDiskNameLookup(qemuMonitor *mon,
-  const char *device,
-  virStorageSource *top,
-  virStorageSource *target)
-{
-QEMU_CHECK_MONITOR_NULL(mon);
-
-return qemuMonitorJSONDiskNameLookup(mon, device, top, target);
-}
-
-
 /* Use the block-job-complete monitor command to pivot a block copy job.  */
 int
 qemuMonitorDrivePivot(qemuMonitor *mon,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 89b2348775..7374192da2 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1002,11 +1002,6 @@ int qemuMonitorBlockCommit(qemuMonitor *mon,
const char *backingName,
unsigned long long bandwidth)
 ATTRIBUTE_NONNULL(2);
-char *qemuMonitorDiskNameLookup(qemuMonitor *mon,
-const char *device,
-virStorageSource *top,
-virStorageSource *target)
-ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);

 int qemuMonitorArbitraryCommand(qemuMonitor *mon,
 const char *cmd,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e569cf27be..7b6be69aa7 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -4208,83 +4208,6 @@ qemuMonitorJSONBlockCommit(qemuMonitor *mon,
 return 0;
 }

-
-static char *
-qemuMonitorJSONDiskNameLookupOne(virJSONValue *image,
- virStorageSource *top,
- virStorageSource *target)
-{
-virJSONValue *backing;
-char *ret;
-
-/* The caller will report a generic message if we return NULL
- * without an error; but in some cases we can improve by reporting
- * a more specific message.  */
-if (!top || !image)
-return NULL;
-if (top != target) {
-backing = virJSONValueObjectGetObject(image, "backing-image");
-return qemuMonitorJSONDiskNameLookupOne(backing, top->backingStore,
-target);
-}
-ret = g_strdup(virJSONValueObjectGetString(image, "filename"));
-/* Sanity check - the name qemu gave us should resolve to the same
-   file tracked by our target description. */
-if (virStorageSourceIsLocalStorage(target) &&
-STRNEQ(ret, target->path) &&
-!virFileLinkPointsTo(ret, target->path)) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("qemu block name '%s' doesn't match expected '%s'"),
-   ret, target->path);
-VIR_FREE(ret);
-}
-return ret;
-}
-
-
-char *
-qemuMonitorJSONDiskNameLookup(qemuMonitor *mon,
-  const char *device,
-  virStorageSource *top,
-  virStorageSource *target)
-{
-g_autoptr(virJSONValue) devices = NULL;
-size_t i;
-
-if (!(devices = qemuMonitorJSONQueryBlock(mon)))
-return NULL;
-
-for (i = 0; i < virJSONValueArraySize(devices); i++) {
-virJSONValue *dev;
-virJSONValue *inserted;
-virJSONValue *image;
-const char *thisdev;
-
-if (!(dev = qemuMonitorJSONGetBlockDev(devices, i)))
-return NULL;
-
-if (!(thisdev = qemuMonitorJSONGetBlockDevDevice(dev)))
-return NULL;
-
-if (STREQ(thisdev, device)) {
-if ((inserted = virJSONValueObjectGetObject(dev, "inserted")) &&
-(image = virJSONValueObjectGetObject(inserted, "image"))) {
-return qemuMonitorJSONDiskNameLookupOne(image, top, target);
-}
-}
-}
-/* Guarantee an error when returning NULL, but don't override a
- * more specific error if one was already generated.  */
-if (virGetLastErrorCode() == VIR_ERR_OK) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("unable to find backing name for device %s"),
-   device);
-}
-
-return NULL;
-}
-
-
 int qemuMonitorJSONArbitraryCommand(qemuMonitor *mon,
 const char *cmd_str,
 int fd,
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 4f780e02aa..9a0bed0355