qom: API to get instance_size of a type

Add an API object_type_get_size(const char *typename) that returns the
instance_size of the give typename.

Backports commit 3f97b53a682d2595747c926c00d78b9d406f1be0 from qemu
This commit is contained in:
Bharata B Rao 2018-02-24 18:59:25 -05:00 committed by Lioncash
parent aee5c93f58
commit 851dec945d
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
16 changed files with 30 additions and 0 deletions

View file

@ -2217,6 +2217,7 @@
#define object_resolve_path_component object_resolve_path_component_aarch64
#define object_resolve_path_type object_resolve_path_type_aarch64
#define object_set_link_property object_set_link_property_aarch64
#define object_type_get_instance_size object_type_get_instance_size_aarch64
#define object_unparent object_unparent_aarch64
#define omap_cachemaint_write omap_cachemaint_write_aarch64
#define omap_cp_reginfo omap_cp_reginfo_aarch64

View file

@ -2217,6 +2217,7 @@
#define object_resolve_path_component object_resolve_path_component_aarch64eb
#define object_resolve_path_type object_resolve_path_type_aarch64eb
#define object_set_link_property object_set_link_property_aarch64eb
#define object_type_get_instance_size object_type_get_instance_size_aarch64eb
#define object_unparent object_unparent_aarch64eb
#define omap_cachemaint_write omap_cachemaint_write_aarch64eb
#define omap_cp_reginfo omap_cp_reginfo_aarch64eb

View file

@ -2217,6 +2217,7 @@
#define object_resolve_path_component object_resolve_path_component_arm
#define object_resolve_path_type object_resolve_path_type_arm
#define object_set_link_property object_set_link_property_arm
#define object_type_get_instance_size object_type_get_instance_size_arm
#define object_unparent object_unparent_arm
#define omap_cachemaint_write omap_cachemaint_write_arm
#define omap_cp_reginfo omap_cp_reginfo_arm

View file

@ -2217,6 +2217,7 @@
#define object_resolve_path_component object_resolve_path_component_armeb
#define object_resolve_path_type object_resolve_path_type_armeb
#define object_set_link_property object_set_link_property_armeb
#define object_type_get_instance_size object_type_get_instance_size_armeb
#define object_unparent object_unparent_armeb
#define omap_cachemaint_write omap_cachemaint_write_armeb
#define omap_cp_reginfo omap_cp_reginfo_armeb

View file

@ -2223,6 +2223,7 @@ symbols = (
'object_resolve_path_component',
'object_resolve_path_type',
'object_set_link_property',
'object_type_get_instance_size',
'object_unparent',
'omap_cachemaint_write',
'omap_cp_reginfo',

View file

@ -1376,6 +1376,14 @@ int object_child_foreach_recursive(Object *obj,
*/
Object *container_get(struct uc_struct *uc, Object *root, const char *path);
/**
* object_type_get_instance_size:
* @typename: Name of the Type whose instance_size is required
*
* Returns the instance_size of the given @typename.
*/
size_t object_type_get_instance_size(struct uc_struct *uc, const char *typename);
void container_register_types(struct uc_struct *uc);
void register_types_object(struct uc_struct *uc);

View file

@ -2217,6 +2217,7 @@
#define object_resolve_path_component object_resolve_path_component_m68k
#define object_resolve_path_type object_resolve_path_type_m68k
#define object_set_link_property object_set_link_property_m68k
#define object_type_get_instance_size object_type_get_instance_size_m68k
#define object_unparent object_unparent_m68k
#define omap_cachemaint_write omap_cachemaint_write_m68k
#define omap_cp_reginfo omap_cp_reginfo_m68k

View file

@ -2217,6 +2217,7 @@
#define object_resolve_path_component object_resolve_path_component_mips
#define object_resolve_path_type object_resolve_path_type_mips
#define object_set_link_property object_set_link_property_mips
#define object_type_get_instance_size object_type_get_instance_size_mips
#define object_unparent object_unparent_mips
#define omap_cachemaint_write omap_cachemaint_write_mips
#define omap_cp_reginfo omap_cp_reginfo_mips

View file

@ -2217,6 +2217,7 @@
#define object_resolve_path_component object_resolve_path_component_mips64
#define object_resolve_path_type object_resolve_path_type_mips64
#define object_set_link_property object_set_link_property_mips64
#define object_type_get_instance_size object_type_get_instance_size_mips64
#define object_unparent object_unparent_mips64
#define omap_cachemaint_write omap_cachemaint_write_mips64
#define omap_cp_reginfo omap_cp_reginfo_mips64

View file

@ -2217,6 +2217,7 @@
#define object_resolve_path_component object_resolve_path_component_mips64el
#define object_resolve_path_type object_resolve_path_type_mips64el
#define object_set_link_property object_set_link_property_mips64el
#define object_type_get_instance_size object_type_get_instance_size_mips64el
#define object_unparent object_unparent_mips64el
#define omap_cachemaint_write omap_cachemaint_write_mips64el
#define omap_cp_reginfo omap_cp_reginfo_mips64el

View file

@ -2217,6 +2217,7 @@
#define object_resolve_path_component object_resolve_path_component_mipsel
#define object_resolve_path_type object_resolve_path_type_mipsel
#define object_set_link_property object_set_link_property_mipsel
#define object_type_get_instance_size object_type_get_instance_size_mipsel
#define object_unparent object_unparent_mipsel
#define omap_cachemaint_write omap_cachemaint_write_mipsel
#define omap_cp_reginfo omap_cp_reginfo_mipsel

View file

@ -2217,6 +2217,7 @@
#define object_resolve_path_component object_resolve_path_component_powerpc
#define object_resolve_path_type object_resolve_path_type_powerpc
#define object_set_link_property object_set_link_property_powerpc
#define object_type_get_instance_size object_type_get_instance_size_powerpc
#define object_unparent object_unparent_powerpc
#define omap_cachemaint_write omap_cachemaint_write_powerpc
#define omap_cp_reginfo omap_cp_reginfo_powerpc

View file

@ -195,6 +195,14 @@ static size_t type_object_get_size(struct uc_struct *uc, TypeImpl *ti)
return 0;
}
size_t object_type_get_instance_size(struct uc_struct *uc, const char *typename)
{
TypeImpl *type = type_get_by_name(uc, typename);
g_assert(type != NULL);
return type_object_get_size(uc, type);
}
static bool type_is_ancestor(struct uc_struct *uc, TypeImpl *type, TypeImpl *target_type)
{
assert(target_type);

View file

@ -2217,6 +2217,7 @@
#define object_resolve_path_component object_resolve_path_component_sparc
#define object_resolve_path_type object_resolve_path_type_sparc
#define object_set_link_property object_set_link_property_sparc
#define object_type_get_instance_size object_type_get_instance_size_sparc
#define object_unparent object_unparent_sparc
#define omap_cachemaint_write omap_cachemaint_write_sparc
#define omap_cp_reginfo omap_cp_reginfo_sparc

View file

@ -2217,6 +2217,7 @@
#define object_resolve_path_component object_resolve_path_component_sparc64
#define object_resolve_path_type object_resolve_path_type_sparc64
#define object_set_link_property object_set_link_property_sparc64
#define object_type_get_instance_size object_type_get_instance_size_sparc64
#define object_unparent object_unparent_sparc64
#define omap_cachemaint_write omap_cachemaint_write_sparc64
#define omap_cp_reginfo omap_cp_reginfo_sparc64

View file

@ -2217,6 +2217,7 @@
#define object_resolve_path_component object_resolve_path_component_x86_64
#define object_resolve_path_type object_resolve_path_type_x86_64
#define object_set_link_property object_set_link_property_x86_64
#define object_type_get_instance_size object_type_get_instance_size_x86_64
#define object_unparent object_unparent_x86_64
#define omap_cachemaint_write omap_cachemaint_write_x86_64
#define omap_cp_reginfo omap_cp_reginfo_x86_64