aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/xl.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2012-05-29 16:44:06 +0100
committerIan Campbell <ian.campbell@citrix.com>2012-05-29 16:44:06 +0100
commit98c0339ead4c24ebe993e0693d354cdcbb166ec6 (patch)
tree534aedfc256bef95efd4c9381ff7910b0e04bb9f /tools/libxl/xl.c
parentbb86668db55fa24f275c8f56ddd4dcb44cd413fe (diff)
downloadxen-98c0339ead4c24ebe993e0693d354cdcbb166ec6.tar.gz
xen-98c0339ead4c24ebe993e0693d354cdcbb166ec6.tar.bz2
xen-98c0339ead4c24ebe993e0693d354cdcbb166ec6.zip
libxl: remove lockdir and config dir from the API
These are only used by xl. Rename _libxl_paths.h -> _paths.h, these are not actually "libxl" paths but rather are part of the Xen build time configuration. It is fine for xl to also consume them. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl/xl.c')
-rw-r--r--tools/libxl/xl.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c
index 492153f29f..a5ada035e0 100644
--- a/tools/libxl/xl.c
+++ b/tools/libxl/xl.c
@@ -73,11 +73,12 @@ static void parse_global_config(const char *configfile,
if (!xlu_cfg_get_string (config, "lockfile", &buf, 0))
lockfile = strdup(buf);
else {
- e = asprintf(&lockfile, "%s/xl", (char *)libxl_lock_dir_path());
- if (e < 0) {
- fprintf(stderr, "asprintf memory allocation failed\n");
- exit(1);
- }
+ lockfile = strdup(XL_LOCK_FILE);
+ }
+
+ if (!lockfile < 0) {
+ fprintf(stderr, "failed to allocate lockdir \n");
+ exit(1);
}
if (!xlu_cfg_get_string (config, "vifscript", &buf, 0))
@@ -192,7 +193,6 @@ int main(int argc, char **argv)
char *cmd = 0;
struct cmd_spec *cspec;
int ret;
- char *config_file;
void *config_data = 0;
int config_len = 0;
const char *locks[] = XEND_LOCK;
@@ -227,20 +227,12 @@ int main(int argc, char **argv)
xl_ctx_alloc();
- /* Read global config file options */
- ret = asprintf(&config_file, "%s/xl.conf", libxl_xen_config_dir_path());
- if (ret < 0) {
- fprintf(stderr, "memory allocation failed ret=%d, errno=%d\n", ret, errno);
- exit(1);
- }
-
- ret = libxl_read_file_contents(ctx, config_file,
+ ret = libxl_read_file_contents(ctx, XL_GLOBAL_CONFIG,
&config_data, &config_len);
if (ret)
fprintf(stderr, "Failed to read config file: %s: %s\n",
- config_file, strerror(errno));
- parse_global_config(config_file, config_data, config_len);
- free(config_file);
+ XL_GLOBAL_CONFIG, strerror(errno));
+ parse_global_config(XL_GLOBAL_CONFIG, config_data, config_len);
free(config_data);
/* Reset options for per-command use of getopt. */