[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 1/3] virtio-balloon: add guest_get_actual_ram()
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [RFC 1/3] virtio-balloon: add guest_get_actual_ram() |
Date: |
Tue, 18 Dec 2012 18:16:53 -0200 |
A future commit will also want to use this.
Signed-off-by: Luiz Capitulino <address@hidden>
---
hw/virtio-balloon.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
index dd1a650..03248df 100644
--- a/hw/virtio-balloon.c
+++ b/hw/virtio-balloon.c
@@ -161,6 +161,11 @@ static uint32_t virtio_balloon_get_features(VirtIODevice
*vdev, uint32_t f)
return f;
}
+static ram_addr_t guest_get_actual_ram(const VirtIOBalloon *s)
+{
+ return ram_size - ((uint64_t) s->actual << VIRTIO_BALLOON_PFN_SHIFT);
+}
+
static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
{
VirtIOBalloon *dev = opaque;
@@ -186,8 +191,7 @@ static void virtio_balloon_stat(void *opaque, BalloonInfo
*info)
*/
reset_stats(dev);
- info->actual = ram_size - ((uint64_t) dev->actual <<
- VIRTIO_BALLOON_PFN_SHIFT);
+ info->actual = guest_get_actual_ram(dev);
}
static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
--
1.8.0