From patchwork Fri Aug 11 16:05:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 800631 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xTVHD2lKpz9t2h for ; Sat, 12 Aug 2017 02:06:12 +1000 (AEST) Received: from localhost ([::1]:52764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dgCRt-0006xG-P8 for incoming@patchwork.ozlabs.org; Fri, 11 Aug 2017 12:06:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dgCRG-0006uE-Jt for qemu-devel@nongnu.org; Fri, 11 Aug 2017 12:05:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dgCRD-0007eS-42 for qemu-devel@nongnu.org; Fri, 11 Aug 2017 12:05:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57550) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dgCRC-0007e5-V1 for qemu-devel@nongnu.org; Fri, 11 Aug 2017 12:05:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E1237F3FD8; Fri, 11 Aug 2017 16:05:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E1237F3FD8 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=armbru@redhat.com Received: from blackfin.pond.sub.org (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 588C69614F; Fri, 11 Aug 2017 16:05:24 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D0A05113864E; Fri, 11 Aug 2017 18:05:22 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 11 Aug 2017 18:05:21 +0200 Message-Id: <1502467522-32237-2-git-send-email-armbru@redhat.com> In-Reply-To: <1502467522-32237-1-git-send-email-armbru@redhat.com> References: <1502467522-32237-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 11 Aug 2017 16:05:26 +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 v2 1/2] vl: Factor object_create() out of main() 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: kwolf@redhat.com, el13635@mail.ntua.gr, f4bug@amsat.org, pbonzini@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé --- vl.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/vl.c b/vl.c index 8e247cc..96c5da1 100644 --- a/vl.c +++ b/vl.c @@ -2855,6 +2855,14 @@ static bool object_create_delayed(const char *type) return !object_create_initial(type); } +static void object_create(bool (*type_predicate)(const char *)) +{ + if (qemu_opts_foreach(qemu_find_opts("object"), + user_creatable_add_opts_foreach, + type_predicate, NULL)) { + exit(1); + } +} static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size, MachineClass *mc) @@ -4391,11 +4399,7 @@ int main(int argc, char **argv, char **envp) page_size_init(); socket_init(); - if (qemu_opts_foreach(qemu_find_opts("object"), - user_creatable_add_opts_foreach, - object_create_initial, NULL)) { - exit(1); - } + object_create(object_create_initial); if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, NULL)) { @@ -4520,11 +4524,7 @@ int main(int argc, char **argv, char **envp) exit(1); } - if (qemu_opts_foreach(qemu_find_opts("object"), - user_creatable_add_opts_foreach, - object_create_delayed, NULL)) { - exit(1); - } + object_create(object_create_delayed); #ifdef CONFIG_TPM if (tpm_init() < 0) {