From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WficO-0002SR-Jo for qemu-devel@nongnu.org; Thu, 01 May 2014 00:29:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WficF-0002Rn-Hd for qemu-devel@nongnu.org; Thu, 01 May 2014 00:29:08 -0400 Received: from mail-ig0-x234.google.com ([2607:f8b0:4001:c05::234]:64382) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WficF-0002Ri-AU for qemu-devel@nongnu.org; Thu, 01 May 2014 00:28:59 -0400 Received: by mail-ig0-f180.google.com with SMTP id c1so87925igq.13 for ; Wed, 30 Apr 2014 21:28:58 -0700 (PDT) From: Wenchao Xia Date: Wed, 30 Apr 2014 21:26:59 -0700 Message-Id: <1398918422-3019-26-git-send-email-wenchaoqemu@gmail.com> In-Reply-To: <1398918422-3019-1-git-send-email-wenchaoqemu@gmail.com> References: <1398918422-3019-1-git-send-email-wenchaoqemu@gmail.com> Subject: [Qemu-devel] [PATCH V5 25/28] qapi event: convert BALLOON_CHANGE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mdroth@linux.vnet.ibm.com, armbru@redhat.com, Wenchao Xia , lcapitulino@redhat.com Signed-off-by: Wenchao Xia --- balloon.c | 13 ------------- hw/virtio/virtio-balloon.c | 6 ++++-- include/sysemu/balloon.h | 2 -- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/balloon.c b/balloon.c index e321f2c..b70da4f 100644 --- a/balloon.c +++ b/balloon.c @@ -81,19 +81,6 @@ static int qemu_balloon_status(BalloonInfo *info) return 1; } -void qemu_balloon_changed(int64_t actual) -{ - QObject *data; - - data = qobject_from_jsonf("{ 'actual': %" PRId64 " }", - actual); - - monitor_protocol_event(QEVENT_BALLOON_CHANGE, data); - - qobject_decref(data); -} - - BalloonInfo *qmp_query_balloon(Error **errp) { BalloonInfo *info; diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index a470a0b..6af21a7 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -24,6 +24,7 @@ #include "sysemu/kvm.h" #include "exec/address-spaces.h" #include "qapi/visitor.h" +#include "qapi-event.h" #if defined(__linux__) #include @@ -275,8 +276,9 @@ static void virtio_balloon_set_config(VirtIODevice *vdev, memcpy(&config, config_data, sizeof(struct virtio_balloon_config)); dev->actual = le32_to_cpu(config.actual); if (dev->actual != oldactual) { - qemu_balloon_changed(ram_size - - ((ram_addr_t) dev->actual << VIRTIO_BALLOON_PFN_SHIFT)); + qapi_event_send_balloon_change(ram_size - + ((ram_addr_t) dev->actual << VIRTIO_BALLOON_PFN_SHIFT), + NULL); } } diff --git a/include/sysemu/balloon.h b/include/sysemu/balloon.h index bd9d395..0345e01 100644 --- a/include/sysemu/balloon.h +++ b/include/sysemu/balloon.h @@ -24,6 +24,4 @@ int qemu_add_balloon_handler(QEMUBalloonEvent *event_func, QEMUBalloonStatus *stat_func, void *opaque); void qemu_remove_balloon_handler(void *opaque); -void qemu_balloon_changed(int64_t actual); - #endif -- 1.7.1