From patchwork Mon Sep 25 10:51:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 9969675 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 50732602D8 for ; Mon, 25 Sep 2017 10:55:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 452B228BC6 for ; Mon, 25 Sep 2017 10:55:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3945E28C4B; Mon, 25 Sep 2017 10:55:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2192D28BC6 for ; Mon, 25 Sep 2017 10:55:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwR0V-0007Rc-EM; Mon, 25 Sep 2017 10:52:59 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwR0U-0007R9-Ch for xen-devel@lists.xenproject.org; Mon, 25 Sep 2017 10:52:58 +0000 Received: from [193.109.254.147] by server-3.bemta-6.messagelabs.com id 81/AD-03093-900E8C95; Mon, 25 Sep 2017 10:52:57 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLIsWRWlGSWpSXmKPExsXitHRDpC7ngxO RBs9eClp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBktyxsZC5brVfS+/c/cwDhJvouRk0NCwF9i 0qZ37CA2m4COxMW5O9m6GDk4RARUJG7vNehi5OJgFjjIKHHsyV5WkBphAWOJVT2tjCA2i4Cqx JqNv1lAbF4BS4n/H6YxgvRKCOhJ/NhuCGJyClhJfF6aBFIhBFRx4HsvG0S1oMTJmU/AOpkFNC Vat/9mh7DlJZq3zmaGqFeU6J/3gG0CI98sJC2zkLTMQtKygJF5FaNGcWpRWWqRrqGZXlJRZnp GSW5iZo6uoYGZXm5qcXFiempOYlKxXnJ+7iZGYKAxAMEOxvsbAw4xSnIwKYny3uU7ESnEl5Sf UpmRWJwRX1Sak1p8iFGGg0NJgtfsPlBOsCg1PbUiLTMHGPIwaQkOHiURXiGQNG9xQWJucWY6R OoUozHHsU2X/zBxdNy8+4dJiCUvPy9VSpzXH6RUAKQ0ozQPbhAsFi8xykoJ8zICnSbEU5BalJ tZgir/ilGcg1FJmDcQZApPZl4J3L5XQKcwAZ3SOxXslJJEhJRUA+PkQF/djEh5Bc6Pc1cfMBT aVRx/Vsy0U7+g5LL9qg5vtcdGxreObOKa3dnHbpuRrfr/3K82Zm/OrO49/1danj64Nlnq2CGf Xwd8HByTt1/9Vnfqk/pvdWmNCH+OuHnRc2tqHaOmXJyaukjjoHfd3KSGPWX3Jjr/FPFRaWs6G p5m51I052jfbCWW4oxEQy3mouJEAMpqQNfAAgAA X-Env-Sender: prvs=43456bc54=roger.pau@citrix.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1506336772!112893408!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31829 invoked from network); 25 Sep 2017 10:52:57 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-5.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 25 Sep 2017 10:52:57 -0000 X-IronPort-AV: E=Sophos;i="5.42,435,1500940800"; d="scan'208";a="441052386" From: Roger Pau Monne To: Date: Mon, 25 Sep 2017 11:51:47 +0100 Message-ID: <20170925105206.66507-4-roger.pau@citrix.com> X-Mailer: git-send-email 2.13.5 (Apple Git-94) In-Reply-To: <20170925105206.66507-1-roger.pau@citrix.com> References: <20170925105206.66507-1-roger.pau@citrix.com> MIME-Version: 1.0 Cc: wei.liu2@citrix.com, boris.ostrovsky@oracle.com, Roger Pau Monne , Ian Jackson Subject: [Xen-devel] [PATCH v3 03/22] xl: parsing code movement X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Code movement in preparation for making the bootloader, bootloader_args, nested_hvm and timer_mode fields shared between all guests types. While moving the code, limit the line-length to 80 columns. No functional change. Signed-off-by: Roger Pau Monné Acked-by: Ian Jackson --- Cc: Ian Jackson Cc: Wei Liu --- Changes since v2: - New in this version. --- tools/xl/xl_parse.c | 96 ++++++++++++++++++++++++++++------------------------- 1 file changed, 51 insertions(+), 45 deletions(-) diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 0678fbc1b0..c336abf6fb 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -1084,6 +1084,57 @@ void parse_config_data(const char *config_source, xlu_cfg_get_defbool(config, "driver_domain", &c_info->driver_domain, 0); xlu_cfg_get_defbool(config, "acpi", &b_info->acpi, 0); + if (b_info->type == LIBXL_DOMAIN_TYPE_PV) { + xlu_cfg_replace_string (config, "bootloader", + &b_info->u.pv.bootloader, 0); + switch (xlu_cfg_get_list_as_string_list(config, "bootloader_args", + &b_info->u.pv.bootloader_args, 1)) + { + + case 0: break; /* Success */ + case ESRCH: break; /* Option not present */ + case EINVAL: + if (!xlu_cfg_get_string(config, "bootloader_args", &buf, 0)) { + + fprintf(stderr, "WARNING: Specifying \"bootloader_args\"" + " as a string is deprecated. " + "Please use a list of arguments.\n"); + split_string_into_string_list(buf, " \t\n", + &b_info->u.pv.bootloader_args); + } + break; + default: + fprintf(stderr,"xl: Unable to parse bootloader_args.\n"); + exit(-ERROR_FAIL); + } else { + if (!xlu_cfg_get_long(config, "timer_mode", &l, 1)) { + const char *s = libxl_timer_mode_to_string(l); + fprintf(stderr, + "WARNING: specifying \"timer_mode\" as an integer is deprecated. " + "Please use the named parameter variant. %s%s%s\n", + s ? "e.g. timer_mode=\"" : "", + s ? s : "", + s ? "\"" : ""); + + if (l < LIBXL_TIMER_MODE_DELAY_FOR_MISSED_TICKS || + l > LIBXL_TIMER_MODE_ONE_MISSED_TICK_PENDING) { + fprintf(stderr, + "ERROR: invalid value %ld for \"timer_mode\"\n", l); + exit (1); + } + b_info->u.hvm.timer_mode = l; + } else if (!xlu_cfg_get_string(config, "timer_mode", &buf, 0) && + libxl_timer_mode_from_string(buf, + &b_info->u.hvm.timer_mode)) { + fprintf(stderr, + "ERROR: invalid value \"%s\" for \"timer_mode\"\n", buf); + exit (1); + } + + xlu_cfg_get_defbool(config, "nestedhvm", &b_info->u.hvm.nested_hvm, + 0); + } + switch(b_info->type) { case LIBXL_DOMAIN_TYPE_HVM: kernel_basename = libxl_basename(b_info->kernel); @@ -1181,29 +1232,6 @@ void parse_config_data(const char *config_source, exit (1); } } - if (!xlu_cfg_get_long(config, "timer_mode", &l, 1)) { - const char *s = libxl_timer_mode_to_string(l); - fprintf(stderr, "WARNING: specifying \"timer_mode\" as an integer is deprecated. " - "Please use the named parameter variant. %s%s%s\n", - s ? "e.g. timer_mode=\"" : "", - s ? s : "", - s ? "\"" : ""); - - if (l < LIBXL_TIMER_MODE_DELAY_FOR_MISSED_TICKS || - l > LIBXL_TIMER_MODE_ONE_MISSED_TICK_PENDING) { - fprintf(stderr, "ERROR: invalid value %ld for \"timer_mode\"\n", l); - exit (1); - } - b_info->u.hvm.timer_mode = l; - } else if (!xlu_cfg_get_string(config, "timer_mode", &buf, 0)) { - if (libxl_timer_mode_from_string(buf, &b_info->u.hvm.timer_mode)) { - fprintf(stderr, "ERROR: invalid value \"%s\" for \"timer_mode\"\n", - buf); - exit (1); - } - } - - xlu_cfg_get_defbool(config, "nestedhvm", &b_info->u.hvm.nested_hvm, 0); if (!xlu_cfg_get_defbool(config, "altp2mhvm", &b_info->u.hvm.altp2m, 0)) fprintf(stderr, "WARNING: Specifying \"altp2mhvm\" is deprecated. " @@ -1259,28 +1287,6 @@ void parse_config_data(const char *config_source, break; case LIBXL_DOMAIN_TYPE_PV: { - xlu_cfg_replace_string (config, "bootloader", &b_info->u.pv.bootloader, 0); - switch (xlu_cfg_get_list_as_string_list(config, "bootloader_args", - &b_info->u.pv.bootloader_args, 1)) - { - - case 0: break; /* Success */ - case ESRCH: break; /* Option not present */ - case EINVAL: - if (!xlu_cfg_get_string(config, "bootloader_args", &buf, 0)) { - - fprintf(stderr, "WARNING: Specifying \"bootloader_args\"" - " as a string is deprecated. " - "Please use a list of arguments.\n"); - split_string_into_string_list(buf, " \t\n", - &b_info->u.pv.bootloader_args); - } - break; - default: - fprintf(stderr,"xl: Unable to parse bootloader_args.\n"); - exit(-ERROR_FAIL); - } - if (!b_info->u.pv.bootloader && !b_info->kernel) { fprintf(stderr, "Neither kernel nor bootloader specified\n"); exit(1);