From 9d5139e543e8579aacd324193680c64fd1463d89 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Thu, 24 Aug 2017 16:23:13 -0300 Subject: vl: Clean up user-creatable objects when exiting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Delete all user-creatable objects in /objects when exiting QEMU, so they can perform cleanup actions. Signed-off-by: Eduardo Habkost Message-Id: <20170824192315.5897-2-ehabkost@redhat.com> Acked-by: Philippe Mathieu-Daudé Tested-by: Zack Cornelius Signed-off-by: Eduardo Habkost --- include/qom/object_interfaces.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/qom') diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h index d63c1c2..d23e11b 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -147,4 +147,12 @@ int user_creatable_add_opts_foreach(void *opaque, */ void user_creatable_del(const char *id, Error **errp); +/** + * user_creatable_cleanup: + * + * Delete all user-creatable objects and the user-creatable + * objects container. + */ +void user_creatable_cleanup(void); + #endif -- cgit v1.1 From 3c72234c98004a01d79a24f78b07053cfebd0f22 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Wed, 13 Sep 2017 18:04:53 +0200 Subject: qom: cpus: split cpu_generic_init() on feature parsing and cpu creation parts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit it would allow to reuse feature parsing part in various machines that have CPU features instead of re-implementing the same feature parsing each time. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daudé Message-Id: <1505318697-77161-2-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost --- include/qom/cpu.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'include/qom') diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 995a7be..885276c 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -645,6 +645,27 @@ void cpu_reset(CPUState *cpu); ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model); /** + * cpu_create: + * @typename: The CPU type. + * + * Instantiates a CPU and realizes the CPU. + * + * Returns: A #CPUState or %NULL if an error occurred. + */ +CPUState *cpu_create(const char *typename); + +/** + * cpu_parse_cpu_model: + * @typename: The CPU base type or CPU type. + * @cpu_model: The model string including optional parameters. + * + * processes optional parameters and registers them as global properties + * + * Returns: type of CPU to create or %NULL if an error occurred. + */ +const char *cpu_parse_cpu_model(const char *typename, const char *cpu_model); + +/** * cpu_generic_init: * @typename: The CPU base type. * @cpu_model: The model string including optional parameters. -- cgit v1.1 From 4482e05cbbb7e50e476f6a9500cf0b38913bd939 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Wed, 13 Sep 2017 18:04:54 +0200 Subject: cpu: make cpu_generic_init() abort QEMU on error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Almost every user of cpu_generic_init() checks for returned NULL and then reports failure in a custom way and aborts process. Some users assume that call can't fail and don't check for failure, though they should have checked for it. In either cases cpu_generic_init() failure is fatal, so instead of checking for failure and reporting it various ways, make cpu_generic_init() report errors in consistent way and terminate QEMU on failure. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daudé Message-Id: <1505318697-77161-3-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost --- include/qom/cpu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/qom') diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 885276c..6d33cf1 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -661,7 +661,8 @@ CPUState *cpu_create(const char *typename); * * processes optional parameters and registers them as global properties * - * Returns: type of CPU to create or %NULL if an error occurred. + * Returns: type of CPU to create or prints error and terminates process + * if an error occurred. */ const char *cpu_parse_cpu_model(const char *typename, const char *cpu_model); -- cgit v1.1