[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl: change xl_cfg_get_list to take a dont_warn parameter



# HG changeset patch
# User Andre Przywara <andre.przywara@xxxxxxx>
# Date 1285083669 -3600
# Node ID 206e25c65694ba3af6f8171419d192b064a77b01
# Parent  77a3da957017c799a553fd21ae3cf040abdac255
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@xxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 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 -r 77a3da957017 -r 206e25c65694 tools/libxl/libxlu_cfg.c
--- a/tools/libxl/libxlu_cfg.c  Tue Sep 21 16:08:38 2010 +0100
+++ b/tools/libxl/libxlu_cfg.c  Tue Sep 21 16:41:09 2010 +0100
@@ -194,14 +194,16 @@ int xlu_cfg_get_long(const XLU_Config *c
         
 
 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 -r 77a3da957017 -r 206e25c65694 tools/libxl/libxlutil.h
--- a/tools/libxl/libxlutil.h   Tue Sep 21 16:08:38 2010 +0100
+++ b/tools/libxl/libxlutil.h   Tue Sep 21 16:41:09 2010 +0100
@@ -51,7 +51,8 @@ int xlu_cfg_get_long(const XLU_Config*, 
 
 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 -r 77a3da957017 -r 206e25c65694 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Tue Sep 21 16:08:38 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Tue Sep 21 16:41:09 2010 +0100
@@ -744,7 +744,7 @@ static void parse_config_data(const char
         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
         }
     }
 
-    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;

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.