aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2010-09-08 16:44:24 +0100
committerIan Campbell <ian.campbell@citrix.com>2010-09-08 16:44:24 +0100
commitfc850f5680f41fd09c7a6d6fee872f889be43043 (patch)
tree12ced78d53498a6261efe59ac48dfd551be89127 /tools
parent0953a577a26adc935177c21115296a3637b3e0e4 (diff)
downloadxen-fc850f5680f41fd09c7a6d6fee872f889be43043.tar.gz
xen-fc850f5680f41fd09c7a6d6fee872f889be43043.tar.bz2
xen-fc850f5680f41fd09c7a6d6fee872f889be43043.zip
libxl: Ensure all _hidden functions use libxl__ prefix (autogenerated patch)
This patch covers all those which could be trivially converted automatically. sed -n -e 's/_hidden.*[ \*]libxl_\([^_][^()]*\)(.*/\1/pg' tools/libxl/*.h | \ while read i ; do \ sed -i -e "s/libxl_$i/libxl__$i/g" tools/libxl/*.[ch]; \ done sed -n -e 's/_hidden.*_libxl_\([^_][^()]*\)(.*/\1/pg' tools/libxl/*.h | \ while read i ; do \ sed -i -e "s/_libxl_$i/libxl__$i/g" tools/libxl/*.[ch]; \ done Check that diffstat includes libxl but not xl. Fixup tools/libxl/xl_cmdimpl.c which used libxl_device_del instead of libxl_device_disk_del in a printf. (Patch runes re-run by Ian Jackson to refresh against tip libxl.) Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/libxl/libxl.c652
-rw-r--r--tools/libxl/libxl.h2
-rw-r--r--tools/libxl/libxl_blktap2.c6
-rw-r--r--tools/libxl/libxl_bootloader.c22
-rw-r--r--tools/libxl/libxl_device.c78
-rw-r--r--tools/libxl/libxl_dom.c66
-rw-r--r--tools/libxl/libxl_exec.c8
-rw-r--r--tools/libxl/libxl_internal.c34
-rw-r--r--tools/libxl/libxl_internal.h66
-rw-r--r--tools/libxl/libxl_pci.c230
-rw-r--r--tools/libxl/libxl_utils.c100
-rw-r--r--tools/libxl/libxl_xshelp.c22
-rw-r--r--tools/libxl/xl_cmdimpl.c2
13 files changed, 644 insertions, 644 deletions
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index bd82653c7f..fe07e3e905 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -119,9 +119,9 @@ int libxl_domain_make(libxl_ctx *ctx, libxl_domain_create_info *info,
xs_transaction_t t;
xen_domain_handle_t handle;
- uuid_string = libxl_uuid2string(&gc, info->uuid);
+ uuid_string = libxl__uuid2string(&gc, info->uuid);
if (!uuid_string) {
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_NOMEM;
}
@@ -136,27 +136,27 @@ int libxl_domain_make(libxl_ctx *ctx, libxl_domain_create_info *info,
ret = xc_domain_create(ctx->xch, info->ssidref, handle, flags, domid);
if (ret < 0) {
XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "domain creation fail");
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_FAIL;
}
ret = xc_cpupool_movedomain(ctx->xch, info->poolid, *domid);
if (ret < 0) {
XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "domain move fail");
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_FAIL;
}
- dom_path = libxl_xs_get_dompath(&gc, *domid);
+ dom_path = libxl__xs_get_dompath(&gc, *domid);
if (!dom_path) {
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_FAIL;
}
- vm_path = libxl_sprintf(&gc, "/vm/%s", uuid_string);
+ vm_path = libxl__sprintf(&gc, "/vm/%s", uuid_string);
if (!vm_path) {
XL_LOG(ctx, XL_LOG_ERROR, "cannot allocate create paths");
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_FAIL;
}
@@ -177,39 +177,39 @@ retry_transaction:
xs_mkdir(ctx->xsh, t, vm_path);
xs_set_permissions(ctx->xsh, t, vm_path, roperm, ARRAY_SIZE(roperm));
- xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/vm", dom_path), vm_path, strlen(vm_path));
+ xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/vm", dom_path), vm_path, strlen(vm_path));
rc = libxl_domain_rename(ctx, *domid, 0, info->name, t);
if (rc) {
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
for (i = 0; i < ARRAY_SIZE(rw_paths); i++) {
- char *path = libxl_sprintf(&gc, "%s/%s", dom_path, rw_paths[i]);
+ char *path = libxl__sprintf(&gc, "%s/%s", dom_path, rw_paths[i]);
xs_mkdir(ctx->xsh, t, path);
xs_set_permissions(ctx->xsh, t, path, rwperm, ARRAY_SIZE(rwperm));
}
for (i = 0; i < ARRAY_SIZE(ro_paths); i++) {
- char *path = libxl_sprintf(&gc, "%s/%s", dom_path, ro_paths[i]);
+ char *path = libxl__sprintf(&gc, "%s/%s", dom_path, ro_paths[i]);
xs_mkdir(ctx->xsh, t, path);
xs_set_permissions(ctx->xsh, t, path, roperm, ARRAY_SIZE(roperm));
}
- xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
- xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/name", vm_path), info->name, strlen(info->name));
+ xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
+ xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/name", vm_path), info->name, strlen(info->name));
if (info->poolname)
- xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
+ xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
- libxl_xs_writev(&gc, t, dom_path, info->xsdata);
- libxl_xs_writev(&gc, t, libxl_sprintf(&gc, "%s/platform", dom_path), info->platformdata);
+ libxl__xs_writev(&gc, t, dom_path, info->xsdata);
+ libxl__xs_writev(&gc, t, libxl__sprintf(&gc, "%s/platform", dom_path), info->platformdata);
- xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/control/platform-feature-multiprocessor-suspend", dom_path), "1", 1);
+ xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/control/platform-feature-multiprocessor-suspend", dom_path), "1", 1);
if (!xs_transaction_end(ctx->xsh, t, 0))
if (errno == EAGAIN)
goto retry_transaction;
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -225,10 +225,10 @@ int libxl_domain_rename(libxl_ctx *ctx, uint32_t domid,
xs_transaction_t our_trans = 0;
int rc;
- dom_path = libxl_xs_get_dompath(&gc, domid);
+ dom_path = libxl__xs_get_dompath(&gc, domid);
if (!dom_path) goto x_nomem;
- name_path= libxl_sprintf(&gc, "%s/name", dom_path);
+ name_path= libxl__sprintf(&gc, "%s/name", dom_path);
if (!name_path) goto x_nomem;
retry_transaction:
@@ -286,7 +286,7 @@ int libxl_domain_rename(libxl_ctx *ctx, uint32_t domid,
rc = 0;
x_rc:
if (our_trans) xs_transaction_end(ctx->xsh, our_trans, 1);
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
x_fail: rc = ERROR_FAIL; goto x_rc;
@@ -311,26 +311,26 @@ int libxl_domain_build(libxl_ctx *ctx, libxl_domain_build_info *info, uint32_t d
if (ret)
goto out;
- vments = libxl_calloc(&gc, 7, sizeof(char *));
+ vments = libxl__calloc(&gc, 7, sizeof(char *));
vments[0] = "rtc/timeoffset";
vments[1] = (info->u.hvm.timeoffset) ? info->u.hvm.timeoffset : "";
vments[2] = "image/ostype";
vments[3] = "hvm";
vments[4] = "start_time";
- vments[5] = libxl_sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
+ vments[5] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
} else {
ret = build_pv(ctx, domid, info, state);
if (ret)
goto out;
- vments = libxl_calloc(&gc, 11, sizeof(char *));
+ vments = libxl__calloc(&gc, 11, sizeof(char *));
i = 0;
vments[i++] = "image/ostype";
vments[i++] = "linux";
vments[i++] = "image/kernel";
vments[i++] = (char*) info->kernel.path;
vments[i++] = "start_time";
- vments[i++] = libxl_sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
+ vments[i++] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
if (info->u.pv.ramdisk.path) {
vments[i++] = "image/ramdisk";
vments[i++] = (char*) info->u.pv.ramdisk.path;
@@ -346,7 +346,7 @@ out:
if (!info->hvm)
libxl__file_reference_unmap(&info->u.pv.ramdisk);
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ret;
}
@@ -370,22 +370,22 @@ int libxl_domain_restore(libxl_ctx *ctx, libxl_domain_build_info *info,
gettimeofday(&start_time, NULL);
if (info->hvm) {
- vments = libxl_calloc(&gc, 7, sizeof(char *));
+ vments = libxl__calloc(&gc, 7, sizeof(char *));
vments[0] = "rtc/timeoffset";
vments[1] = (info->u.hvm.timeoffset) ? info->u.hvm.timeoffset : "";
vments[2] = "image/ostype";
vments[3] = "hvm";
vments[4] = "start_time";
- vments[5] = libxl_sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
+ vments[5] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
} else {
- vments = libxl_calloc(&gc, 11, sizeof(char *));
+ vments = libxl__calloc(&gc, 11, sizeof(char *));
i = 0;
vments[i++] = "image/ostype";
vments[i++] = "linux";
vments[i++] = "image/kernel";
vments[i++] = (char*) info->kernel.path;
vments[i++] = "start_time";
- vments[i++] = libxl_sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
+ vments[i++] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
if (info->u.pv.ramdisk.path) {
vments[i++] = "image/ramdisk";
vments[i++] = (char*) info->u.pv.ramdisk.path;
@@ -424,7 +424,7 @@ out:
}
errno = esave;
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ret;
}
@@ -453,7 +453,7 @@ int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid)
rc = ERROR_FAIL;
}
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -476,27 +476,27 @@ int libxl_domain_preserve(libxl_ctx *ctx, uint32_t domid,
int rc;
- preserved_name = libxl_sprintf(&gc, "%s%s", info->name, name_suffix);
+ preserved_name = libxl__sprintf(&gc, "%s%s", info->name, name_suffix);
if (!preserved_name) {
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_NOMEM;
}
- uuid_string = libxl_uuid2string(&gc, new_uuid);
+ uuid_string = libxl__uuid2string(&gc, new_uuid);
if (!uuid_string) {
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_NOMEM;
}
- dom_path = libxl_xs_get_dompath(&gc, domid);
+ dom_path = libxl__xs_get_dompath(&gc, domid);
if (!dom_path) {
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_FAIL;
}
- vm_path = libxl_sprintf(&gc, "/vm/%s", uuid_string);
+ vm_path = libxl__sprintf(&gc, "/vm/%s", uuid_string);
if (!vm_path) {
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_FAIL;
}
@@ -512,17 +512,17 @@ int libxl_domain_preserve(libxl_ctx *ctx, uint32_t domid,
xs_mkdir(ctx->xsh, t, vm_path);
xs_set_permissions(ctx->xsh, t, vm_path, roperm, ARRAY_SIZE(roperm));
- xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/vm", dom_path), vm_path, strlen(vm_path));
+ xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/vm", dom_path), vm_path, strlen(vm_path));
rc = libxl_domain_rename(ctx, domid, info->name, preserved_name, t);
if (rc) return rc;
- xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
+ xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
if (!xs_transaction_end(ctx->xsh, t, 0))
if (errno == EAGAIN)
goto retry_transaction;
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -692,11 +692,11 @@ int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid)
int ret, rc = 0;
if (is_hvm(ctx, domid)) {
- path = libxl_sprintf(&gc, "/local/domain/0/device-model/%d/state", domid);
- state = libxl_xs_read(&gc, XBT_NULL, path);
+ path = libxl__sprintf(&gc, "/local/domain/0/device-model/%d/state", domid);
+ state = libxl__xs_read(&gc, XBT_NULL, path);
if (state != NULL && !strcmp(state, "paused")) {
- libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "/local/domain/0/device-model/%d/command", domid), "continue");
- libxl_wait_for_device_model(ctx, domid, "running", NULL, NULL);
+ libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "/local/domain/0/device-model/%d/command", domid), "continue");
+ libxl__wait_for_device_model(ctx, domid, "running", NULL, NULL);
}
}
ret = xc_domain_unpause(ctx->xch, domid);
@@ -704,7 +704,7 @@ int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid)
XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unpausing domain %d", domid);
rc = ERROR_FAIL;
}
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -723,17 +723,17 @@ int libxl_domain_shutdown(libxl_ctx *ctx, uint32_t domid, int req)
char *dom_path;
if (req > ARRAY_SIZE(req_table)) {
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_INVAL;
}
- dom_path = libxl_xs_get_dompath(&gc, domid);
+ dom_path = libxl__xs_get_dompath(&gc, domid);
if (!dom_path) {
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_FAIL;
}
- shutdown_path = libxl_sprintf(&gc, "%s/control/shutdown", dom_path);
+ shutdown_path = libxl__sprintf(&gc, "%s/control/shutdown", dom_path);
xs_write(ctx->xsh, XBT_NULL, shutdown_path, req_table[req], strlen(req_table[req]));
if (is_hvm(ctx,domid)) {
@@ -758,7 +758,7 @@ int libxl_domain_shutdown(libxl_ctx *ctx, uint32_t domid, int req)
}
}
}
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -789,7 +789,7 @@ int libxl_wait_for_disk_ejects(libxl_ctx *ctx, uint32_t guest_domid, libxl_devic
for (i = 0; i < num_disks; i++) {
if (asprintf(&(waiter[i].path), "%s/device/vbd/%d/eject",
- libxl_xs_get_dompath(&gc, domid),
+ libxl__xs_get_dompath(&gc, domid),
device_disk_dev_number(disks[i].virtpath)) < 0)
goto out;
if (asprintf(&(waiter[i].token), "%d", LIBXL_EVENT_DISK_EJECT) < 0)
@@ -798,7 +798,7 @@ int libxl_wait_for_disk_ejects(libxl_ctx *ctx, uint32_t guest_domid, libxl_devic
}
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -857,29 +857,29 @@ int libxl_event_get_disk_eject_info(libxl_ctx *ctx, uint32_t domid, libxl_event
char *backend;
char *value;
- value = libxl_xs_read(&gc, XBT_NULL, event->path);
+ value = libxl__xs_read(&gc, XBT_NULL, event->path);
if (!value || strcmp(value, "eject")) {
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
path = strdup(event->path);
path[strlen(path) - 6] = '\0';
- backend = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend", path));
+ backend = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend", path));
disk->backend_domid = 0;
disk->domid = domid;
disk->physpath = NULL;
disk->phystype = 0;
/* this value is returned to the user: do not free right away */
- disk->virtpath = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/dev", backend));
+ disk->virtpath = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/dev", backend));
disk->unpluggable = 1;
disk->readwrite = 0;
disk->is_cdrom = 1;
free(path);
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 1;
}
@@ -889,7 +889,7 @@ static int libxl_destroy_device_model(libxl_ctx *ctx, uint32_t domid)
char *pid;
int ret;
- pid = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "/local/domain/%d/image/device-model-pid", domid));
+ pid = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "/local/domain/%d/image/device-model-pid", domid));
if (!pid) {
int stubdomid = libxl_get_stubdom_id(ctx, domid);
if (!stubdomid) {
@@ -901,7 +901,7 @@ static int libxl_destroy_device_model(libxl_ctx *ctx, uint32_t domid)
ret = libxl_domain_destroy(ctx, stubdomid, 0);
goto out;
}
- xs_rm(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "/local/domain/0/device-model/%d", domid));
+ xs_rm(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "/local/domain/0/device-model/%d", domid));
ret = kill(atoi(pid), SIGHUP);
if (ret < 0 && errno == ESRCH) {
@@ -915,7 +915,7 @@ static int libxl_destroy_device_model(libxl_ctx *ctx, uint32_t domid)
atoi(pid));
}
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ret;
}
@@ -930,11 +930,11 @@ int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force)
dm_present = 1;
} else {
char *pid;
- pid = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "/local/domain/%d/image/device-model-pid", domid));
+ pid = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "/local/domain/%d/image/device-model-pid", domid));
dm_present = (pid != NULL);
}
- dom_path = libxl_xs_get_dompath(&gc, domid);
+ dom_path = libxl__xs_get_dompath(&gc, domid);
if (!dom_path) {
rc = ERROR_FAIL;
goto out;
@@ -944,7 +944,7 @@ int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force)
XL_LOG(ctx, XL_LOG_ERROR, "pci shutdown failed for domid %d", domid);
if (dm_present) {
xs_write(ctx->xsh, XBT_NULL,
- libxl_sprintf(&gc, "/local/domain/0/device-model/%d/command", domid),
+ libxl__sprintf(&gc, "/local/domain/0/device-model/%d/command", domid),
"shutdown", strlen("shutdown"));
}
rc = xc_domain_pause(ctx->xch, domid);
@@ -955,10 +955,10 @@ int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force)
if (libxl_destroy_device_model(ctx, domid) < 0)
XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_device_model failed for %d", domid);
}
- if (libxl_devices_destroy(ctx, domid, force) < 0)
+ if (libxl__devices_destroy(ctx, domid, force) < 0)
XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_devices failed for %d", domid);
- vm_path = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/vm", dom_path));
+ vm_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/vm", dom_path));
if (vm_path)
if (!xs_rm(ctx->xsh, XBT_NULL, vm_path))
XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vm_path);
@@ -976,16 +976,16 @@ int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force)
}
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_constype type)
{
libxl_gc gc = LIBXL_INIT_GC(ctx);
- char *p = libxl_sprintf(&gc, "%s/xenconsole", libxl_private_bindir_path());
- char *domid_s = libxl_sprintf(&gc, "%d", domid);
- char *cons_num_s = libxl_sprintf(&gc, "%d", cons_num);
+ char *p = libxl__sprintf(&gc, "%s/xenconsole", libxl_private_bindir_path());
+ char *domid_s = libxl__sprintf(&gc, "%d", domid);
+ char *cons_num_s = libxl__sprintf(&gc, "%d", cons_num);
char *cons_type_s;
switch (type) {
@@ -1002,7 +1002,7 @@ int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_conso
execl(p, p, domid_s, "--num", cons_num_s, "--type", cons_type_s, (void *)NULL);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_FAIL;
}
@@ -1032,22 +1032,22 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass)
NULL,
};
- vnc_port = libxl_xs_read(&gc, XBT_NULL,
- libxl_sprintf(&gc,
+ vnc_port = libxl__xs_read(&gc, XBT_NULL,
+ libxl__sprintf(&gc,
"/local/domain/%d/console/vnc-port", domid));
if ( vnc_port )
port = atoi(vnc_port) - 5900;
- vfb_back = libxl_xs_read(&gc, XBT_NULL,
- libxl_sprintf(&gc,
+ vfb_back = libxl__xs_read(&gc, XBT_NULL,
+ libxl__sprintf(&gc,
"/local/domain/%d/device/vfb/0/backend", domid));
if ( vfb_back ) {
- vnc_listen = libxl_xs_read(&gc, XBT_NULL,
- libxl_sprintf(&gc,
+ vnc_listen = libxl__xs_read(&gc, XBT_NULL,
+ libxl__sprintf(&gc,
"/local/domain/%d/console/vnc-listen", domid));
if ( autopass )
- vnc_pass = libxl_xs_read(&gc, XBT_NULL,
- libxl_sprintf(&gc,
+ vnc_pass = libxl__xs_read(&gc, XBT_NULL,
+ libxl__sprintf(&gc,
"/local/domain/%d/console/vnc-pass", domid));
}
@@ -1057,7 +1057,7 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass)
if ( (vnc_bin = getenv("VNCVIEWER")) )
args[0] = vnc_bin;
- args[1] = libxl_sprintf(&gc, "%s:%d", vnc_listen, port);
+ args[1] = libxl__sprintf(&gc, "%s:%d", vnc_listen, port);
if ( vnc_pass ) {
char tmpname[] = "/tmp/vncautopass.XXXXXX";
@@ -1079,8 +1079,8 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass)
}
skip_autopass:
- libxl_free_all(&gc);
- libxl_exec(autopass_fd, -1, -1, args[0], args);
+ libxl__free_all(&gc);
+ libxl__exec(autopass_fd, -1, -1, args[0], args);
return 0;
}
@@ -1099,7 +1099,7 @@ static char ** libxl_build_device_model_args_old(libxl_gc *gc,
flexarray_set(dm_args, num++, "qemu-dm");
flexarray_set(dm_args, num++, "-d");
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "%d", info->domid));
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->domid));
if (info->dom_name) {
flexarray_set(dm_args, num++, "-domain-name");
@@ -1111,18 +1111,18 @@ static char ** libxl_build_device_model_args_old(libxl_gc *gc,
if (info->vnclisten && strchr(info->vnclisten, ':') == NULL) {
flexarray_set(
dm_args, num++,
- libxl_sprintf(gc, "%s:%d%s",
+ libxl__sprintf(gc, "%s:%d%s",
info->vnclisten,
info->vncdisplay,
info->vncpasswd ? ",password" : ""));
} else {
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "127.0.0.1:%d", info->vncdisplay));
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "127.0.0.1:%d", info->vncdisplay));
}
} else if (info->vnclisten) {
if (strchr(info->vnclisten, ':') != NULL) {
flexarray_set(dm_args, num++, info->vnclisten);
} else {
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "%s:0", info->vnclisten));
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "%s:0", info->vnclisten));
}
} else {
flexarray_set(dm_args, num++, "127.0.0.1:0");
@@ -1153,7 +1153,7 @@ static char ** libxl_build_device_model_args_old(libxl_gc *gc,
if (info->videoram) {
flexarray_set(dm_args, num++, "-videoram");
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "%d", info->videoram));
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->videoram));
}
if (info->stdvga) {
flexarray_set(dm_args, num++, "-std-vga");
@@ -1179,24 +1179,24 @@ static char ** libxl_build_device_model_args_old(libxl_gc *gc,
}
if (info->vcpus > 1) {
flexarray_set(dm_args, num++, "-vcpus");
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "%d", info->vcpus));
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->vcpus));
}
if (info->vcpu_avail) {
flexarray_set(dm_args, num++, "-vcpu_avail");
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "0x%x", info->vcpu_avail));
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "0x%x", info->vcpu_avail));
}
for (i = 0; i < num_vifs; i++) {
if (vifs[i].nictype == NICTYPE_IOEMU) {
- char *smac = libxl_sprintf(gc, "%02x:%02x:%02x:%02x:%02x:%02x",
+ char *smac = libxl__sprintf(gc, "%02x:%02x:%02x:%02x:%02x:%02x",
vifs[i].mac[0], vifs[i].mac[1], vifs[i].mac[2],
vifs[i].mac[3], vifs[i].mac[4], vifs[i].mac[5]);
if (!vifs[i].ifname)
- vifs[i].ifname = libxl_sprintf(gc, "tap%d.%d", info->domid, vifs[i].devid);
+ vifs[i].ifname = libxl__sprintf(gc, "tap%d.%d", info->domid, vifs[i].devid);
flexarray_set(dm_args, num++, "-net");
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "nic,vlan=%d,macaddr=%s,model=%s",
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "nic,vlan=%d,macaddr=%s,model=%s",
vifs[i].devid, smac, vifs[i].model));
flexarray_set(dm_args, num++, "-net");
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "tap,vlan=%d,ifname=%s,bridge=%s,script=no",
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "tap,vlan=%d,ifname=%s,bridge=%s,script=no",
vifs[i].devid, vifs[i].ifname, vifs[i].bridge));
ioemu_vifs++;
}
@@ -1239,7 +1239,7 @@ static char ** libxl_build_device_model_args_new(libxl_gc *gc,
flexarray_set(dm_args, num++, "qemu-system-xen");
flexarray_set(dm_args, num++, "-xen-domid");
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "%d", info->domid));
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->domid));
if (info->dom_name) {
flexarray_set(dm_args, num++, "-name");
@@ -1262,11 +1262,11 @@ static char ** libxl_build_device_model_args_new(libxl_gc *gc,
if (strchr(listen, ':') != NULL)
flexarray_set(dm_args, num++,
- libxl_sprintf(gc, "%s%s", listen,
+ libxl__sprintf(gc, "%s%s", listen,
info->vncunused ? ",to=99" : ""));
else
flexarray_set(dm_args, num++,
- libxl_sprintf(gc, "%s:%d%s", listen, display,
+ libxl__sprintf(gc, "%s:%d%s", listen, display,
info->vncunused ? ",to=99" : ""));
}
if (info->sdl) {
@@ -1293,7 +1293,7 @@ static char ** libxl_build_device_model_args_new(libxl_gc *gc,
if (info->boot) {
flexarray_set(dm_args, num++, "-boot");
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "order=%s", info->boot));
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "order=%s", info->boot));
}
if (info->usb || info->usbdevice) {
flexarray_set(dm_args, num++, "-usb");
@@ -1312,22 +1312,22 @@ static char ** libxl_build_device_model_args_new(libxl_gc *gc,
if (info->vcpus > 1) {
flexarray_set(dm_args, num++, "-smp");
if (info->vcpu_avail)
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "%d,maxcpus=%d", info->vcpus, info->vcpu_avail));
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d,maxcpus=%d", info->vcpus, info->vcpu_avail));
else
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "%d", info->vcpus));
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->vcpus));
}
for (i = 0; i < num_vifs; i++) {
if (vifs[i].nictype == NICTYPE_IOEMU) {
- char *smac = libxl_sprintf(gc, "%02x:%02x:%02x:%02x:%02x:%02x",
+ char *smac = libxl__sprintf(gc, "%02x:%02x:%02x:%02x:%02x:%02x",
vifs[i].mac[0], vifs[i].mac[1], vifs[i].mac[2],
vifs[i].mac[3], vifs[i].mac[4], vifs[i].mac[5]);
if (!vifs[i].ifname)
- vifs[i].ifname = libxl_sprintf(gc, "tap%d.%d", info->domid, vifs[i].devid);
+ vifs[i].ifname = libxl__sprintf(gc, "tap%d.%d", info->domid, vifs[i].devid);
flexarray_set(dm_args, num++, "-net");
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "nic,vlan=%d,macaddr=%s,model=%s",
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "nic,vlan=%d,macaddr=%s,model=%s",
vifs[i].devid, smac, vifs[i].model));
flexarray_set(dm_args, num++, "-net");
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "tap,vlan=%d,ifname=%s,script=no",
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "tap,vlan=%d,ifname=%s,script=no",
vifs[i].devid, vifs[i].ifname));
ioemu_vifs++;
}
@@ -1356,7 +1356,7 @@ static char ** libxl_build_device_model_args_new(libxl_gc *gc,
flexarray_set(dm_args, num++, "-cdrom");
flexarray_set(dm_args, num++, disks[i].physpath);
}else{
- flexarray_set(dm_args, num++, libxl_sprintf(gc, "-%s", disks[i].virtpath));
+ flexarray_set(dm_args, num++, libxl__sprintf(gc, "-%s", disks[i].virtpath));
flexarray_set(dm_args, num++, disks[i].physpath);
}
libxl_device_disk_destroy(&disks[i]);
@@ -1443,7 +1443,7 @@ static int libxl_write_dmargs(libxl_ctx *ctx, int domid, int guest_domid, char *
roperm[1].id = domid;
roperm[1].perms = XS_PERM_READ;
- vm_path = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "/local/domain/%d/vm", guest_domid));
+ vm_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "/local/domain/%d/vm", guest_domid));
i = 0;
dmargs_size = 0;
@@ -1462,18 +1462,18 @@ static int libxl_write_dmargs(libxl_ctx *ctx, int domid, int guest_domid, char *
}
i++;
}
- path = libxl_sprintf(&gc, "%s/image/dmargs", vm_path);
+ path = libxl__sprintf(&gc, "%s/image/dmargs", vm_path);
retry_transaction:
t = xs_transaction_start(ctx->xsh);
xs_write(ctx->xsh, t, path, dmargs, strlen(dmargs));
xs_set_permissions(ctx->xsh, t, path, roperm, ARRAY_SIZE(roperm));
- xs_set_permissions(ctx->xsh, t, libxl_sprintf(&gc, "%s/rtc/timeoffset", vm_path), roperm, ARRAY_SIZE(roperm));
+ xs_set_permissions(ctx->xsh, t, libxl__sprintf(&gc, "%s/rtc/timeoffset", vm_path), roperm, ARRAY_SIZE(roperm));
if (!xs_transaction_end(ctx->xsh, t, 0))
if (errno == EAGAIN)
goto retry_transaction;
free(dmargs);
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -1505,7 +1505,7 @@ static int libxl_create_stubdom(libxl_ctx *ctx,
memset(&c_info, 0x00, sizeof(libxl_domain_create_info));
c_info.hvm = 0;
- c_info.name = libxl_sprintf(&gc, "%s-dm", _libxl_domid_to_name(&gc, info->domid));
+ c_info.name = libxl__sprintf(&gc, "%s-dm", libxl__domid_to_name(&gc, info->domid));
libxl_uuid_copy(&c_info.uuid, &info->uuid);
@@ -1513,8 +1513,8 @@ static int libxl_create_stubdom(libxl_ctx *ctx,
b_info.max_vcpus = 1;
b_info.max_memkb = 32 * 1024;
b_info.target_memkb = b_info.max_memkb;
- b_info.kernel.path = libxl_abs_path(&gc, "ioemu-stubdom.gz", libxl_xenfirmwaredir_path());
- b_info.u.pv.cmdline = libxl_sprintf(&gc, " -d %d", info->domid);
+ b_info.kernel.path = libxl__abs_path(&gc, "ioemu-stubdom.gz", libxl_xenfirmwaredir_path());
+ b_info.u.pv.cmdline = libxl__sprintf(&gc, " -d %d", info->domid);
b_info.u.pv.ramdisk.path = "";
b_info.u.pv.features = "";
b_info.hvm = 0;
@@ -1527,11 +1527,11 @@ static int libxl_create_stubdom(libxl_ctx *ctx,
goto out_free;
libxl_write_dmargs(ctx, domid, info->domid, args);
- libxl_xs_write(&gc, XBT_NULL,
- libxl_sprintf(&gc, "%s/image/device-model-domid", libxl_xs_get_dompath(&gc, info->domid)),
+ libxl__xs_write(&gc, XBT_NULL,
+ libxl__sprintf(&gc, "%s/image/device-model-domid", libxl__xs_get_dompath(&gc, info->domid)),
"%d", domid);
- libxl_xs_write(&gc, XBT_NULL,
- libxl_sprintf(&gc, "%s/target", libxl_xs_get_dompath(&gc, domid)),
+ libxl__xs_write(&gc, XBT_NULL,
+ libxl__sprintf(&gc, "%s/target", libxl__xs_get_dompath(&gc, domid)),
"%d", info->domid);
ret = xc_domain_set_target(ctx->xch, domid, info->domid);
if (ret<0) {
@@ -1547,10 +1547,10 @@ static int libxl_create_stubdom(libxl_ctx *ctx,
perm[1].perms = XS_PERM_READ;
retry_transaction:
t = xs_transaction_start(ctx->xsh);
- xs_mkdir(ctx->xsh, t, libxl_sprintf(&gc, "/local/domain/0/device-model/%d", info->domid));
- xs_set_permissions(ctx->xsh, t, libxl_sprintf(&gc, "/local/domain/0/device-model/%d", info->domid), perm, ARRAY_SIZE(perm));
- xs_mkdir(ctx->xsh, t, libxl_sprintf(&gc, "/local/domain/%d/device/vfs", domid));
- xs_set_permissions(ctx->xsh, t, libxl_sprintf(&gc, "/local/domain/%d/device/vfs",domid), perm, ARRAY_SIZE(perm));
+ xs_mkdir(ctx->xsh, t, libxl__sprintf(&gc, "/local/domain/0/device-model/%d", info->domid));
+ xs_set_permissions(ctx->xsh, t, libxl__sprintf(&gc, "/local/domain/0/device-model/%d", info->domid), perm, ARRAY_SIZE(perm));
+ xs_mkdir(ctx->xsh, t, libxl__sprintf(&gc, "/local/domain/%d/device/vfs", domid));
+ xs_set_permissions(ctx->xsh, t, libxl__sprintf(&gc, "/local/domain/%d/device/vfs",domid), perm, ARRAY_SIZE(perm));
if (!xs_transaction_end(ctx->xsh, t, 0))
if (errno == EAGAIN)
goto retry_transaction;
@@ -1579,7 +1579,7 @@ retry_transaction:
if (info->serial)
num_console++;
- console = libxl_calloc(&gc, num_console, sizeof(libxl_device_console));
+ console = libxl__calloc(&gc, num_console, sizeof(libxl_device_console));
if (!console) {
ret = ERROR_NOMEM;
goto out_free;
@@ -1591,9 +1591,9 @@ retry_transaction:
console[i].domid = domid;
if (!i) {
char *filename;
- char *name = libxl_sprintf(&gc, "qemu-dm-%s", libxl_domid_to_name(ctx, info->domid));
+ char *name = libxl__sprintf(&gc, "qemu-dm-%s", libxl_domid_to_name(ctx, info->domid));
libxl_create_logfile(ctx, name, &filename);
- console[i].output = libxl_sprintf(&gc, "file:%s", filename);
+ console[i].output = libxl__sprintf(&gc, "file:%s", filename);
console[i].build_state = &state;
free(filename);
} else
@@ -1616,7 +1616,7 @@ retry_transaction:
if (starting_r) {
*starting_r = calloc(sizeof(libxl_device_model_starting), 1);
(*starting_r)->domid = info->domid;
- (*starting_r)->dom_path = libxl_xs_get_dompath(&gc, info->domid);
+ (*starting_r)->dom_path = libxl__xs_get_dompath(&gc, info->domid);
(*starting_r)->for_spawn = NULL;
}
@@ -1625,7 +1625,7 @@ retry_transaction:
out_free:
free(args);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ret;
}
@@ -1660,11 +1660,11 @@ int libxl_create_device_model(libxl_ctx *ctx,
goto out;
}
- path = libxl_sprintf(&gc, "/local/domain/0/device-model/%d", info->domid);
+ path = libxl__sprintf(&gc, "/local/domain/0/device-model/%d", info->domid);
xs_mkdir(ctx->xsh, XBT_NULL, path);
- libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/disable_pf", path), "%d", !info->xen_platform_pci);
+ libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/disable_pf", path), "%d", !info->xen_platform_pci);
- libxl_create_logfile(ctx, libxl_sprintf(&gc, "qemu-dm-%s", info->dom_name), &logfile);
+ libxl_create_logfile(ctx, libxl__sprintf(&gc, "qemu-dm-%s", info->dom_name), &logfile);
logfile_w = open(logfile, O_WRONLY|O_CREAT, 0644);
free(logfile);
null = open("/dev/null", O_RDONLY);
@@ -1682,7 +1682,7 @@ int libxl_create_device_model(libxl_ctx *ctx,
}
p->domid = info->domid;
- p->dom_path = libxl_xs_get_dompath(&gc, info->domid);
+ p->dom_path = libxl__xs_get_dompath(&gc, info->domid);
if (!p->dom_path) {
rc = ERROR_FAIL;
goto out_close;
@@ -1692,25 +1692,25 @@ int libxl_create_device_model(libxl_ctx *ctx,
retry_transaction:
/* Find uuid and the write the vnc password to xenstore for qemu. */
t = xs_transaction_start(ctx->xsh);
- vm_path = libxl_xs_read(&gc,t,libxl_sprintf(&gc, "%s/vm", p->dom_path));
+ vm_path = libxl__xs_read(&gc,t,libxl__sprintf(&gc, "%s/vm", p->dom_path));
if (vm_path) {
/* Now write the vncpassword into it. */
- pass_stuff = libxl_calloc(&gc, 2, sizeof(char *));
+ pass_stuff = libxl__calloc(&gc, 2, sizeof(char *));
pass_stuff[0] = "vncpasswd";
pass_stuff[1] = info->vncpasswd;
- libxl_xs_writev(&gc,t,vm_path,pass_stuff);
+ libxl__xs_writev(&gc,t,vm_path,pass_stuff);
if (!xs_transaction_end(ctx->xsh, t, 0))
if (errno == EAGAIN)
goto retry_transaction;
}
}
- rc = libxl_spawn_spawn(ctx, p, "device model", dm_xenstore_record_pid);
+ rc = libxl__spawn_spawn(ctx, p, "device model", dm_xenstore_record_pid);
if (rc < 0)
goto out_close;
if (!rc) { /* inner child */
- libxl_exec(null, logfile_w, logfile_w,
- libxl_abs_path(&gc, info->device_model, libxl_private_bindir_path()),
+ libxl__exec(null, logfile_w, logfile_w,
+ libxl__abs_path(&gc, info->device_model, libxl_private_bindir_path()),
args);
}
@@ -1721,7 +1721,7 @@ out_close:
close(logfile_w);
free(args);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -1729,7 +1729,7 @@ int libxl_detach_device_model(libxl_ctx *ctx,
libxl_device_model_starting *starting)
{
int rc;
- rc = libxl_spawn_detach(ctx, starting->for_spawn);
+ rc = libxl__spawn_detach(ctx, starting->for_spawn);
if (starting->for_spawn)
free(starting->for_spawn);
free(starting);
@@ -1740,10 +1740,10 @@ int libxl_detach_device_model(libxl_ctx *ctx,
int libxl_confirm_device_model_startup(libxl_ctx *ctx,
libxl_device_model_starting *starting)
{
- int problem = libxl_wait_for_device_model(ctx, starting->domid, "running", NULL, NULL);
+ int problem = libxl__wait_for_device_model(ctx, starting->domid, "running", NULL, NULL);
int detach;
if ( !problem )
- problem = libxl_spawn_check(ctx, starting->for_spawn);
+ problem = libxl__spawn_check(ctx, starting->for_spawn);
detach = libxl_detach_device_model(ctx, starting);
return problem ? problem : detach;
}
@@ -1794,7 +1794,7 @@ int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *dis
device_physdisk_major_minor(disk->physpath, &major, &minor);
flexarray_set(back, boffset++, "physical-device");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%x:%x", major, minor));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%x:%x", major, minor));
flexarray_set(back, boffset++, "params");
flexarray_set(back, boffset++, disk->physpath);
@@ -1817,19 +1817,19 @@ int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *dis
goto out_free;
}
flexarray_set(back, boffset++, "tapdisk-params");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%s:%s", device_disk_string_of_phystype(disk->phystype), disk->physpath));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%s:%s", device_disk_string_of_phystype(disk->phystype), disk->physpath));
flexarray_set(back, boffset++, "params");
- flexarray_set(back, boffset++, libxl_strdup(&gc, dev));
+ flexarray_set(back, boffset++, libxl__strdup(&gc, dev));
backend_type = "phy";
device_physdisk_major_minor(dev, &major, &minor);
flexarray_set(back, boffset++, "physical-device");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%x:%x", major, minor));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%x:%x", major, minor));
device.backend_kind = DEVICE_VBD;
break;
}
flexarray_set(back, boffset++, "params");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%s:%s",
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%s:%s",
device_disk_string_of_phystype(disk->phystype), disk->physpath));
device.backend_kind = DEVICE_TAP;
@@ -1842,15 +1842,15 @@ int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *dis
}
flexarray_set(back, boffset++, "frontend-id");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", disk->domid));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", disk->domid));
flexarray_set(back, boffset++, "online");
flexarray_set(back, boffset++, "1");
flexarray_set(back, boffset++, "removable");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", (disk->unpluggable) ? 1 : 0));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", (disk->unpluggable) ? 1 : 0));
flexarray_set(back, boffset++, "bootable");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", 1));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", 1));
flexarray_set(back, boffset++, "state");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", 1));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", 1));
flexarray_set(back, boffset++, "dev");
flexarray_set(back, boffset++, disk->virtpath);
flexarray_set(back, boffset++, "type");
@@ -1859,11 +1859,11 @@ int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *dis
flexarray_set(back, boffset++, disk->readwrite ? "w" : "r");
flexarray_set(front, foffset++, "backend-id");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", disk->backend_domid));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", disk->backend_domid));
flexarray_set(front, foffset++, "state");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", 1));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", 1));
flexarray_set(front, foffset++, "virtual-device");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", devid));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", devid));
flexarray_set(front, foffset++, "device-type");
flexarray_set(front, foffset++, disk->is_cdrom ? "cdrom" : "disk");
@@ -1872,9 +1872,9 @@ int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *dis
flexarray_set(front, foffset++, "x86_32-abi"); /* hardcoded ! */
}
- libxl_device_generic_add(ctx, &device,
- libxl_xs_kvs_of_flexarray(&gc, back, boffset),
- libxl_xs_kvs_of_flexarray(&gc, front, foffset));
+ libxl__device_generic_add(ctx, &device,
+ libxl__xs_kvs_of_flexarray(&gc, back, boffset),
+ libxl__xs_kvs_of_flexarray(&gc, front, foffset));
rc = 0;
@@ -1882,7 +1882,7 @@ out_free:
flexarray_free(back);
flexarray_free(front);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -1900,7 +1900,7 @@ int libxl_device_disk_del(libxl_ctx *ctx,
device.domid = disk->domid;
device.devid = devid;
device.kind = DEVICE_VBD;
- return libxl_device_del(ctx, &device, wait);
+ return libxl__device_del(ctx, &device, wait);
}
char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk)
@@ -1931,7 +1931,7 @@ char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk)
break;
}
ret = strdup(dev);
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ret;
}
@@ -1971,12 +1971,12 @@ int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic)
}
if (nic->devid == -1) {
- if (!(dompath = libxl_xs_get_dompath(&gc, domid))) {
+ if (!(dompath = libxl__xs_get_dompath(&gc, domid))) {
rc = ERROR_FAIL;
goto out_free;
}
- if (!(l = libxl_xs_directory(&gc, XBT_NULL,
- libxl_sprintf(&gc, "%s/device/vif", dompath), &nb))) {
+ if (!(l = libxl__xs_directory(&gc, XBT_NULL,
+ libxl__sprintf(&gc, "%s/device/vif", dompath), &nb))) {
nic->devid = 0;
} else {
nic->devid = strtoul(l[nb - 1], NULL, 10) + 1;
@@ -1991,30 +1991,30 @@ int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic)
device.kind = DEVICE_VIF;
flexarray_set(back, boffset++, "frontend-id");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", nic->domid));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", nic->domid));
flexarray_set(back, boffset++, "online");
flexarray_set(back, boffset++, "1");
flexarray_set(back, boffset++, "state");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", 1));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", 1));
flexarray_set(back, boffset++, "script");
flexarray_set(back, boffset++, nic->script);
flexarray_set(back, boffset++, "mac");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
nic->mac[0], nic->mac[1], nic->mac[2],
nic->mac[3], nic->mac[4], nic->mac[5]));
flexarray_set(back, boffset++, "bridge");
- flexarray_set(back, boffset++, libxl_strdup(&gc, nic->bridge));
+ flexarray_set(back, boffset++, libxl__strdup(&gc, nic->bridge));
flexarray_set(back, boffset++, "handle");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", nic->devid));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", nic->devid));
flexarray_set(front, foffset++, "backend-id");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", nic->backend_domid));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", nic->backend_domid));
flexarray_set(front, foffset++, "state");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", 1));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", 1));
flexarray_set(front, foffset++, "handle");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", nic->devid));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", nic->devid));
flexarray_set(front, foffset++, "mac");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
nic->mac[0], nic->mac[1], nic->mac[2],
nic->mac[3], nic->mac[4], nic->mac[5]));
if (0 /* protocol != native*/) {
@@ -2022,9 +2022,9 @@ int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic)
flexarray_set(front, foffset++, "x86_32-abi"); /* hardcoded ! */
}
- libxl_device_generic_add(ctx, &device,
- libxl_xs_kvs_of_flexarray(&gc, back, boffset),
- libxl_xs_kvs_of_flexarray(&gc, front, foffset));
+ libxl__device_generic_add(ctx, &device,
+ libxl__xs_kvs_of_flexarray(&gc, back, boffset),
+ libxl__xs_kvs_of_flexarray(&gc, front, foffset));
/* FIXME: wait for plug */
rc = 0;
@@ -2032,7 +2032,7 @@ out_free:
flexarray_free(back);
flexarray_free(front);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -2048,7 +2048,7 @@ int libxl_device_nic_del(libxl_ctx *ctx,
device.domid = nic->domid;
device.kind = DEVICE_VIF;
- return libxl_device_del(ctx, &device, wait);
+ return libxl__device_del(ctx, &device, wait);
}
libxl_nicinfo *libxl_list_nics(libxl_ctx *ctx, uint32_t domid, unsigned int *nb)
@@ -2060,50 +2060,50 @@ libxl_nicinfo *libxl_list_nics(libxl_ctx *ctx, uint32_t domid, unsigned int *nb)
unsigned int nb_nics, i;
libxl_nicinfo *res, *nics;
- dompath = libxl_xs_get_dompath(&gc, domid);
+ dompath = libxl__xs_get_dompath(&gc, domid);
if (!dompath)
goto err;
- list = l = libxl_xs_directory(&gc, XBT_NULL,
- libxl_sprintf(&gc, "%s/device/vif", dompath), &nb_nics);
+ list = l = libxl__xs_directory(&gc, XBT_NULL,
+ libxl__sprintf(&gc, "%s/device/vif", dompath), &nb_nics);
if (!l)
goto err;
nics = res = calloc(nb_nics, sizeof (libxl_device_nic));
if (!res)
goto err;
for (*nb = nb_nics; nb_nics > 0; --nb_nics, ++l, ++nics) {
- nic_path_fe = libxl_sprintf(&gc, "%s/device/vif/%s", dompath, *l);
+ nic_path_fe = libxl__sprintf(&gc, "%s/device/vif/%s", dompath, *l);
nics->backend = xs_read(ctx->xsh, XBT_NULL,
- libxl_sprintf(&gc, "%s/backend", nic_path_fe), NULL);
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend-id", nic_path_fe));
+ libxl__sprintf(&gc, "%s/backend", nic_path_fe), NULL);
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", nic_path_fe));
nics->backend_id = val ? strtoul(val, NULL, 10) : -1;
nics->devid = strtoul(*l, NULL, 10);
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/state", nic_path_fe));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/state", nic_path_fe));
nics->state = val ? strtoul(val, NULL, 10) : -1;
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/mac", nic_path_fe));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", nic_path_fe));
for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
++i, tok = strtok(NULL, ":")) {
nics->mac[i] = strtoul(tok, NULL, 16);
}
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/event-channel", nic_path_fe));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/event-channel", nic_path_fe));
nics->evtch = val ? strtol(val, NULL, 10) : -1;
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/tx-ring-ref", nic_path_fe));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/tx-ring-ref", nic_path_fe));
nics->rref_tx = val ? strtol(val, NULL, 10) : -1;
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/rx-ring-ref", nic_path_fe));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/rx-ring-ref", nic_path_fe));
nics->rref_rx = val ? strtol(val, NULL, 10) : -1;
nics->frontend = xs_read(ctx->xsh, XBT_NULL,
- libxl_sprintf(&gc, "%s/frontend", nics->backend), NULL);
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/frontend-id", nics->backend));
+ libxl__sprintf(&gc, "%s/frontend", nics->backend), NULL);
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/frontend-id", nics->backend));
nics->frontend_id = val ? strtoul(val, NULL, 10) : -1;
nics->script = xs_read(ctx->xsh, XBT_NULL,
- libxl_sprintf(&gc, "%s/script", nics->backend), NULL);
+ libxl__sprintf(&gc, "%s/script", nics->backend), NULL);
}
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return res;
err:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return NULL;
}
@@ -2129,15 +2129,15 @@ int libxl_device_net2_add(libxl_ctx *ctx, uint32_t domid, libxl_device_net2 *net
goto err_free;
}
- if (!(dompath = libxl_xs_get_dompath(&gc, domid))) {
+ if (!(dompath = libxl__xs_get_dompath(&gc, domid))) {
rc = ERROR_FAIL;
goto err_free;
}
- dom = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/name", dompath));
+ dom = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/name", dompath));
if (net2->devid == -1) {
- if (!(l = libxl_xs_directory(&gc, XBT_NULL,
- libxl_sprintf(&gc, "%s/device/vif2", dompath), &nb))) {
+ if (!(l = libxl__xs_directory(&gc, XBT_NULL,
+ libxl__sprintf(&gc, "%s/device/vif2", dompath), &nb))) {
net2->devid = 0;
} else {
net2->devid = strtoul(l[nb - 1], NULL, 10) + 1;
@@ -2154,62 +2154,62 @@ int libxl_device_net2_add(libxl_ctx *ctx, uint32_t domid, libxl_device_net2 *net
flexarray_set(back, boffset++, "domain");
flexarray_set(back, boffset++, dom);
flexarray_set(back, boffset++, "frontend-id");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", net2->domid));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", net2->domid));
flexarray_set(back, boffset++, "local-trusted");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", net2->back_trusted));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", net2->back_trusted));
flexarray_set(back, boffset++, "mac");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
net2->back_mac[0], net2->back_mac[1],
net2->back_mac[2], net2->back_mac[3],
net2->back_mac[4], net2->back_mac[5]));
flexarray_set(back, boffset++, "remote-trusted");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", net2->trusted));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", net2->trusted));
flexarray_set(back, boffset++, "remote-mac");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
net2->front_mac[0], net2->front_mac[1],
net2->front_mac[2], net2->front_mac[3],
net2->front_mac[4], net2->front_mac[5]));
flexarray_set(back, boffset++, "max-bypasses");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", net2->max_bypasses));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", net2->max_bypasses));
flexarray_set(back, boffset++, "filter-mac");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", !!(net2->filter_mac)));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", !!(net2->filter_mac)));
flexarray_set(back, boffset++, "handle");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", net2->devid));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", net2->devid));
flexarray_set(back, boffset++, "online");
flexarray_set(back, boffset++, "1");
flexarray_set(back, boffset++, "state");
flexarray_set(back, boffset++, "1");
flexarray_set(front, foffset++, "backend-id");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", net2->backend_domid));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", net2->backend_domid));
flexarray_set(front, foffset++, "local-trusted");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", net2->trusted));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", net2->trusted));
flexarray_set(front, foffset++, "mac");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
net2->front_mac[0], net2->front_mac[1],
net2->front_mac[2], net2->front_mac[3],
net2->front_mac[4], net2->front_mac[5]));
flexarray_set(front, foffset++, "remote-trusted");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", net2->back_trusted));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", net2->back_trusted));
flexarray_set(front, foffset++, "remote-mac");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
net2->back_mac[0], net2->back_mac[1],
net2->back_mac[2], net2->back_mac[3],
net2->back_mac[4], net2->back_mac[5]));
flexarray_set(front, foffset++, "filter-mac");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", !!(net2->filter_mac)));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", !!(net2->filter_mac)));
flexarray_set(front, foffset++, "state");
flexarray_set(front, foffset++, "1");
- libxl_device_generic_add(ctx, &device,
- libxl_xs_kvs_of_flexarray(&gc, back, boffset),
- libxl_xs_kvs_of_flexarray(&gc, front, foffset));
+ libxl__device_generic_add(ctx, &device,
+ libxl__xs_kvs_of_flexarray(&gc, back, boffset),
+ libxl__xs_kvs_of_flexarray(&gc, front, foffset));
/* FIXME: wait for plug */
rc = 0;
@@ -2217,7 +2217,7 @@ err_free:
flexarray_free(back);
flexarray_free(front);
err:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -2230,11 +2230,11 @@ libxl_net2info *libxl_device_net2_list(libxl_ctx *ctx, uint32_t domid, unsigned
unsigned int nb_net2s, i;
libxl_net2info *res, *net2s;
- dompath = libxl_xs_get_dompath(&gc, domid);
+ dompath = libxl__xs_get_dompath(&gc, domid);
if (!dompath)
goto err;
- l = libxl_xs_directory(&gc, XBT_NULL,
- libxl_sprintf(&gc, "%s/device/vif2", dompath), &nb_net2s);
+ l = libxl__xs_directory(&gc, XBT_NULL,
+ libxl__sprintf(&gc, "%s/device/vif2", dompath), &nb_net2s);
if (!l)
goto err;
res = calloc(nb_net2s, sizeof (libxl_net2info));
@@ -2242,43 +2242,43 @@ libxl_net2info *libxl_device_net2_list(libxl_ctx *ctx, uint32_t domid, unsigned
goto err;
net2s = res;
for (*nb = nb_net2s; nb_net2s > 0; --nb_net2s, ++l, ++net2s) {
- net2_path_fe = libxl_sprintf(&gc, "%s/device/vif2/%s", dompath, *l);
+ net2_path_fe = libxl__sprintf(&gc, "%s/device/vif2/%s", dompath, *l);
- net2s->backend = libxl_xs_read(&gc, XBT_NULL,
- libxl_sprintf(&gc, "%s/backend", net2_path_fe));
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend-id", net2_path_fe));
+ net2s->backend = libxl__xs_read(&gc, XBT_NULL,
+ libxl__sprintf(&gc, "%s/backend", net2_path_fe));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", net2_path_fe));
net2s->backend_id = val ? strtoul(val, NULL, 10) : -1;
net2s->devid = strtoul(*l, NULL, 10);
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/state", net2_path_fe));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/state", net2_path_fe));
net2s->state = val ? strtoul(val, NULL, 10) : -1;
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/mac", net2_path_fe));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", net2_path_fe));
for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
++i, tok = strtok(NULL, ":")) {
net2s->mac[i] = strtoul(tok, NULL, 16);
}
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/remote-trusted", net2_path_fe));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/remote-trusted", net2_path_fe));
net2s->trusted = val ? strtoul(val, NULL, 10) : -1;
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/remote-mac", net2_path_fe));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/remote-mac", net2_path_fe));
for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
++i, tok = strtok(NULL, ":")) {
net2s->back_mac[i] = strtoul(tok, NULL, 16);
}
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/filter-mac", net2_path_fe));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/filter-mac", net2_path_fe));
net2s->filter_mac = val ? strtoul(val, NULL, 10) : -1;
- net2s->frontend = libxl_xs_read(&gc, XBT_NULL,
- libxl_sprintf(&gc, "%s/frontend", net2s->backend));
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/frontend-id", net2s->backend));
+ net2s->frontend = libxl__xs_read(&gc, XBT_NULL,
+ libxl__sprintf(&gc, "%s/frontend", net2s->backend));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/frontend-id", net2s->backend));
net2s->frontend_id = val ? strtoul(val, NULL, 10) : -1;
}
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return res;
err:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return NULL;
}
@@ -2293,7 +2293,7 @@ int libxl_device_net2_del(libxl_ctx *ctx, libxl_device_net2 *net2, int wait)
device.domid = net2->domid;
device.kind = DEVICE_VIF2;
- return libxl_device_del(ctx, &device, wait);
+ return libxl__device_del(ctx, &device, wait);
}
@@ -2310,13 +2310,13 @@ int libxl_device_console_add(libxl_ctx *ctx, uint32_t domid, libxl_device_consol
if (console->build_state) {
xs_transaction_t t;
- char **ents = (char **) libxl_calloc(&gc, 11, sizeof(char *));
+ char **ents = (char **) libxl__calloc(&gc, 11, sizeof(char *));
ents[0] = "console/port";
- ents[1] = libxl_sprintf(&gc, "%"PRIu32, console->build_state->console_port);
+ ents[1] = libxl__sprintf(&gc, "%"PRIu32, console->build_state->console_port);
ents[2] = "console/ring-ref";
- ents[3] = libxl_sprintf(&gc, "%lu", console->build_state->console_mfn);
+ ents[3] = libxl__sprintf(&gc, "%lu", console->build_state->console_mfn);
ents[4] = "console/limit";
- ents[5] = libxl_sprintf(&gc, "%d", LIBXL_XENCONSOLE_LIMIT);
+ ents[5] = libxl__sprintf(&gc, "%d", LIBXL_XENCONSOLE_LIMIT);
ents[6] = "console/type";
if (console->consback == LIBXL_CONSBACK_XENCONSOLED)
ents[7] = "xenconsoled";
@@ -2326,7 +2326,7 @@ int libxl_device_console_add(libxl_ctx *ctx, uint32_t domid, libxl_device_consol
ents[9] = console->output;
retry_transaction:
t = xs_transaction_start(ctx->xsh);
- libxl_xs_writev(&gc, t, libxl_xs_get_dompath(&gc, console->domid), ents);
+ libxl__xs_writev(&gc, t, libxl__xs_get_dompath(&gc, console->domid), ents);
if (!xs_transaction_end(ctx->xsh, t, 0))
if (errno == EAGAIN)
goto retry_transaction;
@@ -2351,13 +2351,13 @@ retry_transaction:
device.kind = DEVICE_CONSOLE;
flexarray_set(back, boffset++, "frontend-id");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", console->domid));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", console->domid));
flexarray_set(back, boffset++, "online");
flexarray_set(back, boffset++, "1");
flexarray_set(back, boffset++, "state");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", 1));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", 1));
flexarray_set(back, boffset++, "domain");
- flexarray_set(back, boffset++, _libxl_domid_to_name(&gc, domid));
+ flexarray_set(back, boffset++, libxl__domid_to_name(&gc, domid));
flexarray_set(back, boffset++, "protocol");
flexarray_set(back, boffset++, LIBXL_XENCONSOLE_PROTOCOL);
@@ -2365,11 +2365,11 @@ retry_transaction:
* it has already been added to console/ */
if (device.devid > 0) {
flexarray_set(front, foffset++, "backend-id");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", console->backend_domid));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", console->backend_domid));
flexarray_set(front, foffset++, "state");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", 1));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", 1));
flexarray_set(front, foffset++, "limit");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", LIBXL_XENCONSOLE_LIMIT));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", LIBXL_XENCONSOLE_LIMIT));
flexarray_set(front, foffset++, "protocol");
flexarray_set(front, foffset++, LIBXL_XENCONSOLE_PROTOCOL);
flexarray_set(front, foffset++, "type");
@@ -2381,15 +2381,15 @@ retry_transaction:
flexarray_set(front, foffset++, console->output);
}
- libxl_device_generic_add(ctx, &device,
- libxl_xs_kvs_of_flexarray(&gc, back, boffset),
- libxl_xs_kvs_of_flexarray(&gc, front, foffset));
+ libxl__device_generic_add(ctx, &device,
+ libxl__xs_kvs_of_flexarray(&gc, back, boffset),
+ libxl__xs_kvs_of_flexarray(&gc, front, foffset));
rc = 0;
out_free:
flexarray_free(back);
flexarray_free(front);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -2423,28 +2423,28 @@ int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb)
device.kind = DEVICE_VKBD;
flexarray_set(back, boffset++, "frontend-id");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vkb->domid));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vkb->domid));
flexarray_set(back, boffset++, "online");
flexarray_set(back, boffset++, "1");
flexarray_set(back, boffset++, "state");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", 1));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", 1));
flexarray_set(back, boffset++, "domain");
- flexarray_set(back, boffset++, _libxl_domid_to_name(&gc, domid));
+ flexarray_set(back, boffset++, libxl__domid_to_name(&gc, domid));
flexarray_set(front, foffset++, "backend-id");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", vkb->backend_domid));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", vkb->backend_domid));
flexarray_set(front, foffset++, "state");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", 1));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", 1));
- libxl_device_generic_add(ctx, &device,
- libxl_xs_kvs_of_flexarray(&gc, back, boffset),
- libxl_xs_kvs_of_flexarray(&gc, front, foffset));
+ libxl__device_generic_add(ctx, &device,
+ libxl__xs_kvs_of_flexarray(&gc, back, boffset),
+ libxl__xs_kvs_of_flexarray(&gc, front, foffset));
rc = 0;
out_free:
flexarray_free(back);
flexarray_free(front);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -2467,10 +2467,10 @@ libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *n
unsigned int numl, len;
char *type;
- be_path_vbd = libxl_sprintf(&gc, "%s/backend/vbd/%d", libxl_xs_get_dompath(&gc, 0), domid);
- be_path_tap = libxl_sprintf(&gc, "%s/backend/tap/%d", libxl_xs_get_dompath(&gc, 0), domid);
+ be_path_vbd = libxl__sprintf(&gc, "%s/backend/vbd/%d", libxl__xs_get_dompath(&gc, 0), domid);
+ be_path_tap = libxl__sprintf(&gc, "%s/backend/tap/%d", libxl__xs_get_dompath(&gc, 0), domid);
- b = l = libxl_xs_directory(&gc, XBT_NULL, be_path_vbd, &numl);
+ b = l = libxl__xs_directory(&gc, XBT_NULL, be_path_vbd, &numl);
if (l) {
ret = realloc(ret, sizeof(libxl_device_disk) * numl);
disks = ret;
@@ -2479,19 +2479,19 @@ libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *n
for (; disks < dend; ++disks, ++l) {
disks->backend_domid = 0;
disks->domid = domid;
- disks->physpath = xs_read(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "%s/%s/params", be_path_vbd, *l), &len);
- libxl_string_to_phystype(ctx, libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/type", be_path_vbd, *l)), &(disks->phystype));
- disks->virtpath = xs_read(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "%s/%s/dev", be_path_vbd, *l), &len);
- disks->unpluggable = atoi(libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/removable", be_path_vbd, *l)));
- if (!strcmp(libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/mode", be_path_vbd, *l)), "w"))
+ disks->physpath = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/%s/params", be_path_vbd, *l), &len);
+ libxl_string_to_phystype(ctx, libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/type", be_path_vbd, *l)), &(disks->phystype));
+ disks->virtpath = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/%s/dev", be_path_vbd, *l), &len);
+ disks->unpluggable = atoi(libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/removable", be_path_vbd, *l)));
+ if (!strcmp(libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/mode", be_path_vbd, *l)), "w"))
disks->readwrite = 1;
else
disks->readwrite = 0;
- type = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/device-type", libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/frontend", be_path_vbd, *l))));
+ type = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/device-type", libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/frontend", be_path_vbd, *l))));
disks->is_cdrom = !strcmp(type, "cdrom");
}
}
- b = l = libxl_xs_directory(&gc, XBT_NULL, be_path_tap, &numl);
+ b = l = libxl__xs_directory(&gc, XBT_NULL, be_path_tap, &numl);
if (l) {
ret = realloc(ret, sizeof(libxl_device_disk) * (*num + numl));
disks = ret + *num;
@@ -2499,19 +2499,19 @@ libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *n
for (dend = ret + *num; disks < dend; ++disks, ++l) {
disks->backend_domid = 0;
disks->domid = domid;
- disks->physpath = xs_read(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "%s/%s/params", be_path_tap, *l), &len);
- libxl_string_to_phystype(ctx, libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/type", be_path_tap, *l)), &(disks->phystype));
- disks->virtpath = xs_read(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "%s/%s/dev", be_path_tap, *l), &len);
- disks->unpluggable = atoi(libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/removable", be_path_tap, *l)));
- if (!strcmp(libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/mode", be_path_tap, *l)), "w"))
+ disks->physpath = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/%s/params", be_path_tap, *l), &len);
+ libxl_string_to_phystype(ctx, libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/type", be_path_tap, *l)), &(disks->phystype));
+ disks->virtpath = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/%s/dev", be_path_tap, *l), &len);
+ disks->unpluggable = atoi(libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/removable", be_path_tap, *l)));
+ if (!strcmp(libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/mode", be_path_tap, *l)), "w"))
disks->readwrite = 1;
else
disks->readwrite = 0;
- type = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/device-type", libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/frontend", be_path_tap, *l))));
+ type = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/device-type", libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/frontend", be_path_tap, *l))));
disks->is_cdrom = !strcmp(type, "cdrom");
}
}
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ret;
}
@@ -2522,31 +2522,31 @@ int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid,
char *dompath, *diskpath;
char *val;
- dompath = libxl_xs_get_dompath(&gc, domid);
+ dompath = libxl__xs_get_dompath(&gc, domid);
diskinfo->devid = device_disk_dev_number(disk->virtpath);
/* tap devices entries in xenstore are written as vbd devices. */
- diskpath = libxl_sprintf(&gc, "%s/device/vbd/%d", dompath, diskinfo->devid);
+ diskpath = libxl__sprintf(&gc, "%s/device/vbd/%d", dompath, diskinfo->devid);
diskinfo->backend = xs_read(ctx->xsh, XBT_NULL,
- libxl_sprintf(&gc, "%s/backend", diskpath), NULL);
+ libxl__sprintf(&gc, "%s/backend", diskpath), NULL);
if (!diskinfo->backend) {
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_FAIL;
}
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend-id", diskpath));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", diskpath));
diskinfo->backend_id = val ? strtoul(val, NULL, 10) : -1;
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/state", diskpath));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/state", diskpath));
diskinfo->state = val ? strtoul(val, NULL, 10) : -1;
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/event-channel", diskpath));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/event-channel", diskpath));
diskinfo->evtch = val ? strtoul(val, NULL, 10) : -1;
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/ring-ref", diskpath));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/ring-ref", diskpath));
diskinfo->rref = val ? strtoul(val, NULL, 10) : -1;
diskinfo->frontend = xs_read(ctx->xsh, XBT_NULL,
- libxl_sprintf(&gc, "%s/frontend", diskinfo->backend), NULL);
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/frontend-id", diskinfo->backend));
+ libxl__sprintf(&gc, "%s/frontend", diskinfo->backend), NULL);
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/frontend-id", diskinfo->backend));
diskinfo->frontend_id = val ? strtoul(val, NULL, 10) : -1;
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -2603,20 +2603,20 @@ static int libxl_build_xenpv_qemu_args(libxl_gc *gc,
if (vfb != NULL) {
info->vnc = vfb->vnc;
if (vfb->vnclisten)
- info->vnclisten = libxl_strdup(gc, vfb->vnclisten);
+ info->vnclisten = libxl__strdup(gc, vfb->vnclisten);
info->vncdisplay = vfb->vncdisplay;
info->vncunused = vfb->vncunused;
if (vfb->vncpasswd)
info->vncpasswd = vfb->vncpasswd;
if (vfb->keymap)
- info->keymap = libxl_strdup(gc, vfb->keymap);
+ info->keymap = libxl__strdup(gc, vfb->keymap);
info->sdl = vfb->sdl;
info->opengl = vfb->opengl;
} else
info->nographic = 1;
info->domid = domid;
info->dom_name = libxl_domid_to_name(ctx, domid);
- info->device_model = libxl_abs_path(gc, "qemu-dm", libxl_libexec_path());
+ info->device_model = libxl__abs_path(gc, "qemu-dm", libxl_libexec_path());
info->type = XENPV;
return 0;
}
@@ -2629,7 +2629,7 @@ int libxl_create_xenpv_qemu(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vf
libxl_build_xenpv_qemu_args(&gc, domid, vfb, &info);
libxl_create_device_model(ctx, &info, NULL, 0, NULL, 0, starting_r);
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -2662,27 +2662,27 @@ int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb)
device.kind = DEVICE_VFB;
flexarray_set(back, boffset++, "frontend-id");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vfb->domid));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vfb->domid));
flexarray_set(back, boffset++, "online");
flexarray_set(back, boffset++, "1");
flexarray_set(back, boffset++, "state");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", 1));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", 1));
flexarray_set(back, boffset++, "domain");
- flexarray_set(back, boffset++, _libxl_domid_to_name(&gc, domid));
+ flexarray_set(back, boffset++, libxl__domid_to_name(&gc, domid));
flexarray_set(back, boffset++, "vnc");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vfb->vnc));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vfb->vnc));
flexarray_set(back, boffset++, "vnclisten");
flexarray_set(back, boffset++, vfb->vnclisten);
flexarray_set(back, boffset++, "vncpasswd");
flexarray_set(back, boffset++, vfb->vncpasswd);
flexarray_set(back, boffset++, "vncdisplay");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vfb->vncdisplay));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vfb->vncdisplay));
flexarray_set(back, boffset++, "vncunused");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vfb->vncunused));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vfb->vncunused));
flexarray_set(back, boffset++, "sdl");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vfb->sdl));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vfb->sdl));
flexarray_set(back, boffset++, "opengl");
- flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vfb->opengl));
+ flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vfb->opengl));
if (vfb->xauthority) {
flexarray_set(back, boffset++, "xauthority");
flexarray_set(back, boffset++, vfb->xauthority);
@@ -2693,19 +2693,19 @@ int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb)
}
flexarray_set(front, foffset++, "backend-id");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", vfb->backend_domid));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", vfb->backend_domid));
flexarray_set(front, foffset++, "state");
- flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", 1));
+ flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", 1));
- libxl_device_generic_add(ctx, &device,
- libxl_xs_kvs_of_flexarray(&gc, back, boffset),
- libxl_xs_kvs_of_flexarray(&gc, front, foffset));
+ libxl__device_generic_add(ctx, &device,
+ libxl__xs_kvs_of_flexarray(&gc, back, boffset),
+ libxl__xs_kvs_of_flexarray(&gc, front, foffset));
rc = 0;
out_free:
flexarray_free(front);
flexarray_free(back);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -2726,10 +2726,10 @@ int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint32_t max_memkb)
libxl_gc gc = LIBXL_INIT_GC(ctx);
char *mem, *endptr;
uint32_t memorykb;
- char *dompath = libxl_xs_get_dompath(&gc, domid);
+ char *dompath = libxl__xs_get_dompath(&gc, domid);
int rc = 1;
- mem = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/memory/target", dompath));
+ mem = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/memory/target", dompath));
if (!mem) {
XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "cannot get memory info from %s/memory/target\n", dompath);
goto out;
@@ -2746,11 +2746,11 @@ int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint32_t max_memkb)
}
if (domid != 0)
- libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/memory/static-max", dompath), "%"PRIu32, max_memkb);
+ libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/memory/static-max", dompath), "%"PRIu32, max_memkb);
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -2760,13 +2760,13 @@ int libxl_set_memory_target(libxl_ctx *ctx, uint32_t domid, uint32_t target_memk
int rc = 1;
uint32_t memorykb = 0, videoram = 0;
char *memmax, *endptr, *videoram_s = NULL;
- char *dompath = libxl_xs_get_dompath(&gc, domid);
+ char *dompath = libxl__xs_get_dompath(&gc, domid);
xc_domaininfo_t info;
libxl_dominfo ptr;
char *uuid;
if (domid) {
- memmax = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/memory/static-max", dompath));
+ memmax = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/memory/static-max", dompath));
if (!memmax) {
XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
"cannot get memory info from %s/memory/static-max\n", dompath);
@@ -2786,17 +2786,17 @@ int libxl_set_memory_target(libxl_ctx *ctx, uint32_t domid, uint32_t target_memk
}
}
- videoram_s = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/memory/videoram", dompath));
+ videoram_s = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/memory/videoram", dompath));
videoram = videoram_s ? atoi(videoram_s) : 0;
- libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/memory/target", dompath), "%"PRIu32, target_memkb);
+ libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/memory/target", dompath), "%"PRIu32, target_memkb);
rc = xc_domain_getinfolist(ctx->xch, domid, 1, &info);
if (rc != 1 || info.domain != domid)
goto out;
xcinfo2xlinfo(&info, &ptr);
- uuid = libxl_uuid2string(&gc, ptr.uuid);
- libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "/vm/%s/memory", uuid), "%"PRIu32, target_memkb / 1024);
+ uuid = libxl__uuid2string(&gc, ptr.uuid);
+ libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "/vm/%s/memory", uuid), "%"PRIu32, target_memkb / 1024);
if (enforce || !domid)
memorykb = target_memkb;
@@ -2806,7 +2806,7 @@ int libxl_set_memory_target(libxl_ctx *ctx, uint32_t domid, uint32_t target_memk
rc = xc_domain_memory_set_pod_target(ctx->xch, domid, (target_memkb - videoram) / 4, NULL, NULL, NULL);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -2969,14 +2969,14 @@ int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, uint32_t bitmask)
XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting domain info list");
goto out;
}
- if (!(dompath = libxl_xs_get_dompath(&gc, domid)))
+ if (!(dompath = libxl__xs_get_dompath(&gc, domid)))
goto out;
retry_transaction:
t = xs_transaction_start(ctx->xsh);
for (i = 0; i <= info.vcpu_max_id; i++)
- libxl_xs_write(&gc, t,
- libxl_sprintf(&gc, "%s/cpu/%u/availability", dompath, i),
+ libxl__xs_write(&gc, t,
+ libxl__sprintf(&gc, "%s/cpu/%u/availability", dompath, i),
"%s", ((1 << i) & bitmask) ? "online" : "offline");
if (!xs_transaction_end(ctx->xsh, t, 0)) {
if (errno == EAGAIN)
@@ -2984,7 +2984,7 @@ retry_transaction:
} else
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -3099,11 +3099,11 @@ int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid, char *trigger_name, uint3
int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq)
{
libxl_gc gc = LIBXL_INIT_GC(ctx);
- char *dompath = libxl_xs_get_dompath(&gc, domid);
+ char *dompath = libxl__xs_get_dompath(&gc, domid);
- libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/control/sysrq", dompath), "%c", sysrq);
+ libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/control/sysrq", dompath), "%c", sysrq);
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -3191,14 +3191,14 @@ void libxl_xen_console_read_finish(libxl_ctx *ctx,
uint32_t libxl_vm_get_start_time(libxl_ctx *ctx, uint32_t domid)
{
libxl_gc gc = LIBXL_INIT_GC(ctx);
- char *dompath = libxl_xs_get_dompath(&gc, domid);
+ char *dompath = libxl__xs_get_dompath(&gc, domid);
char *vm_path, *start_time;
uint32_t ret;
- vm_path = libxl_xs_read(
- &gc, XBT_NULL, libxl_sprintf(&gc, "%s/vm", dompath));
- start_time = libxl_xs_read(
- &gc, XBT_NULL, libxl_sprintf(&gc, "%s/start_time", vm_path));
+ vm_path = libxl__xs_read(
+ &gc, XBT_NULL, libxl__sprintf(&gc, "%s/vm", dompath));
+ start_time = libxl__xs_read(
+ &gc, XBT_NULL, libxl__sprintf(&gc, "%s/start_time", vm_path));
if (start_time == NULL) {
XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, -1,
"Can't get start time of domain '%d'", domid);
@@ -3206,7 +3206,7 @@ uint32_t libxl_vm_get_start_time(libxl_ctx *ctx, uint32_t domid)
}else{
ret = strtoul(start_time, NULL, 10);
}
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ret;
}
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index d989f100e6..f9ebbea2e8 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -119,7 +119,7 @@
*
* No temporary objects allocated from the pool may be explicitly freed.
* Therefore public functions which initialize a libxl_gc MUST call
- * libxl_free_all() before returning.
+ * libxl__free_all() before returning.
*/
#ifndef LIBXL_H
#define LIBXL_H
diff --git a/tools/libxl/libxl_blktap2.c b/tools/libxl/libxl_blktap2.c
index e6a8ed1662..24d13da555 100644
--- a/tools/libxl/libxl_blktap2.c
+++ b/tools/libxl/libxl_blktap2.c
@@ -35,15 +35,15 @@ const char *libxl_blktap_devpath(libxl_gc *gc,
type = device_disk_string_of_phystype(phystype);
minor = tap_ctl_find_minor(type, disk);
if (minor >= 0) {
- devname = libxl_sprintf(gc, "/dev/xen/blktap-2/tapdev%d", minor);
+ devname = libxl__sprintf(gc, "/dev/xen/blktap-2/tapdev%d", minor);
if (devname)
return devname;
}
- params = libxl_sprintf(gc, "%s:%s", type, disk);
+ params = libxl__sprintf(gc, "%s:%s", type, disk);
err = tap_ctl_create(params, &devname);
if (!err) {
- libxl_ptr_add(gc, devname);
+ libxl__ptr_add(gc, devname);
return devname;
}
diff --git a/tools/libxl/libxl_bootloader.c b/tools/libxl/libxl_bootloader.c
index d96db5b2e1..e842f4d574 100644
--- a/tools/libxl/libxl_bootloader.c
+++ b/tools/libxl/libxl_bootloader.c
@@ -45,20 +45,20 @@ static char **make_bootloader_args(libxl_gc *gc,
flexarray_set(args, nr++, (char *)info->u.pv.bootloader);
if (info->kernel.path)
- flexarray_set(args, nr++, libxl_sprintf(gc, "--kernel=%s", info->kernel.path));
+ flexarray_set(args, nr++, libxl__sprintf(gc, "--kernel=%s", info->kernel.path));
if (info->u.pv.ramdisk.path)
- flexarray_set(args, nr++, libxl_sprintf(gc, "--ramdisk=%s", info->u.pv.ramdisk.path));
+ flexarray_set(args, nr++, libxl__sprintf(gc, "--ramdisk=%s", info->u.pv.ramdisk.path));
if (info->u.pv.cmdline && *info->u.pv.cmdline != '\0')
- flexarray_set(args, nr++, libxl_sprintf(gc, "--args=%s", info->u.pv.cmdline));
+ flexarray_set(args, nr++, libxl__sprintf(gc, "--args=%s", info->u.pv.cmdline));
- flexarray_set(args, nr++, libxl_sprintf(gc, "--output=%s", fifo));
+ flexarray_set(args, nr++, libxl__sprintf(gc, "--output=%s", fifo));
flexarray_set(args, nr++, "--output-format=simple0");
- flexarray_set(args, nr++, libxl_sprintf(gc, "--output-directory=%s", "/var/run/libxl/"));
+ flexarray_set(args, nr++, libxl__sprintf(gc, "--output-directory=%s", "/var/run/libxl/"));
if (info->u.pv.bootloader_args) {
char *saveptr;
/* Operate on a duplicate since strtok modifes the argument */
- char *dup = libxl_strdup(gc, info->u.pv.bootloader_args);
+ char *dup = libxl__strdup(gc, info->u.pv.bootloader_args);
char *t = strtok_r(dup, " \t\n", &saveptr);
do {
flexarray_set(args, nr++, t);
@@ -126,7 +126,7 @@ static pid_t fork_exec_bootloader(int *master, char *arg0, char **args)
return -1;
else if (pid == 0) {
setenv("TERM", "vt100", 1);
- libxl_exec(-1, -1, -1, arg0, args);
+ libxl__exec(-1, -1, -1, arg0, args);
return -1;
}
@@ -263,7 +263,7 @@ static char * bootloader_interact(libxl_gc *gc, int xenconsoled_fd, int bootload
}
}
- libxl_ptr_add(gc, output);
+ libxl__ptr_add(gc, output);
return output;
out_err:
@@ -383,8 +383,8 @@ int libxl_run_bootloader(libxl_ctx *ctx,
goto out_close;
}
- dom_console_xs_path = libxl_sprintf(&gc, "%s/console/tty", libxl_xs_get_dompath(&gc, domid));
- libxl_xs_write(&gc, XBT_NULL, dom_console_xs_path, "%s", dom_console_slave_tty_path);
+ dom_console_xs_path = libxl__sprintf(&gc, "%s/console/tty", libxl__xs_get_dompath(&gc, domid));
+ libxl__xs_write(&gc, XBT_NULL, dom_console_xs_path, "%s", dom_console_slave_tty_path);
pid = fork_exec_bootloader(&bootloader_fd, (char *)info->u.pv.bootloader, args);
if (pid < 0) {
@@ -441,7 +441,7 @@ out_close:
free(args);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 1fc81ce316..797f4bbc54 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -39,7 +39,7 @@ static const char *string_of_kinds[] = {
[DEVICE_CONSOLE] = "console",
};
-int libxl_device_generic_add(libxl_ctx *ctx, libxl_device *device,
+int libxl__device_generic_add(libxl_ctx *ctx, libxl_device *device,
char **bents, char **fents)
{
libxl_gc gc = LIBXL_INIT_GC(ctx);
@@ -54,12 +54,12 @@ int libxl_device_generic_add(libxl_ctx *ctx, libxl_device *device,
goto out;
}
- dom_path_backend = libxl_xs_get_dompath(&gc, device->backend_domid);
- dom_path = libxl_xs_get_dompath(&gc, device->domid);
+ dom_path_backend = libxl__xs_get_dompath(&gc, device->backend_domid);
+ dom_path = libxl__xs_get_dompath(&gc, device->domid);
- frontend_path = libxl_sprintf(&gc, "%s/device/%s/%d",
+ frontend_path = libxl__sprintf(&gc, "%s/device/%s/%d",
dom_path, string_of_kinds[device->kind], device->devid);
- backend_path = libxl_sprintf(&gc, "%s/backend/%s/%u/%d",
+ backend_path = libxl__sprintf(&gc, "%s/backend/%s/%u/%d",
dom_path_backend, string_of_kinds[device->backend_kind], device->domid, device->devid);
frontend_perms[0].id = device->domid;
@@ -80,16 +80,16 @@ retry_transaction:
xs_rm(ctx->xsh, t, frontend_path);
xs_mkdir(ctx->xsh, t, frontend_path);
xs_set_permissions(ctx->xsh, t, frontend_path, frontend_perms, ARRAY_SIZE(frontend_perms));
- xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/backend", frontend_path), backend_path, strlen(backend_path));
- libxl_xs_writev(&gc, t, frontend_path, fents);
+ xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/backend", frontend_path), backend_path, strlen(backend_path));
+ libxl__xs_writev(&gc, t, frontend_path, fents);
}
if (bents) {
xs_rm(ctx->xsh, t, backend_path);
xs_mkdir(ctx->xsh, t, backend_path);
xs_set_permissions(ctx->xsh, t, backend_path, backend_perms, ARRAY_SIZE(backend_perms));
- xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/frontend", backend_path), frontend_path, strlen(frontend_path));
- libxl_xs_writev(&gc, t, backend_path, bents);
+ xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/frontend", backend_path), frontend_path, strlen(frontend_path));
+ libxl__xs_writev(&gc, t, backend_path, bents);
}
if (!xs_transaction_end(ctx->xsh, t, 0)) {
@@ -100,7 +100,7 @@ retry_transaction:
}
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -226,12 +226,12 @@ int device_disk_dev_number(char *virtpath)
return -1;
}
-int libxl_device_destroy(libxl_ctx *ctx, char *be_path, int force)
+int libxl__device_destroy(libxl_ctx *ctx, char *be_path, int force)
{
libxl_gc gc = LIBXL_INIT_GC(ctx);
xs_transaction_t t;
- char *state_path = libxl_sprintf(&gc, "%s/state", be_path);
- char *state = libxl_xs_read(&gc, XBT_NULL, state_path);
+ char *state_path = libxl__sprintf(&gc, "%s/state", be_path);
+ char *state = libxl__xs_read(&gc, XBT_NULL, state_path);
int rc = 0;
if (!state)
@@ -243,7 +243,7 @@ int libxl_device_destroy(libxl_ctx *ctx, char *be_path, int force)
retry_transaction:
t = xs_transaction_start(ctx->xsh);
- xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/online", be_path), "0", strlen("0"));
+ xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/online", be_path), "0", strlen("0"));
xs_write(ctx->xsh, t, state_path, "5", strlen("5"));
if (!xs_transaction_end(ctx->xsh, t, 0)) {
if (errno == EAGAIN)
@@ -258,7 +258,7 @@ retry_transaction:
rc = 1;
}
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -277,7 +277,7 @@ static int wait_for_dev_destroy(libxl_ctx *ctx, struct timeval *tv)
if (select(nfds, &rfds, NULL, NULL, tv) > 0) {
l1 = xs_read_watch(ctx->xsh, &n);
if (l1 != NULL) {
- char *state = libxl_xs_read(&gc, XBT_NULL, l1[XS_WATCH_PATH]);
+ char *state = libxl__xs_read(&gc, XBT_NULL, l1[XS_WATCH_PATH]);
if (!state || atoi(state) == 6) {
xs_unwatch(ctx->xsh, l1[0], l1[1]);
xs_rm(ctx->xsh, XBT_NULL, l1[XS_WATCH_TOKEN]);
@@ -287,11 +287,11 @@ static int wait_for_dev_destroy(libxl_ctx *ctx, struct timeval *tv)
free(l1);
}
}
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
-int libxl_devices_destroy(libxl_ctx *ctx, uint32_t domid, int force)
+int libxl__devices_destroy(libxl_ctx *ctx, uint32_t domid, int force)
{
libxl_gc gc = LIBXL_INIT_GC(ctx);
char *path, *be_path, *fe_path;
@@ -301,8 +301,8 @@ int libxl_devices_destroy(libxl_ctx *ctx, uint32_t domid, int force)
flexarray_t *toremove;
toremove = flexarray_make(16, 1);
- path = libxl_sprintf(&gc, "/local/domain/%d/device", domid);
- l1 = libxl_xs_directory(&gc, XBT_NULL, path, &num1);
+ path = libxl__sprintf(&gc, "/local/domain/%d/device", domid);
+ l1 = libxl__xs_directory(&gc, XBT_NULL, path, &num1);
if (!l1) {
XL_LOG(ctx, XL_LOG_ERROR, "%s is empty", path);
goto out;
@@ -310,17 +310,17 @@ int libxl_devices_destroy(libxl_ctx *ctx, uint32_t domid, int force)
for (i = 0; i < num1; i++) {
if (!strcmp("vfs", l1[i]))
continue;
- path = libxl_sprintf(&gc, "/local/domain/%d/device/%s", domid, l1[i]);
- l2 = libxl_xs_directory(&gc, XBT_NULL, path, &num2);
+ path = libxl__sprintf(&gc, "/local/domain/%d/device/%s", domid, l1[i]);
+ l2 = libxl__xs_directory(&gc, XBT_NULL, path, &num2);
if (!l2)
continue;
for (j = 0; j < num2; j++) {
- fe_path = libxl_sprintf(&gc, "/local/domain/%d/device/%s/%s", domid, l1[i], l2[j]);
- be_path = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend", fe_path));
+ fe_path = libxl__sprintf(&gc, "/local/domain/%d/device/%s/%s", domid, l1[i], l2[j]);
+ be_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend", fe_path));
if (be_path != NULL) {
- if (libxl_device_destroy(ctx, be_path, force) > 0)
+ if (libxl__device_destroy(ctx, be_path, force) > 0)
n_watches++;
- flexarray_set(toremove, n++, libxl_dirname(&gc, be_path));
+ flexarray_set(toremove, n++, libxl__dirname(&gc, be_path));
} else {
xs_rm(ctx->xsh, XBT_NULL, path);
}
@@ -349,23 +349,23 @@ int libxl_devices_destroy(libxl_ctx *ctx, uint32_t domid, int force)
}
out:
flexarray_free(toremove);
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
-int libxl_device_del(libxl_ctx *ctx, libxl_device *dev, int wait)
+int libxl__device_del(libxl_ctx *ctx, libxl_device *dev, int wait)
{
libxl_gc gc = LIBXL_INIT_GC(ctx);
char *dom_path_backend, *backend_path;
int rc;
/* Create strings */
- dom_path_backend = libxl_xs_get_dompath(&gc, dev->backend_domid);
- backend_path = libxl_sprintf(&gc, "%s/backend/%s/%u/%d",
+ dom_path_backend = libxl__xs_get_dompath(&gc, dev->backend_domid);
+ backend_path = libxl__sprintf(&gc, "%s/backend/%s/%u/%d",
dom_path_backend,
string_of_kinds[dev->backend_kind],
dev->domid, dev->devid);
- rc = libxl_device_destroy(ctx, backend_path, !wait);
+ rc = libxl__device_destroy(ctx, backend_path, !wait);
if (rc == -1) {
rc = ERROR_FAIL;
goto out;
@@ -381,11 +381,11 @@ int libxl_device_del(libxl_ctx *ctx, libxl_device *dev, int wait)
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
-int libxl_wait_for_device_model(libxl_ctx *ctx,
+int libxl__wait_for_device_model(libxl_ctx *ctx,
uint32_t domid, char *state,
int (*check_callback)(libxl_ctx *ctx,
uint32_t domid,
@@ -406,7 +406,7 @@ int libxl_wait_for_device_model(libxl_ctx *ctx,
char **l = NULL;
xsh = xs_daemon_open();
- path = libxl_sprintf(&gc, "/local/domain/0/device-model/%d/state", domid);
+ path = libxl__sprintf(&gc, "/local/domain/0/device-model/%d/state", domid);
xs_watch(xsh, path, path);
tv.tv_sec = LIBXL_DEVICE_MODEL_START_TIMEOUT;
tv.tv_usec = 0;
@@ -428,7 +428,7 @@ int libxl_wait_for_device_model(libxl_ctx *ctx,
free(p);
xs_unwatch(xsh, path, path);
xs_daemon_close(xsh);
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
again:
free(p);
@@ -446,17 +446,17 @@ again:
xs_unwatch(xsh, path, path);
xs_daemon_close(xsh);
XL_LOG(ctx, XL_LOG_ERROR, "Device Model not ready");
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return -1;
}
-int libxl_wait_for_backend(libxl_ctx *ctx, char *be_path, char *state)
+int libxl__wait_for_backend(libxl_ctx *ctx, char *be_path, char *state)
{
libxl_gc gc = LIBXL_INIT_GC(ctx);
int watchdog = 100;
unsigned int len;
char *p;
- char *path = libxl_sprintf(&gc, "%s/state", be_path);
+ char *path = libxl__sprintf(&gc, "%s/state", be_path);
int rc = -1;
while (watchdog > 0) {
@@ -482,7 +482,7 @@ int libxl_wait_for_backend(libxl_ctx *ctx, char *be_path, char *state)
}
XL_LOG(ctx, XL_LOG_ERROR, "Backend %s not ready", be_path);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index d9781e7060..618599ed34 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -96,43 +96,43 @@ int build_post(libxl_ctx *ctx, uint32_t domid,
xc_cpuid_apply_policy(ctx->xch, domid);
#endif
- ents = libxl_calloc(&gc, 12 + (info->max_vcpus * 2) + 2, sizeof(char *));
+ ents = libxl__calloc(&gc, 12 + (info->max_vcpus * 2) + 2, sizeof(char *));
ents[0] = "memory/static-max";
- ents[1] = libxl_sprintf(&gc, "%d", info->max_memkb);
+ ents[1] = libxl__sprintf(&gc, "%d", info->max_memkb);
ents[2] = "memory/target";
- ents[3] = libxl_sprintf(&gc, "%d", info->target_memkb);
+ ents[3] = libxl__sprintf(&gc, "%d", info->target_memkb);
ents[4] = "memory/videoram";
- ents[5] = libxl_sprintf(&gc, "%d", info->video_memkb);
+ ents[5] = libxl__sprintf(&gc, "%d", info->video_memkb);
ents[6] = "domid";
- ents[7] = libxl_sprintf(&gc, "%d", domid);
+ ents[7] = libxl__sprintf(&gc, "%d", domid);
ents[8] = "store/port";
- ents[9] = libxl_sprintf(&gc, "%"PRIu32, state->store_port);
+ ents[9] = libxl__sprintf(&gc, "%"PRIu32, state->store_port);
ents[10] = "store/ring-ref";
- ents[11] = libxl_sprintf(&gc, "%lu", state->store_mfn);
+ ents[11] = libxl__sprintf(&gc, "%lu", state->store_mfn);
for (i = 0; i < info->max_vcpus; i++) {
- ents[12+(i*2)] = libxl_sprintf(&gc, "cpu/%d/availability", i);
+ ents[12+(i*2)] = libxl__sprintf(&gc, "cpu/%d/availability", i);
ents[12+(i*2)+1] = (i && info->cur_vcpus && !(info->cur_vcpus & (1 << i)))
? "offline" : "online";
}
- dom_path = libxl_xs_get_dompath(&gc, domid);
+ dom_path = libxl__xs_get_dompath(&gc, domid);
if (!dom_path)
return ERROR_FAIL;
- vm_path = xs_read(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "%s/vm", dom_path), NULL);
+ vm_path = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/vm", dom_path), NULL);
retry_transaction:
t = xs_transaction_start(ctx->xsh);
- libxl_xs_writev(&gc, t, dom_path, ents);
- libxl_xs_writev(&gc, t, dom_path, local_ents);
- libxl_xs_writev(&gc, t, vm_path, vms_ents);
+ libxl__xs_writev(&gc, t, dom_path, ents);
+ libxl__xs_writev(&gc, t, dom_path, local_ents);
+ libxl__xs_writev(&gc, t, vm_path, vms_ents);
if (!xs_transaction_end(ctx->xsh, t, 0))
if (errno == EAGAIN)
goto retry_transaction;
xs_introduce_domain(ctx->xsh, domid, state->store_mfn, state->store_port);
free(vm_path);
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -232,7 +232,7 @@ int build_hvm(libxl_ctx *ctx, uint32_t domid,
domid,
(info->max_memkb - info->video_memkb) / 1024,
(info->target_memkb - info->video_memkb) / 1024,
- libxl_abs_path(&gc, (char *)info->kernel.path,
+ libxl__abs_path(&gc, (char *)info->kernel.path,
libxl_xenfirmwaredir_path()));
if (ret) {
XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "hvm building failed");
@@ -246,7 +246,7 @@ int build_hvm(libxl_ctx *ctx, uint32_t domid,
}
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -317,8 +317,8 @@ static int core_suspend_callback(void *data)
}
return 1;
}
- path = libxl_sprintf(si->gc, "%s/control/shutdown", libxl_xs_get_dompath(si->gc, si->domid));
- libxl_xs_write(si->gc, XBT_NULL, path, "suspend");
+ path = libxl__sprintf(si->gc, "%s/control/shutdown", libxl__xs_get_dompath(si->gc, si->domid));
+ libxl__xs_write(si->gc, XBT_NULL, path, "suspend");
if (si->hvm) {
unsigned long hvm_pvdrv, hvm_s_state;
xc_get_hvm_param(ctx->xch, si->domid, HVM_PARAM_CALLBACK_IRQ, &hvm_pvdrv);
@@ -341,12 +341,12 @@ static int core_suspend_callback(void *data)
if (shutdown_reason == SHUTDOWN_suspend)
return 1;
}
- state = libxl_xs_read(si->gc, XBT_NULL, path);
+ state = libxl__xs_read(si->gc, XBT_NULL, path);
watchdog--;
}
if (!strcmp(state, "suspend")) {
XL_LOG(ctx, XL_LOG_ERROR, "guest didn't suspend in time");
- libxl_xs_write(si->gc, XBT_NULL, path, "");
+ libxl__xs_write(si->gc, XBT_NULL, path, "");
}
return 1;
}
@@ -409,11 +409,11 @@ int save_device_model(libxl_ctx *ctx, uint32_t domid, int fd)
libxl_gc gc = LIBXL_INIT_GC(ctx);
int fd2, c;
char buf[1024];
- char *filename = libxl_sprintf(&gc, "/var/lib/xen/qemu-save.%d", domid);
+ char *filename = libxl__sprintf(&gc, "/var/lib/xen/qemu-save.%d", domid);
XL_LOG(ctx, XL_LOG_DEBUG, "Saving device model state to %s", filename);
- libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "/local/domain/0/device-model/%d/command", domid), "save");
- libxl_wait_for_device_model(ctx, domid, "paused", NULL, NULL);
+ libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "/local/domain/0/device-model/%d/command", domid), "save");
+ libxl__wait_for_device_model(ctx, domid, "paused", NULL, NULL);
c = libxl_write_exactly(ctx, fd, QEMU_SIGNATURE, strlen(QEMU_SIGNATURE),
"saved-state file", "qemu signature");
@@ -424,25 +424,25 @@ int save_device_model(libxl_ctx *ctx, uint32_t domid, int fd)
if (c < 0) {
if (errno == EINTR)
continue;
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return errno;
}
c = libxl_write_exactly(
ctx, fd, buf, c, "saved-state file", "qemu state");
if (c) {
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return c;
}
}
close(fd2);
unlink(filename);
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
-char *libxl_uuid2string(libxl_gc *gc, const libxl_uuid uuid)
+char *libxl__uuid2string(libxl_gc *gc, const libxl_uuid uuid)
{
- char *s = libxl_sprintf(gc, LIBXL_UUID_FMT, LIBXL_UUID_BYTES(uuid));
+ char *s = libxl__sprintf(gc, LIBXL_UUID_FMT, LIBXL_UUID_BYTES(uuid));
if (!s)
XL_LOG(libxl_gc_owner(gc), XL_LOG_ERROR, "cannot allocate for uuid");
return s;
@@ -463,9 +463,9 @@ static const char *userdata_path(libxl_gc *gc, uint32_t domid,
" for domain %"PRIu32, domid);
return NULL;
}
- uuid_string = libxl_sprintf(gc, LIBXL_UUID_FMT, LIBXL_UUID_BYTES(info.uuid));
+ uuid_string = libxl__sprintf(gc, LIBXL_UUID_FMT, LIBXL_UUID_BYTES(info.uuid));
- path = libxl_sprintf(gc, "/var/lib/xen/"
+ path = libxl__sprintf(gc, "/var/lib/xen/"
"userdata-%s.%u.%s.%s",
wh, domid, uuid_string, userdata_userid);
if (!path)
@@ -509,7 +509,7 @@ void libxl__userdata_destroyall(libxl_ctx *ctx, uint32_t domid)
}
globfree(&gl);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
}
int libxl_userdata_store(libxl_ctx *ctx, uint32_t domid,
@@ -577,7 +577,7 @@ err:
XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "cannot write %s for %s",
newfilename, filename);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -610,6 +610,6 @@ int libxl_userdata_retrieve(libxl_ctx *ctx, uint32_t domid,
if (datalen_r) *datalen_r = datalen;
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
diff --git a/tools/libxl/libxl_exec.c b/tools/libxl/libxl_exec.c
index 5210c4f98a..a1f0bf2e2a 100644
--- a/tools/libxl/libxl_exec.c
+++ b/tools/libxl/libxl_exec.c
@@ -35,7 +35,7 @@ static int call_waitpid(pid_t (*waitpid_cb)(pid_t, int *, int), pid_t pid, int *
return (waitpid_cb) ? waitpid_cb(pid, status, options) : waitpid(pid, status, options);
}
-void libxl_exec(int stdinfd, int stdoutfd, int stderrfd, char *arg0, char **args)
+void libxl__exec(int stdinfd, int stdoutfd, int stderrfd, char *arg0, char **args)
/* call this in the child */
{
int i;
@@ -88,7 +88,7 @@ void libxl_report_child_exitstatus(libxl_ctx *ctx,
}
}
-int libxl_spawn_spawn(libxl_ctx *ctx,
+int libxl__spawn_spawn(libxl_ctx *ctx,
libxl_device_model_starting *starting,
const char *what,
void (*intermediate_hook)(void *for_spawn,
@@ -151,7 +151,7 @@ static void report_spawn_intermediate_status(libxl_ctx *ctx,
}
}
-int libxl_spawn_detach(libxl_ctx *ctx,
+int libxl__spawn_detach(libxl_ctx *ctx,
libxl_spawn_starting *for_spawn)
{
int r, status;
@@ -184,7 +184,7 @@ int libxl_spawn_detach(libxl_ctx *ctx,
return rc;
}
-int libxl_spawn_check(libxl_ctx *ctx, void *for_spawn_void)
+int libxl__spawn_check(libxl_ctx *ctx, void *for_spawn_void)
{
libxl_spawn_starting *for_spawn = for_spawn_void;
pid_t got;
diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
index 05ef3e3130..7ba9f38e07 100644
--- a/tools/libxl/libxl_internal.c
+++ b/tools/libxl/libxl_internal.c
@@ -29,12 +29,12 @@
#include "libxl_internal.h"
#include "libxl_utils.h"
-int libxl_error_set(libxl_ctx *ctx, int code)
+int libxl__error_set(libxl_ctx *ctx, int code)
{
return 0;
}
-int libxl_ptr_add(libxl_gc *gc, void *ptr)
+int libxl__ptr_add(libxl_gc *gc, void *ptr)
{
int i;
void **re;
@@ -65,7 +65,7 @@ int libxl_ptr_add(libxl_gc *gc, void *ptr)
return 0;
}
-void libxl_free_all(libxl_gc *gc)
+void libxl__free_all(libxl_gc *gc)
{
void *ptr;
int i;
@@ -78,31 +78,31 @@ void libxl_free_all(libxl_gc *gc)
free(gc->alloc_ptrs);
}
-void *libxl_zalloc(libxl_gc *gc, int bytes)
+void *libxl__zalloc(libxl_gc *gc, int bytes)
{
void *ptr = calloc(bytes, 1);
if (!ptr) {
- libxl_error_set(libxl_gc_owner(gc), ENOMEM);
+ libxl__error_set(libxl_gc_owner(gc), ENOMEM);
return NULL;
}
- libxl_ptr_add(gc, ptr);
+ libxl__ptr_add(gc, ptr);
return ptr;
}
-void *libxl_calloc(libxl_gc *gc, size_t nmemb, size_t size)
+void *libxl__calloc(libxl_gc *gc, size_t nmemb, size_t size)
{
void *ptr = calloc(nmemb, size);
if (!ptr) {
- libxl_error_set(libxl_gc_owner(gc), ENOMEM);
+ libxl__error_set(libxl_gc_owner(gc), ENOMEM);
return NULL;
}
- libxl_ptr_add(gc, ptr);
+ libxl__ptr_add(gc, ptr);
return ptr;
}
-char *libxl_sprintf(libxl_gc *gc, const char *fmt, ...)
+char *libxl__sprintf(libxl_gc *gc, const char *fmt, ...)
{
char *s;
va_list ap;
@@ -116,7 +116,7 @@ char *libxl_sprintf(libxl_gc *gc, const char *fmt, ...)
return NULL;
}
- s = libxl_zalloc(gc, ret + 1);
+ s = libxl__zalloc(gc, ret + 1);
if (s) {
va_start(ap, fmt);
ret = vsnprintf(s, ret + 1, fmt, ap);
@@ -125,20 +125,20 @@ char *libxl_sprintf(libxl_gc *gc, const char *fmt, ...)
return s;
}
-char *libxl_strdup(libxl_gc *gc, const char *c)
+char *libxl__strdup(libxl_gc *gc, const char *c)
{
char *s = strdup(c);
if (s)
- libxl_ptr_add(gc, s);
+ libxl__ptr_add(gc, s);
return s;
}
-char *libxl_dirname(libxl_gc *gc, const char *s)
+char *libxl__dirname(libxl_gc *gc, const char *s)
{
char *c;
- char *ptr = libxl_strdup(gc, s);
+ char *ptr = libxl__strdup(gc, s);
c = strrchr(ptr, '/');
if (!c)
@@ -184,11 +184,11 @@ void xl_log(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
va_end(ap);
}
-char *libxl_abs_path(libxl_gc *gc, char *s, const char *path)
+char *libxl__abs_path(libxl_gc *gc, char *s, const char *path)
{
if (!s || s[0] == '/')
return s;
- return libxl_sprintf(gc, "%s/%s", path, s);
+ return libxl__sprintf(gc, "%s/%s", path, s);
}
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index face02136c..1a4448a677 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -122,22 +122,22 @@ static inline libxl_ctx *libxl_gc_owner(libxl_gc *gc)
}
/* memory allocation tracking/helpers */
-_hidden int libxl_ptr_add(libxl_gc *gc, void *ptr);
-_hidden void libxl_free_all(libxl_gc *gc);
-_hidden void *libxl_zalloc(libxl_gc *gc, int bytes);
-_hidden void *libxl_calloc(libxl_gc *gc, size_t nmemb, size_t size);
-_hidden char *libxl_sprintf(libxl_gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
-_hidden char *libxl_strdup(libxl_gc *gc, const char *c);
-_hidden char *libxl_dirname(libxl_gc *gc, const char *s);
-
-_hidden char **libxl_xs_kvs_of_flexarray(libxl_gc *gc, flexarray_t *array, int length);
-_hidden int libxl_xs_writev(libxl_gc *gc, xs_transaction_t t,
+_hidden int libxl__ptr_add(libxl_gc *gc, void *ptr);
+_hidden void libxl__free_all(libxl_gc *gc);
+_hidden void *libxl__zalloc(libxl_gc *gc, int bytes);
+_hidden void *libxl__calloc(libxl_gc *gc, size_t nmemb, size_t size);
+_hidden char *libxl__sprintf(libxl_gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
+_hidden char *libxl__strdup(libxl_gc *gc, const char *c);
+_hidden char *libxl__dirname(libxl_gc *gc, const char *s);
+
+_hidden char **libxl__xs_kvs_of_flexarray(libxl_gc *gc, flexarray_t *array, int length);
+_hidden int libxl__xs_writev(libxl_gc *gc, xs_transaction_t t,
char *dir, char **kvs);
-_hidden int libxl_xs_write(libxl_gc *gc, xs_transaction_t t,
+_hidden int libxl__xs_write(libxl_gc *gc, xs_transaction_t t,
char *path, char *fmt, ...) PRINTF_ATTRIBUTE(4, 5);
-_hidden char *libxl_xs_get_dompath(libxl_gc *gc, uint32_t domid); // logs errs
-_hidden char *libxl_xs_read(libxl_gc *gc, xs_transaction_t t, char *path);
-_hidden char **libxl_xs_directory(libxl_gc *gc, xs_transaction_t t, char *path, unsigned int *nb);
+_hidden char *libxl__xs_get_dompath(libxl_gc *gc, uint32_t domid); // logs errs
+_hidden char *libxl__xs_read(libxl_gc *gc, xs_transaction_t t, char *path);
+_hidden char **libxl__xs_directory(libxl_gc *gc, xs_transaction_t t, char *path, unsigned int *nb);
/* from xl_dom */
_hidden int is_hvm(libxl_ctx *ctx, uint32_t domid);
@@ -168,19 +168,19 @@ _hidden char *device_disk_string_of_phystype(libxl_disk_phystype phystype);
_hidden int device_physdisk_major_minor(const char *physpath, int *major, int *minor);
_hidden int device_disk_dev_number(char *virtpath);
-_hidden int libxl_device_generic_add(libxl_ctx *ctx, libxl_device *device,
+_hidden int libxl__device_generic_add(libxl_ctx *ctx, libxl_device *device,
char **bents, char **fents);
-_hidden int libxl_device_del(libxl_ctx *ctx, libxl_device *dev, int wait);
-_hidden int libxl_device_destroy(libxl_ctx *ctx, char *be_path, int force);
-_hidden int libxl_devices_destroy(libxl_ctx *ctx, uint32_t domid, int force);
-_hidden int libxl_wait_for_device_model(libxl_ctx *ctx,
+_hidden int libxl__device_del(libxl_ctx *ctx, libxl_device *dev, int wait);
+_hidden int libxl__device_destroy(libxl_ctx *ctx, char *be_path, int force);
+_hidden int libxl__devices_destroy(libxl_ctx *ctx, uint32_t domid, int force);
+_hidden int libxl__wait_for_device_model(libxl_ctx *ctx,
uint32_t domid, char *state,
int (*check_callback)(libxl_ctx *ctx,
uint32_t domid,
const char *state,
void *userdata),
void *check_callback_userdata);
-_hidden int libxl_wait_for_backend(libxl_ctx *ctx, char *be_path, char *state);
+_hidden int libxl__wait_for_backend(libxl_ctx *ctx, char *be_path, char *state);
/* from xenguest (helper */
_hidden int hvm_build_set_params(xc_interface *handle, uint32_t domid,
@@ -205,42 +205,42 @@ struct libxl__device_model_starting {
int domid;
};
-_hidden int libxl_spawn_spawn(libxl_ctx *ctx,
+_hidden int libxl__spawn_spawn(libxl_ctx *ctx,
libxl_device_model_starting *starting,
const char *what,
void (*intermediate_hook)(void *for_spawn, pid_t innerchild));
/* Logs errors. A copy of "what" is taken. Return values:
* < 0 error, for_spawn need not be detached
* +1 caller is the parent, must call detach on *for_spawn eventually
- * 0 caller is now the inner child, should probably call libxl_exec
+ * 0 caller is now the inner child, should probably call libxl__exec
* Caller, may pass 0 for for_spawn, in which case no need to detach.
*/
-_hidden int libxl_spawn_detach(libxl_ctx *ctx,
+_hidden int libxl__spawn_detach(libxl_ctx *ctx,
libxl_spawn_starting *for_spawn);
/* Logs errors. Idempotent, but only permitted after successful
- * call to libxl_spawn_spawn, and no point calling it again if it fails. */
-_hidden int libxl_spawn_check(libxl_ctx *ctx,
+ * call to libxl__spawn_spawn, and no point calling it again if it fails. */
+_hidden int libxl__spawn_check(libxl_ctx *ctx,
void *for_spawn);
/* Logs errors but also returns them.
* for_spawn must actually be a libxl_spawn_starting* but
* we take void* so you can pass this function directly to
- * libxl_wait_for_device_model. Caller must still call detach. */
+ * libxl__wait_for_device_model. Caller must still call detach. */
/* low-level stuff, for synchronous subprocesses etc. */
-_hidden void libxl_exec(int stdinfd, int stdoutfd, int stderrfd, char *arg0, char **args); // logs errors, never returns
-_hidden void libxl_log_child_exitstatus(libxl_gc *gc,
+_hidden void libxl__exec(int stdinfd, int stdoutfd, int stderrfd, char *arg0, char **args); // logs errors, never returns
+_hidden void libxl__log_child_exitstatus(libxl_gc *gc,
const char *what, pid_t pid, int status);
-_hidden char *libxl_abs_path(libxl_gc *gc, char *s, const char *path);
+_hidden char *libxl__abs_path(libxl_gc *gc, char *s, const char *path);
#define XL_LOG_DEBUG XTL_DEBUG
#define XL_LOG_INFO XTL_INFO
#define XL_LOG_WARNING XTL_WARN
#define XL_LOG_ERROR XTL_ERROR
-_hidden char *_libxl_domid_to_name(libxl_gc *gc, uint32_t domid);
-_hidden char *_libxl_poolid_to_name(libxl_gc *gc, uint32_t poolid);
+_hidden char *libxl__domid_to_name(libxl_gc *gc, uint32_t domid);
+_hidden char *libxl__poolid_to_name(libxl_gc *gc, uint32_t poolid);
/*
* blktap2 support
@@ -261,7 +261,7 @@ const char *libxl_blktap_devpath(libxl_gc *gc,
const char *disk,
libxl_disk_phystype phystype);
-_hidden char *libxl_uuid2string(libxl_gc *gc, const libxl_uuid uuid);
+_hidden char *libxl__uuid2string(libxl_gc *gc, const libxl_uuid uuid);
struct libxl__xen_console_reader {
char *buffer;
@@ -272,7 +272,7 @@ struct libxl__xen_console_reader {
unsigned int index;
};
-_hidden int libxl_error_set(libxl_ctx *ctx, int code);
+_hidden int libxl__error_set(libxl_ctx *ctx, int code);
_hidden int libxl__file_reference_map(libxl_file_reference *f);
_hidden int libxl__file_reference_unmap(libxl_file_reference *f);
diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 66df5f4849..e83201cdb8 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -224,38 +224,38 @@ static int libxl_create_pci_backend(libxl_gc *gc, uint32_t domid, libxl_device_p
device.kind = DEVICE_PCI;
flexarray_set(back, boffset++, "frontend-id");
- flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", domid));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", domid));
flexarray_set(back, boffset++, "online");
flexarray_set(back, boffset++, "1");
flexarray_set(back, boffset++, "state");
- flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", 1));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", 1));
flexarray_set(back, boffset++, "domain");
- flexarray_set(back, boffset++, _libxl_domid_to_name(gc, domid));
+ flexarray_set(back, boffset++, libxl__domid_to_name(gc, domid));
for (i = 0; i < num; i++) {
- flexarray_set(back, boffset++, libxl_sprintf(gc, "key-%d", i));
- flexarray_set(back, boffset++, libxl_sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
- flexarray_set(back, boffset++, libxl_sprintf(gc, "dev-%d", i));
- flexarray_set(back, boffset++, libxl_sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "key-%d", i));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "dev-%d", i));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
if (pcidev->vdevfn) {
- flexarray_set(back, boffset++, libxl_sprintf(gc, "vdevfn-%d", i));
- flexarray_set(back, boffset++, libxl_sprintf(gc, "%x", pcidev->vdevfn));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "vdevfn-%d", i));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "%x", pcidev->vdevfn));
}
- flexarray_set(back, boffset++, libxl_sprintf(gc, "opts-%d", i));
- flexarray_set(back, boffset++, libxl_sprintf(gc, "msitranslate=%d,power_mgmt=%d", pcidev->msitranslate, pcidev->power_mgmt));
- flexarray_set(back, boffset++, libxl_sprintf(gc, "state-%d", i));
- flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", 1));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "opts-%d", i));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "msitranslate=%d,power_mgmt=%d", pcidev->msitranslate, pcidev->power_mgmt));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "state-%d", i));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", 1));
}
flexarray_set(back, boffset++, "num_devs");
- flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", num));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", num));
flexarray_set(front, foffset++, "backend-id");
- flexarray_set(front, foffset++, libxl_sprintf(gc, "%d", 0));
+ flexarray_set(front, foffset++, libxl__sprintf(gc, "%d", 0));
flexarray_set(front, foffset++, "state");
- flexarray_set(front, foffset++, libxl_sprintf(gc, "%d", 1));
+ flexarray_set(front, foffset++, libxl__sprintf(gc, "%d", 1));
- libxl_device_generic_add(ctx, &device,
- libxl_xs_kvs_of_flexarray(gc, back, boffset),
- libxl_xs_kvs_of_flexarray(gc, front, foffset));
+ libxl__device_generic_add(ctx, &device,
+ libxl__xs_kvs_of_flexarray(gc, back, boffset),
+ libxl__xs_kvs_of_flexarray(gc, front, foffset));
flexarray_free(back);
flexarray_free(front);
@@ -271,13 +271,13 @@ static int libxl_device_pci_add_xenstore(libxl_gc *gc, uint32_t domid, libxl_dev
unsigned int boffset = 0;
xs_transaction_t t;
- be_path = libxl_sprintf(gc, "%s/backend/pci/%d/0", libxl_xs_get_dompath(gc, 0), domid);
- num_devs = libxl_xs_read(gc, XBT_NULL, libxl_sprintf(gc, "%s/num_devs", be_path));
+ be_path = libxl__sprintf(gc, "%s/backend/pci/%d/0", libxl__xs_get_dompath(gc, 0), domid);
+ num_devs = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/num_devs", be_path));
if (!num_devs)
return libxl_create_pci_backend(gc, domid, pcidev, 1);
if (!is_hvm(ctx, domid)) {
- if (libxl_wait_for_backend(ctx, be_path, "4") < 0)
+ if (libxl__wait_for_backend(ctx, be_path, "4") < 0)
return ERROR_FAIL;
}
@@ -287,27 +287,27 @@ static int libxl_device_pci_add_xenstore(libxl_gc *gc, uint32_t domid, libxl_dev
XL_LOG(ctx, XL_LOG_DEBUG, "Adding new pci device to xenstore");
num = atoi(num_devs);
- flexarray_set(back, boffset++, libxl_sprintf(gc, "key-%d", num));
- flexarray_set(back, boffset++, libxl_sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
- flexarray_set(back, boffset++, libxl_sprintf(gc, "dev-%d", num));
- flexarray_set(back, boffset++, libxl_sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "key-%d", num));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "dev-%d", num));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
if (pcidev->vdevfn) {
- flexarray_set(back, boffset++, libxl_sprintf(gc, "vdevfn-%d", num));
- flexarray_set(back, boffset++, libxl_sprintf(gc, "%x", pcidev->vdevfn));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "vdevfn-%d", num));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "%x", pcidev->vdevfn));
}
- flexarray_set(back, boffset++, libxl_sprintf(gc, "opts-%d", num));
- flexarray_set(back, boffset++, libxl_sprintf(gc, "msitranslate=%d,power_mgmt=%d", pcidev->msitranslate, pcidev->power_mgmt));
- flexarray_set(back, boffset++, libxl_sprintf(gc, "state-%d", num));
- flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", 1));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "opts-%d", num));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "msitranslate=%d,power_mgmt=%d", pcidev->msitranslate, pcidev->power_mgmt));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "state-%d", num));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", 1));
flexarray_set(back, boffset++, "num_devs");
- flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", num + 1));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", num + 1));
flexarray_set(back, boffset++, "state");
- flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", 7));
+ flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", 7));
retry_transaction:
t = xs_transaction_start(ctx->xsh);
- libxl_xs_writev(gc, t, be_path,
- libxl_xs_kvs_of_flexarray(gc, back, boffset));
+ libxl__xs_writev(gc, t, be_path,
+ libxl__xs_kvs_of_flexarray(gc, back, boffset));
if (!xs_transaction_end(ctx->xsh, t, 0))
if (errno == EAGAIN)
goto retry_transaction;
@@ -324,22 +324,22 @@ static int libxl_device_pci_remove_xenstore(libxl_gc *gc, uint32_t domid, libxl_
xs_transaction_t t;
unsigned int domain = 0, bus = 0, dev = 0, func = 0;
- be_path = libxl_sprintf(gc, "%s/backend/pci/%d/0", libxl_xs_get_dompath(gc, 0), domid);
- num_devs_path = libxl_sprintf(gc, "%s/num_devs", be_path);
- num_devs = libxl_xs_read(gc, XBT_NULL, num_devs_path);
+ be_path = libxl__sprintf(gc, "%s/backend/pci/%d/0", libxl__xs_get_dompath(gc, 0), domid);
+ num_devs_path = libxl__sprintf(gc, "%s/num_devs", be_path);
+ num_devs = libxl__xs_read(gc, XBT_NULL, num_devs_path);
if (!num_devs)
return ERROR_INVAL;
num = atoi(num_devs);
if (!is_hvm(ctx, domid)) {
- if (libxl_wait_for_backend(ctx, be_path, "4") < 0) {
+ if (libxl__wait_for_backend(ctx, be_path, "4") < 0) {
XL_LOG(ctx, XL_LOG_DEBUG, "pci backend at %s is not ready", be_path);
return ERROR_FAIL;
}
}
for (i = 0; i < num; i++) {
- xsdev = libxl_xs_read(gc, XBT_NULL, libxl_sprintf(gc, "%s/dev-%d", be_path, i));
+ xsdev = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/dev-%d", be_path, i));
sscanf(xsdev, PCI_BDF, &domain, &bus, &dev, &func);
if (domain == pcidev->domain && bus == pcidev->bus &&
pcidev->dev == dev && pcidev->func == func) {
@@ -353,14 +353,14 @@ static int libxl_device_pci_remove_xenstore(libxl_gc *gc, uint32_t domid, libxl_
retry_transaction:
t = xs_transaction_start(ctx->xsh);
- xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/state-%d", be_path, i), "5", strlen("5"));
- xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/state", be_path), "7", strlen("7"));
+ xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/state-%d", be_path, i), "5", strlen("5"));
+ xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/state", be_path), "7", strlen("7"));
if (!xs_transaction_end(ctx->xsh, t, 0))
if (errno == EAGAIN)
goto retry_transaction;
if (!is_hvm(ctx, domid)) {
- if (libxl_wait_for_backend(ctx, be_path, "4") < 0) {
+ if (libxl__wait_for_backend(ctx, be_path, "4") < 0) {
XL_LOG(ctx, XL_LOG_DEBUG, "pci backend at %s is not ready", be_path);
return ERROR_FAIL;
}
@@ -368,42 +368,42 @@ retry_transaction:
retry_transaction2:
t = xs_transaction_start(ctx->xsh);
- xs_rm(ctx->xsh, t, libxl_sprintf(gc, "%s/state-%d", be_path, i));
- xs_rm(ctx->xsh, t, libxl_sprintf(gc, "%s/key-%d", be_path, i));
- xs_rm(ctx->xsh, t, libxl_sprintf(gc, "%s/dev-%d", be_path, i));
- xs_rm(ctx->xsh, t, libxl_sprintf(gc, "%s/vdev-%d", be_path, i));
- xs_rm(ctx->xsh, t, libxl_sprintf(gc, "%s/opts-%d", be_path, i));
- xs_rm(ctx->xsh, t, libxl_sprintf(gc, "%s/vdevfn-%d", be_path, i));
- libxl_xs_write(gc, t, num_devs_path, "%d", num - 1);
+ xs_rm(ctx->xsh, t, libxl__sprintf(gc, "%s/state-%d", be_path, i));
+ xs_rm(ctx->xsh, t, libxl__sprintf(gc, "%s/key-%d", be_path, i));
+ xs_rm(ctx->xsh, t, libxl__sprintf(gc, "%s/dev-%d", be_path, i));
+ xs_rm(ctx->xsh, t, libxl__sprintf(gc, "%s/vdev-%d", be_path, i));
+ xs_rm(ctx->xsh, t, libxl__sprintf(gc, "%s/opts-%d", be_path, i));
+ xs_rm(ctx->xsh, t, libxl__sprintf(gc, "%s/vdevfn-%d", be_path, i));
+ libxl__xs_write(gc, t, num_devs_path, "%d", num - 1);
for (j = i + 1; j < num; j++) {
- tmppath = libxl_sprintf(gc, "%s/state-%d", be_path, j);
- tmp = libxl_xs_read(gc, t, tmppath);
- xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/state-%d", be_path, j - 1), tmp, strlen(tmp));
+ tmppath = libxl__sprintf(gc, "%s/state-%d", be_path, j);
+ tmp = libxl__xs_read(gc, t, tmppath);
+ xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/state-%d", be_path, j - 1), tmp, strlen(tmp));
xs_rm(ctx->xsh, t, tmppath);
- tmppath = libxl_sprintf(gc, "%s/dev-%d", be_path, j);
- tmp = libxl_xs_read(gc, t, tmppath);
- xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/dev-%d", be_path, j - 1), tmp, strlen(tmp));
+ tmppath = libxl__sprintf(gc, "%s/dev-%d", be_path, j);
+ tmp = libxl__xs_read(gc, t, tmppath);
+ xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/dev-%d", be_path, j - 1), tmp, strlen(tmp));
xs_rm(ctx->xsh, t, tmppath);
- tmppath = libxl_sprintf(gc, "%s/key-%d", be_path, j);
- tmp = libxl_xs_read(gc, t, tmppath);
- xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/key-%d", be_path, j - 1), tmp, strlen(tmp));
+ tmppath = libxl__sprintf(gc, "%s/key-%d", be_path, j);
+ tmp = libxl__xs_read(gc, t, tmppath);
+ xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/key-%d", be_path, j - 1), tmp, strlen(tmp));
xs_rm(ctx->xsh, t, tmppath);
- tmppath = libxl_sprintf(gc, "%s/vdev-%d", be_path, j);
- tmp = libxl_xs_read(gc, t, tmppath);
+ tmppath = libxl__sprintf(gc, "%s/vdev-%d", be_path, j);
+ tmp = libxl__xs_read(gc, t, tmppath);
if (tmp) {
- xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/vdev-%d", be_path, j - 1), tmp, strlen(tmp));
+ xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/vdev-%d", be_path, j - 1), tmp, strlen(tmp));
xs_rm(ctx->xsh, t, tmppath);
}
- tmppath = libxl_sprintf(gc, "%s/opts-%d", be_path, j);
- tmp = libxl_xs_read(gc, t, tmppath);
+ tmppath = libxl__sprintf(gc, "%s/opts-%d", be_path, j);
+ tmp = libxl__xs_read(gc, t, tmppath);
if (tmp) {
- xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/opts-%d", be_path, j - 1), tmp, strlen(tmp));
+ xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/opts-%d", be_path, j - 1), tmp, strlen(tmp));
xs_rm(ctx->xsh, t, tmppath);
}
- tmppath = libxl_sprintf(gc, "%s/vdevfn-%d", be_path, j);
- tmp = libxl_xs_read(gc, t, tmppath);
+ tmppath = libxl__sprintf(gc, "%s/vdevfn-%d", be_path, j);
+ tmp = libxl__xs_read(gc, t, tmppath);
if (tmp) {
- xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/vdevfn-%d", be_path, j - 1), tmp, strlen(tmp));
+ xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/vdevfn-%d", be_path, j - 1), tmp, strlen(tmp));
xs_rm(ctx->xsh, t, tmppath);
}
}
@@ -412,8 +412,8 @@ retry_transaction2:
goto retry_transaction2;
if (num == 1) {
- char *fe_path = libxl_xs_read(gc, XBT_NULL, libxl_sprintf(gc, "%s/frontend", be_path));
- libxl_device_destroy(ctx, be_path, 1);
+ char *fe_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/frontend", be_path));
+ libxl__device_destroy(ctx, be_path, 1);
xs_rm(ctx->xsh, XBT_NULL, be_path);
xs_rm(ctx->xsh, XBT_NULL, fe_path);
return 0;
@@ -431,21 +431,21 @@ static int get_all_assigned_devices(libxl_gc *gc, libxl_device_pci **list, int *
*list = NULL;
*num = 0;
- domlist = libxl_xs_directory(gc, XBT_NULL, "/local/domain", &nd);
+ domlist = libxl__xs_directory(gc, XBT_NULL, "/local/domain", &nd);
for(i = 0; i < nd; i++) {
char *path, *num_devs;
- path = libxl_sprintf(gc, "/local/domain/0/backend/pci/%s/0/num_devs", domlist[i]);
- num_devs = libxl_xs_read(gc, XBT_NULL, path);
+ path = libxl__sprintf(gc, "/local/domain/0/backend/pci/%s/0/num_devs", domlist[i]);
+ num_devs = libxl__xs_read(gc, XBT_NULL, path);
if ( num_devs ) {
int ndev = atoi(num_devs), j;
char *devpath, *bdf;
- pcidevs = libxl_calloc(gc, sizeof(*pcidevs), ndev);
+ pcidevs = libxl__calloc(gc, sizeof(*pcidevs), ndev);
for(j = (pcidevs) ? 0 : ndev; j < ndev; j++) {
- devpath = libxl_sprintf(gc, "/local/domain/0/backend/pci/%s/0/dev-%u",
+ devpath = libxl__sprintf(gc, "/local/domain/0/backend/pci/%s/0/dev-%u",
domlist[i], j);
- bdf = libxl_xs_read(gc, XBT_NULL, devpath);
+ bdf = libxl__xs_read(gc, XBT_NULL, devpath);
if ( bdf ) {
unsigned dom, bus, dev, func;
if ( sscanf(bdf, PCI_BDF, &dom, &bus, &dev, &func) != 4 )
@@ -510,7 +510,7 @@ int libxl_device_pci_list_assignable(libxl_ctx *ctx, libxl_device_pci **list, in
}else{
XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", SYSFS_PCIBACK_DRIVER);
}
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ERROR_FAIL;
}
@@ -536,7 +536,7 @@ int libxl_device_pci_list_assignable(libxl_ctx *ctx, libxl_device_pci **list, in
closedir(dir);
*list = pcidevs;
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -573,7 +573,7 @@ static int pci_multifunction_check(libxl_gc *gc, libxl_device_pci *pcidev, unsig
if ( pcidev->dev != dev )
continue;
- path = libxl_sprintf(gc, "%s/" PCI_BDF, SYSFS_PCIBACK_DRIVER, dom, bus, dev, func);
+ path = libxl__sprintf(gc, "%s/" PCI_BDF, SYSFS_PCIBACK_DRIVER, dom, bus, dev, func);
if ( lstat(path, &st) ) {
if ( errno == ENOENT )
XL_LOG(ctx, XL_LOG_ERROR, PCI_BDF " is not assigned to pciback driver",
@@ -613,24 +613,24 @@ static int do_pci_add(libxl_gc *gc, uint32_t domid, libxl_device_pci *pcidev)
hvm = is_hvm(ctx, domid);
if (hvm) {
- if (libxl_wait_for_device_model(ctx, domid, "running", NULL, NULL) < 0) {
+ if (libxl__wait_for_device_model(ctx, domid, "running", NULL, NULL) < 0) {
return ERROR_FAIL;
}
- path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
- state = libxl_xs_read(gc, XBT_NULL, path);
- path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
+ path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
+ state = libxl__xs_read(gc, XBT_NULL, path);
+ path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
if (pcidev->vdevfn)
- libxl_xs_write(gc, XBT_NULL, path, PCI_BDF_VDEVFN, pcidev->domain,
+ libxl__xs_write(gc, XBT_NULL, path, PCI_BDF_VDEVFN, pcidev->domain,
pcidev->bus, pcidev->dev, pcidev->func, pcidev->vdevfn);
else
- libxl_xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
+ libxl__xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
pcidev->bus, pcidev->dev, pcidev->func);
- path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/command", domid);
+ path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", domid);
xs_write(ctx->xsh, XBT_NULL, path, "pci-ins", strlen("pci-ins"));
- rc = libxl_wait_for_device_model(ctx, domid, NULL, pci_ins_check, state);
- path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
- vdevfn = libxl_xs_read(gc, XBT_NULL, path);
- path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
+ rc = libxl__wait_for_device_model(ctx, domid, NULL, pci_ins_check, state);
+ path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
+ vdevfn = libxl__xs_read(gc, XBT_NULL, path);
+ path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
if ( rc < 0 )
XL_LOG(ctx, XL_LOG_ERROR, "qemu refused to add device: %s", vdevfn);
else if ( sscanf(vdevfn, "0x%x", &pcidev->vdevfn) != 1 )
@@ -639,7 +639,7 @@ static int do_pci_add(libxl_gc *gc, uint32_t domid, libxl_device_pci *pcidev)
if ( rc )
return ERROR_FAIL;
} else {
- char *sysfs_path = libxl_sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/resource", pcidev->domain,
+ char *sysfs_path = libxl__sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/resource", pcidev->domain,
pcidev->bus, pcidev->dev, pcidev->func);
FILE *f = fopen(sysfs_path, "r");
unsigned long long start = 0, end = 0, flags = 0, size = 0;
@@ -674,7 +674,7 @@ static int do_pci_add(libxl_gc *gc, uint32_t domid, libxl_device_pci *pcidev)
}
}
fclose(f);
- sysfs_path = libxl_sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/irq", pcidev->domain,
+ sysfs_path = libxl__sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/irq", pcidev->domain,
pcidev->bus, pcidev->dev, pcidev->func);
f = fopen(sysfs_path, "r");
if (f == NULL) {
@@ -717,10 +717,10 @@ static int libxl_device_pci_reset(libxl_gc *gc, unsigned int domain, unsigned in
char *reset;
int fd, rc;
- reset = libxl_sprintf(gc, "%s/pciback/do_flr", SYSFS_PCI_DEV);
+ reset = libxl__sprintf(gc, "%s/pciback/do_flr", SYSFS_PCI_DEV);
fd = open(reset, O_WRONLY);
if (fd > 0) {
- char *buf = libxl_sprintf(gc, PCI_BDF, domain, bus, dev, func);
+ char *buf = libxl__sprintf(gc, PCI_BDF, domain, bus, dev, func);
rc = write(fd, buf, strlen(buf));
if (rc < 0)
XL_LOG(ctx, XL_LOG_ERROR, "write to %s returned %d", reset, rc);
@@ -729,7 +729,7 @@ static int libxl_device_pci_reset(libxl_gc *gc, unsigned int domain, unsigned in
}
if (errno != ENOENT)
XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Failed to access pciback path %s", reset);
- reset = libxl_sprintf(gc, "%s/"PCI_BDF"/reset", SYSFS_PCI_DEV, domain, bus, dev, func);
+ reset = libxl__sprintf(gc, "%s/"PCI_BDF"/reset", SYSFS_PCI_DEV, domain, bus, dev, func);
fd = open(reset, O_WRONLY);
if (fd > 0) {
rc = write(fd, "1", 1);
@@ -812,7 +812,7 @@ int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcide
}
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -837,29 +837,29 @@ static int do_pci_remove(libxl_gc *gc, uint32_t domid, libxl_device_pci *pcidev)
hvm = is_hvm(ctx, domid);
if (hvm) {
- if (libxl_wait_for_device_model(ctx, domid, "running", NULL, NULL) < 0) {
+ if (libxl__wait_for_device_model(ctx, domid, "running", NULL, NULL) < 0) {
return ERROR_FAIL;
}
- path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
- state = libxl_xs_read(gc, XBT_NULL, path);
- path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
- libxl_xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
+ path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
+ state = libxl__xs_read(gc, XBT_NULL, path);
+ path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
+ libxl__xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
pcidev->bus, pcidev->dev, pcidev->func);
- path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/command", domid);
+ path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", domid);
/* Remove all functions at once atomically by only signalling
* device-model for function 0 */
if ( (pcidev->vdevfn & 0x7) == 0 ) {
xs_write(ctx->xsh, XBT_NULL, path, "pci-rem", strlen("pci-rem"));
- if (libxl_wait_for_device_model(ctx, domid, "pci-removed", NULL, NULL) < 0) {
+ if (libxl__wait_for_device_model(ctx, domid, "pci-removed", NULL, NULL) < 0) {
XL_LOG(ctx, XL_LOG_ERROR, "Device Model didn't respond in time");
return ERROR_FAIL;
}
}
- path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
+ path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
xs_write(ctx->xsh, XBT_NULL, path, state, strlen(state));
} else {
- char *sysfs_path = libxl_sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/resource", pcidev->domain,
+ char *sysfs_path = libxl__sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/resource", pcidev->domain,
pcidev->bus, pcidev->dev, pcidev->func);
FILE *f = fopen(sysfs_path, "r");
unsigned int start = 0, end = 0, flags = 0, size = 0;
@@ -889,7 +889,7 @@ static int do_pci_remove(libxl_gc *gc, uint32_t domid, libxl_device_pci *pcidev)
}
fclose(f);
skip1:
- sysfs_path = libxl_sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/irq", pcidev->domain,
+ sysfs_path = libxl__sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/irq", pcidev->domain,
pcidev->bus, pcidev->dev, pcidev->func);
f = fopen(sysfs_path, "r");
if (f == NULL) {
@@ -961,7 +961,7 @@ int libxl_device_pci_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pc
}
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -973,12 +973,12 @@ int libxl_device_pci_list_assigned(libxl_ctx *ctx, libxl_device_pci **list, uint
unsigned int domain = 0, bus = 0, dev = 0, func = 0, vdevfn = 0;
libxl_device_pci *pcidevs;
- be_path = libxl_sprintf(&gc, "%s/backend/pci/%d/0", libxl_xs_get_dompath(&gc, 0), domid);
- num_devs = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/num_devs", be_path));
+ be_path = libxl__sprintf(&gc, "%s/backend/pci/%d/0", libxl__xs_get_dompath(&gc, 0), domid);
+ num_devs = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/num_devs", be_path));
if (!num_devs) {
*num = 0;
*list = NULL;
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
n = atoi(num_devs);
@@ -986,13 +986,13 @@ int libxl_device_pci_list_assigned(libxl_ctx *ctx, libxl_device_pci **list, uint
*num = n;
for (i = 0; i < n; i++) {
- xsdev = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/dev-%d", be_path, i));
+ xsdev = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/dev-%d", be_path, i));
sscanf(xsdev, PCI_BDF, &domain, &bus, &dev, &func);
- xsvdevfn = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/vdevfn-%d", be_path, i));
+ xsvdevfn = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/vdevfn-%d", be_path, i));
if (xsvdevfn)
vdevfn = strtol(xsvdevfn, (char **) NULL, 16);
pcidev_init(pcidevs + i, domain, bus, dev, func, vdevfn);
- xsopts = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/opts-%d", be_path, i));
+ xsopts = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/opts-%d", be_path, i));
if (xsopts) {
char *saveptr;
char *p = strtok_r(xsopts, ",=", &saveptr);
@@ -1011,7 +1011,7 @@ int libxl_device_pci_list_assigned(libxl_ctx *ctx, libxl_device_pci **list, uint
}
if ( *num )
*list = pcidevs;
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index 225c53fb85..5108fea628 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -54,11 +54,11 @@ char *libxl_domid_to_name(libxl_ctx *ctx, uint32_t domid)
return s;
}
-char *_libxl_domid_to_name(libxl_gc *gc, uint32_t domid)
+char *libxl__domid_to_name(libxl_gc *gc, uint32_t domid)
{
char *s = libxl_domid_to_name(libxl_gc_owner(gc), domid);
if ( s )
- libxl_ptr_add(gc, s);
+ libxl__ptr_add(gc, s);
return s;
}
@@ -103,11 +103,11 @@ char *libxl_poolid_to_name(libxl_ctx *ctx, uint32_t poolid)
return s;
}
-char *_libxl_poolid_to_name(libxl_gc *gc, uint32_t poolid)
+char *libxl__poolid_to_name(libxl_gc *gc, uint32_t poolid)
{
char *s = libxl_poolid_to_name(libxl_gc_owner(gc), poolid);
if ( s )
- libxl_ptr_add(gc, s);
+ libxl__ptr_add(gc, s);
return s;
}
@@ -145,14 +145,14 @@ int libxl_get_stubdom_id(libxl_ctx *ctx, int guest_domid)
char * stubdom_id_s;
int ret;
- stubdom_id_s = libxl_xs_read(&gc, XBT_NULL,
- libxl_sprintf(&gc, "%s/image/device-model-domid",
- libxl_xs_get_dompath(&gc, guest_domid)));
+ stubdom_id_s = libxl__xs_read(&gc, XBT_NULL,
+ libxl__sprintf(&gc, "%s/image/device-model-domid",
+ libxl__xs_get_dompath(&gc, guest_domid)));
if (stubdom_id_s)
ret = atoi(stubdom_id_s);
else
ret = 0;
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ret;
}
@@ -163,7 +163,7 @@ int libxl_is_stubdom(libxl_ctx *ctx, uint32_t domid, uint32_t *target_domid)
uint32_t value;
int ret = 0;
- target = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/target", libxl_xs_get_dompath(&gc, domid)));
+ target = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/target", libxl__xs_get_dompath(&gc, domid)));
if (!target)
goto out;
value = strtol(target, &endptr, 10);
@@ -173,7 +173,7 @@ int libxl_is_stubdom(libxl_ctx *ctx, uint32_t domid, uint32_t *target_domid)
*target_domid = value;
ret = 1;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ret;
}
@@ -198,20 +198,20 @@ int libxl_create_logfile(libxl_ctx *ctx, char *name, char **full_name)
char *logfile, *logfile_new;
int i, rc;
- logfile = libxl_sprintf(&gc, "/var/log/xen/%s.log", name);
+ logfile = libxl__sprintf(&gc, "/var/log/xen/%s.log", name);
if (stat(logfile, &stat_buf) == 0) {
/* file exists, rotate */
- logfile = libxl_sprintf(&gc, "/var/log/xen/%s.log.10", name);
+ logfile = libxl__sprintf(&gc, "/var/log/xen/%s.log.10", name);
unlink(logfile);
for (i = 9; i > 0; i--) {
- logfile = libxl_sprintf(&gc, "/var/log/xen/%s.log.%d", name, i);
- logfile_new = libxl_sprintf(&gc, "/var/log/xen/%s.log.%d", name, i + 1);
+ logfile = libxl__sprintf(&gc, "/var/log/xen/%s.log.%d", name, i);
+ logfile_new = libxl__sprintf(&gc, "/var/log/xen/%s.log.%d", name, i + 1);
rc = logrename(ctx, logfile, logfile_new);
if (rc)
goto out;
}
- logfile = libxl_sprintf(&gc, "/var/log/xen/%s.log", name);
- logfile_new = libxl_sprintf(&gc, "/var/log/xen/%s.log.1", name);
+ logfile = libxl__sprintf(&gc, "/var/log/xen/%s.log", name);
+ logfile_new = libxl__sprintf(&gc, "/var/log/xen/%s.log.1", name);
rc = logrename(ctx, logfile, logfile_new);
if (rc)
@@ -225,7 +225,7 @@ int libxl_create_logfile(libxl_ctx *ctx, char *name, char **full_name)
*full_name = strdup(logfile);
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -455,29 +455,29 @@ int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid,
int rc = ERROR_FAIL;
memset(nic, 0, sizeof (libxl_device_nic));
- dompath = libxl_xs_get_dompath(&gc, domid);
+ dompath = libxl__xs_get_dompath(&gc, domid);
if (!dompath) {
goto out;
}
- nic_path_fe = libxl_sprintf(&gc, "%s/device/vif/%s", dompath, devid);
- nic_path_be = libxl_xs_read(&gc, XBT_NULL,
- libxl_sprintf(&gc, "%s/backend", nic_path_fe));
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend-id", nic_path_fe));
+ nic_path_fe = libxl__sprintf(&gc, "%s/device/vif/%s", dompath, devid);
+ nic_path_be = libxl__xs_read(&gc, XBT_NULL,
+ libxl__sprintf(&gc, "%s/backend", nic_path_fe));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", nic_path_fe));
if ( NULL == val ) {
goto out;
}
nic->backend_domid = strtoul(val, NULL, 10);
nic->devid = strtoul(devid, NULL, 10);
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/mac", nic_path_fe));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", nic_path_fe));
for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
++i, tok = strtok(NULL, ":")) {
nic->mac[i] = strtoul(tok, NULL, 16);
}
- nic->script = xs_read(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "%s/script", nic_path_be), NULL);
+ nic->script = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/script", nic_path_be), NULL);
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -495,32 +495,32 @@ int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
goto out;
}
rc = ERROR_FAIL;
- dompath = libxl_xs_get_dompath(&gc, domid);
- diskpath = libxl_sprintf(&gc, "%s/device/vbd/%s", dompath, devid);
+ dompath = libxl__xs_get_dompath(&gc, domid);
+ diskpath = libxl__sprintf(&gc, "%s/device/vbd/%s", dompath, devid);
if (!diskpath) {
goto out;
}
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend-id", diskpath));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", diskpath));
if (!val)
goto out;
disk->backend_domid = strtoul(val, NULL, 10);
disk->domid = domid;
- be_path = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend", diskpath));
- disk->physpath = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/params", be_path));
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/type", be_path));
+ be_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend", diskpath));
+ disk->physpath = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/params", be_path));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/type", be_path));
libxl_string_to_phystype(ctx, val, &(disk->phystype));
- disk->virtpath = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/dev", be_path));
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/removable", be_path));
+ disk->virtpath = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/dev", be_path));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/removable", be_path));
disk->unpluggable = !strcmp(val, "1");
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/mode", be_path));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mode", be_path));
disk->readwrite = !!strcmp(val, "w");
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/device-type", diskpath));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/device-type", diskpath));
disk->is_cdrom = !strcmp(val, "cdrom");
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -538,43 +538,43 @@ int libxl_devid_to_device_net2(libxl_ctx *ctx, uint32_t domid,
goto out;
}
rc = ERROR_FAIL;
- dompath = libxl_xs_get_dompath(&gc, domid);
- net2path = libxl_sprintf(&gc, "%s/device/vif2/%s", dompath, devid);
+ dompath = libxl__xs_get_dompath(&gc, domid);
+ net2path = libxl__sprintf(&gc, "%s/device/vif2/%s", dompath, devid);
if (!net2path) {
goto out;
}
memset(net2, 0, sizeof (libxl_device_net2));
- be_path = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend", net2path));
+ be_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend", net2path));
net2->devid = devid_n;
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/mac", net2path));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", net2path));
for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
++i, tok = strtok(NULL, ":")) {
net2->front_mac[i] = strtoul(tok, NULL, 16);
}
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/remote-mac", net2path));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/remote-mac", net2path));
for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
++i, tok = strtok(NULL, ":")) {
net2->back_mac[i] = strtoul(tok, NULL, 16);
}
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend-id", net2path));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", net2path));
net2->backend_domid = strtoul(val, NULL, 10);
net2->domid = domid;
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/remote-trusted", be_path));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/remote-trusted", be_path));
net2->trusted = strtoul(val, NULL, 10);
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/local-trusted", be_path));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/local-trusted", be_path));
net2->back_trusted = strtoul(val, NULL, 10);
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/filter-mac", be_path));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/filter-mac", be_path));
net2->filter_mac = strtoul(val, NULL, 10);
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/filter-mac", net2path));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/filter-mac", net2path));
net2->front_filter_mac = strtoul(val, NULL, 10);
- val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/max-bypasses", be_path));
+ val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/max-bypasses", be_path));
net2->max_bypasses = strtoul(val, NULL, 10);
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -607,7 +607,7 @@ int libxl_check_device_model_version(libxl_ctx *ctx, char *path)
char *abs_path = NULL;
int rc = -1;
- abs_path = libxl_abs_path(&gc, path, libxl_private_bindir_path());
+ abs_path = libxl__abs_path(&gc, path, libxl_private_bindir_path());
if (pipe(pipefd))
goto out;
@@ -672,6 +672,6 @@ int libxl_check_device_model_version(libxl_ctx *ctx, char *path)
}
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
diff --git a/tools/libxl/libxl_xshelp.c b/tools/libxl/libxl_xshelp.c
index cfd7be3cb5..b04929d65e 100644
--- a/tools/libxl/libxl_xshelp.c
+++ b/tools/libxl/libxl_xshelp.c
@@ -44,7 +44,7 @@ int xs_writev(struct xs_handle *xsh, xs_transaction_t t, char *dir, char *kvs[])
return 0;
}
-char **libxl_xs_kvs_of_flexarray(libxl_gc *gc, flexarray_t *array, int length)
+char **libxl__xs_kvs_of_flexarray(libxl_gc *gc, flexarray_t *array, int length)
{
char **kvs;
int i;
@@ -52,7 +52,7 @@ char **libxl_xs_kvs_of_flexarray(libxl_gc *gc, flexarray_t *array, int length)
if (!length)
return NULL;
- kvs = libxl_calloc(gc, length + 2, sizeof(char *));
+ kvs = libxl__calloc(gc, length + 2, sizeof(char *));
if (kvs) {
for (i = 0; i < length; i += 2) {
void *ptr;
@@ -68,7 +68,7 @@ char **libxl_xs_kvs_of_flexarray(libxl_gc *gc, flexarray_t *array, int length)
return kvs;
}
-int libxl_xs_writev(libxl_gc *gc, xs_transaction_t t,
+int libxl__xs_writev(libxl_gc *gc, xs_transaction_t t,
char *dir, char *kvs[])
{
libxl_ctx *ctx = libxl_gc_owner(gc);
@@ -79,7 +79,7 @@ int libxl_xs_writev(libxl_gc *gc, xs_transaction_t t,
return 0;
for (i = 0; kvs[i] != NULL; i += 2) {
- path = libxl_sprintf(gc, "%s/%s", dir, kvs[i]);
+ path = libxl__sprintf(gc, "%s/%s", dir, kvs[i]);
if (path && kvs[i + 1]) {
int length = strlen(kvs[i + 1]);
xs_write(ctx->xsh, t, path, kvs[i + 1], length);
@@ -88,7 +88,7 @@ int libxl_xs_writev(libxl_gc *gc, xs_transaction_t t,
return 0;
}
-int libxl_xs_write(libxl_gc *gc, xs_transaction_t t,
+int libxl__xs_write(libxl_gc *gc, xs_transaction_t t,
char *path, char *fmt, ...)
{
libxl_ctx *ctx = libxl_gc_owner(gc);
@@ -107,20 +107,20 @@ int libxl_xs_write(libxl_gc *gc, xs_transaction_t t,
return 0;
}
-char * libxl_xs_read(libxl_gc *gc, xs_transaction_t t, char *path)
+char * libxl__xs_read(libxl_gc *gc, xs_transaction_t t, char *path)
{
libxl_ctx *ctx = libxl_gc_owner(gc);
char *ptr;
ptr = xs_read(ctx->xsh, t, path, NULL);
if (ptr != NULL) {
- libxl_ptr_add(gc, ptr);
+ libxl__ptr_add(gc, ptr);
return ptr;
}
return 0;
}
-char *libxl_xs_get_dompath(libxl_gc *gc, uint32_t domid)
+char *libxl__xs_get_dompath(libxl_gc *gc, uint32_t domid)
{
libxl_ctx *ctx = libxl_gc_owner(gc);
char *s = xs_get_domain_path(ctx->xsh, domid);
@@ -129,15 +129,15 @@ char *libxl_xs_get_dompath(libxl_gc *gc, uint32_t domid)
domid);
return NULL;
}
- libxl_ptr_add(gc, s);
+ libxl__ptr_add(gc, s);
return s;
}
-char **libxl_xs_directory(libxl_gc *gc, xs_transaction_t t, char *path, unsigned int *nb)
+char **libxl__xs_directory(libxl_gc *gc, xs_transaction_t t, char *path, unsigned int *nb)
{
libxl_ctx *ctx = libxl_gc_owner(gc);
char **ret = NULL;
ret = xs_directory(ctx->xsh, XBT_NULL, path, nb);
- libxl_ptr_add(gc, ret);
+ libxl__ptr_add(gc, ret);
return ret;
}
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index c042426228..3bdee6899a 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -4395,7 +4395,7 @@ int main_blockdetach(int argc, char **argv)
return 1;
}
if (libxl_device_disk_del(&ctx, &disk, 1)) {
- fprintf(stderr, "libxl_device_del failed.\n");
+ fprintf(stderr, "libxl_device_disk_del failed.\n");
}
return 0;
}