From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org
Cc: vsementsov@virtuozzo.com, guangrong.xiao@linux.intel.com,
mst@redhat.com, armbru@redhat.com, lcapitulino@redhat.com,
stefanha@redhat.com, imammedo@redhat.com,
cornelia.huck@de.ibm.com, den@openvz.org
Subject: [Qemu-devel] [PATCH 4/5] virtio-balloon: rewrite get_current_ram_size()
Date: Wed, 10 Feb 2016 11:49:25 +0300 [thread overview]
Message-ID: <1455094166-7381-5-git-send-email-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <1455094166-7381-1-git-send-email-vsementsov@virtuozzo.com>
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 <vsementsov@virtuozzo.com>
---
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..14aab77 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);
+ for (item = list; item; item = g_slist_next(item)) {
+ Object *obj = OBJECT(item->data);
+ size += object_property_get_int(obj, PC_DIMM_SIZE_PROP, &error_abort);
}
- qapi_free_MemoryDeviceInfoList(info_list);
+ g_slist_free(list);
return size;
}
--
1.8.3.1
next prev parent reply other threads:[~2016-02-10 8:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-10 8:49 [Qemu-devel] [PATCH v7 0/5] don't use NVDIMM for balooning Vladimir Sementsov-Ogievskiy
2016-02-10 8:49 ` [Qemu-devel] [PATCH 1/5] move get_current_ram_size to virtio-balloon.c Vladimir Sementsov-Ogievskiy
2016-02-10 8:49 ` [Qemu-devel] [PATCH 2/5] pc-dimm: rename pc_dimm_built_list() Vladimir Sementsov-Ogievskiy
2016-02-10 8:49 ` [Qemu-devel] [PATCH 3/5] pc-dimm: add pc_dimm_build_list() Vladimir Sementsov-Ogievskiy
2016-02-10 8:49 ` Vladimir Sementsov-Ogievskiy [this message]
2016-02-10 8:49 ` [Qemu-devel] [PATCH 5/5] balloon: Use only 'pc-dimm' type dimm for ballooning Vladimir Sementsov-Ogievskiy
2016-02-16 5:56 ` [Qemu-devel] [PATCH v7 0/5] don't use NVDIMM for balooning Denis V. Lunev
2016-02-22 9:16 ` Denis V. Lunev
2016-02-23 5:15 ` Xiao Guangrong
-- strict thread matches above, loose matches on Subject: below --
2016-02-05 8:18 [Qemu-devel] [PATCH " Vladimir Sementsov-Ogievskiy
2016-02-05 8:19 ` [Qemu-devel] [PATCH 4/5] virtio-balloon: rewrite get_current_ram_size() Vladimir Sementsov-Ogievskiy
2016-02-05 12:57 ` Igor Mammedov
2016-02-05 14:12 ` Vladimir Sementsov-Ogievskiy
2016-02-05 14:53 ` Igor Mammedov
2016-02-04 11:37 [Qemu-devel] [PATCH v5 0/5] don't use NVDIMM for balooning Vladimir Sementsov-Ogievskiy
2016-02-04 11:37 ` [Qemu-devel] [PATCH 4/5] virtio-balloon: rewrite get_current_ram_size() Vladimir Sementsov-Ogievskiy
2016-02-04 12:23 ` Cornelia Huck
2016-02-04 12:36 ` Vladimir Sementsov-Ogievskiy
2016-02-04 12:59 ` Cornelia Huck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455094166-7381-5-git-send-email-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=den@openvz.org \
--cc=guangrong.xiao@linux.intel.com \
--cc=imammedo@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.