[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/4] hostmem-file: Register TYPE_MEMORY_BACKEND_FILE
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH 4/4] hostmem-file: Register TYPE_MEMORY_BACKEND_FILE properties as class properties |
Date: |
Thu, 13 Oct 2016 18:26:42 -0300 |
To do the conversion, the file_backend_class_init() was moved
after the getter/setter functions. The old
file_backend_instance_init() function was removed because it is
not needed anymore.
The NULL errp arguments on the property registration calls were
changed to &error_abort.
Signed-off-by: Eduardo Habkost <address@hidden>
---
backends/hostmem-file.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
index 5c4b808..42efb2f 100644
--- a/backends/hostmem-file.c
+++ b/backends/hostmem-file.c
@@ -64,14 +64,6 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error
**errp)
#endif
}
-static void
-file_backend_class_init(ObjectClass *oc, void *data)
-{
- HostMemoryBackendClass *bc = MEMORY_BACKEND_CLASS(oc);
-
- bc->alloc = file_backend_memory_alloc;
-}
-
static char *get_mem_path(Object *o, Error **errp)
{
HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o);
@@ -112,13 +104,18 @@ static void file_memory_backend_set_share(Object *o, bool
value, Error **errp)
}
static void
-file_backend_instance_init(Object *o)
+file_backend_class_init(ObjectClass *oc, void *data)
{
- object_property_add_bool(o, "share",
- file_memory_backend_get_share,
- file_memory_backend_set_share, NULL);
- object_property_add_str(o, "mem-path", get_mem_path,
- set_mem_path, NULL);
+ HostMemoryBackendClass *bc = MEMORY_BACKEND_CLASS(oc);
+
+ bc->alloc = file_backend_memory_alloc;
+
+ object_class_property_add_bool(oc, "share",
+ file_memory_backend_get_share, file_memory_backend_set_share,
+ &error_abort);
+ object_class_property_add_str(oc, "mem-path",
+ get_mem_path, set_mem_path,
+ &error_abort);
}
static void file_backend_instance_finalize(Object *o)
@@ -132,7 +129,6 @@ static const TypeInfo file_backend_info = {
.name = TYPE_MEMORY_BACKEND_FILE,
.parent = TYPE_MEMORY_BACKEND,
.class_init = file_backend_class_init,
- .instance_init = file_backend_instance_init,
.instance_finalize = file_backend_instance_finalize,
.instance_size = sizeof(HostMemoryBackendFile),
};
--
2.7.4
- [Qemu-devel] [PATCH 0/4] machine, hostmem, pc: Register properties as class properties, Eduardo Habkost, 2016/10/13
- [Qemu-devel] [PATCH 1/4] machine: Register TYPE_MACHINE properties as class properties, Eduardo Habkost, 2016/10/13
- [Qemu-devel] [PATCH 2/4] pc: Register TYPE_PC_MACHINE properties as class properties, Eduardo Habkost, 2016/10/13
- [Qemu-devel] [PATCH 3/4] hostmem: Register TYPE_MEMORY_BACKEND properties as class properties, Eduardo Habkost, 2016/10/13
- [Qemu-devel] [PATCH 4/4] hostmem-file: Register TYPE_MEMORY_BACKEND_FILE properties as class properties,
Eduardo Habkost <=
- Re: [Qemu-devel] [PATCH 0/4] machine, hostmem, pc: Register properties as class properties, no-reply, 2016/10/13
- Re: [Qemu-devel] [PATCH 0/4] machine, hostmem, pc: Register properties as class properties, Eduardo Habkost, 2016/10/14