* [PATCH 1 of 4] libxl: Ensure all _hidden functions use libxl__ prefix
2010-09-07 10:07 [PATCH 0 of 4] libxl: use libxl__ namespace for hidden functions Ian Campbell
@ 2010-09-07 10:07 ` Ian Campbell
2010-09-07 10:07 ` [PATCH 2 " Ian Campbell
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Ian Campbell @ 2010-09-07 10:07 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Campbell
# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1283851103 -3600
# Node ID a13d2fc2c1f6120cd9bcb3b2a56f10e18fdd17f0
# Parent 3337bac80d870221ebfa7bc0365b1706f5fa9dde
libxl: Ensure all _hidden functions use libxl__ prefix
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.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
diff -r 3337bac80d87 -r a13d2fc2c1f6 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl.c Tue Sep 07 10:18:23 2010 +0100
@@ -119,9 +119,9 @@ int libxl_domain_make(libxl_ctx *ctx, li
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, li
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,
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,
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, l
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,
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,
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
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
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,
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,
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
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
}
}
}
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -789,7 +789,7 @@ int libxl_wait_for_disk_ejects(libxl_ctx
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
}
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -857,29 +857,29 @@ int libxl_event_get_disk_eject_info(libx
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(li
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(li
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(li
atoi(pid));
}
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ret;
}
@@ -930,11 +930,11 @@ int libxl_domain_destroy(libxl_ctx *ctx,
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,
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,
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,
}
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, u
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,
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,
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,
}
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_
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_
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_
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_
}
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_
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_
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_
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_
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_
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
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
}
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_ct
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_ct
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_ct
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_ct
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 @@ out_free:
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
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
}
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 @@ retry_transaction:
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
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_confirm_device_model_startup(l
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
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
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
}
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
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
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(li
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,
}
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,
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,
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
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
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
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(l
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(l
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
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 *
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 *
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,
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_lis
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_lis
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_lis
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
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(l
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 *c
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,
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,
}
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 *ct
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 *ct
}
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 *c
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 *c
}
}
- 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 *c
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,
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_sysrq(libxl_ctx *ctx, uin
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 @@ uint32_t libxl_vm_get_start_time(libxl_c
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_c
}else{
ret = strtoul(start_time, NULL, 10);
}
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return ret;
}
diff -r 3337bac80d87 -r a13d2fc2c1f6 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl.h Tue Sep 07 10:18:23 2010 +0100
@@ -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 -r 3337bac80d87 -r a13d2fc2c1f6 tools/libxl/libxl_blktap2.c
--- a/tools/libxl/libxl_blktap2.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_blktap2.c Tue Sep 07 10:18:23 2010 +0100
@@ -35,15 +35,15 @@ const char *libxl_blktap_devpath(libxl_g
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 -r 3337bac80d87 -r a13d2fc2c1f6 tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_bootloader.c Tue Sep 07 10:18:23 2010 +0100
@@ -45,20 +45,20 @@ static char **make_bootloader_args(libxl
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 *m
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_
}
}
- 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/serial/0/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/serial/0/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 -r 3337bac80d87 -r a13d2fc2c1f6 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_device.c Tue Sep 07 10:18:23 2010 +0100
@@ -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 *
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 *virtpat
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,
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_ct
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_ct
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
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
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
}
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, lib
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_ct
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_ct
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 *ct
}
XL_LOG(ctx, XL_LOG_ERROR, "Backend %s not ready", be_path);
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
diff -r 3337bac80d87 -r a13d2fc2c1f6 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_dom.c Tue Sep 07 10:18:23 2010 +0100
@@ -96,43 +96,43 @@ int build_post(libxl_ctx *ctx, uint32_t
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 d
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 d
}
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -317,8 +317,8 @@ static int core_suspend_callback(void *d
}
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 *d
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, ui
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, ui
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_g
" 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.%s.%s",
wh, uuid_string, userdata_userid);
if (!path)
@@ -509,7 +509,7 @@ void libxl__userdata_destroyall(libxl_ct
}
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 *c
if (datalen_r) *datalen_r = datalen;
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
diff -r 3337bac80d87 -r a13d2fc2c1f6 tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_exec.c Tue Sep 07 10:18:23 2010 +0100
@@ -35,7 +35,7 @@ static int call_waitpid(pid_t (*waitpid_
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
}
}
-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_st
}
}
-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 -r 3337bac80d87 -r a13d2fc2c1f6 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_internal.c Tue Sep 07 10:18:23 2010 +0100
@@ -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 *pt
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
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
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_l
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 -r 3337bac80d87 -r a13d2fc2c1f6 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_internal.h Tue Sep 07 10:18:23 2010 +0100
@@ -122,22 +122,22 @@ static inline libxl_ctx *libxl_gc_owner(
}
/* 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 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 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 int device_physdisk_major_minor(
_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_g
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 -r 3337bac80d87 -r a13d2fc2c1f6 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_pci.c Tue Sep 07 10:18:23 2010 +0100
@@ -224,38 +224,38 @@ static int libxl_create_pci_backend(libx
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
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
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_xenst
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_xenst
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(libx
*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(lib
}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(lib
closedir(dir);
*list = pcidevs;
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
@@ -573,7 +573,7 @@ static int pci_multifunction_check(libxl
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, uint
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, uint
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, uint
}
}
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_
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_
}
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,
}
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -837,29 +837,29 @@ static int do_pci_remove(libxl_gc *gc, u
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, u
}
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 *c
}
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
@@ -973,12 +973,12 @@ int libxl_device_pci_list_assigned(libxl
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
*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
}
if ( *num )
*list = pcidevs;
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return 0;
}
diff -r 3337bac80d87 -r a13d2fc2c1f6 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_utils.c Tue Sep 07 10:18:23 2010 +0100
@@ -54,11 +54,11 @@ char *libxl_domid_to_name(libxl_ctx *ctx
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 *ct
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,
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, uin
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, uin
*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 *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,
*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
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
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
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(lib
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(lib
}
rc = 0;
out:
- libxl_free_all(&gc);
+ libxl__free_all(&gc);
return rc;
}
diff -r 3337bac80d87 -r a13d2fc2c1f6 tools/libxl/libxl_xshelp.c
--- a/tools/libxl/libxl_xshelp.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_xshelp.c Tue Sep 07 10:18:23 2010 +0100
@@ -44,7 +44,7 @@ int xs_writev(struct xs_handle *xsh, xs_
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_g
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_g
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_tra
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_tra
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_tran
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,
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 -r 3337bac80d87 -r a13d2fc2c1f6 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c Tue Sep 07 10:18:23 2010 +0100
@@ -4384,7 +4384,7 @@ int main_blockdetach(int argc, char **ar
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;
}
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 2 of 4] libxl: Ensure all _hidden functions use libxl__ prefix
2010-09-07 10:07 [PATCH 0 of 4] libxl: use libxl__ namespace for hidden functions Ian Campbell
2010-09-07 10:07 ` [PATCH 1 of 4] libxl: Ensure all _hidden functions use libxl__ prefix Ian Campbell
@ 2010-09-07 10:07 ` Ian Campbell
2010-09-07 10:07 ` [PATCH 3 of 4] libxl: move hvm_build_set_params to libxl_dom.c Ian Campbell
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Ian Campbell @ 2010-09-07 10:07 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Campbell
# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1283853890 -3600
# Node ID f5372f2ac680ab1bd686499f4a9bdbc288629db1
# Parent a13d2fc2c1f6120cd9bcb3b2a56f10e18fdd17f0
libxl: Ensure all _hidden functions use libxl__ prefix
This patch covers the remaining functions identified by:
rgrep _hidden tools/libxl/*.h | grep -v libxl__
sed -i -e 's/XL_LOG/LIBXL__LOG/g' tools/libxl/*.[ch]
sed -i -e 's/xl_log/libxl__log/g' tools/libxl/*.[ch]
sed -i -e 's/\(build_\(pre\|post\|pv\|hvm\)\)/libxl__\1/g' tools/libxl/*.[ch]
sed -i -e 's/is_hvm/libxl__domain_is_hvm/g' tools/libxl/*.[ch]
sed -i -e 's/get_shutdown_reason/libxl__domain_shutdown_reason/g' tools/libxl/*.[ch]
sed -i -e 's/restore_common/libxl__domain_restore_common/g' tools/libxl/*.[ch]
sed -i -e 's/core_suspend/libxl__domain_suspend_common/g' tools/libxl/*.[ch]
sed -i -e 's/save_device_model/libxl__domain_save_device_model/g' tools/libxl/*.[ch]
sed -i -e 's/device_disk_backend_type_of_phystype/libxl__device_disk_backend_type_of_phystype/g' tools/libxl/*.[ch]
sed -i -e 's/\<libxl_blktap_enabled\>/libxl__blktap_enabled/g' tools/libxl/*.[ch]
sed -i -e 's/\<libxl_blktap_devpath\>/libxl__blktap_devpath/g' tools/libxl/*.[ch]
Add _hidden to libxl__blktap_enabled and libxl__blktap_devpath
Inline dominfo_libxl__domain_shutdown_reason(info) into
libxl__domain_shutdown_reason, its only caller.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
diff -r a13d2fc2c1f6 -r f5372f2ac680 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl.c Tue Sep 07 11:04:50 2010 +0100
@@ -48,7 +48,7 @@ int libxl_ctx_init(libxl_ctx *ctx, int v
ctx->xch = xc_interface_open(lg,lg,0);
if (!ctx->xch) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, errno,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, errno,
"cannot open libxc handle");
return ERROR_FAIL;
}
@@ -57,7 +57,7 @@ int libxl_ctx_init(libxl_ctx *ctx, int v
if (!ctx->xsh)
ctx->xsh = xs_domain_open();
if (!ctx->xsh) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, errno,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, errno,
"cannot connect to xenstore");
xc_interface_close(ctx->xch);
return ERROR_FAIL;
@@ -135,14 +135,14 @@ int libxl_domain_make(libxl_ctx *ctx, li
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__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "domain creation fail");
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__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "domain move fail");
libxl__free_all(&gc);
return ERROR_FAIL;
}
@@ -155,7 +155,7 @@ int libxl_domain_make(libxl_ctx *ctx, li
vm_path = libxl__sprintf(&gc, "/vm/%s", uuid_string);
if (!vm_path) {
- XL_LOG(ctx, XL_LOG_ERROR, "cannot allocate create paths");
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot allocate create paths");
libxl__free_all(&gc);
return ERROR_FAIL;
}
@@ -235,7 +235,7 @@ int libxl_domain_rename(libxl_ctx *ctx,
if (!trans) {
trans = our_trans = xs_transaction_start(ctx->xsh);
if (!our_trans) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, errno,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, errno,
"create xs transaction for domain (re)name");
goto x_fail;
}
@@ -244,13 +244,13 @@ int libxl_domain_rename(libxl_ctx *ctx,
if (old_name) {
got_old_name = xs_read(ctx->xsh, trans, name_path, &got_old_len);
if (!got_old_name) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, errno, "check old name"
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, errno, "check old name"
" for domain %"PRIu32" allegedly named `%s'",
domid, old_name);
goto x_fail;
}
if (strcmp(old_name, got_old_name)) {
- XL_LOG(ctx, XL_LOG_ERROR, "domain %"PRIu32" allegedly named "
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "domain %"PRIu32" allegedly named "
"`%s' is actually named `%s' - racing ?",
domid, old_name, got_old_name);
free(got_old_name);
@@ -260,7 +260,7 @@ int libxl_domain_rename(libxl_ctx *ctx,
}
if (!xs_write(ctx->xsh, trans, name_path,
new_name, strlen(new_name))) {
- XL_LOG(ctx, XL_LOG_ERROR, "failed to write new name `%s'"
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "failed to write new name `%s'"
" for domain %"PRIu32" previously named `%s'",
new_name, domid, old_name);
goto x_fail;
@@ -270,12 +270,12 @@ int libxl_domain_rename(libxl_ctx *ctx,
if (!xs_transaction_end(ctx->xsh, our_trans, 0)) {
trans = our_trans = 0;
if (errno != EAGAIN) {
- XL_LOG(ctx, XL_LOG_ERROR, "failed to commit new name `%s'"
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "failed to commit new name `%s'"
" for domain %"PRIu32" previously named `%s'",
new_name, domid, old_name);
goto x_fail;
}
- XL_LOG(ctx, XL_LOG_DEBUG, "need to retry rename transaction"
+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "need to retry rename transaction"
" for domain %"PRIu32" (name_path=\"%s\", new_name=\"%s\")",
domid, name_path, new_name);
goto retry_transaction;
@@ -300,14 +300,14 @@ int libxl_domain_build(libxl_ctx *ctx, l
struct timeval start_time;
int i, ret;
- ret = build_pre(ctx, domid, info, state);
+ ret = libxl__build_pre(ctx, domid, info, state);
if (ret)
goto out;
gettimeofday(&start_time, NULL);
if (info->hvm) {
- ret = build_hvm(ctx, domid, info, state);
+ ret = libxl__build_hvm(ctx, domid, info, state);
if (ret)
goto out;
@@ -319,7 +319,7 @@ int libxl_domain_build(libxl_ctx *ctx, l
vments[4] = "start_time";
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);
+ ret = libxl__build_pv(ctx, domid, info, state);
if (ret)
goto out;
@@ -340,7 +340,7 @@ int libxl_domain_build(libxl_ctx *ctx, l
vments[i++] = (char*) info->u.pv.cmdline;
}
}
- ret = build_post(ctx, domid, info, state, vments, localents);
+ ret = libxl__build_post(ctx, domid, info, state, vments, localents);
out:
libxl__file_reference_unmap(&info->kernel);
if (!info->hvm)
@@ -359,11 +359,11 @@ int libxl_domain_restore(libxl_ctx *ctx,
struct timeval start_time;
int i, ret, esave, flags;
- ret = build_pre(ctx, domid, info, state);
+ ret = libxl__build_pre(ctx, domid, info, state);
if (ret)
goto out;
- ret = restore_common(ctx, domid, info, state, fd);
+ ret = libxl__domain_restore_common(ctx, domid, info, state, fd);
if (ret)
goto out;
@@ -395,7 +395,7 @@ int libxl_domain_restore(libxl_ctx *ctx,
vments[i++] = (char*) info->u.pv.cmdline;
}
}
- ret = build_post(ctx, domid, info, state, vments, localents);
+ ret = libxl__build_post(ctx, domid, info, state, vments, localents);
if (ret)
goto out;
@@ -415,11 +415,11 @@ out:
flags = fcntl(fd, F_GETFL);
if (flags == -1) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unable to get flags on restore fd");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unable to get flags on restore fd");
} else {
flags &= ~O_NONBLOCK;
if (fcntl(fd, F_SETFL, flags) == -1)
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unable to put restore fd"
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unable to put restore fd"
" back to blocking mode");
}
@@ -433,21 +433,21 @@ int libxl_domain_resume(libxl_ctx *ctx,
libxl_gc gc = LIBXL_INIT_GC(ctx);
int rc = 0;
- if (is_hvm(ctx, domid)) {
- XL_LOG(ctx, XL_LOG_DEBUG, "Called domain_resume on "
+ if (libxl__domain_is_hvm(ctx, domid)) {
+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Called domain_resume on "
"non-cooperative hvm domain %u", domid);
rc = ERROR_NI;
goto out;
}
if (xc_domain_resume(ctx->xch, domid, 1)) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
"xc_domain_resume failed for domain %u",
domid);
rc = ERROR_FAIL;
goto out;
}
if (!xs_resume_domain(ctx->xsh, domid)) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
"xs_resume_domain failed for domain %u",
domid);
rc = ERROR_FAIL;
@@ -558,13 +558,13 @@ libxl_dominfo * libxl_list_domain(libxl_
ptr = calloc(size, sizeof(libxl_dominfo));
if (!ptr) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "allocating domain info");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "allocating domain info");
return NULL;
}
ret = xc_domain_getinfolist(ctx->xch, 0, 1024, info);
if (ret<0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "geting domain info list");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "geting domain info list");
return NULL;
}
@@ -582,7 +582,7 @@ int libxl_domain_info(libxl_ctx *ctx, li
ret = xc_domain_getinfolist(ctx->xch, domid, 1, &xcinfo);
if (ret<0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "geting domain info list");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "geting domain info list");
return ERROR_FAIL;
}
if (ret==0 || xcinfo.domain != domid) return ERROR_INVAL;
@@ -600,13 +600,13 @@ libxl_poolinfo * libxl_list_pool(libxl_c
ptr = calloc(size, sizeof(libxl_poolinfo));
if (!ptr) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "allocating cpupool info");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "allocating cpupool info");
return NULL;
}
ret = xc_cpupool_getinfo(ctx->xch, 0, 256, info);
if (ret<0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting cpupool info");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting cpupool info");
return NULL;
}
@@ -631,7 +631,7 @@ libxl_vminfo * libxl_list_vm(libxl_ctx *
ret = xc_domain_getinfolist(ctx->xch, 1, 1024, info);
if (ret<0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "geting domain info list");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "geting domain info list");
return NULL;
}
for (index = i = 0; i < ret; i++) {
@@ -649,14 +649,14 @@ int libxl_domain_suspend(libxl_ctx *ctx,
int libxl_domain_suspend(libxl_ctx *ctx, libxl_domain_suspend_info *info,
uint32_t domid, int fd)
{
- int hvm = is_hvm(ctx, domid);
+ int hvm = libxl__domain_is_hvm(ctx, domid);
int live = info != NULL && info->flags & XL_SUSPEND_LIVE;
int debug = info != NULL && info->flags & XL_SUSPEND_DEBUG;
int rc = 0;
- core_suspend(ctx, domid, fd, hvm, live, debug);
+ libxl__domain_suspend_common(ctx, domid, fd, hvm, live, debug);
if (hvm)
- rc = save_device_model(ctx, domid, fd);
+ rc = libxl__domain_save_device_model(ctx, domid, fd);
return rc;
}
@@ -665,7 +665,7 @@ int libxl_domain_pause(libxl_ctx *ctx, u
int ret;
ret = xc_domain_pause(ctx->xch, domid);
if (ret<0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "pausing domain %d", domid);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "pausing domain %d", domid);
return ERROR_FAIL;
}
return 0;
@@ -677,7 +677,7 @@ int libxl_domain_core_dump(libxl_ctx *ct
int ret;
ret = xc_domain_dumpcore(ctx->xch, domid, filename);
if (ret<0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "core dumping domain %d to %s",
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "core dumping domain %d to %s",
domid, filename);
return ERROR_FAIL;
}
@@ -691,7 +691,7 @@ int libxl_domain_unpause(libxl_ctx *ctx,
char *state;
int ret, rc = 0;
- if (is_hvm(ctx, domid)) {
+ if (libxl__domain_is_hvm(ctx, domid)) {
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")) {
@@ -701,7 +701,7 @@ int libxl_domain_unpause(libxl_ctx *ctx,
}
ret = xc_domain_unpause(ctx->xch, domid);
if (ret<0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unpausing domain %d", domid);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unpausing domain %d", domid);
rc = ERROR_FAIL;
}
libxl__free_all(&gc);
@@ -736,24 +736,24 @@ int libxl_domain_shutdown(libxl_ctx *ctx
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)) {
+ if (libxl__domain_is_hvm(ctx,domid)) {
unsigned long acpi_s_state = 0;
unsigned long pvdriver = 0;
int ret;
ret = xc_get_hvm_param(ctx->xch, domid, HVM_PARAM_ACPI_S_STATE, &acpi_s_state);
if (ret<0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting ACPI S-state");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting ACPI S-state");
return ERROR_FAIL;
}
ret = xc_get_hvm_param(ctx->xch, domid, HVM_PARAM_CALLBACK_IRQ, &pvdriver);
if (ret<0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting HVM callback IRQ");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting HVM callback IRQ");
return ERROR_FAIL;
}
if (!pvdriver || acpi_s_state != 0) {
ret = xc_domain_shutdown(ctx->xch, domid, req);
if (ret<0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unpausing domain");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unpausing domain");
return ERROR_FAIL;
}
}
@@ -790,7 +790,7 @@ int libxl_wait_for_disk_ejects(libxl_ctx
for (i = 0; i < num_disks; i++) {
if (asprintf(&(waiter[i].path), "%s/device/vbd/%d/eject",
libxl__xs_get_dompath(&gc, domid),
- device_disk_dev_number(disks[i].virtpath)) < 0)
+ libxl__device_disk_dev_number(disks[i].virtpath)) < 0)
goto out;
if (asprintf(&(waiter[i].token), "%d", LIBXL_EVENT_DISK_EJECT) < 0)
goto out;
@@ -893,11 +893,11 @@ static int libxl_destroy_device_model(li
if (!pid) {
int stubdomid = libxl_get_stubdom_id(ctx, domid);
if (!stubdomid) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't find device model's pid");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't find device model's pid");
ret = ERROR_INVAL;
goto out;
}
- XL_LOG(ctx, XL_LOG_ERROR, "Device model is a stubdom, domid=%d\n", stubdomid);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device model is a stubdom, domid=%d\n", stubdomid);
ret = libxl_domain_destroy(ctx, stubdomid, 0);
goto out;
}
@@ -905,13 +905,13 @@ static int libxl_destroy_device_model(li
ret = kill(atoi(pid), SIGHUP);
if (ret < 0 && errno == ESRCH) {
- XL_LOG(ctx, XL_LOG_DEBUG, "Device Model already exited");
+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Device Model already exited");
ret = 0;
} else if (ret == 0) {
- XL_LOG(ctx, XL_LOG_DEBUG, "Device Model signaled");
+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Device Model signaled");
ret = 0;
} else {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to kill Device Model [%d]",
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to kill Device Model [%d]",
atoi(pid));
}
out:
@@ -926,7 +926,7 @@ int libxl_domain_destroy(libxl_ctx *ctx,
char *vm_path;
int rc, dm_present;
- if (is_hvm(ctx, domid)) {
+ if (libxl__domain_is_hvm(ctx, domid)) {
dm_present = 1;
} else {
char *pid;
@@ -941,7 +941,7 @@ int libxl_domain_destroy(libxl_ctx *ctx,
}
if (libxl_device_pci_shutdown(ctx, domid) < 0)
- XL_LOG(ctx, XL_LOG_ERROR, "pci shutdown failed for domid %d", domid);
+ LIBXL__LOG(ctx, LIBXL__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),
@@ -949,28 +949,28 @@ int libxl_domain_destroy(libxl_ctx *ctx,
}
rc = xc_domain_pause(ctx->xch, domid);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_pause failed for %d", domid);
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_pause failed for %d", domid);
}
if (dm_present) {
if (libxl_destroy_device_model(ctx, domid) < 0)
- XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_device_model failed for %d", domid);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_destroy_device_model failed for %d", domid);
}
if (libxl__devices_destroy(ctx, domid, force) < 0)
- XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_devices failed for %d", domid);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_destroy_devices failed for %d", domid);
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);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xs_rm failed for %s", vm_path);
if (!xs_rm(ctx->xsh, XBT_NULL, dom_path))
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", dom_path);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xs_rm failed for %s", dom_path);
libxl__userdata_destroyall(ctx, domid);
rc = xc_domain_destroy(ctx->xch, domid);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_destroy failed for %d", domid);
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_destroy failed for %d", domid);
rc = ERROR_FAIL;
goto out;
}
@@ -1012,7 +1012,7 @@ int libxl_primary_console_exec(libxl_ctx
if (stubdomid)
return libxl_console_exec(ctx, stubdomid, 1, LIBXL_CONSTYPE_PV);
else {
- if (is_hvm(ctx, domid_vm))
+ if (libxl__domain_is_hvm(ctx, domid_vm))
return libxl_console_exec(ctx, domid_vm, 0, LIBXL_CONSTYPE_SERIAL);
else
return libxl_console_exec(ctx, domid_vm, 0, LIBXL_CONSTYPE_PV);
@@ -1067,7 +1067,7 @@ int libxl_vncviewer_exec(libxl_ctx *ctx,
if ( unlink(tmpname) )
/* should never happen */
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unlink %s failed", tmpname);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unlink %s failed", tmpname);
if ( libxl_write_exactly(ctx, autopass_fd, vnc_pass, strlen(vnc_pass),
tmpname, "vnc password") ) {
@@ -1535,7 +1535,7 @@ static int libxl_create_stubdom(libxl_ct
"%d", info->domid);
ret = xc_domain_set_target(ctx->xch, domid, info->domid);
if (ret<0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "setting target domain %d -> %d", domid, info->domid);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting target domain %d -> %d", domid, info->domid);
ret = ERROR_FAIL;
goto out_free;
}
@@ -1774,10 +1774,10 @@ int libxl_device_disk_add(libxl_ctx *ctx
goto out_free;
}
- backend_type = device_disk_backend_type_of_phystype(disk->phystype);
- devid = device_disk_dev_number(disk->virtpath);
+ backend_type = libxl__device_disk_backend_type_of_phystype(disk->phystype);
+ devid = libxl__device_disk_dev_number(disk->virtpath);
if (devid==-1) {
- XL_LOG(ctx, XL_LOG_ERROR, "Invalid or unsupported"
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Invalid or unsupported"
" virtual disk identifier %s", disk->virtpath);
rc = ERROR_INVAL;
goto out_free;
@@ -1792,7 +1792,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
switch (disk->phystype) {
case PHYSTYPE_PHY: {
- device_physdisk_major_minor(disk->physpath, &major, &minor);
+ libxl__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));
@@ -1809,19 +1809,19 @@ int libxl_device_disk_add(libxl_ctx *ctx
case PHYSTYPE_QCOW:
case PHYSTYPE_QCOW2:
case PHYSTYPE_VHD:
- if (libxl_blktap_enabled(&gc)) {
- const char *dev = libxl_blktap_devpath(&gc,
+ if (libxl__blktap_enabled(&gc)) {
+ const char *dev = libxl__blktap_devpath(&gc,
disk->physpath, disk->phystype);
if (!dev) {
rc = ERROR_FAIL;
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", libxl__device_disk_string_of_phystype(disk->phystype), disk->physpath));
flexarray_set(back, boffset++, "params");
flexarray_set(back, boffset++, libxl__strdup(&gc, dev));
backend_type = "phy";
- device_physdisk_major_minor(dev, &major, &minor);
+ libxl__device_physdisk_major_minor(dev, &major, &minor);
flexarray_set(back, boffset++, "physical-device");
flexarray_set(back, boffset++, libxl__sprintf(&gc, "%x:%x", major, minor));
device.backend_kind = DEVICE_VBD;
@@ -1830,13 +1830,13 @@ int libxl_device_disk_add(libxl_ctx *ctx
}
flexarray_set(back, boffset++, "params");
flexarray_set(back, boffset++, libxl__sprintf(&gc, "%s:%s",
- device_disk_string_of_phystype(disk->phystype), disk->physpath));
+ libxl__device_disk_string_of_phystype(disk->phystype), disk->physpath));
device.backend_kind = DEVICE_TAP;
break;
default:
- XL_LOG(ctx, XL_LOG_ERROR, "unrecognized disk physical type: %d\n", disk->phystype);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk physical type: %d\n", disk->phystype);
rc = ERROR_INVAL;
goto out_free;
}
@@ -1892,7 +1892,7 @@ int libxl_device_disk_del(libxl_ctx *ctx
libxl_device device;
int devid;
- devid = device_disk_dev_number(disk->virtpath);
+ devid = libxl__device_disk_dev_number(disk->virtpath);
device.backend_domid = disk->backend_domid;
device.backend_devid = devid;
device.backend_kind =
@@ -1922,12 +1922,12 @@ char * libxl_device_disk_local_attach(li
case PHYSTYPE_QCOW:
case PHYSTYPE_QCOW2:
case PHYSTYPE_VHD:
- if (libxl_blktap_enabled(&gc))
- dev = libxl_blktap_devpath(&gc, disk->physpath, phystype);
+ if (libxl__blktap_enabled(&gc))
+ dev = libxl__blktap_devpath(&gc, disk->physpath, phystype);
break;
default:
- XL_LOG(ctx, XL_LOG_ERROR, "unrecognized disk physical type: %d\n", phystype);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk physical type: %d\n", phystype);
break;
}
ret = strdup(dev);
@@ -2523,7 +2523,7 @@ int libxl_device_disk_getinfo(libxl_ctx
char *val;
dompath = libxl__xs_get_dompath(&gc, domid);
- diskinfo->devid = device_disk_dev_number(disk->virtpath);
+ diskinfo->devid = libxl__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);
@@ -2568,7 +2568,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u
break;
}
if (i == num) {
- XL_LOG(ctx, XL_LOG_ERROR, "Virtual device not found");
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual device not found");
goto out;
}
@@ -2731,17 +2731,17 @@ int libxl_domain_setmaxmem(libxl_ctx *ct
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);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot get memory info from %s/memory/target\n", dompath);
goto out;
}
memorykb = strtoul(mem, &endptr, 10);
if (*endptr != '\0') {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "invalid memory %s from %s/memory/target\n", mem, dompath);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "invalid memory %s from %s/memory/target\n", mem, dompath);
goto out;
}
if (max_memkb < memorykb) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "memory_static_max must be greater than or or equal to memory_dynamic_max\n");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "memory_static_max must be greater than or or equal to memory_dynamic_max\n");
goto out;
}
@@ -2768,19 +2768,19 @@ int libxl_set_memory_target(libxl_ctx *c
if (domid) {
memmax = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/memory/static-max", dompath));
if (!memmax) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
"cannot get memory info from %s/memory/static-max\n", dompath);
goto out;
}
memorykb = strtoul(memmax, &endptr, 10);
if (*endptr != '\0') {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
"invalid max memory %s from %s/memory/static-max\n", memmax, dompath);
goto out;
}
if (target_memkb > memorykb) {
- XL_LOG(ctx, XL_LOG_ERROR,
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
"memory_dynamic_max must be less than or equal to memory_static_max\n");
goto out;
}
@@ -2835,7 +2835,7 @@ int libxl_get_physinfo(libxl_ctx *ctx, l
rc = xc_physinfo(ctx->xch, &xcphysinfo);
if (rc != 0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting physinfo");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting physinfo");
return ERROR_FAIL;
}
physinfo->threads_per_core = xcphysinfo.threads_per_core;
@@ -2909,11 +2909,11 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ct
unsigned num_cpuwords;
if (xc_domain_getinfolist(ctx->xch, domid, 1, &domaininfo) != 1) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting infolist");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting infolist");
return NULL;
}
if (xc_physinfo(ctx->xch, &physinfo) == -1) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting physinfo");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting physinfo");
return NULL;
}
*nrcpus = physinfo.max_cpu_id + 1;
@@ -2929,12 +2929,12 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ct
return NULL;
}
if (xc_vcpu_getinfo(ctx->xch, domid, *nb_vcpu, &vcpuinfo) == -1) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting vcpu info");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting vcpu info");
return NULL;
}
if (xc_vcpu_getaffinity(ctx->xch, domid, *nb_vcpu,
ptr->cpumap, ((*nrcpus) + 7) / 8) == -1) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting vcpu affinity");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting vcpu affinity");
return NULL;
}
ptr->vcpuid = *nb_vcpu;
@@ -2951,7 +2951,7 @@ int libxl_set_vcpuaffinity(libxl_ctx *ct
uint64_t *cpumap, int nrcpus)
{
if (xc_vcpu_setaffinity(ctx->xch, domid, vcpuid, cpumap, (nrcpus + 7) / 8)) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "setting vcpu affinity");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting vcpu affinity");
return ERROR_FAIL;
}
return 0;
@@ -2966,7 +2966,7 @@ int libxl_set_vcpuonline(libxl_ctx *ctx,
int i, rc = ERROR_FAIL;
if (libxl_domain_info(ctx, &info, domid) < 0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting domain info list");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list");
goto out;
}
if (!(dompath = libxl__xs_get_dompath(&gc, domid)))
@@ -2996,7 +2996,7 @@ int libxl_get_sched_id(libxl_ctx *ctx)
int sched, ret;
if ((ret = xc_sched_id(ctx->xch, &sched)) != 0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting domain info list");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list");
return ERROR_FAIL;
}
return sched;
@@ -3009,7 +3009,7 @@ int libxl_sched_credit_domain_get(libxl_
rc = xc_sched_credit_domain_get(ctx->xch, domid, &sdom);
if (rc != 0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "setting domain sched credit");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting domain sched credit");
return ERROR_FAIL;
}
@@ -3027,7 +3027,7 @@ int libxl_sched_credit_domain_set(libxl_
rc = xc_domain_getinfolist(ctx->xch, domid, 1, &domaininfo);
if (rc < 0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting domain info list");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list");
return ERROR_FAIL;
}
if (rc != 1 || domaininfo.domain != domid)
@@ -3035,13 +3035,13 @@ int libxl_sched_credit_domain_set(libxl_
if (scinfo->weight < 1 || scinfo->weight > 65535) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
"Cpu weight out of range, valid values are within range from 1 to 65535");
return ERROR_INVAL;
}
if (scinfo->cap < 0 || scinfo->cap > (domaininfo.max_vcpu_id + 1) * 100) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
"Cpu cap out of range, valid range is from 0 to %d for specified number of vcpus",
((domaininfo.max_vcpu_id + 1) * 100));
return ERROR_INVAL;
@@ -3052,7 +3052,7 @@ int libxl_sched_credit_domain_set(libxl_
rc = xc_sched_credit_domain_set(ctx->xch, domid, &sdom);
if ( rc < 0 ) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "setting domain sched credit");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting domain sched credit");
return ERROR_FAIL;
}
@@ -3081,14 +3081,14 @@ int libxl_send_trigger(libxl_ctx *ctx, u
int trigger_type = trigger_type_from_string(trigger_name);
if (trigger_type == -1) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, -1,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, -1,
"Invalid trigger, valid triggers are <nmi|reset|init|power|sleep>");
return ERROR_INVAL;
}
rc = xc_domain_send_trigger(ctx->xch, domid, trigger_type, vcpuid);
if (rc != 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
"Send trigger '%s' failed", trigger_name);
return ERROR_FAIL;
}
@@ -3112,7 +3112,7 @@ int libxl_send_debug_keys(libxl_ctx *ctx
int ret;
ret = xc_send_debug_keys(ctx->xch, keys);
if ( ret < 0 ) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "sending debug keys");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "sending debug keys");
return ERROR_FAIL;
}
return 0;
@@ -3126,14 +3126,14 @@ libxl_xen_console_reader *
char *buf = malloc(size);
if (!buf) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "cannot malloc buffer for libxl_xen_console_reader,"
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot malloc buffer for libxl_xen_console_reader,"
" size is %u", size);
return NULL;
}
cr = malloc(sizeof(libxl_xen_console_reader));
if (!cr) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "cannot malloc libxl_xen_console_reader");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot malloc libxl_xen_console_reader");
return NULL;
}
@@ -3165,7 +3165,7 @@ int libxl_xen_console_read_line(libxl_ct
ret = xc_readconsolering(ctx->xch, &cr->buffer, &cr->count,
cr->clear, cr->incremental, &cr->index);
if (ret < 0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "reading console ring buffer");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "reading console ring buffer");
return ERROR_FAIL;
}
if (!ret) {
@@ -3200,7 +3200,7 @@ uint32_t libxl_vm_get_start_time(libxl_c
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,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, -1,
"Can't get start time of domain '%d'", domid);
ret = -1;
}else{
@@ -3218,7 +3218,7 @@ char *libxl_tmem_list(libxl_ctx *ctx, ui
rc = xc_tmem_control(ctx->xch, -1, TMEMC_LIST, domid, 32768, use_long,
0, _buf);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
"Can not get tmem list");
return NULL;
}
@@ -3233,7 +3233,7 @@ int libxl_tmem_freeze(libxl_ctx *ctx, ui
rc = xc_tmem_control(ctx->xch, -1, TMEMC_FREEZE, domid, 0, 0,
0, NULL);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
"Can not freeze tmem pools");
return ERROR_FAIL;
}
@@ -3248,7 +3248,7 @@ int libxl_tmem_destroy(libxl_ctx *ctx, u
rc = xc_tmem_control(ctx->xch, -1, TMEMC_DESTROY, domid, 0, 0,
0, NULL);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
"Can not destroy tmem pools");
return ERROR_FAIL;
}
@@ -3263,7 +3263,7 @@ int libxl_tmem_thaw(libxl_ctx *ctx, uint
rc = xc_tmem_control(ctx->xch, -1, TMEMC_THAW, domid, 0, 0,
0, NULL);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
"Can not thaw tmem pools");
return ERROR_FAIL;
}
@@ -3289,13 +3289,13 @@ int libxl_tmem_set(libxl_ctx *ctx, uint3
int32_t subop = tmem_setop_from_string(name);
if (subop == -1) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, -1,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, -1,
"Invalid set, valid sets are <weight|cap|compress>");
return ERROR_INVAL;
}
rc = xc_tmem_control(ctx->xch, -1, subop, domid, set, 0, 0, NULL);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
"Can not set tmem %s", name);
return ERROR_FAIL;
}
@@ -3310,7 +3310,7 @@ int libxl_tmem_shared_auth(libxl_ctx *ct
rc = xc_tmem_auth(ctx->xch, domid, uuid, auth);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
"Can not set tmem shared auth");
return ERROR_FAIL;
}
@@ -3324,7 +3324,7 @@ int libxl_tmem_freeable(libxl_ctx *ctx)
rc = xc_tmem_control(ctx->xch, -1, TMEMC_QUERY_FREEABLE_MB, -1, 0, 0, 0, 0);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
"Can not get tmem freeable memory");
return ERROR_FAIL;
}
diff -r a13d2fc2c1f6 -r f5372f2ac680 tools/libxl/libxl_blktap2.c
--- a/tools/libxl/libxl_blktap2.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_blktap2.c Tue Sep 07 11:04:50 2010 +0100
@@ -18,13 +18,13 @@
#include "tap-ctl.h"
-int libxl_blktap_enabled(libxl_gc *gc)
+int libxl__blktap_enabled(libxl_gc *gc)
{
const char *msg;
return !tap_ctl_check(&msg);
}
-const char *libxl_blktap_devpath(libxl_gc *gc,
+const char *libxl__blktap_devpath(libxl_gc *gc,
const char *disk,
libxl_disk_phystype phystype)
{
@@ -32,7 +32,7 @@ const char *libxl_blktap_devpath(libxl_g
char *params, *devname = NULL;
int minor, err;
- type = device_disk_string_of_phystype(phystype);
+ type = libxl__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);
diff -r a13d2fc2c1f6 -r f5372f2ac680 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_device.c Tue Sep 07 11:04:50 2010 +0100
@@ -96,7 +96,7 @@ retry_transaction:
if (errno == EAGAIN)
goto retry_transaction;
else
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs transaction failed");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xs transaction failed");
}
rc = 0;
out:
@@ -104,7 +104,7 @@ out:
return rc;
}
-char *device_disk_string_of_phystype(libxl_disk_phystype phystype)
+char *libxl__device_disk_string_of_phystype(libxl_disk_phystype phystype)
{
switch (phystype) {
case PHYSTYPE_QCOW: return "qcow";
@@ -117,7 +117,7 @@ char *device_disk_string_of_phystype(lib
}
}
-char *device_disk_backend_type_of_phystype(libxl_disk_phystype phystype)
+char *libxl__device_disk_backend_type_of_phystype(libxl_disk_phystype phystype)
{
switch (phystype) {
case PHYSTYPE_QCOW: return "tap";
@@ -130,7 +130,7 @@ char *device_disk_backend_type_of_physty
}
}
-int device_physdisk_major_minor(const char *physpath, int *major, int *minor)
+int libxl__device_physdisk_major_minor(const char *physpath, int *major, int *minor)
{
struct stat buf;
if (stat(physpath, &buf) < 0)
@@ -188,7 +188,7 @@ static int device_virtdisk_matches(const
return 1;
}
-int device_disk_dev_number(char *virtpath)
+int libxl__device_disk_dev_number(char *virtpath)
{
int disk, partition;
char *ep;
@@ -281,7 +281,7 @@ static int wait_for_dev_destroy(libxl_ct
if (!state || atoi(state) == 6) {
xs_unwatch(ctx->xsh, l1[0], l1[1]);
xs_rm(ctx->xsh, XBT_NULL, l1[XS_WATCH_TOKEN]);
- XL_LOG(ctx, XL_LOG_DEBUG, "Destroyed device backend at %s", l1[XS_WATCH_TOKEN]);
+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Destroyed device backend at %s", l1[XS_WATCH_TOKEN]);
rc = 0;
}
free(l1);
@@ -304,7 +304,7 @@ int libxl__devices_destroy(libxl_ctx *ct
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);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "%s is empty", path);
goto out;
}
for (i = 0; i < num1; i++) {
@@ -445,7 +445,7 @@ again:
}
xs_unwatch(xsh, path, path);
xs_daemon_close(xsh);
- XL_LOG(ctx, XL_LOG_ERROR, "Device Model not ready");
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model not ready");
libxl__free_all(&gc);
return -1;
}
@@ -463,10 +463,10 @@ int libxl__wait_for_backend(libxl_ctx *c
p = xs_read(ctx->xsh, XBT_NULL, path, &len);
if (p == NULL) {
if (errno == ENOENT) {
- XL_LOG(ctx, XL_LOG_ERROR, "Backend %s does not exist",
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Backend %s does not exist",
be_path);
} else {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Failed to access backend %s",
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Failed to access backend %s",
be_path);
}
goto out;
@@ -480,7 +480,7 @@ int libxl__wait_for_backend(libxl_ctx *c
}
}
}
- XL_LOG(ctx, XL_LOG_ERROR, "Backend %s not ready", be_path);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Backend %s not ready", be_path);
out:
libxl__free_all(&gc);
return rc;
diff -r a13d2fc2c1f6 -r f5372f2ac680 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_dom.c Tue Sep 07 11:04:50 2010 +0100
@@ -31,7 +31,7 @@
#include "libxl.h"
#include "libxl_internal.h"
-int is_hvm(libxl_ctx *ctx, uint32_t domid)
+int libxl__domain_is_hvm(libxl_ctx *ctx, uint32_t domid)
{
xc_domaininfo_t info;
int ret;
@@ -44,7 +44,7 @@ int is_hvm(libxl_ctx *ctx, uint32_t domi
return !!(info.flags & XEN_DOMINF_hvm_guest);
}
-int get_shutdown_reason(libxl_ctx *ctx, uint32_t domid)
+int libxl__domain_shutdown_reason(libxl_ctx *ctx, uint32_t domid)
{
xc_domaininfo_t info;
int ret;
@@ -56,10 +56,11 @@ int get_shutdown_reason(libxl_ctx *ctx,
return -1;
if (!(info.flags & XEN_DOMINF_shutdown))
return -1;
- return dominfo_get_shutdown_reason(&info);
+
+ return (info.flags >> XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask;
}
-int build_pre(libxl_ctx *ctx, uint32_t domid,
+int libxl__build_pre(libxl_ctx *ctx, uint32_t domid,
libxl_domain_build_info *info, libxl_domain_build_state *state)
{
xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
@@ -82,7 +83,7 @@ int build_pre(libxl_ctx *ctx, uint32_t d
return 0;
}
-int build_post(libxl_ctx *ctx, uint32_t domid,
+int libxl__build_post(libxl_ctx *ctx, uint32_t domid,
libxl_domain_build_info *info, libxl_domain_build_state *state,
char **vms_ents, char **local_ents)
{
@@ -136,7 +137,7 @@ retry_transaction:
return 0;
}
-int build_pv(libxl_ctx *ctx, uint32_t domid,
+int libxl__build_pv(libxl_ctx *ctx, uint32_t domid,
libxl_domain_build_info *info, libxl_domain_build_state *state)
{
struct xc_dom_image *dom;
@@ -147,18 +148,18 @@ int build_pv(libxl_ctx *ctx, uint32_t do
dom = xc_dom_allocate(ctx->xch, info->u.pv.cmdline, info->u.pv.features);
if (!dom) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_allocate failed");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_allocate failed");
return ERROR_FAIL;
}
if (info->kernel.mapped) {
if ( (ret = xc_dom_kernel_mem(dom, info->kernel.data, info->kernel.size)) != 0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_kernel_mem failed");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_kernel_mem failed");
goto out;
}
} else {
if ( (ret = xc_dom_kernel_file(dom, info->kernel.path)) != 0) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_kernel_file failed");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_kernel_file failed");
goto out;
}
}
@@ -166,12 +167,12 @@ int build_pv(libxl_ctx *ctx, uint32_t do
if ( info->u.pv.ramdisk.path && strlen(info->u.pv.ramdisk.path) ) {
if (info->u.pv.ramdisk.mapped) {
if ( (ret = xc_dom_ramdisk_mem(dom, info->u.pv.ramdisk.data, info->u.pv.ramdisk.size)) != 0 ) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_ramdisk_mem failed");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_ramdisk_mem failed");
goto out;
}
} else {
if ( (ret = xc_dom_ramdisk_file(dom, info->u.pv.ramdisk.path)) != 0 ) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_ramdisk_file failed");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_ramdisk_file failed");
goto out;
}
}
@@ -182,27 +183,27 @@ int build_pv(libxl_ctx *ctx, uint32_t do
dom->xenstore_evtchn = state->store_port;
if ( (ret = xc_dom_boot_xen_init(dom, ctx->xch, domid)) != 0 ) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_boot_xen_init failed");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_boot_xen_init failed");
goto out;
}
if ( (ret = xc_dom_parse_image(dom)) != 0 ) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_parse_image failed");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_parse_image failed");
goto out;
}
if ( (ret = xc_dom_mem_init(dom, info->target_memkb / 1024)) != 0 ) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_mem_init failed");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_mem_init failed");
goto out;
}
if ( (ret = xc_dom_boot_mem_init(dom)) != 0 ) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_boot_mem_init failed");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_boot_mem_init failed");
goto out;
}
if ( (ret = xc_dom_build_image(dom)) != 0 ) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_build_image failed");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_build_image failed");
goto out;
}
if ( (ret = xc_dom_boot_image(dom)) != 0 ) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_boot_image failed");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_boot_image failed");
goto out;
}
@@ -215,14 +216,14 @@ out:
return ret == 0 ? 0 : ERROR_FAIL;
}
-int build_hvm(libxl_ctx *ctx, uint32_t domid,
+int libxl__build_hvm(libxl_ctx *ctx, uint32_t domid,
libxl_domain_build_info *info, libxl_domain_build_state *state)
{
libxl_gc gc = LIBXL_INIT_GC(ctx);
int ret, rc = ERROR_INVAL;
if (info->kernel.mapped) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "build_hvm kernel cannot be mmapped");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "libxl__build_hvm kernel cannot be mmapped");
goto out;
}
@@ -235,13 +236,13 @@ int build_hvm(libxl_ctx *ctx, uint32_t d
libxl__abs_path(&gc, (char *)info->kernel.path,
libxl_xenfirmwaredir_path()));
if (ret) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "hvm building failed");
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "hvm building failed");
goto out;
}
ret = hvm_build_set_params(ctx->xch, domid, info, state->store_port,
&state->store_mfn, state->console_port, &state->console_mfn);
if (ret) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "hvm build set params failed");
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "hvm build set params failed");
goto out;
}
rc = 0;
@@ -250,7 +251,7 @@ out:
return 0;
}
-int restore_common(libxl_ctx *ctx, uint32_t domid,
+int libxl__domain_restore_common(libxl_ctx *ctx, uint32_t domid,
libxl_domain_build_info *info, libxl_domain_build_state *state,
int fd)
{
@@ -261,7 +262,7 @@ int restore_common(libxl_ctx *ctx, uint3
state->console_port, &state->console_mfn,
info->hvm, info->u.hvm.pae, 0);
if ( rc ) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "restoring domain");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "restoring domain");
return ERROR_FAIL;
}
return 0;
@@ -276,7 +277,7 @@ struct suspendinfo {
unsigned int flags;
};
-static void core_suspend_switch_qemu_logdirty(int domid, unsigned int enable)
+static void libxl__domain_suspend_common_switch_qemu_logdirty(int domid, unsigned int enable)
{
struct xs_handle *xsh;
char path[64];
@@ -293,7 +294,7 @@ static void core_suspend_switch_qemu_log
xs_daemon_close(xsh);
}
-static int core_suspend_callback(void *data)
+static int libxl__domain_suspend_common_callback(void *data)
{
struct suspendinfo *si = data;
unsigned long s_state = 0;
@@ -307,12 +308,12 @@ static int core_suspend_callback(void *d
if ((s_state == 0) && (si->suspend_eventchn >= 0)) {
ret = xc_evtchn_notify(si->xce, si->suspend_eventchn);
if (ret < 0) {
- XL_LOG(ctx, XL_LOG_ERROR, "xc_evtchn_notify failed ret=%d", ret);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "xc_evtchn_notify failed ret=%d", ret);
return 0;
}
ret = xc_await_suspend(ctx->xch, si->xce, si->suspend_eventchn);
if (ret < 0) {
- XL_LOG(ctx, XL_LOG_ERROR, "xc_await_suspend failed ret=%d", ret);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "xc_await_suspend failed ret=%d", ret);
return 0;
}
return 1;
@@ -324,11 +325,11 @@ static int core_suspend_callback(void *d
xc_get_hvm_param(ctx->xch, si->domid, HVM_PARAM_CALLBACK_IRQ, &hvm_pvdrv);
xc_get_hvm_param(ctx->xch, si->domid, HVM_PARAM_ACPI_S_STATE, &hvm_s_state);
if (!hvm_pvdrv || hvm_s_state) {
- XL_LOG(ctx, XL_LOG_DEBUG, "Calling xc_domain_shutdown on the domain");
+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Calling xc_domain_shutdown on the domain");
xc_domain_shutdown(ctx->xch, si->domid, SHUTDOWN_suspend);
}
}
- XL_LOG(ctx, XL_LOG_DEBUG, "wait for the guest to suspend");
+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "wait for the guest to suspend");
while (!strcmp(state, "suspend") && watchdog > 0) {
xc_domaininfo_t info;
@@ -345,13 +346,13 @@ static int core_suspend_callback(void *d
watchdog--;
}
if (!strcmp(state, "suspend")) {
- XL_LOG(ctx, XL_LOG_ERROR, "guest didn't suspend in time");
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "guest didn't suspend in time");
libxl__xs_write(si->gc, XBT_NULL, path, "");
}
return 1;
}
-int core_suspend(libxl_ctx *ctx, uint32_t domid, int fd,
+int libxl__domain_suspend_common(libxl_ctx *ctx, uint32_t domid, int fd,
int hvm, int live, int debug)
{
libxl_gc gc = LIBXL_INIT_GC(ctx);
@@ -382,17 +383,17 @@ int core_suspend(libxl_ctx *ctx, uint32_
si.suspend_eventchn = xc_suspend_evtchn_init(ctx->xch, si.xce, si.domid, port);
if (si.suspend_eventchn < 0)
- XL_LOG(ctx, XL_LOG_WARNING, "Suspend event channel initialization failed");
+ LIBXL__LOG(ctx, LIBXL__LOG_WARNING, "Suspend event channel initialization failed");
}
}
memset(&callbacks, 0, sizeof(callbacks));
- callbacks.suspend = core_suspend_callback;
+ callbacks.suspend = libxl__domain_suspend_common_callback;
callbacks.data = &si;
xc_domain_save(ctx->xch, fd, domid, 0, 0, flags,
&callbacks, hvm,
- &core_suspend_switch_qemu_logdirty);
+ &libxl__domain_suspend_common_switch_qemu_logdirty);
if (si.suspend_eventchn > 0)
xc_suspend_evtchn_release(ctx->xch, si.xce, domid, si.suspend_eventchn);
@@ -404,14 +405,14 @@ out:
return rc;
}
-int save_device_model(libxl_ctx *ctx, uint32_t domid, int fd)
+int libxl__domain_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);
- XL_LOG(ctx, XL_LOG_DEBUG, "Saving device model state to %s", filename);
+ LIBXL__LOG(ctx, LIBXL__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);
@@ -444,7 +445,7 @@ char *libxl__uuid2string(libxl_gc *gc, c
{
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");
+ LIBXL__LOG(libxl_gc_owner(gc), LIBXL__LOG_ERROR, "cannot allocate for uuid");
return s;
}
@@ -459,7 +460,7 @@ static const char *userdata_path(libxl_g
rc = libxl_domain_info(ctx, &info, domid);
if (rc) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unable to find domain info"
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unable to find domain info"
" for domain %"PRIu32, domid);
return NULL;
}
@@ -469,7 +470,7 @@ static const char *userdata_path(libxl_g
"userdata-%s.%s.%s",
wh, uuid_string, userdata_userid);
if (!path)
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unable to allocate for"
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unable to allocate for"
" userdata path");
return path;
}
@@ -478,7 +479,7 @@ static int userdata_delete(libxl_ctx *ct
int r;
r = unlink(path);
if (r) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "remove failed for %s", path);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "remove failed for %s", path);
return errno;
}
return 0;
@@ -502,7 +503,7 @@ void libxl__userdata_destroyall(libxl_ct
if (r == GLOB_NOMATCH)
goto out;
if (r)
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "glob failed for %s", pattern);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "glob failed for %s", pattern);
for (i=0; i<gl.gl_pathc; i++) {
userdata_delete(ctx, gl.gl_pathv[i]);
@@ -574,7 +575,7 @@ err:
errno = e;
if ( rc )
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "cannot write %s for %s",
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot write %s for %s",
newfilename, filename);
out:
libxl__free_all(&gc);
@@ -600,7 +601,7 @@ int libxl_userdata_retrieve(libxl_ctx *c
e = libxl_read_file_contents(ctx, filename, data_r ? &data : 0, &datalen);
if (!e && !datalen) {
- XL_LOG(ctx, XL_LOG_ERROR, "userdata file %s is empty", filename);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "userdata file %s is empty", filename);
if (data_r) assert(!*data_r);
rc = ERROR_FAIL;
goto out;
diff -r a13d2fc2c1f6 -r f5372f2ac680 tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_exec.c Tue Sep 07 11:04:50 2010 +0100
@@ -65,25 +65,25 @@ void libxl_report_child_exitstatus(libxl
if (WIFEXITED(status)) {
int st = WEXITSTATUS(status);
if (st)
- XL_LOG(ctx, level, "%s [%ld] exited"
+ LIBXL__LOG(ctx, level, "%s [%ld] exited"
" with error status %d", what, (unsigned long)pid, st);
else
- XL_LOG(ctx, level, "%s [%ld] unexpectedly"
+ LIBXL__LOG(ctx, level, "%s [%ld] unexpectedly"
" exited status zero", what, (unsigned long)pid);
} else if (WIFSIGNALED(status)) {
int sig = WTERMSIG(status);
const char *str = strsignal(sig);
const char *coredump = WCOREDUMP(status) ? " (core dumped)" : "";
if (str)
- XL_LOG(ctx, level, "%s [%ld] died due to"
+ LIBXL__LOG(ctx, level, "%s [%ld] died due to"
" fatal signal %s%s", what, (unsigned long)pid,
str, coredump);
else
- XL_LOG(ctx, level, "%s [%ld] died due to unknown"
+ LIBXL__LOG(ctx, level, "%s [%ld] died due to unknown"
" fatal signal number %d%s", what, (unsigned long)pid,
sig, coredump);
} else {
- XL_LOG(ctx, level, "%s [%ld] gave unknown"
+ LIBXL__LOG(ctx, level, "%s [%ld] gave unknown"
" wait status 0x%x", what, (unsigned long)pid, status);
}
}
@@ -146,7 +146,7 @@ static void report_spawn_intermediate_st
"%s intermediate process (startup monitor)",
for_spawn->what) < 0 )
intermediate_what = "intermediate process (startup monitor)";
- libxl_report_child_exitstatus(ctx, XL_LOG_ERROR, intermediate_what,
+ libxl_report_child_exitstatus(ctx, LIBXL__LOG_ERROR, intermediate_what,
for_spawn->intermediate, status);
}
}
@@ -163,7 +163,7 @@ int libxl__spawn_detach(libxl_ctx *ctx,
if (for_spawn->intermediate) {
r = kill(for_spawn->intermediate, SIGKILL);
if (r) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
"could not kill %s intermediate process [%ld]",
for_spawn->what,
(unsigned long)for_spawn->intermediate);
diff -r a13d2fc2c1f6 -r f5372f2ac680 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_internal.c Tue Sep 07 11:04:50 2010 +0100
@@ -147,7 +147,7 @@ char *libxl__dirname(libxl_gc *gc, const
return ptr;
}
-void xl_logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
+void libxl__logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
const char *file, int line, const char *func,
char *fmt, va_list ap)
{
@@ -174,13 +174,13 @@ void xl_logv(libxl_ctx *ctx, xentoollog_
errno = esave;
}
-void xl_log(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
+void libxl__log(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
const char *file, int line, const char *func,
char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
- xl_logv(ctx, msglevel, errnoval, file, line, func, fmt, ap);
+ libxl__logv(ctx, msglevel, errnoval, file, line, func, fmt, ap);
va_end(ap);
}
diff -r a13d2fc2c1f6 -r f5372f2ac680 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_internal.h Tue Sep 07 11:04:50 2010 +0100
@@ -45,27 +45,27 @@
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#define XL_LOGGING_ENABLED
+#define LIBXL__LOGGING_ENABLED
-#ifdef XL_LOGGING_ENABLED
-#define XL_LOG(ctx, loglevel, _f, _a...) xl_log(ctx, loglevel, -1, __FILE__, __LINE__, __func__, _f, ##_a)
-#define XL_LOG_ERRNO(ctx, loglevel, _f, _a...) xl_log(ctx, loglevel, errno, __FILE__, __LINE__, __func__, _f, ##_a)
-#define XL_LOG_ERRNOVAL(ctx, loglevel, errnoval, _f, _a...) xl_log(ctx, loglevel, errnoval, __FILE__, __LINE__, __func__, _f, ##_a)
+#ifdef LIBXL__LOGGING_ENABLED
+#define LIBXL__LOG(ctx, loglevel, _f, _a...) libxl__log(ctx, loglevel, -1, __FILE__, __LINE__, __func__, _f, ##_a)
+#define LIBXL__LOG_ERRNO(ctx, loglevel, _f, _a...) libxl__log(ctx, loglevel, errno, __FILE__, __LINE__, __func__, _f, ##_a)
+#define LIBXL__LOG_ERRNOVAL(ctx, loglevel, errnoval, _f, _a...) libxl__log(ctx, loglevel, errnoval, __FILE__, __LINE__, __func__, _f, ##_a)
#else
-#define XL_LOG(ctx, loglevel, _f, _a...)
-#define XL_LOG_ERRNO(ctx, loglevel, _f, _a...)
-#define XL_LOG_ERRNOVAL(ctx, loglevel, errnoval, _f, _a...)
+#define LIBXL__LOG(ctx, loglevel, _f, _a...)
+#define LIBXL__LOG_ERRNO(ctx, loglevel, _f, _a...)
+#define LIBXL__LOG_ERRNOVAL(ctx, loglevel, errnoval, _f, _a...)
#endif
/* all of these macros preserve errno (saving and restoring) */
/* logging */
-_hidden void xl_logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
+_hidden void libxl__logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
const char *file /* may be 0 */, int line /* ignored if !file */,
const char *func /* may be 0 */,
char *fmt, va_list al)
__attribute__((format(printf,7,0)));
-_hidden void xl_log(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
+_hidden void libxl__log(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
const char *file /* may be 0 */, int line /* ignored if !file */,
const char *func /* may be 0 */,
char *fmt, ...)
@@ -140,33 +140,32 @@ _hidden char **libxl__xs_directory(libxl
_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);
-_hidden int get_shutdown_reason(libxl_ctx *ctx, uint32_t domid);
-#define dominfo_get_shutdown_reason(info) (((info)->flags >> XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask)
+_hidden int libxl__domain_is_hvm(libxl_ctx *ctx, uint32_t domid);
+_hidden int libxl__domain_shutdown_reason(libxl_ctx *ctx, uint32_t domid);
-_hidden int build_pre(libxl_ctx *ctx, uint32_t domid,
+_hidden int libxl__build_pre(libxl_ctx *ctx, uint32_t domid,
libxl_domain_build_info *info, libxl_domain_build_state *state);
-_hidden int build_post(libxl_ctx *ctx, uint32_t domid,
+_hidden int libxl__build_post(libxl_ctx *ctx, uint32_t domid,
libxl_domain_build_info *info, libxl_domain_build_state *state,
char **vms_ents, char **local_ents);
-_hidden int build_pv(libxl_ctx *ctx, uint32_t domid,
+_hidden int libxl__build_pv(libxl_ctx *ctx, uint32_t domid,
libxl_domain_build_info *info, libxl_domain_build_state *state);
-_hidden int build_hvm(libxl_ctx *ctx, uint32_t domid,
+_hidden int libxl__build_hvm(libxl_ctx *ctx, uint32_t domid,
libxl_domain_build_info *info, libxl_domain_build_state *state);
-_hidden int restore_common(libxl_ctx *ctx, uint32_t domid,
+_hidden int libxl__domain_restore_common(libxl_ctx *ctx, uint32_t domid,
libxl_domain_build_info *info, libxl_domain_build_state *state, int fd);
-_hidden int core_suspend(libxl_ctx *ctx, uint32_t domid, int fd, int hvm, int live, int debug);
-_hidden int save_device_model(libxl_ctx *ctx, uint32_t domid, int fd);
+_hidden int libxl__domain_suspend_common(libxl_ctx *ctx, uint32_t domid, int fd, int hvm, int live, int debug);
+_hidden int libxl__domain_save_device_model(libxl_ctx *ctx, uint32_t domid, int fd);
_hidden void libxl__userdata_destroyall(libxl_ctx *ctx, uint32_t domid);
/* from xl_device */
-_hidden char *device_disk_backend_type_of_phystype(libxl_disk_phystype phystype);
-_hidden char *device_disk_string_of_phystype(libxl_disk_phystype phystype);
+_hidden char *libxl__device_disk_backend_type_of_phystype(libxl_disk_phystype phystype);
+_hidden char *libxl__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_physdisk_major_minor(const char *physpath, int *major, int *minor);
+_hidden int libxl__device_disk_dev_number(char *virtpath);
_hidden int libxl__device_generic_add(libxl_ctx *ctx, libxl_device *device,
char **bents, char **fents);
@@ -234,10 +233,10 @@ _hidden void libxl__log_child_exitstatus
_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
+#define LIBXL__LOG_DEBUG XTL_DEBUG
+#define LIBXL__LOG_INFO XTL_INFO
+#define LIBXL__LOG_WARNING XTL_WARN
+#define LIBXL__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);
@@ -246,18 +245,18 @@ _hidden char *libxl__poolid_to_name(libx
* blktap2 support
*/
-/* libxl_blktap_enabled:
+/* libxl__blktap_enabled:
* return true if blktap/blktap2 support is available.
*/
-int libxl_blktap_enabled(libxl_gc *gc);
+_hidden int libxl__blktap_enabled(libxl_gc *gc);
-/* libxl_blktap_devpath:
+/* libxl__blktap_devpath:
* Argument: path and disk image as specified in config file.
* The type specifies whether this is aio, qcow, qcow2, etc.
* returns device path xenstore wants to have. returns NULL
* if no device corresponds to the disk.
*/
-const char *libxl_blktap_devpath(libxl_gc *gc,
+_hidden const char *libxl__blktap_devpath(libxl_gc *gc,
const char *disk,
libxl_disk_phystype phystype);
diff -r a13d2fc2c1f6 -r f5372f2ac680 tools/libxl/libxl_noblktap2.c
--- a/tools/libxl/libxl_noblktap2.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_noblktap2.c Tue Sep 07 11:04:50 2010 +0100
@@ -16,12 +16,12 @@
#include "libxl_osdeps.h"
#include "libxl_internal.h"
-int libxl_blktap_enabled(libxl_gc *gc)
+int libxl__blktap_enabled(libxl_gc *gc)
{
return 0;
}
-const char *libxl_blktap_devpath(libxl_gc *gc,
+const char *libxl__blktap_devpath(libxl_gc *gc,
const char *disk,
libxl_disk_phystype phystype)
{
diff -r a13d2fc2c1f6 -r f5372f2ac680 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_pci.c Tue Sep 07 11:04:50 2010 +0100
@@ -173,7 +173,7 @@ int libxl_device_pci_parse_bdf(libxl_ctx
}else if ( !strcmp(optkey, "power_mgmt") ) {
pcidev->power_mgmt = atoi(tok);
}else{
- XL_LOG(ctx, XL_LOG_WARNING,
+ LIBXL__LOG(ctx, LIBXL__LOG_WARNING,
"Unknown PCI BDF option: %s", optkey);
}
tok = ptr + 1;
@@ -213,7 +213,7 @@ static int libxl_create_pci_backend(libx
if (!back)
return ERROR_NOMEM;
- XL_LOG(ctx, XL_LOG_DEBUG, "Creating pci backend");
+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Creating pci backend");
/* add pci device */
device.backend_devid = 0;
@@ -276,7 +276,7 @@ static int libxl_device_pci_add_xenstore
if (!num_devs)
return libxl_create_pci_backend(gc, domid, pcidev, 1);
- if (!is_hvm(ctx, domid)) {
+ if (!libxl__domain_is_hvm(ctx, domid)) {
if (libxl__wait_for_backend(ctx, be_path, "4") < 0)
return ERROR_FAIL;
}
@@ -285,7 +285,7 @@ static int libxl_device_pci_add_xenstore
if (!back)
return ERROR_NOMEM;
- XL_LOG(ctx, XL_LOG_DEBUG, "Adding new pci device to xenstore");
+ LIBXL__LOG(ctx, LIBXL__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));
@@ -331,9 +331,9 @@ static int libxl_device_pci_remove_xenst
return ERROR_INVAL;
num = atoi(num_devs);
- if (!is_hvm(ctx, domid)) {
+ if (!libxl__domain_is_hvm(ctx, domid)) {
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);
+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "pci backend at %s is not ready", be_path);
return ERROR_FAIL;
}
}
@@ -347,7 +347,7 @@ static int libxl_device_pci_remove_xenst
}
}
if (i == num) {
- XL_LOG(ctx, XL_LOG_ERROR, "Couldn't find the device on xenstore");
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Couldn't find the device on xenstore");
return ERROR_INVAL;
}
@@ -359,9 +359,9 @@ retry_transaction:
if (errno == EAGAIN)
goto retry_transaction;
- if (!is_hvm(ctx, domid)) {
+ if (!libxl__domain_is_hvm(ctx, domid)) {
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);
+ LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "pci backend at %s is not ready", be_path);
return ERROR_FAIL;
}
}
@@ -506,9 +506,9 @@ int libxl_device_pci_list_assignable(lib
dir = opendir(SYSFS_PCIBACK_DRIVER);
if ( NULL == dir ) {
if ( errno == ENOENT ) {
- XL_LOG(ctx, XL_LOG_ERROR, "Looks like pciback driver not loaded");
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Looks like pciback driver not loaded");
}else{
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", SYSFS_PCIBACK_DRIVER);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s", SYSFS_PCIBACK_DRIVER);
}
libxl__free_all(&gc);
return ERROR_FAIL;
@@ -555,7 +555,7 @@ static int pci_multifunction_check(libxl
dir = opendir(SYSFS_PCI_DEV);
if ( NULL == dir ) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", SYSFS_PCI_DEV);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s", SYSFS_PCI_DEV);
return -1;
}
@@ -576,10 +576,10 @@ static int pci_multifunction_check(libxl
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",
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, PCI_BDF " is not assigned to pciback driver",
dom, bus, dev, func);
else
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't lstat %s", path);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't lstat %s", path);
closedir(dir);
return -1;
}
@@ -611,7 +611,7 @@ static int do_pci_add(libxl_gc *gc, uint
char *state, *vdevfn;
int rc, hvm;
- hvm = is_hvm(ctx, domid);
+ hvm = libxl__domain_is_hvm(ctx, domid);
if (hvm) {
if (libxl__wait_for_device_model(ctx, domid, "running", NULL, NULL) < 0) {
return ERROR_FAIL;
@@ -632,7 +632,7 @@ static int do_pci_add(libxl_gc *gc, uint
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);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "qemu refused to add device: %s", vdevfn);
else if ( sscanf(vdevfn, "0x%x", &pcidev->vdevfn) != 1 )
rc = -1;
xs_write(ctx->xsh, XBT_NULL, path, state, strlen(state));
@@ -647,7 +647,7 @@ static int do_pci_add(libxl_gc *gc, uint
int i;
if (f == NULL) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", sysfs_path);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s", sysfs_path);
return ERROR_FAIL;
}
for (i = 0; i < PROC_PCI_NUM_RESOURCES; i++) {
@@ -658,7 +658,7 @@ static int do_pci_add(libxl_gc *gc, uint
if (flags & PCI_BAR_IO) {
rc = xc_domain_ioport_permission(ctx->xch, domid, start, size, 1);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "Error: xc_domain_ioport_permission error 0x%llx/0x%llx", start, size);
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "Error: xc_domain_ioport_permission error 0x%llx/0x%llx", start, size);
fclose(f);
return ERROR_FAIL;
}
@@ -666,7 +666,7 @@ static int do_pci_add(libxl_gc *gc, uint
rc = xc_domain_iomem_permission(ctx->xch, domid, start>>XC_PAGE_SHIFT,
(size+(XC_PAGE_SIZE-1))>>XC_PAGE_SHIFT, 1);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "Error: xc_domain_iomem_permission error 0x%llx/0x%llx", start, size);
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "Error: xc_domain_iomem_permission error 0x%llx/0x%llx", start, size);
fclose(f);
return ERROR_FAIL;
}
@@ -678,19 +678,19 @@ static int do_pci_add(libxl_gc *gc, uint
pcidev->bus, pcidev->dev, pcidev->func);
f = fopen(sysfs_path, "r");
if (f == NULL) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", sysfs_path);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s", sysfs_path);
goto out;
}
if ((fscanf(f, "%u", &irq) == 1) && irq) {
rc = xc_physdev_map_pirq(ctx->xch, domid, irq, &irq);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "Error: xc_physdev_map_pirq irq=%d", irq);
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "Error: xc_physdev_map_pirq irq=%d", irq);
fclose(f);
return ERROR_FAIL;
}
rc = xc_domain_irq_permission(ctx->xch, domid, irq, 1);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "Error: xc_domain_irq_permission irq=%d", irq);
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "Error: xc_domain_irq_permission irq=%d", irq);
fclose(f);
return ERROR_FAIL;
}
@@ -701,7 +701,7 @@ out:
if (!libxl_is_stubdom(ctx, domid, NULL)) {
rc = xc_assign_device(ctx->xch, domid, pcidev->value);
if (rc < 0 && (hvm || errno != ENOSYS)) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_assign_device failed");
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_assign_device failed");
return ERROR_FAIL;
}
}
@@ -723,25 +723,25 @@ static int libxl_device_pci_reset(libxl_
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);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "write to %s returned %d", reset, rc);
close(fd);
return rc < 0 ? rc : 0;
}
if (errno != ENOENT)
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Failed to access pciback path %s", reset);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Failed to access pciback path %s", reset);
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);
if (rc < 0)
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "write to %s returned %d", reset, rc);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "write to %s returned %d", reset, rc);
close(fd);
return rc < 0 ? rc : 0;
}
if (errno == ENOENT) {
- XL_LOG(ctx, XL_LOG_ERROR, "The kernel doesn't support PCI device reset from sysfs");
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "The kernel doesn't support PCI device reset from sysfs");
} else {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Failed to access reset path %s", reset);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Failed to access reset path %s", reset);
}
return -1;
}
@@ -756,12 +756,12 @@ int libxl_device_pci_add(libxl_ctx *ctx,
rc = get_all_assigned_devices(&gc, &assigned, &num_assigned);
if ( rc ) {
- XL_LOG(ctx, XL_LOG_ERROR, "cannot determine if device is assigned, refusing to continue");
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot determine if device is assigned, refusing to continue");
goto out;
}
if ( is_assigned(assigned, num_assigned, pcidev->domain,
pcidev->bus, pcidev->dev, pcidev->func) ) {
- XL_LOG(ctx, XL_LOG_ERROR, "PCI device already attached to a domain");
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "PCI device already attached to a domain");
rc = ERROR_FAIL;
goto out;
}
@@ -780,7 +780,7 @@ int libxl_device_pci_add(libxl_ctx *ctx,
if ( pcidev->vfunc_mask == LIBXL_PCI_FUNC_ALL ) {
if ( !(pcidev->vdevfn >> 3) ) {
- XL_LOG(ctx, XL_LOG_ERROR, "Must specify a v-slot for multi-function devices");
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Must specify a v-slot for multi-function devices");
rc = ERROR_INVAL;
goto out;
}
@@ -828,14 +828,14 @@ static int do_pci_remove(libxl_gc *gc, u
if ( !libxl_device_pci_list_assigned(ctx, &assigned, domid, &num) ) {
if ( !is_assigned(assigned, num, pcidev->domain,
pcidev->bus, pcidev->dev, pcidev->func) ) {
- XL_LOG(ctx, XL_LOG_ERROR, "PCI device not attached to this domain");
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "PCI device not attached to this domain");
return ERROR_INVAL;
}
}
libxl_device_pci_remove_xenstore(gc, domid, pcidev);
- hvm = is_hvm(ctx, domid);
+ hvm = libxl__domain_is_hvm(ctx, domid);
if (hvm) {
if (libxl__wait_for_device_model(ctx, domid, "running", NULL, NULL) < 0) {
return ERROR_FAIL;
@@ -852,7 +852,7 @@ static int do_pci_remove(libxl_gc *gc, u
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) {
- XL_LOG(ctx, XL_LOG_ERROR, "Device Model didn't respond in time");
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model didn't respond in time");
return ERROR_FAIL;
}
}
@@ -867,7 +867,7 @@ static int do_pci_remove(libxl_gc *gc, u
int i;
if (f == NULL) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", sysfs_path);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s", sysfs_path);
goto skip1;
}
for (i = 0; i < PROC_PCI_NUM_RESOURCES; i++) {
@@ -878,12 +878,12 @@ static int do_pci_remove(libxl_gc *gc, u
if (flags & PCI_BAR_IO) {
rc = xc_domain_ioport_permission(ctx->xch, domid, start, size, 0);
if (rc < 0)
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_ioport_permission error 0x%x/0x%x", start, size);
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_ioport_permission error 0x%x/0x%x", start, size);
} else {
rc = xc_domain_iomem_permission(ctx->xch, domid, start>>XC_PAGE_SHIFT,
(size+(XC_PAGE_SIZE-1))>>XC_PAGE_SHIFT, 0);
if (rc < 0)
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_iomem_permission error 0x%x/0x%x", start, size);
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_iomem_permission error 0x%x/0x%x", start, size);
}
}
}
@@ -893,17 +893,17 @@ skip1:
pcidev->bus, pcidev->dev, pcidev->func);
f = fopen(sysfs_path, "r");
if (f == NULL) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", sysfs_path);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s", sysfs_path);
goto out;
}
if ((fscanf(f, "%u", &irq) == 1) && irq) {
rc = xc_physdev_unmap_pirq(ctx->xch, domid, irq);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_physdev_map_pirq irq=%d", irq);
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_physdev_map_pirq irq=%d", irq);
}
rc = xc_domain_irq_permission(ctx->xch, domid, irq, 0);
if (rc < 0) {
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_irq_permission irq=%d", irq);
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_irq_permission irq=%d", irq);
}
}
fclose(f);
@@ -917,7 +917,7 @@ out:
if (!libxl_is_stubdom(ctx, domid, NULL)) {
rc = xc_deassign_device(ctx->xch, domid, pcidev->value);
if (rc < 0 && (hvm || errno != ENOSYS))
- XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_deassign_device failed");
+ LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_deassign_device failed");
}
stubdomid = libxl_get_stubdom_id(ctx, domid);
diff -r a13d2fc2c1f6 -r f5372f2ac680 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_utils.c Tue Sep 07 11:04:50 2010 +0100
@@ -184,7 +184,7 @@ static int logrename(libxl_ctx *ctx, con
if (r) {
if (errno == ENOENT) return 0; /* ok */
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to rotate logfile - could not"
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to rotate logfile - could not"
" rename %s to %s", old, new);
return ERROR_FAIL;
}
@@ -218,7 +218,7 @@ int libxl_create_logfile(libxl_ctx *ctx,
goto out;
} else {
if (errno != ENOENT)
- XL_LOG_ERRNO(ctx, XL_LOG_WARNING, "problem checking existence of"
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_WARNING, "problem checking existence of"
" logfile %s, which might have needed to be rotated",
name);
}
@@ -271,23 +271,23 @@ int libxl_read_file_contents(libxl_ctx *
f = fopen(filename, "r");
if (!f) {
if (errno == ENOENT) return ENOENT;
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to open %s", filename);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to open %s", filename);
goto xe;
}
if (fstat(fileno(f), &stab)) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to fstat %s", filename);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to fstat %s", filename);
goto xe;
}
if (!S_ISREG(stab.st_mode)) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "%s is not a plain file", filename);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "%s is not a plain file", filename);
errno = ENOTTY;
goto xe;
}
if (stab.st_size > INT_MAX) {
- XL_LOG(ctx, XL_LOG_ERROR, "file %s is far too large", filename);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "file %s is far too large", filename);
errno = EFBIG;
goto xe;
}
@@ -301,9 +301,9 @@ int libxl_read_file_contents(libxl_ctx *
rs = fread(data, 1, datalen, f);
if (rs != datalen) {
if (ferror(f))
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to read %s", filename);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to read %s", filename);
else if (feof(f))
- XL_LOG(ctx, XL_LOG_ERROR, "%s changed size while we"
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "%s changed size while we"
" were reading it", filename);
else
abort();
@@ -313,7 +313,7 @@ int libxl_read_file_contents(libxl_ctx *
if (fclose(f)) {
f = 0;
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to close %s", filename);
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to close %s", filename);
goto xe;
}
@@ -342,13 +342,13 @@ int libxl_read_file_contents(libxl_ctx *
if (got == -1) { \
if (errno == EINTR) continue; \
if (!ctx) return errno; \
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to " #rw " %s%s%s", \
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to " #rw " %s%s%s", \
what?what:"", what?" from ":"", filename); \
return errno; \
} \
if (got == 0) { \
if (!ctx) return EPROTO; \
- XL_LOG(ctx, XL_LOG_ERROR, \
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, \
zero_is_eof \
? "file/stream truncated reading %s%s%s" \
: "file/stream write returned 0! writing %s%s%s", \
@@ -378,7 +378,7 @@ pid_t libxl_fork(libxl_ctx *ctx)
pid = fork();
if (pid == -1) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "fork failed");
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "fork failed");
return -1;
}
@@ -396,7 +396,7 @@ int libxl_pipe(libxl_ctx *ctx, int pipes
int libxl_pipe(libxl_ctx *ctx, int pipes[2])
{
if (pipe(pipes) < 0) {
- XL_LOG(ctx, XL_LOG_ERROR, "Failed to create a pipe");
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to create a pipe");
return -1;
}
return 0;
diff -r a13d2fc2c1f6 -r f5372f2ac680 tools/libxl/libxl_xshelp.c
--- a/tools/libxl/libxl_xshelp.c Tue Sep 07 10:18:23 2010 +0100
+++ b/tools/libxl/libxl_xshelp.c Tue Sep 07 11:04:50 2010 +0100
@@ -125,7 +125,7 @@ char *libxl__xs_get_dompath(libxl_gc *gc
libxl_ctx *ctx = libxl_gc_owner(gc);
char *s = xs_get_domain_path(ctx->xsh, domid);
if (!s) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to get dompath for %" PRIu32,
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to get dompath for %" PRIu32,
domid);
return NULL;
}
^ permalink raw reply [flat|nested] 7+ messages in thread