All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: Marcel Apfelbaum <marcel@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PULL 01/12] vl: Clean up user-creatable objects when exiting
Date: Tue, 19 Sep 2017 17:18:39 -0300	[thread overview]
Message-ID: <20170919201850.14772-2-ehabkost@redhat.com> (raw)
In-Reply-To: <20170919201850.14772-1-ehabkost@redhat.com>

Delete all user-creatable objects in /objects when exiting QEMU, so they
can perform cleanup actions.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170824192315.5897-2-ehabkost@redhat.com>
Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Zack Cornelius <zack.cornelius@kove.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/qom/object_interfaces.h | 8 ++++++++
 qom/object_interfaces.c         | 5 +++++
 vl.c                            | 1 +
 3 files changed, 14 insertions(+)

diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h
index d63c1c28f8..d23e11bc53 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
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index 3bb8959f09..6824a88caa 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -193,6 +193,11 @@ void user_creatable_del(const char *id, Error **errp)
     object_unparent(obj);
 }
 
+void user_creatable_cleanup(void)
+{
+    object_unparent(object_get_objects_root());
+}
+
 static void register_types(void)
 {
     static const TypeInfo uc_interface_info = {
diff --git a/vl.c b/vl.c
index 9e62e92aea..ad49314608 100644
--- a/vl.c
+++ b/vl.c
@@ -4887,6 +4887,7 @@ int main(int argc, char **argv, char **envp)
     audio_cleanup();
     monitor_cleanup();
     qemu_chr_cleanup();
+    user_creatable_cleanup();
     /* TODO: unref root container, check all devices are ok */
 
     return 0;
-- 
2.13.5

  reply	other threads:[~2017-09-19 20:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 20:18 [Qemu-devel] [PULL 00/12] Machine/CPU/NUMA queue, 2017-09-19 Eduardo Habkost
2017-09-19 20:18 ` Eduardo Habkost [this message]
2017-09-26 10:14   ` [Qemu-devel] [PULL 01/12] vl: Clean up user-creatable objects when exiting Christian Borntraeger
2017-09-26 12:24     ` Eduardo Habkost
2017-09-26 13:00       ` [Qemu-devel] [PATCH] iothread: Make iothread_stop() idempotent Eduardo Habkost
2017-09-26 13:08         ` Christian Borntraeger
2017-09-29 13:47         ` Christian Borntraeger
2017-09-29 14:13           ` Paolo Bonzini
2017-09-29 15:57             ` Peter Maydell
2017-09-19 20:18 ` [Qemu-devel] [PULL 02/12] osdep: Define QEMU_MADV_REMOVE Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 03/12] hostmem-file: Add "discard-data" option Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 04/12] qom: cpus: split cpu_generic_init() on feature parsing and cpu creation parts Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 05/12] cpu: make cpu_generic_init() abort QEMU on error Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 06/12] vl.c: convert cpu_model to cpu type and set of global properties before machine_init() Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 07/12] pc: use generic cpu_model parsing Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 08/12] arm: drop intermediate cpu_model -> cpu type parsing and use cpu type directly Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 09/12] numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 10/12] NUMA: Replace MAX_NODES with nb_numa_nodes in for loop Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 11/12] hw/acpi-build: Fix SRAT memory building in case of node 0 without RAM Eduardo Habkost
2017-09-19 20:18 ` [Qemu-devel] [PULL 12/12] MAINTAINERS: Update git URLs for my trees Eduardo Habkost
2017-09-20 18:16 ` [Qemu-devel] [PULL 00/12] Machine/CPU/NUMA queue, 2017-09-19 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170919201850.14772-2-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=marcel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.