xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: george.dunlap@eu.citrix.com
Subject: [PATCH 1 of 2] libxlu: Rename filename to config_source
Date: Tue, 3 Apr 2012 19:28:41 +0100	[thread overview]
Message-ID: <5ca90c805046b88d6f03.1333477721@kodo2> (raw)
In-Reply-To: <patchbomb.1333477720@kodo2>

The "filename" is a bit of a misnomer, as it's only used during error
messages, and in most instances cases is actually set to "command
line".

Rename it to "config_source" to make it clear that it's not used to
actually open any files.

No functional changes.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

diff -r 0625fe50a2ee -r 5ca90c805046 tools/libxl/libxlu_cfg.c
--- a/tools/libxl/libxlu_cfg.c	Tue Apr 03 14:46:27 2012 +0100
+++ b/tools/libxl/libxlu_cfg.c	Tue Apr 03 18:00:24 2012 +0100
@@ -25,15 +25,15 @@
 #include "libxlu_cfg_l.h"
 #include "libxlu_cfg_i.h"
 
-XLU_Config *xlu_cfg_init(FILE *report, const char *report_filename) {
+XLU_Config *xlu_cfg_init(FILE *report, const char *report_source) {
     XLU_Config *cfg;
 
     cfg= malloc(sizeof(*cfg));
     if (!cfg) return 0;
 
     cfg->report= report;
-    cfg->filename= strdup(report_filename);
-    if (!cfg->filename) { free(cfg); return 0; }
+    cfg->config_source= strdup(report_source);
+    if (!cfg->config_source) { free(cfg); return 0; }
 
     cfg->settings= 0;
     return cfg;
@@ -51,7 +51,7 @@ static int ctx_prep(CfgParseContext *ctx
     e= xlu__cfg_yylex_init_extra(ctx, &ctx->scanner);
     if (e) {
         fprintf(cfg->report,"%s: unable to create scanner: %s\n",
-                cfg->filename, strerror(e));
+                cfg->config_source, strerror(e));
         return e;
     }
     return 0;
@@ -117,7 +117,7 @@ int xlu_cfg_readdata(XLU_Config *cfg, co
     buf = xlu__cfg_yy_scan_bytes(data, length, ctx.scanner);
     if (!buf) {
         fprintf(cfg->report,"%s: unable to allocate scanner buffer\n",
-                cfg->filename);
+                cfg->config_source);
         ctx.err= ENOMEM;
         goto xe;
     }
@@ -151,7 +151,7 @@ void xlu_cfg_destroy(XLU_Config *cfg) {
         set_next= set->next;
         xlu__cfg_set_free(set);
     }
-    free(cfg->filename);
+    free(cfg->config_source);
     free(cfg);
 }
 
@@ -178,7 +178,7 @@ static int find_atom(const XLU_Config *c
             fprintf(cfg->report,
                     "%s:%d: warning: parameter `%s' is"
                     " a list but should be a single value\n",
-                    cfg->filename, set->lineno, n);
+                    cfg->config_source, set->lineno, n);
         return EINVAL;
     }
     *set_r= set;
@@ -223,14 +223,14 @@ int xlu_cfg_get_long(const XLU_Config *c
             fprintf(cfg->report,
                     "%s:%d: warning: parameter `%s' could not be parsed"
                     " as a number: %s\n",
-                    cfg->filename, set->lineno, n, strerror(e));
+                    cfg->config_source, set->lineno, n, strerror(e));
         return e;
     }
     if (*ep || ep==set->values[0]) {
         if (!dont_warn)
             fprintf(cfg->report,
                     "%s:%d: warning: parameter `%s' is not a valid number\n",
-                    cfg->filename, set->lineno, n);
+                    cfg->config_source, set->lineno, n);
         return EINVAL;
     }
     *value_r= l;
@@ -258,7 +258,7 @@ int xlu_cfg_get_list(const XLU_Config *c
             fprintf(cfg->report,
                     "%s:%d: warning: parameter `%s' is a single value"
                     " but should be a list\n",
-                    cfg->filename, set->lineno, n);
+                    cfg->config_source, set->lineno, n);
         }
         return EINVAL;
     }
@@ -467,7 +467,7 @@ void xlu__cfg_yyerror(YYLTYPE *loc, CfgP
 
     fprintf(ctx->cfg->report,
             "%s:%d: config parsing error near %s%.*s%s%s: %s\n",
-            ctx->cfg->filename, lineno,
+            ctx->cfg->config_source, lineno,
             len?"`":"", len, text, len?"'":"", newline,
             msg);
     if (!ctx->err) ctx->err= EINVAL;
diff -r 0625fe50a2ee -r 5ca90c805046 tools/libxl/libxlu_disk.c
--- a/tools/libxl/libxlu_disk.c	Tue Apr 03 14:46:27 2012 +0100
+++ b/tools/libxl/libxlu_disk.c	Tue Apr 03 18:00:24 2012 +0100
@@ -10,7 +10,7 @@ void xlu__disk_err(DiskParseContext *dpc
             "%s: config parsing error in disk specification: %s"
             "%s%s%s"
             " in `%s'\n",
-            dpc->cfg->filename, message,
+            dpc->cfg->config_source, message,
             erroneous?": near `":"", erroneous?erroneous:"", erroneous?"'":"",
             dpc->spec);
     if (!dpc->err) dpc->err= EINVAL;
diff -r 0625fe50a2ee -r 5ca90c805046 tools/libxl/libxlu_internal.h
--- a/tools/libxl/libxlu_internal.h	Tue Apr 03 14:46:27 2012 +0100
+++ b/tools/libxl/libxlu_internal.h	Tue Apr 03 18:00:24 2012 +0100
@@ -36,7 +36,7 @@ struct XLU_ConfigSetting { /* transparen
 struct XLU_Config {
     XLU_ConfigSetting *settings;
     FILE *report;
-    char *filename;
+    char *config_source;
 };
 
 typedef struct {

       reply	other threads:[~2012-04-03 18:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <patchbomb.1333477720@kodo2>
2012-04-03 18:28 ` George Dunlap [this message]
2012-04-03 18:28 ` [PATCH 2 of 2] xl: Make clear distinction between "filename" and "data source" George Dunlap
2012-04-03 18:52   ` George Dunlap
2012-04-04 15:18   ` Ian Jackson
     [not found] <patchbomb.1335971421@kodo2>
2012-05-02 15:10 ` [PATCH 1 of 2] libxlu: Rename filename to config_source George Dunlap
2012-05-15 14:51 [PATCH 0 of 2] libxl cleanup: distinguish filenames from sources George Dunlap
2012-05-15 14:51 ` [PATCH 1 of 2] libxlu: Rename filename to config_source George Dunlap

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=5ca90c805046b88d6f03.1333477721@kodo2 \
    --to=george.dunlap@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).