container.c 788 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Device Container
  3. *
  4. * Copyright IBM, Corp. 2012
  5. *
  6. * Authors:
  7. * Anthony Liguori <aliguori@us.ibm.com>
  8. *
  9. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  10. * See the COPYING file in the top-level directory.
  11. */
  12. #include "qemu/osdep.h"
  13. #include "qom/object.h"
  14. #include "qemu/module.h"
  15. static const TypeInfo container_info = {
  16. .name = TYPE_CONTAINER,
  17. .parent = TYPE_OBJECT,
  18. };
  19. static void container_register_types(void)
  20. {
  21. type_register_static(&container_info);
  22. }
  23. Object *object_property_add_new_container(Object *obj, const char *name)
  24. {
  25. Object *child = object_new(TYPE_CONTAINER);
  26. object_property_add_child(obj, name, child);
  27. object_unref(child);
  28. return child;
  29. }
  30. type_init(container_register_types)