619821
From 43d3585ba869c97c46cffc3c9fd7e46885d539c0 Mon Sep 17 00:00:00 2001
619821
From: Miroslav Rezanina <mrezanin@redhat.com>
619821
Date: Thu, 9 Mar 2017 06:12:05 +0100
619821
Subject: [PATCH 17/17] spice: replace use of deprecated API
619821
MIME-Version: 1.0
619821
Content-Type: text/plain; charset=UTF-8
619821
Content-Transfer-Encoding: 8bit
619821
619821
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
619821
Message-id: <4696b589a948f544ea081abeb496cb383a466020.1489039263.git.mrezanin@redhat.com>
619821
Patchwork-id: 74259
619821
O-Subject: [RHEL-7.4 qemu-kvm PATCH 2/2] spice: replace use of deprecated API
619821
Bugzilla: 1430606
619821
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
619821
RH-Acked-by: Marc-André Lureau <mlureau@redhat.com>
619821
RH-Acked-by: David Hildenbrand <david@redhat.com>
619821
619821
From: Marc-André Lureau <marcandre.lureau@gmail.com>
619821
619821
hose API are deprecated since 0.11, and qemu depends on 0.12 already.
619821
619821
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
619821
(cherry picked from commit 26defe81f6a878f33e0aaeb1df4d0d7022c929ca)
619821
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
619821
---
619821
 hw/display/qxl.c   | 16 ++++++++--------
619821
 ui/spice-core.c    | 15 +++++++--------
619821
 ui/spice-display.c | 10 +++++-----
619821
 3 files changed, 20 insertions(+), 21 deletions(-)
619821
619821
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
619821
index c76c237..0a755df 100644
619821
--- a/hw/display/qxl.c
619821
+++ b/hw/display/qxl.c
619821
@@ -162,7 +162,7 @@ void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id,
619821
     trace_qxl_spice_update_area_rest(qxl->id, num_dirty_rects,
619821
                                      clear_dirty_region);
619821
     if (async == QXL_SYNC) {
619821
-        qxl->ssd.worker->update_area(qxl->ssd.worker, surface_id, area,
619821
+        spice_qxl_update_area(&qxl->ssd.qxl, surface_id, area,
619821
                         dirty_rects, num_dirty_rects, clear_dirty_region);
619821
     } else {
619821
         assert(cookie != NULL);
619821
@@ -193,7 +193,7 @@ static void qxl_spice_destroy_surface_wait(PCIQXLDevice *qxl, uint32_t id,
619821
         cookie->u.surface_id = id;
619821
         spice_qxl_destroy_surface_async(&qxl->ssd.qxl, id, (uintptr_t)cookie);
619821
     } else {
619821
-        qxl->ssd.worker->destroy_surface_wait(qxl->ssd.worker, id);
619821
+        spice_qxl_destroy_surface_wait(&qxl->ssd.qxl, id);
619821
         qxl_spice_destroy_surface_wait_complete(qxl, id);
619821
     }
619821
 }
619821
@@ -211,19 +211,19 @@ void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext,
619821
                                uint32_t count)
619821
 {
619821
     trace_qxl_spice_loadvm_commands(qxl->id, ext, count);
619821
-    qxl->ssd.worker->loadvm_commands(qxl->ssd.worker, ext, count);
619821
+    spice_qxl_loadvm_commands(&qxl->ssd.qxl, ext, count);
619821
 }
619821
 
619821
 void qxl_spice_oom(PCIQXLDevice *qxl)
619821
 {
619821
     trace_qxl_spice_oom(qxl->id);
619821
-    qxl->ssd.worker->oom(qxl->ssd.worker);
619821
+    spice_qxl_oom(&qxl->ssd.qxl);
619821
 }
619821
 
619821
 void qxl_spice_reset_memslots(PCIQXLDevice *qxl)
619821
 {
619821
     trace_qxl_spice_reset_memslots(qxl->id);
619821
-    qxl->ssd.worker->reset_memslots(qxl->ssd.worker);
619821
+    spice_qxl_reset_memslots(&qxl->ssd.qxl);
619821
 }
619821
 
619821
 static void qxl_spice_destroy_surfaces_complete(PCIQXLDevice *qxl)
619821
@@ -244,7 +244,7 @@ static void qxl_spice_destroy_surfaces(PCIQXLDevice *qxl, qxl_async_io async)
619821
                 (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO,
619821
                                           QXL_IO_DESTROY_ALL_SURFACES_ASYNC));
619821
     } else {
619821
-        qxl->ssd.worker->destroy_surfaces(qxl->ssd.worker);
619821
+        spice_qxl_destroy_surfaces(&qxl->ssd.qxl);
619821
         qxl_spice_destroy_surfaces_complete(qxl);
619821
     }
619821
 }
619821
@@ -283,13 +283,13 @@ static void qxl_spice_monitors_config_async(PCIQXLDevice *qxl, int replay)
619821
 void qxl_spice_reset_image_cache(PCIQXLDevice *qxl)
619821
 {
619821
     trace_qxl_spice_reset_image_cache(qxl->id);
619821
-    qxl->ssd.worker->reset_image_cache(qxl->ssd.worker);
619821
+    spice_qxl_reset_image_cache(&qxl->ssd.qxl);
619821
 }
619821
 
619821
 void qxl_spice_reset_cursor(PCIQXLDevice *qxl)
619821
 {
619821
     trace_qxl_spice_reset_cursor(qxl->id);
619821
-    qxl->ssd.worker->reset_cursor(qxl->ssd.worker);
619821
+    spice_qxl_reset_cursor(&qxl->ssd.qxl);
619821
     qemu_mutex_lock(&qxl->track_lock);
619821
     qxl->guest_cursor = 0;
619821
     qemu_mutex_unlock(&qxl->track_lock);
619821
diff --git a/ui/spice-core.c b/ui/spice-core.c
619821
index 0585267..0cd60f3 100644
619821
--- a/ui/spice-core.c
619821
+++ b/ui/spice-core.c
619821
@@ -383,17 +383,16 @@ static SpiceChannelList *qmp_query_spice_channels(void)
619821
         struct sockaddr *paddr;
619821
         socklen_t plen;
619821
 
619821
+        if (!(item->info->flags & SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT)) {
619821
+            error_report("invalid channel event");
619821
+            return NULL;
619821
+        }
619821
+
619821
         chan = g_malloc0(sizeof(*chan));
619821
         chan->value = g_malloc0(sizeof(*chan->value));
619821
 
619821
-        if (item->info->flags & SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT) {
619821
-            paddr = (struct sockaddr *)&item->info->paddr_ext;
619821
-            plen = item->info->plen_ext;
619821
-        } else {
619821
-            paddr = &item->info->paddr;
619821
-            plen = item->info->plen;
619821
-        }
619821
-
619821
+        paddr = (struct sockaddr *)&item->info->paddr_ext;
619821
+        plen = item->info->plen_ext;
619821
         getnameinfo(paddr, plen,
619821
                     host, sizeof(host), port, sizeof(port),
619821
                     NI_NUMERICHOST | NI_NUMERICSERV);
619821
diff --git a/ui/spice-display.c b/ui/spice-display.c
619821
index d29d2ab..e2c24a9 100644
619821
--- a/ui/spice-display.c
619821
+++ b/ui/spice-display.c
619821
@@ -83,14 +83,14 @@ void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot,
619821
                 (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO,
619821
                                           QXL_IO_MEMSLOT_ADD_ASYNC));
619821
     } else {
619821
-        ssd->worker->add_memslot(ssd->worker, memslot);
619821
+        spice_qxl_add_memslot(&ssd->qxl, memslot);
619821
     }
619821
 }
619821
 
619821
 void qemu_spice_del_memslot(SimpleSpiceDisplay *ssd, uint32_t gid, uint32_t sid)
619821
 {
619821
     trace_qemu_spice_del_memslot(ssd->qxl.id, gid, sid);
619821
-    ssd->worker->del_memslot(ssd->worker, gid, sid);
619821
+    spice_qxl_del_memslot(&ssd->qxl, gid, sid);
619821
 }
619821
 
619821
 void qemu_spice_create_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id,
619821
@@ -103,7 +103,7 @@ void qemu_spice_create_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id,
619821
                 (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO,
619821
                                           QXL_IO_CREATE_PRIMARY_ASYNC));
619821
     } else {
619821
-        ssd->worker->create_primary_surface(ssd->worker, id, surface);
619821
+        spice_qxl_create_primary_surface(&ssd->qxl, id, surface);
619821
     }
619821
 }
619821
 
619821
@@ -116,14 +116,14 @@ void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd,
619821
                 (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO,
619821
                                           QXL_IO_DESTROY_PRIMARY_ASYNC));
619821
     } else {
619821
-        ssd->worker->destroy_primary_surface(ssd->worker, id);
619821
+        spice_qxl_destroy_primary_surface(&ssd->qxl, id);
619821
     }
619821
 }
619821
 
619821
 void qemu_spice_wakeup(SimpleSpiceDisplay *ssd)
619821
 {
619821
     trace_qemu_spice_wakeup(ssd->qxl.id);
619821
-    ssd->worker->wakeup(ssd->worker);
619821
+    spice_qxl_wakeup(&ssd->qxl);
619821
 }
619821
 
619821
 static void qemu_spice_create_one_update(SimpleSpiceDisplay *ssd,
619821
-- 
619821
1.8.3.1
619821