Received: from eggs.gnu.org ([2001:4830:134:3::10]:58531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRIwt-00062o-0C for qemu-devel@nongnu.org; Thu, 04 Feb 2016 07:23:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRIwo-0008Ne-QY for qemu-devel@nongnu.org; Thu, 04 Feb 2016 07:23:46 -0500 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:47270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRIwo-0008Lo-IX for qemu-devel@nongnu.org; Thu, 04 Feb 2016 07:23:42 -0500 Received: from localhost by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 Feb 2016 12:23:39 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id F125B17D8059 for ; Thu, 4 Feb 2016 12:23:49 +0000 (GMT) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u14CNb0o61931758 for ; Thu, 4 Feb 2016 12:23:37 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u14CNbFl023655 for ; Thu, 4 Feb 2016 05:23:37 -0700 Date: Thu, 4 Feb 2016 13:23:35 +0100 From: Cornelia Huck Message-ID: <20160204132335.16a0db22.cornelia.huck@de.ibm.com> In-Reply-To: <1454585843-20716-5-git-send-email-vsementsov@virtuozzo.com> References: <1454585843-20716-1-git-send-email-vsementsov@virtuozzo.com> <1454585843-20716-5-git-send-email-vsementsov@virtuozzo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/5] virtio-balloon: rewrite get_current_ram_size() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy Cc: Xiao Guangrong , "Michael S. Tsirkin" , Markus Armbruster , qemu-devel@nongnu.org, Stefan Hajnoczi , Igor Mammedov On Thu, 4 Feb 2016 14:37:22 +0300 Vladimir Sementsov-Ogievskiy wrote: > Use pc_dimm_built_list() instead of qmp_pc_dimm_device_list() > > Actually, Qapi is not related to this internal helper. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > > CC: Stefan Hajnoczi > CC: Xiao Guangrong > CC: "Michael S. Tsirkin" > CC: Igor Mammedov > CC: Eric Blake > CC: Markus Armbruster > --- > hw/virtio/virtio-balloon.c | 23 ++++++----------------- > 1 file changed, 6 insertions(+), 17 deletions(-) > > diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c > index 6a4c4d2..b9c1964 100644 > --- a/hw/virtio/virtio-balloon.c > +++ b/hw/virtio/virtio-balloon.c > @@ -296,26 +296,15 @@ static void virtio_balloon_get_config(VirtIODevice *vdev, uint8_t *config_data) > > static ram_addr_t get_current_ram_size(void) > { > - MemoryDeviceInfoList *info_list = NULL; > - MemoryDeviceInfoList **prev = &info_list; > - MemoryDeviceInfoList *info; > + GSList *list = NULL, *item; > ram_addr_t size = ram_size; > > - qmp_pc_dimm_device_list(qdev_get_machine(), &prev); > - for (info = info_list; info; info = info->next) { > - MemoryDeviceInfo *value = info->value; > - > - if (value) { > - switch (value->type) { > - case MEMORY_DEVICE_INFO_KIND_DIMM: > - size += value->u.dimm->size; > - break; > - default: > - break; > - } > - } > + pc_dimm_build_list(qdev_get_machine(), &list); This will break the build for !CONFIG_MEM_HOTPLUG, as you didn't provide a stubbed-out version of this function. > + for (item = list; item; item = g_slist_next(item)) { > + PCDIMMDevice *dimm = item->data; > + size += object_property_get_int(OBJECT(dimm), PC_DIMM_SIZE_PROP, NULL); > } > - qapi_free_MemoryDeviceInfoList(info_list); > + g_slist_free(list); > > return size; > }