aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2016-03-01 14:18:21 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2016-03-07 13:26:29 +0100
commit8e41fb63c5bf29ecabe0cee1239bf6230f19978a (patch)
treea0f105310b59466dbd726eca96837550b92f2ecf /hw
parent7ebb2745acbb8d910eab07dc5f0aa01a4457703c (diff)
memory: Drop MemoryRegion.ram_addr
All references to mr->ram_addr are replaced by memory_region_get_ram_addr(mr) (except for a few assertions that are replaced with mr->ram_block). Reviewed-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <1456813104-25902-5-git-send-email-famz@redhat.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/misc/ivshmem.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 48b7a34a8f..1838bc8506 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -400,7 +400,7 @@ static int create_shared_memory_BAR(IVShmemState *s, int fd, uint8_t attr,
memory_region_init_ram_ptr(&s->ivshmem, OBJECT(s), "ivshmem.bar2",
s->ivshmem_size, ptr);
- qemu_set_ram_fd(s->ivshmem.ram_addr, fd);
+ qemu_set_ram_fd(memory_region_get_ram_addr(&s->ivshmem), fd);
vmstate_register_ram(&s->ivshmem, DEVICE(s));
memory_region_add_subregion(&s->bar, 0, &s->ivshmem);
@@ -661,7 +661,8 @@ static void ivshmem_read(void *opaque, const uint8_t *buf, int size)
}
memory_region_init_ram_ptr(&s->ivshmem, OBJECT(s),
"ivshmem.bar2", s->ivshmem_size, map_ptr);
- qemu_set_ram_fd(s->ivshmem.ram_addr, incoming_fd);
+ qemu_set_ram_fd(memory_region_get_ram_addr(&s->ivshmem),
+ incoming_fd);
vmstate_register_ram(&s->ivshmem, DEVICE(s));
IVSHMEM_DPRINTF("guest h/w addr = %p, size = %" PRIu64 "\n",
@@ -996,8 +997,10 @@ static void pci_ivshmem_exit(PCIDevice *dev)
strerror(errno));
}
- if ((fd = qemu_get_ram_fd(s->ivshmem.ram_addr)) != -1)
+ fd = qemu_get_ram_fd(memory_region_get_ram_addr(&s->ivshmem));
+ if (fd != -1) {
close(fd);
+ }
}
vmstate_unregister_ram(&s->ivshmem, DEVICE(dev));