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

[PATCH 21/22] tools/utils: add settings get function



The better to isolate the shared portion of the interface from the
low-level implementation.

Signed-off-by: Elliott Mitchell <ehem+xen@xxxxxxx>
---
 tools/libs/util/libxlu_cfg.c      | 7 ++++++-
 tools/libs/util/libxlu_internal.h | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/libs/util/libxlu_cfg.c b/tools/libs/util/libxlu_cfg.c
index cb99b0aab0..7bbedde8f6 100644
--- a/tools/libs/util/libxlu_cfg.c
+++ b/tools/libs/util/libxlu_cfg.c
@@ -240,7 +240,7 @@ int xlu_cfg_printf(const XLU_Config *cfg, const char 
*format, ...)
 static XLU_ConfigSetting *find(const XLU_Config *cfg, const char *n) {
     XLU_ConfigSetting *set;
 
-    for (set= cfg->settings;
+    for (set = xlu__cfg_get_settings(cfg);
          set;
          set= set->next)
         if (!strcmp(set->name, n))
@@ -267,6 +267,11 @@ static int find_atom(const XLU_Config *cfg, const char *n,
     return 0;
 }
 
+XLU_ConfigSetting *xlu__cfg_get_settings(const XLU_Config *cfg)
+{
+    return cfg->settings;
+}
+
 
 enum XLU_ConfigValueType xlu_cfg_value_type(const XLU_ConfigValue *value)
 {
diff --git a/tools/libs/util/libxlu_internal.h 
b/tools/libs/util/libxlu_internal.h
index 34c6c7a443..993ff88171 100644
--- a/tools/libs/util/libxlu_internal.h
+++ b/tools/libs/util/libxlu_internal.h
@@ -45,6 +45,8 @@ extern int xlu__cfg_readfile(XLU_Config *cfg, FILE *msgfile,
 extern int xlu__cfg_readdata(XLU_Config *cfg, FILE *msgfile,
     const char *msgprefix, XLU_ConfigSetting **psettings, const char *data,
     int length);
+extern XLU_ConfigSetting *xlu__cfg_get_settings(const XLU_Config *cfg)
+    __attribute__((access(read_only, 1)));
 
 #endif /*LIBXLU_INTERNAL_H*/
 
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+sigmsg@xxxxxxx      PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445






 


Rackspace

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