[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/16] qom: Introduce type_get_instance_size()
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH 14/16] qom: Introduce type_get_instance_size() |
Date: |
Sat, 24 Aug 2013 02:00:34 +0200 |
Helper to obtain the instance_size for a type.
Signed-off-by: Andreas Färber <address@hidden>
---
include/qom/object.h | 8 ++++++++
qom/object.c | 7 +++++++
2 files changed, 15 insertions(+)
diff --git a/include/qom/object.h b/include/qom/object.h
index 1a7b71a..96b9ab4 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -659,6 +659,14 @@ const char *object_get_typename(Object *obj);
Type type_register_static(const TypeInfo *info);
/**
+ * type_get_instance_size:
+ * @typename: The name of the #Type to obtain the object size for.
+ *
+ * Returns: The instance size of an object of type @typename.
+ */
+size_t type_get_instance_size(const char *typename);
+
+/**
* type_register:
* @info: The #TypeInfo of the new type
*
diff --git a/qom/object.c b/qom/object.c
index e90e382..71322c3 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -337,6 +337,13 @@ void object_initialize(void *data, size_t size, const char
*typename)
object_initialize_with_type(data, size, type);
}
+size_t type_get_instance_size(const char *typename)
+{
+ TypeImpl *type = type_get_by_name(typename);
+
+ return type->instance_size;
+}
+
static inline bool object_property_is_child(ObjectProperty *prop)
{
return strstart(prop->type, "child<", NULL);
--
1.8.1.4
- [Qemu-devel] [PATCH 05/16] pci: Pass size to pci_bus_new_inplace(), (continued)
- [Qemu-devel] [PATCH 05/16] pci: Pass size to pci_bus_new_inplace(), Andreas Färber, 2013/08/23
- [Qemu-devel] [PATCH 11/16] virtio-mmio: Pass size to virtio_mmio_bus_new(), Andreas Färber, 2013/08/23
- [Qemu-devel] [PATCH 10/16] virtio-ccw: Pass size to virtio_ccw_bus_new(), Andreas Färber, 2013/08/23
- [Qemu-devel] [PATCH 02/16] intel-hda: Pass size to hda_codec_bus_init(), Andreas Färber, 2013/08/23
- [Qemu-devel] [PATCH 12/16] qdev: Pass size to qbus_create_inplace(), Andreas Färber, 2013/08/23
- [Qemu-devel] [PATCH 14/16] qom: Introduce type_get_instance_size(),
Andreas Färber <=
- [Qemu-devel] [PATCH 13/16] qom: Pass available size to object_initialize(), Andreas Färber, 2013/08/23
- [Qemu-devel] [PATCH 16/16] qdev-monitor: Avoid aborting on out-of-memory in qdev_device_add(), Andreas Färber, 2013/08/23
- [Qemu-devel] [PATCH 15/16] qdev-monitor: Clean up qdev_device_add() variable naming, Andreas Färber, 2013/08/23
- Re: [Qemu-devel] [PATCH 00/16] qom: Assert sufficient object instance size, Wenchao Xia, 2013/08/26
- Re: [Qemu-devel] [PATCH 00/16] qom: Assert sufficient object instance size, Andreas Färber, 2013/08/30