aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_utils.c
diff options
context:
space:
mode:
authorGeorge Dunlap <george.dunlap@eu.citrix.com>2012-05-15 16:28:13 +0100
committerGeorge Dunlap <george.dunlap@eu.citrix.com>2012-05-15 16:28:13 +0100
commit8b9105f6d9e6716c265ca0116038b8273b1d9116 (patch)
tree47ac6bc1787be0b023fa6daed6a283b03a5bc051 /tools/libxl/libxl_utils.c
parentf77723ad33a89f48ddcd5dcd628a8061fb41d18b (diff)
downloadxen-8b9105f6d9e6716c265ca0116038b8273b1d9116.tar.gz
xen-8b9105f6d9e6716c265ca0116038b8273b1d9116.tar.bz2
xen-8b9105f6d9e6716c265ca0116038b8273b1d9116.zip
xl: Make clear distinction between "filename" and "data source"
Many places in xl there's a variable or element named "filename" which does not contain a filename, but the source of the data for reporting purposes. Worse, there are variables which are sometimes actually used or interpreted as a filename depending on what other variables are set. This makes it difficult to tell when a string is purely cosmetic, and when another bit of code may actually attempt to call "open" with the string. This patch makes a consistent distinction between "filename" (which always refers to the name of an actual file, and may be interpreted as such at some point) and "source" (which may be a filename, or may be another data source such as a migration stream or saved data). This does add some variables and reshuffle where assignments happen; most notably, the "restore_filename" element of struct domain_create is now only set when restoring from a file. But at a high level, there should be no funcitonal changes. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl/libxl_utils.c')
-rw-r--r--tools/libxl/libxl_utils.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index 858410e7bc..73b00b3f84 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -334,7 +334,7 @@ int libxl_read_file_contents(libxl_ctx *ctx, const char *filename,
\
int libxl_##rw##_exactly(libxl_ctx *ctx, int fd, \
constdata void *data, ssize_t sz, \
- const char *filename, const char *what) { \
+ const char *source, const char *what) { \
ssize_t got; \
\
while (sz > 0) { \
@@ -343,7 +343,7 @@ int libxl_read_file_contents(libxl_ctx *ctx, const char *filename,
if (errno == EINTR) continue; \
if (!ctx) return errno; \
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to " #rw " %s%s%s", \
- what?what:"", what?" from ":"", filename); \
+ what?what:"", what?" from ":"", source); \
return errno; \
} \
if (got == 0) { \
@@ -352,7 +352,7 @@ int libxl_read_file_contents(libxl_ctx *ctx, const char *filename,
zero_is_eof \
? "file/stream truncated reading %s%s%s" \
: "file/stream write returned 0! writing %s%s%s", \
- what?what:"", what?" from ":"", filename); \
+ what?what:"", what?" from ":"", source); \
return EPROTO; \
} \
sz -= got; \