summaryrefslogtreecommitdiff
path: root/backends/hostmem-ram.c
diff options
context:
space:
mode:
authorHu Tao <hutao@cn.fujitsu.com>2014-06-10 19:15:19 +0800
committerMichael S. Tsirkin <mst@redhat.com>2014-06-19 18:44:20 +0300
commitbd9262d95f9172a5f4897aeea341c219a6c6cf96 (patch)
tree32f8d88adff799545a71253f6cbdb08cbb60ba08 /backends/hostmem-ram.c
parent58f4662c6c98a9fd05519745661177792d7aeede (diff)
downloadqemu-bd9262d95f9172a5f4897aeea341c219a6c6cf96.tar.gz
qemu-bd9262d95f9172a5f4897aeea341c219a6c6cf96.tar.bz2
qemu-bd9262d95f9172a5f4897aeea341c219a6c6cf96.zip
hostmem: separate allocation from UserCreatable complete method
This allows the superclass to set various policies on the memory region that the subclass creates. Drops hostmem-ram's complete method accordingly. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'backends/hostmem-ram.c')
-rw-r--r--backends/hostmem-ram.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c
index bba2ebcce8..d9a8290dc9 100644
--- a/backends/hostmem-ram.c
+++ b/backends/hostmem-ram.c
@@ -16,9 +16,8 @@
static void
-ram_backend_memory_init(UserCreatable *uc, Error **errp)
+ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
{
- HostMemoryBackend *backend = MEMORY_BACKEND(uc);
char *path;
if (!backend->size) {
@@ -35,9 +34,9 @@ ram_backend_memory_init(UserCreatable *uc, Error **errp)
static void
ram_backend_class_init(ObjectClass *oc, void *data)
{
- UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
+ HostMemoryBackendClass *bc = MEMORY_BACKEND_CLASS(oc);
- ucc->complete = ram_backend_memory_init;
+ bc->alloc = ram_backend_memory_alloc;
}
static const TypeInfo ram_backend_info = {