From nobody Wed Nov 5 15:20:29 2025 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.zoho.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 1497472423420714.3282070783036; Wed, 14 Jun 2017 13:33:43 -0700 (PDT) Received: from localhost ([::1]:50732 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLEyy-00044z-5d for importer@patchew.org; Wed, 14 Jun 2017 16:33:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLEvf-0000v2-MV for qemu-devel@nongnu.org; Wed, 14 Jun 2017 16:30:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLEve-0005iQ-D4 for qemu-devel@nongnu.org; Wed, 14 Jun 2017 16:30:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39982) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dLEve-0005iH-6w for qemu-devel@nongnu.org; Wed, 14 Jun 2017 16:30:14 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E9AB334599 for ; Wed, 14 Jun 2017 20:30:13 +0000 (UTC) Received: from localhost (ovpn-116-27.gru2.redhat.com [10.97.116.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6BB15C6CE; Wed, 14 Jun 2017 20:30:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3E9AB334599 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=ehabkost@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3E9AB334599 From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Wed, 14 Jun 2017 17:29:56 -0300 Message-Id: <20170614203000.19984-2-ehabkost@redhat.com> In-Reply-To: <20170614203000.19984-1-ehabkost@redhat.com> References: <20170614203000.19984-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 14 Jun 2017 20:30:13 +0000 (UTC) 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] [PATCH 1/5] 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: Paolo Bonzini , "Dr. David Alan Gilbert" , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.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 --- 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 fdd7603c84..3f5f206921 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -148,4 +148,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 ff27e0669e..dbf8878322 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 32db19e3b9..4e9a7fd05a 100644 --- a/vl.c +++ b/vl.c @@ -4762,6 +4762,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.11.0.259.g40922b1