All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] tools/utils: cleanup formatting of libxlutil.h
  2026-10-14 22:31 [PATCH 0/3] Some cleanup of tools utility library Elliott Mitchell
  2026-10-14 22:31 ` [PATCH 2/3] tools/utils: rename "n" arguments to "key" Elliott Mitchell
  2026-10-14 22:31 ` [PATCH 3/3] tools/utils: remove old declaration of xlu__cfg_yyparse() Elliott Mitchell
@ 2026-10-14 22:31 ` Elliott Mitchell
  2 siblings, 0 replies; 4+ messages in thread
From: Elliott Mitchell @ 2026-10-14 22:31 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Juergen Gross

Date: Mon, 10 Jul 2023 15:55:30 -0700

Some arguments included a name, but not all did.  Now use "cfg" for
all uses of XLU_Config * and "list" for uses of XLU_ConfigList *.

Also fix some spaces missing from xlu_cfg_get_defbool()'s prototype.

Rename the "b" argument of xlu_cfg_get_defbool() to "value_r".  Similar
to other functions this is where the returned value is stored.

Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com>
---
 tools/include/libxlutil.h    | 22 +++++++++++-----------
 tools/libs/util/libxlu_cfg.c |  6 +++---
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/tools/include/libxlutil.h b/tools/include/libxlutil.h
index 4dd3c5e92b..fcbe41b15a 100644
--- a/tools/include/libxlutil.h
+++ b/tools/include/libxlutil.h
@@ -40,12 +40,12 @@ XLU_Config *xlu_cfg_init(FILE *report, const char *report_filename);
   /* report_filename is copied; report is saved and must remain valid
    *  until the Config is destroyed. */
 
-int xlu_cfg_readfile(XLU_Config*, const char *real_filename);
-int xlu_cfg_readdata(XLU_Config*, const char *data, int length);
+int xlu_cfg_readfile(XLU_Config *cfg, const char *real_filename);
+int xlu_cfg_readdata(XLU_Config *cfg, const char *data, int length);
   /* If these fail, then it is undefined behaviour to call xlu_cfg_get_...
    * functions.  You have to just xlu_cfg_destroy. */
 
-void xlu_cfg_destroy(XLU_Config*);
+void xlu_cfg_destroy(XLU_Config *cfg);
 
 
 /* All of the following print warnings to "report" if there is a problem.
@@ -56,26 +56,26 @@ void xlu_cfg_destroy(XLU_Config*);
  *   ERANGE   value out of range (from strtol)
  */
 
-int xlu_cfg_get_string(const XLU_Config*, const char *n, const char **value_r,
-                       int dont_warn);
+int xlu_cfg_get_string(const XLU_Config *cfg, const char *n,
+                       const char **value_r, int dont_warn);
 /* free/strdup version */
 int xlu_cfg_replace_string(const XLU_Config *cfg, const char *n,
                            char **value_r, int dont_warn);
-int xlu_cfg_get_long(const XLU_Config*, const char *n, long *value_r,
+int xlu_cfg_get_long(const XLU_Config *cfg, const char *n, long *value_r,
                      int dont_warn);
-int xlu_cfg_get_bounded_long(const XLU_Config*, const char *n, long min,
+int xlu_cfg_get_bounded_long(const XLU_Config *cfg, const char *n, long min,
                              long max, long *value_r, int dont_warn);
-int xlu_cfg_get_defbool(const XLU_Config*, const char *n, libxl_defbool *b,
-                     int dont_warn);
+int xlu_cfg_get_defbool(const XLU_Config *cfg, const char *n,
+                        libxl_defbool *value_r, int dont_warn);
 
-int xlu_cfg_get_list(const XLU_Config*, const char *n,
+int xlu_cfg_get_list(const XLU_Config *cfg, const char *n,
                      XLU_ConfigList **list_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 */
 int xlu_cfg_get_list_as_string_list(const XLU_Config *cfg, const char *n,
                                     libxl_string_list *sl, int dont_warn);
-const char *xlu_cfg_get_listitem(const XLU_ConfigList*, int entry);
+const char *xlu_cfg_get_listitem(const XLU_ConfigList *list, int entry);
   /* xlu_cfg_get_listitem cannot fail, except that if entry is
    * out of range it returns 0 (not setting errno) */
 
diff --git a/tools/libs/util/libxlu_cfg.c b/tools/libs/util/libxlu_cfg.c
index 874f5abfb9..87ac8c4b41 100644
--- a/tools/libs/util/libxlu_cfg.c
+++ b/tools/libs/util/libxlu_cfg.c
@@ -328,15 +328,15 @@ int xlu_cfg_get_long(const XLU_Config *cfg, const char *n,
                                     dont_warn);
 }
 
-int xlu_cfg_get_defbool(const XLU_Config *cfg, const char *n, libxl_defbool *b,
-                     int dont_warn)
+int xlu_cfg_get_defbool(const XLU_Config *cfg, const char *n,
+                        libxl_defbool *value_r, int dont_warn)
 {
     int ret;
     long l;
 
     ret = xlu_cfg_get_long(cfg, n, &l, dont_warn);
     if (ret) return ret;
-    libxl_defbool_set(b, !!l);
+    libxl_defbool_set(value_r, !!l);
     return 0;
 }
 
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 0/3] Some cleanup of tools utility library
@ 2026-10-14 22:31 Elliott Mitchell
  2026-10-14 22:31 ` [PATCH 2/3] tools/utils: rename "n" arguments to "key" Elliott Mitchell
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Elliott Mitchell @ 2026-10-14 22:31 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Juergen Gross

These have been hanging around in my repository for a while.  The
original submission pass got bungled and other things came up.  Simply
some small bits of formatting cleanup.

Elliott Mitchell (3):
  tools/utils: cleanup formatting of libxlutil.h
  tools/utils: rename "n" arguments to "key"
  tools/utils: remove old declaration of xlu__cfg_yyparse()

 tools/include/libxlutil.h      | 26 +++++++++++++-------------
 tools/libs/util/libxlu_cfg.c   |  6 +++---
 tools/libs/util/libxlu_cfg_i.h |  6 ------
 3 files changed, 16 insertions(+), 22 deletions(-)

-- 
2.47.3



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] tools/utils: remove old declaration of xlu__cfg_yyparse()
  2026-10-14 22:31 [PATCH 0/3] Some cleanup of tools utility library Elliott Mitchell
  2026-10-14 22:31 ` [PATCH 2/3] tools/utils: rename "n" arguments to "key" Elliott Mitchell
@ 2026-10-14 22:31 ` Elliott Mitchell
  2026-10-14 22:31 ` [PATCH 1/3] tools/utils: cleanup formatting of libxlutil.h Elliott Mitchell
  2 siblings, 0 replies; 4+ messages in thread
From: Elliott Mitchell @ 2026-10-14 22:31 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Juergen Gross

Date: Wed, 26 Jul 2023 21:09:21 -0700

This was added at b104c3762dc.  Appears this was fixed in the intervening
decade.  Otherwise this could have been an issue from using advanced
features of Bison.  Now this appears unnecessary.

Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com>
---
 tools/libs/util/libxlu_cfg_i.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/tools/libs/util/libxlu_cfg_i.h b/tools/libs/util/libxlu_cfg_i.h
index 4217f5b28d..3717b9460c 100644
--- a/tools/libs/util/libxlu_cfg_i.h
+++ b/tools/libs/util/libxlu_cfg_i.h
@@ -42,12 +42,6 @@ void xlu__cfgl_lexicalerror(CfgParseContext*, char const *msg);
 
 void xlu__cfgl_likely_python(CfgParseContext *ctx);
 
-
-
-/* Why oh why does bison not declare this in its autogenerated .h ? */
-int xlu__cfg_yyparse(CfgParseContext *ctx);
-
-
 #endif /*LIBXLU_CFG_I_H*/
 
 /*
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] tools/utils: rename "n" arguments to "key"
  2026-10-14 22:31 [PATCH 0/3] Some cleanup of tools utility library Elliott Mitchell
@ 2026-10-14 22:31 ` Elliott Mitchell
  2026-10-14 22:31 ` [PATCH 3/3] tools/utils: remove old declaration of xlu__cfg_yyparse() Elliott Mitchell
  2026-10-14 22:31 ` [PATCH 1/3] tools/utils: cleanup formatting of libxlutil.h Elliott Mitchell
  2 siblings, 0 replies; 4+ messages in thread
From: Elliott Mitchell @ 2026-10-14 22:31 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Juergen Gross

Date: Wed, 12 Jul 2023 23:29:59 -0700

Hopefully make it clearer to others this is the key associated with the
storage value to retrieve.

Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com>
---
 tools/include/libxlutil.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/include/libxlutil.h b/tools/include/libxlutil.h
index fcbe41b15a..0ce66c2096 100644
--- a/tools/include/libxlutil.h
+++ b/tools/include/libxlutil.h
@@ -56,24 +56,24 @@ void xlu_cfg_destroy(XLU_Config *cfg);
  *   ERANGE   value out of range (from strtol)
  */
 
-int xlu_cfg_get_string(const XLU_Config *cfg, const char *n,
+int xlu_cfg_get_string(const XLU_Config *cfg, const char *key,
                        const char **value_r, int dont_warn);
 /* free/strdup version */
-int xlu_cfg_replace_string(const XLU_Config *cfg, const char *n,
+int xlu_cfg_replace_string(const XLU_Config *cfg, const char *key,
                            char **value_r, int dont_warn);
-int xlu_cfg_get_long(const XLU_Config *cfg, const char *n, long *value_r,
+int xlu_cfg_get_long(const XLU_Config *cfg, const char *key, long *value_r,
                      int dont_warn);
-int xlu_cfg_get_bounded_long(const XLU_Config *cfg, const char *n, long min,
+int xlu_cfg_get_bounded_long(const XLU_Config *cfg, const char *key, long min,
                              long max, long *value_r, int dont_warn);
-int xlu_cfg_get_defbool(const XLU_Config *cfg, const char *n,
+int xlu_cfg_get_defbool(const XLU_Config *cfg, const char *key,
                         libxl_defbool *value_r, int dont_warn);
 
-int xlu_cfg_get_list(const XLU_Config *cfg, const char *n,
+int xlu_cfg_get_list(const XLU_Config *cfg, const char *key,
                      XLU_ConfigList **list_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 */
-int xlu_cfg_get_list_as_string_list(const XLU_Config *cfg, const char *n,
+int xlu_cfg_get_list_as_string_list(const XLU_Config *cfg, const char *key,
                                     libxl_string_list *sl, int dont_warn);
 const char *xlu_cfg_get_listitem(const XLU_ConfigList *list, int entry);
   /* xlu_cfg_get_listitem cannot fail, except that if entry is
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-15  0:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-14 22:31 [PATCH 0/3] Some cleanup of tools utility library Elliott Mitchell
2026-10-14 22:31 ` [PATCH 2/3] tools/utils: rename "n" arguments to "key" Elliott Mitchell
2026-10-14 22:31 ` [PATCH 3/3] tools/utils: remove old declaration of xlu__cfg_yyparse() Elliott Mitchell
2026-10-14 22:31 ` [PATCH 1/3] tools/utils: cleanup formatting of libxlutil.h Elliott Mitchell

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.