All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@amd.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH 3/4] libxl: change xl_cfg_get_list to take a dont_warn parameter
Date: Tue, 21 Sep 2010 15:27:05 +0200	[thread overview]
Message-ID: <4C98B2A9.4020203@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

xl_cfg_get_list can cope with the option not being a list, but
it always reports a warning in this case. Introduce a parameter
to omit this warning if needed. Future code can then decide what
to do with this information.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>

-- 
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 448-3567-12

[-- Attachment #2: 0003-libxl-change-xl_cfg_get_list-to-take-a-dont_warn-par.patch --]
[-- Type: text/x-patch, Size: 4353 bytes --]

>From cae88598268186391b64d351721f410af97989a9 Mon Sep 17 00:00:00 2001
From: Andre Przywara <andre.przywara@amd.com>
Date: Mon, 20 Sep 2010 12:29:09 +0200
Subject: [PATCH 3/4] libxl: change xl_cfg_get_list to take a dont_warn parameter

xl_cfg_get_list can cope with the option not being a list, but
it always reports a warning in this case. Introduce a parameter
to omit this warning if needed. Future code can then decide what
to do with this information.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
---
 tools/libxl/libxlu_cfg.c |   12 +++++++-----
 tools/libxl/libxlutil.h  |    3 ++-
 tools/libxl/xl_cmdimpl.c |   10 +++++-----
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/tools/libxl/libxlu_cfg.c b/tools/libxl/libxlu_cfg.c
index 07e65e1..864a723 100644
--- a/tools/libxl/libxlu_cfg.c
+++ b/tools/libxl/libxlu_cfg.c
@@ -194,14 +194,16 @@ int xlu_cfg_get_long(const XLU_Config *cfg, const char *n,
         
 
 int xlu_cfg_get_list(const XLU_Config *cfg, const char *n,
-                     XLU_ConfigList **list_r, int *entries_r) {
+                     XLU_ConfigList **list_r, int *entries_r, int dont_warn) {
     XLU_ConfigSetting *set;
     set= find(cfg,n);  if (!set) return ESRCH;
     if (set->avalues==1) {
-        fprintf(cfg->report,
-                "%s:%d: warning: parameter `%s' is a single value"
-                " but should be a list\n",
-                cfg->filename, set->lineno, n);
+        if (!dont_warn) {
+            fprintf(cfg->report,
+                    "%s:%d: warning: parameter `%s' is a single value"
+                    " but should be a list\n",
+                    cfg->filename, set->lineno, n);
+        }
         return EINVAL;
     }
     if (list_r) *list_r= set;
diff --git a/tools/libxl/libxlutil.h b/tools/libxl/libxlutil.h
index 6c992a2..8a6fcbd 100644
--- a/tools/libxl/libxlutil.h
+++ b/tools/libxl/libxlutil.h
@@ -51,7 +51,8 @@ int xlu_cfg_get_long(const XLU_Config*, const char *n, long *value_r);
 
 int xlu_cfg_get_list(const XLU_Config*, const char *n,
                      XLU_ConfigList **list_r /* may be 0 */,
-                     int *entries_r /* may be 0 */);
+                     int *entries_r /* may be 0 */,
+                     int dont_warn);
   /* there is no need to free *list_r; lifetime is that of the XLU_Config */
 const char *xlu_cfg_get_listitem(const XLU_ConfigList*, int entry);
   /* xlu_cfg_get_listitem cannot fail, except that if entry is
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 1f7117e..7c37cc6 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -744,7 +744,7 @@ static void parse_config_data(const char *configfile_filename_report,
         xlu_cfg_replace_string (config, "ramdisk", &b_info->u.pv.ramdisk.path);
     }
 
-    if (!xlu_cfg_get_list (config, "disk", &vbds, 0)) {
+    if (!xlu_cfg_get_list (config, "disk", &vbds, 0, 0)) {
         d_config->num_disks = 0;
         d_config->disks = NULL;
         while ((buf = xlu_cfg_get_listitem (vbds, d_config->num_disks)) != NULL) {
@@ -808,7 +808,7 @@ static void parse_config_data(const char *configfile_filename_report,
         }
     }
 
-    if (!xlu_cfg_get_list (config, "vif", &nics, 0)) {
+    if (!xlu_cfg_get_list (config, "vif", &nics, 0, 0)) {
         d_config->num_vifs = 0;
         d_config->vifs = NULL;
         while ((buf = xlu_cfg_get_listitem (nics, d_config->num_vifs)) != NULL) {
@@ -882,7 +882,7 @@ skip:
         }
     }
 
-    if (!xlu_cfg_get_list(config, "vif2", &net2s, 0)) {
+    if (!xlu_cfg_get_list(config, "vif2", &net2s, 0, 0)) {
         d_config->num_vif2s = 0;
         d_config->vif2s = NULL;
         while ((buf = xlu_cfg_get_listitem(net2s, d_config->num_vif2s))) {
@@ -930,7 +930,7 @@ skip:
         }
     }
 
-    if (!xlu_cfg_get_list (config, "vfb", &cvfbs, 0)) {
+    if (!xlu_cfg_get_list (config, "vfb", &cvfbs, 0, 0)) {
         d_config->num_vfbs = 0;
         d_config->num_vkbs = 0;
         d_config->vfbs = NULL;
@@ -994,7 +994,7 @@ skip_vfb:
     if (!xlu_cfg_get_long (config, "pci_power_mgmt", &l))
         pci_power_mgmt = l;
 
-    if (!xlu_cfg_get_list (config, "pci", &pcis, 0)) {
+    if (!xlu_cfg_get_list (config, "pci", &pcis, 0, 0)) {
         int i;
         d_config->num_pcidevs = 0;
         d_config->pcidevs = NULL;
-- 
1.6.4


[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2010-09-21 13:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C98B2A9.4020203@amd.com \
    --to=andre.przywara@amd.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.