From nobody Sun Feb 8 22:50:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505852632870890.8069717077716; Tue, 19 Sep 2017 13:23:52 -0700 (PDT) Received: from localhost ([::1]:45217 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duP3e-0000K9-Ep for importer@patchew.org; Tue, 19 Sep 2017 16:23:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duOz0-0004qI-2I for qemu-devel@nongnu.org; Tue, 19 Sep 2017 16:19:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duOyy-00049x-DC for qemu-devel@nongnu.org; Tue, 19 Sep 2017 16:19:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33142) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duOyy-000498-7Q for qemu-devel@nongnu.org; Tue, 19 Sep 2017 16:19:00 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 64F41CCFF5; Tue, 19 Sep 2017 20:18:59 +0000 (UTC) Received: from localhost (ovpn-116-23.gru2.redhat.com [10.97.116.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA28C5C882; Tue, 19 Sep 2017 20:18:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 64F41CCFF5 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 17:18:39 -0300 Message-Id: <20170919201850.14772-2-ehabkost@redhat.com> In-Reply-To: <20170919201850.14772-1-ehabkost@redhat.com> References: <20170919201850.14772-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 19 Sep 2017 20:18:59 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 01/12] vl: Clean up user-creatable objects when exiting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marcel Apfelbaum , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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=C3=A9 Tested-by: Zack Cornelius Signed-off-by: Eduardo Habkost --- 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_interface= s.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); =20 +/** + * 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); } =20 +void user_creatable_cleanup(void) +{ + object_unparent(object_get_objects_root()); +} + static void register_types(void) { static const TypeInfo uc_interface_info =3D { 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 */ =20 return 0; --=20 2.13.5