From patchwork Wed May 2 16:07:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 156498 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B591BB6FA8 for ; Thu, 3 May 2012 03:14:01 +1000 (EST) Received: from localhost ([::1]:42708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPc5d-0002oY-3g for incoming@patchwork.ozlabs.org; Wed, 02 May 2012 12:07:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPc5I-0002PV-6r for qemu-devel@nongnu.org; Wed, 02 May 2012 12:07:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPc5C-0008Jb-HH for qemu-devel@nongnu.org; Wed, 02 May 2012 12:07:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPc5C-0008Iy-8E for qemu-devel@nongnu.org; Wed, 02 May 2012 12:07:14 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q42G7BWE009536 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 2 May 2012 12:07:11 -0400 Received: from blackpad.lan.raisama.net (ovpn-116-79.ams2.redhat.com [10.36.116.79]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q42G75VG021112; Wed, 2 May 2012 12:07:06 -0400 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id C789120118D; Wed, 2 May 2012 13:07:30 -0300 (BRT) From: Eduardo Habkost To: qemu-devel@nongnu.org, Anthony Liguori Date: Wed, 2 May 2012 13:07:27 -0300 Message-Id: <1335974850-30180-4-git-send-email-ehabkost@redhat.com> In-Reply-To: <1335974850-30180-1-git-send-email-ehabkost@redhat.com> References: <1335974850-30180-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: libvir-list@redhat.com, Jiri Denemark Subject: [Qemu-devel] [PATCH qemu 3/6] move list of default config files to an array X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org More files will be added to the list, with additional attributes, later. Signed-off-by: Eduardo Habkost --- arch_init.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/arch_init.c b/arch_init.c index 152cbbb..62332e9 100644 --- a/arch_init.c +++ b/arch_init.c @@ -112,20 +112,27 @@ const uint32_t arch_type = QEMU_ARCH; #endif +static struct defconfig_file { + const char *filename; +} default_config_files[] = { + { CONFIG_QEMU_CONFDIR "/qemu.conf" }, + { CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf" }, + { NULL }, /* end of list */ +}; + + int qemu_read_default_config_files(void) { int ret; - - ret = qemu_read_config_file(CONFIG_QEMU_CONFDIR "/qemu.conf"); - if (ret < 0 && ret != -ENOENT) { - return ret; - } + struct defconfig_file *f; - ret = qemu_read_config_file(CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf"); - if (ret < 0 && ret != -ENOENT) { - return ret; + for (f = default_config_files; f->filename; f++) { + ret = qemu_read_config_file(f->filename); + if (ret < 0 && ret != -ENOENT) { + return ret; + } } - + return 0; }