debuggers.hg

changeset 22164:23112038074f

libxl: Ensure all _hidden functions use libxl__ prefix (autogenerated patch)

This patch covers all those which could be trivially converted automatically.

sed -n -e 's/_hidden.*[ \*]libxl_\([^_][^()]*\)(.*/\1/pg' tools/libxl/*.h | \
while read i ; do \
sed -i -e "s/libxl_$i/libxl__$i/g" tools/libxl/*.[ch]; \
done

sed -n -e 's/_hidden.*_libxl_\([^_][^()]*\)(.*/\1/pg' tools/libxl/*.h | \
while read i ; do \
sed -i -e "s/_libxl_$i/libxl__$i/g" tools/libxl/*.[ch]; \
done

Check that diffstat includes libxl but not xl.

Fixup tools/libxl/xl_cmdimpl.c which used libxl_device_del instead of
libxl_device_disk_del in a printf.

(Patch runes re-run by Ian Jackson to refresh against tip libxl.)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Ian Campbell <ian.campbell@citrix.com>
date Wed Sep 08 16:44:24 2010 +0100 (2010-09-08)
parents 9d6fcb72ae5f
children d6663c62524a
files tools/libxl/libxl.c tools/libxl/libxl.h tools/libxl/libxl_blktap2.c tools/libxl/libxl_bootloader.c tools/libxl/libxl_device.c tools/libxl/libxl_dom.c tools/libxl/libxl_exec.c tools/libxl/libxl_internal.c tools/libxl/libxl_internal.h tools/libxl/libxl_pci.c tools/libxl/libxl_utils.c tools/libxl/libxl_xshelp.c tools/libxl/xl_cmdimpl.c
line diff
     1.1 --- a/tools/libxl/libxl.c	Wed Sep 08 16:35:40 2010 +0100
     1.2 +++ b/tools/libxl/libxl.c	Wed Sep 08 16:44:24 2010 +0100
     1.3 @@ -119,9 +119,9 @@ int libxl_domain_make(libxl_ctx *ctx, li
     1.4      xs_transaction_t t;
     1.5      xen_domain_handle_t handle;
     1.6  
     1.7 -    uuid_string = libxl_uuid2string(&gc, info->uuid);
     1.8 +    uuid_string = libxl__uuid2string(&gc, info->uuid);
     1.9      if (!uuid_string) {
    1.10 -        libxl_free_all(&gc);
    1.11 +        libxl__free_all(&gc);
    1.12          return ERROR_NOMEM;
    1.13      }
    1.14  
    1.15 @@ -136,27 +136,27 @@ int libxl_domain_make(libxl_ctx *ctx, li
    1.16      ret = xc_domain_create(ctx->xch, info->ssidref, handle, flags, domid);
    1.17      if (ret < 0) {
    1.18          XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "domain creation fail");
    1.19 -        libxl_free_all(&gc);
    1.20 +        libxl__free_all(&gc);
    1.21          return ERROR_FAIL;
    1.22      }
    1.23  
    1.24      ret = xc_cpupool_movedomain(ctx->xch, info->poolid, *domid);
    1.25      if (ret < 0) {
    1.26          XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "domain move fail");
    1.27 -        libxl_free_all(&gc);
    1.28 +        libxl__free_all(&gc);
    1.29          return ERROR_FAIL;
    1.30      }
    1.31  
    1.32 -    dom_path = libxl_xs_get_dompath(&gc, *domid);
    1.33 +    dom_path = libxl__xs_get_dompath(&gc, *domid);
    1.34      if (!dom_path) {
    1.35 -        libxl_free_all(&gc);
    1.36 +        libxl__free_all(&gc);
    1.37          return ERROR_FAIL;
    1.38      }
    1.39  
    1.40 -    vm_path = libxl_sprintf(&gc, "/vm/%s", uuid_string);
    1.41 +    vm_path = libxl__sprintf(&gc, "/vm/%s", uuid_string);
    1.42      if (!vm_path) {
    1.43          XL_LOG(ctx, XL_LOG_ERROR, "cannot allocate create paths");
    1.44 -        libxl_free_all(&gc);
    1.45 +        libxl__free_all(&gc);
    1.46          return ERROR_FAIL;
    1.47      }
    1.48  
    1.49 @@ -177,39 +177,39 @@ retry_transaction:
    1.50      xs_mkdir(ctx->xsh, t, vm_path);
    1.51      xs_set_permissions(ctx->xsh, t, vm_path, roperm, ARRAY_SIZE(roperm));
    1.52  
    1.53 -    xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/vm", dom_path), vm_path, strlen(vm_path));
    1.54 +    xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/vm", dom_path), vm_path, strlen(vm_path));
    1.55      rc = libxl_domain_rename(ctx, *domid, 0, info->name, t);
    1.56      if (rc) {
    1.57 -        libxl_free_all(&gc);
    1.58 +        libxl__free_all(&gc);
    1.59          return rc;
    1.60      }
    1.61  
    1.62      for (i = 0; i < ARRAY_SIZE(rw_paths); i++) {
    1.63 -        char *path = libxl_sprintf(&gc, "%s/%s", dom_path, rw_paths[i]);
    1.64 +        char *path = libxl__sprintf(&gc, "%s/%s", dom_path, rw_paths[i]);
    1.65          xs_mkdir(ctx->xsh, t, path);
    1.66          xs_set_permissions(ctx->xsh, t, path, rwperm, ARRAY_SIZE(rwperm));
    1.67      }
    1.68      for (i = 0; i < ARRAY_SIZE(ro_paths); i++) {
    1.69 -        char *path = libxl_sprintf(&gc, "%s/%s", dom_path, ro_paths[i]);
    1.70 +        char *path = libxl__sprintf(&gc, "%s/%s", dom_path, ro_paths[i]);
    1.71          xs_mkdir(ctx->xsh, t, path);
    1.72          xs_set_permissions(ctx->xsh, t, path, roperm, ARRAY_SIZE(roperm));
    1.73      }
    1.74  
    1.75 -    xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
    1.76 -    xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/name", vm_path), info->name, strlen(info->name));
    1.77 +    xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
    1.78 +    xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/name", vm_path), info->name, strlen(info->name));
    1.79      if (info->poolname)
    1.80 -        xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
    1.81 -
    1.82 -    libxl_xs_writev(&gc, t, dom_path, info->xsdata);
    1.83 -    libxl_xs_writev(&gc, t, libxl_sprintf(&gc, "%s/platform", dom_path), info->platformdata);
    1.84 -
    1.85 -    xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/control/platform-feature-multiprocessor-suspend", dom_path), "1", 1);
    1.86 +        xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
    1.87 +
    1.88 +    libxl__xs_writev(&gc, t, dom_path, info->xsdata);
    1.89 +    libxl__xs_writev(&gc, t, libxl__sprintf(&gc, "%s/platform", dom_path), info->platformdata);
    1.90 +
    1.91 +    xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/control/platform-feature-multiprocessor-suspend", dom_path), "1", 1);
    1.92  
    1.93      if (!xs_transaction_end(ctx->xsh, t, 0))
    1.94          if (errno == EAGAIN)
    1.95              goto retry_transaction;
    1.96  
    1.97 -    libxl_free_all(&gc);
    1.98 +    libxl__free_all(&gc);
    1.99      return 0;
   1.100  }
   1.101  
   1.102 @@ -225,10 +225,10 @@ int libxl_domain_rename(libxl_ctx *ctx, 
   1.103      xs_transaction_t our_trans = 0;
   1.104      int rc;
   1.105  
   1.106 -    dom_path = libxl_xs_get_dompath(&gc, domid);
   1.107 +    dom_path = libxl__xs_get_dompath(&gc, domid);
   1.108      if (!dom_path) goto x_nomem;
   1.109  
   1.110 -    name_path= libxl_sprintf(&gc, "%s/name", dom_path);
   1.111 +    name_path= libxl__sprintf(&gc, "%s/name", dom_path);
   1.112      if (!name_path) goto x_nomem;
   1.113  
   1.114   retry_transaction:
   1.115 @@ -286,7 +286,7 @@ int libxl_domain_rename(libxl_ctx *ctx, 
   1.116      rc = 0;
   1.117   x_rc:
   1.118      if (our_trans) xs_transaction_end(ctx->xsh, our_trans, 1);
   1.119 -    libxl_free_all(&gc);
   1.120 +    libxl__free_all(&gc);
   1.121      return rc;
   1.122  
   1.123   x_fail:  rc = ERROR_FAIL;  goto x_rc;
   1.124 @@ -311,26 +311,26 @@ int libxl_domain_build(libxl_ctx *ctx, l
   1.125          if (ret)
   1.126              goto out;
   1.127  
   1.128 -        vments = libxl_calloc(&gc, 7, sizeof(char *));
   1.129 +        vments = libxl__calloc(&gc, 7, sizeof(char *));
   1.130          vments[0] = "rtc/timeoffset";
   1.131          vments[1] = (info->u.hvm.timeoffset) ? info->u.hvm.timeoffset : "";
   1.132          vments[2] = "image/ostype";
   1.133          vments[3] = "hvm";
   1.134          vments[4] = "start_time";
   1.135 -        vments[5] = libxl_sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
   1.136 +        vments[5] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
   1.137      } else {
   1.138          ret = build_pv(ctx, domid, info, state);
   1.139          if (ret)
   1.140              goto out;
   1.141  
   1.142 -        vments = libxl_calloc(&gc, 11, sizeof(char *));
   1.143 +        vments = libxl__calloc(&gc, 11, sizeof(char *));
   1.144          i = 0;
   1.145          vments[i++] = "image/ostype";
   1.146          vments[i++] = "linux";
   1.147          vments[i++] = "image/kernel";
   1.148          vments[i++] = (char*) info->kernel.path;
   1.149          vments[i++] = "start_time";
   1.150 -        vments[i++] = libxl_sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
   1.151 +        vments[i++] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
   1.152          if (info->u.pv.ramdisk.path) {
   1.153              vments[i++] = "image/ramdisk";
   1.154              vments[i++] = (char*) info->u.pv.ramdisk.path;
   1.155 @@ -346,7 +346,7 @@ out:
   1.156      if (!info->hvm)
   1.157  	    libxl__file_reference_unmap(&info->u.pv.ramdisk);
   1.158  
   1.159 -    libxl_free_all(&gc);
   1.160 +    libxl__free_all(&gc);
   1.161      return ret;
   1.162  }
   1.163  
   1.164 @@ -370,22 +370,22 @@ int libxl_domain_restore(libxl_ctx *ctx,
   1.165      gettimeofday(&start_time, NULL);
   1.166  
   1.167      if (info->hvm) {
   1.168 -        vments = libxl_calloc(&gc, 7, sizeof(char *));
   1.169 +        vments = libxl__calloc(&gc, 7, sizeof(char *));
   1.170          vments[0] = "rtc/timeoffset";
   1.171          vments[1] = (info->u.hvm.timeoffset) ? info->u.hvm.timeoffset : "";
   1.172          vments[2] = "image/ostype";
   1.173          vments[3] = "hvm";
   1.174          vments[4] = "start_time";
   1.175 -        vments[5] = libxl_sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
   1.176 +        vments[5] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
   1.177      } else {
   1.178 -        vments = libxl_calloc(&gc, 11, sizeof(char *));
   1.179 +        vments = libxl__calloc(&gc, 11, sizeof(char *));
   1.180          i = 0;
   1.181          vments[i++] = "image/ostype";
   1.182          vments[i++] = "linux";
   1.183          vments[i++] = "image/kernel";
   1.184          vments[i++] = (char*) info->kernel.path;
   1.185          vments[i++] = "start_time";
   1.186 -        vments[i++] = libxl_sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
   1.187 +        vments[i++] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
   1.188          if (info->u.pv.ramdisk.path) {
   1.189              vments[i++] = "image/ramdisk";
   1.190              vments[i++] = (char*) info->u.pv.ramdisk.path;
   1.191 @@ -424,7 +424,7 @@ out:
   1.192      }
   1.193  
   1.194      errno = esave;
   1.195 -    libxl_free_all(&gc);
   1.196 +    libxl__free_all(&gc);
   1.197      return ret;
   1.198  }
   1.199  
   1.200 @@ -453,7 +453,7 @@ int libxl_domain_resume(libxl_ctx *ctx, 
   1.201          rc = ERROR_FAIL;
   1.202      }
   1.203  out:
   1.204 -    libxl_free_all(&gc);
   1.205 +    libxl__free_all(&gc);
   1.206      return 0;
   1.207  }
   1.208  
   1.209 @@ -476,27 +476,27 @@ int libxl_domain_preserve(libxl_ctx *ctx
   1.210  
   1.211      int rc;
   1.212  
   1.213 -    preserved_name = libxl_sprintf(&gc, "%s%s", info->name, name_suffix);
   1.214 +    preserved_name = libxl__sprintf(&gc, "%s%s", info->name, name_suffix);
   1.215      if (!preserved_name) {
   1.216 -        libxl_free_all(&gc);
   1.217 +        libxl__free_all(&gc);
   1.218          return ERROR_NOMEM;
   1.219      }
   1.220  
   1.221 -    uuid_string = libxl_uuid2string(&gc, new_uuid);
   1.222 +    uuid_string = libxl__uuid2string(&gc, new_uuid);
   1.223      if (!uuid_string) {
   1.224 -        libxl_free_all(&gc);
   1.225 +        libxl__free_all(&gc);
   1.226          return ERROR_NOMEM;
   1.227      }
   1.228  
   1.229 -    dom_path = libxl_xs_get_dompath(&gc, domid);
   1.230 +    dom_path = libxl__xs_get_dompath(&gc, domid);
   1.231      if (!dom_path) {
   1.232 -        libxl_free_all(&gc);
   1.233 +        libxl__free_all(&gc);
   1.234          return ERROR_FAIL;
   1.235      }
   1.236  
   1.237 -    vm_path = libxl_sprintf(&gc, "/vm/%s", uuid_string);
   1.238 +    vm_path = libxl__sprintf(&gc, "/vm/%s", uuid_string);
   1.239      if (!vm_path) {
   1.240 -        libxl_free_all(&gc);
   1.241 +        libxl__free_all(&gc);
   1.242          return ERROR_FAIL;
   1.243      }
   1.244  
   1.245 @@ -512,17 +512,17 @@ int libxl_domain_preserve(libxl_ctx *ctx
   1.246      xs_mkdir(ctx->xsh, t, vm_path);
   1.247      xs_set_permissions(ctx->xsh, t, vm_path, roperm, ARRAY_SIZE(roperm));
   1.248  
   1.249 -    xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/vm", dom_path), vm_path, strlen(vm_path));
   1.250 +    xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/vm", dom_path), vm_path, strlen(vm_path));
   1.251      rc = libxl_domain_rename(ctx, domid, info->name, preserved_name, t);
   1.252      if (rc) return rc;
   1.253  
   1.254 -    xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
   1.255 +    xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
   1.256  
   1.257      if (!xs_transaction_end(ctx->xsh, t, 0))
   1.258          if (errno == EAGAIN)
   1.259              goto retry_transaction;
   1.260  
   1.261 -    libxl_free_all(&gc);
   1.262 +    libxl__free_all(&gc);
   1.263      return 0;
   1.264  }
   1.265  
   1.266 @@ -692,11 +692,11 @@ int libxl_domain_unpause(libxl_ctx *ctx,
   1.267      int ret, rc = 0;
   1.268  
   1.269      if (is_hvm(ctx, domid)) {
   1.270 -        path = libxl_sprintf(&gc, "/local/domain/0/device-model/%d/state", domid);
   1.271 -        state = libxl_xs_read(&gc, XBT_NULL, path);
   1.272 +        path = libxl__sprintf(&gc, "/local/domain/0/device-model/%d/state", domid);
   1.273 +        state = libxl__xs_read(&gc, XBT_NULL, path);
   1.274          if (state != NULL && !strcmp(state, "paused")) {
   1.275 -            libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "/local/domain/0/device-model/%d/command", domid), "continue");
   1.276 -            libxl_wait_for_device_model(ctx, domid, "running", NULL, NULL);
   1.277 +            libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "/local/domain/0/device-model/%d/command", domid), "continue");
   1.278 +            libxl__wait_for_device_model(ctx, domid, "running", NULL, NULL);
   1.279          }
   1.280      }
   1.281      ret = xc_domain_unpause(ctx->xch, domid);
   1.282 @@ -704,7 +704,7 @@ int libxl_domain_unpause(libxl_ctx *ctx,
   1.283          XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unpausing domain %d", domid);
   1.284          rc = ERROR_FAIL;
   1.285      }
   1.286 -    libxl_free_all(&gc);
   1.287 +    libxl__free_all(&gc);
   1.288      return rc;
   1.289  }
   1.290  
   1.291 @@ -723,17 +723,17 @@ int libxl_domain_shutdown(libxl_ctx *ctx
   1.292      char *dom_path;
   1.293  
   1.294      if (req > ARRAY_SIZE(req_table)) {
   1.295 -        libxl_free_all(&gc);
   1.296 +        libxl__free_all(&gc);
   1.297          return ERROR_INVAL;
   1.298      }
   1.299  
   1.300 -    dom_path = libxl_xs_get_dompath(&gc, domid);
   1.301 +    dom_path = libxl__xs_get_dompath(&gc, domid);
   1.302      if (!dom_path) {
   1.303 -        libxl_free_all(&gc);
   1.304 +        libxl__free_all(&gc);
   1.305          return ERROR_FAIL;
   1.306      }
   1.307  
   1.308 -    shutdown_path = libxl_sprintf(&gc, "%s/control/shutdown", dom_path);
   1.309 +    shutdown_path = libxl__sprintf(&gc, "%s/control/shutdown", dom_path);
   1.310  
   1.311      xs_write(ctx->xsh, XBT_NULL, shutdown_path, req_table[req], strlen(req_table[req]));
   1.312      if (is_hvm(ctx,domid)) {
   1.313 @@ -758,7 +758,7 @@ int libxl_domain_shutdown(libxl_ctx *ctx
   1.314              }
   1.315         }
   1.316      }
   1.317 -    libxl_free_all(&gc);
   1.318 +    libxl__free_all(&gc);
   1.319      return 0;
   1.320  }
   1.321  
   1.322 @@ -789,7 +789,7 @@ int libxl_wait_for_disk_ejects(libxl_ctx
   1.323  
   1.324      for (i = 0; i < num_disks; i++) {
   1.325          if (asprintf(&(waiter[i].path), "%s/device/vbd/%d/eject",
   1.326 -                     libxl_xs_get_dompath(&gc, domid),
   1.327 +                     libxl__xs_get_dompath(&gc, domid),
   1.328                       device_disk_dev_number(disks[i].virtpath)) < 0)
   1.329              goto out;
   1.330          if (asprintf(&(waiter[i].token), "%d", LIBXL_EVENT_DISK_EJECT) < 0)
   1.331 @@ -798,7 +798,7 @@ int libxl_wait_for_disk_ejects(libxl_ctx
   1.332      }
   1.333      rc = 0;
   1.334  out:
   1.335 -    libxl_free_all(&gc);
   1.336 +    libxl__free_all(&gc);
   1.337      return rc;
   1.338  }
   1.339  
   1.340 @@ -857,29 +857,29 @@ int libxl_event_get_disk_eject_info(libx
   1.341      char *backend;
   1.342      char *value;
   1.343  
   1.344 -    value = libxl_xs_read(&gc, XBT_NULL, event->path);
   1.345 +    value = libxl__xs_read(&gc, XBT_NULL, event->path);
   1.346  
   1.347      if (!value || strcmp(value,  "eject")) {
   1.348 -        libxl_free_all(&gc);
   1.349 +        libxl__free_all(&gc);
   1.350          return 0;
   1.351      }
   1.352  
   1.353      path = strdup(event->path);
   1.354      path[strlen(path) - 6] = '\0';
   1.355 -    backend = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend", path));
   1.356 +    backend = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend", path));
   1.357  
   1.358      disk->backend_domid = 0;
   1.359      disk->domid = domid;
   1.360      disk->physpath = NULL;
   1.361      disk->phystype = 0;
   1.362      /* this value is returned to the user: do not free right away */
   1.363 -    disk->virtpath = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/dev", backend));
   1.364 +    disk->virtpath = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/dev", backend));
   1.365      disk->unpluggable = 1;
   1.366      disk->readwrite = 0;
   1.367      disk->is_cdrom = 1;
   1.368  
   1.369      free(path);
   1.370 -    libxl_free_all(&gc);
   1.371 +    libxl__free_all(&gc);
   1.372      return 1;
   1.373  }
   1.374  
   1.375 @@ -889,7 +889,7 @@ static int libxl_destroy_device_model(li
   1.376      char *pid;
   1.377      int ret;
   1.378  
   1.379 -    pid = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "/local/domain/%d/image/device-model-pid", domid));
   1.380 +    pid = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "/local/domain/%d/image/device-model-pid", domid));
   1.381      if (!pid) {
   1.382          int stubdomid = libxl_get_stubdom_id(ctx, domid);
   1.383          if (!stubdomid) {
   1.384 @@ -901,7 +901,7 @@ static int libxl_destroy_device_model(li
   1.385          ret = libxl_domain_destroy(ctx, stubdomid, 0);
   1.386          goto out;
   1.387      }
   1.388 -    xs_rm(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "/local/domain/0/device-model/%d", domid));
   1.389 +    xs_rm(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "/local/domain/0/device-model/%d", domid));
   1.390  
   1.391      ret = kill(atoi(pid), SIGHUP);
   1.392      if (ret < 0 && errno == ESRCH) {
   1.393 @@ -915,7 +915,7 @@ static int libxl_destroy_device_model(li
   1.394                       atoi(pid));
   1.395      }
   1.396  out:
   1.397 -    libxl_free_all(&gc);
   1.398 +    libxl__free_all(&gc);
   1.399      return ret;
   1.400  }
   1.401  
   1.402 @@ -930,11 +930,11 @@ int libxl_domain_destroy(libxl_ctx *ctx,
   1.403          dm_present = 1;
   1.404      } else {
   1.405          char *pid;
   1.406 -        pid = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "/local/domain/%d/image/device-model-pid", domid));
   1.407 +        pid = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "/local/domain/%d/image/device-model-pid", domid));
   1.408          dm_present = (pid != NULL);
   1.409      }
   1.410  
   1.411 -    dom_path = libxl_xs_get_dompath(&gc, domid);
   1.412 +    dom_path = libxl__xs_get_dompath(&gc, domid);
   1.413      if (!dom_path) {
   1.414          rc = ERROR_FAIL;
   1.415          goto out;
   1.416 @@ -944,7 +944,7 @@ int libxl_domain_destroy(libxl_ctx *ctx,
   1.417          XL_LOG(ctx, XL_LOG_ERROR, "pci shutdown failed for domid %d", domid);
   1.418      if (dm_present) {
   1.419          xs_write(ctx->xsh, XBT_NULL,
   1.420 -                 libxl_sprintf(&gc, "/local/domain/0/device-model/%d/command", domid),
   1.421 +                 libxl__sprintf(&gc, "/local/domain/0/device-model/%d/command", domid),
   1.422                   "shutdown", strlen("shutdown"));
   1.423      }
   1.424      rc = xc_domain_pause(ctx->xch, domid);
   1.425 @@ -955,10 +955,10 @@ int libxl_domain_destroy(libxl_ctx *ctx,
   1.426          if (libxl_destroy_device_model(ctx, domid) < 0)
   1.427              XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_device_model failed for %d", domid);
   1.428      }
   1.429 -    if (libxl_devices_destroy(ctx, domid, force) < 0)
   1.430 +    if (libxl__devices_destroy(ctx, domid, force) < 0)
   1.431          XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_devices failed for %d", domid);
   1.432  
   1.433 -    vm_path = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/vm", dom_path));
   1.434 +    vm_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/vm", dom_path));
   1.435      if (vm_path)
   1.436          if (!xs_rm(ctx->xsh, XBT_NULL, vm_path))
   1.437              XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vm_path);
   1.438 @@ -976,16 +976,16 @@ int libxl_domain_destroy(libxl_ctx *ctx,
   1.439      }
   1.440      rc = 0;
   1.441  out:
   1.442 -    libxl_free_all(&gc);
   1.443 +    libxl__free_all(&gc);
   1.444      return 0;
   1.445  }
   1.446  
   1.447  int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_constype type)
   1.448  {
   1.449      libxl_gc gc = LIBXL_INIT_GC(ctx);
   1.450 -    char *p = libxl_sprintf(&gc, "%s/xenconsole", libxl_private_bindir_path());
   1.451 -    char *domid_s = libxl_sprintf(&gc, "%d", domid);
   1.452 -    char *cons_num_s = libxl_sprintf(&gc, "%d", cons_num);
   1.453 +    char *p = libxl__sprintf(&gc, "%s/xenconsole", libxl_private_bindir_path());
   1.454 +    char *domid_s = libxl__sprintf(&gc, "%d", domid);
   1.455 +    char *cons_num_s = libxl__sprintf(&gc, "%d", cons_num);
   1.456      char *cons_type_s;
   1.457  
   1.458      switch (type) {
   1.459 @@ -1002,7 +1002,7 @@ int libxl_console_exec(libxl_ctx *ctx, u
   1.460      execl(p, p, domid_s, "--num", cons_num_s, "--type", cons_type_s, (void *)NULL);
   1.461  
   1.462  out:
   1.463 -    libxl_free_all(&gc);
   1.464 +    libxl__free_all(&gc);
   1.465      return ERROR_FAIL;
   1.466  }
   1.467  
   1.468 @@ -1032,22 +1032,22 @@ int libxl_vncviewer_exec(libxl_ctx *ctx,
   1.469          NULL,
   1.470      };
   1.471  
   1.472 -    vnc_port = libxl_xs_read(&gc, XBT_NULL,
   1.473 -                            libxl_sprintf(&gc,
   1.474 +    vnc_port = libxl__xs_read(&gc, XBT_NULL,
   1.475 +                            libxl__sprintf(&gc,
   1.476                              "/local/domain/%d/console/vnc-port", domid));
   1.477      if ( vnc_port )
   1.478          port = atoi(vnc_port) - 5900;
   1.479  
   1.480 -    vfb_back = libxl_xs_read(&gc, XBT_NULL,
   1.481 -                            libxl_sprintf(&gc,
   1.482 +    vfb_back = libxl__xs_read(&gc, XBT_NULL,
   1.483 +                            libxl__sprintf(&gc,
   1.484                              "/local/domain/%d/device/vfb/0/backend", domid));
   1.485      if ( vfb_back ) {
   1.486 -        vnc_listen = libxl_xs_read(&gc, XBT_NULL,
   1.487 -                            libxl_sprintf(&gc,
   1.488 +        vnc_listen = libxl__xs_read(&gc, XBT_NULL,
   1.489 +                            libxl__sprintf(&gc,
   1.490                              "/local/domain/%d/console/vnc-listen", domid));
   1.491          if ( autopass )
   1.492 -            vnc_pass = libxl_xs_read(&gc, XBT_NULL,
   1.493 -                            libxl_sprintf(&gc,
   1.494 +            vnc_pass = libxl__xs_read(&gc, XBT_NULL,
   1.495 +                            libxl__sprintf(&gc,
   1.496                              "/local/domain/%d/console/vnc-pass", domid));
   1.497      }
   1.498  
   1.499 @@ -1057,7 +1057,7 @@ int libxl_vncviewer_exec(libxl_ctx *ctx,
   1.500      if ( (vnc_bin = getenv("VNCVIEWER")) )
   1.501          args[0] = vnc_bin;
   1.502  
   1.503 -    args[1] = libxl_sprintf(&gc, "%s:%d", vnc_listen, port);
   1.504 +    args[1] = libxl__sprintf(&gc, "%s:%d", vnc_listen, port);
   1.505  
   1.506      if ( vnc_pass ) {
   1.507          char tmpname[] = "/tmp/vncautopass.XXXXXX";
   1.508 @@ -1079,8 +1079,8 @@ int libxl_vncviewer_exec(libxl_ctx *ctx,
   1.509      }
   1.510  
   1.511  skip_autopass:
   1.512 -    libxl_free_all(&gc);
   1.513 -    libxl_exec(autopass_fd, -1, -1, args[0], args);
   1.514 +    libxl__free_all(&gc);
   1.515 +    libxl__exec(autopass_fd, -1, -1, args[0], args);
   1.516      return 0;
   1.517  }
   1.518  
   1.519 @@ -1099,7 +1099,7 @@ static char ** libxl_build_device_model_
   1.520      flexarray_set(dm_args, num++, "qemu-dm");
   1.521      flexarray_set(dm_args, num++, "-d");
   1.522  
   1.523 -    flexarray_set(dm_args, num++, libxl_sprintf(gc, "%d", info->domid));
   1.524 +    flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->domid));
   1.525  
   1.526      if (info->dom_name) {
   1.527          flexarray_set(dm_args, num++, "-domain-name");
   1.528 @@ -1111,18 +1111,18 @@ static char ** libxl_build_device_model_
   1.529              if (info->vnclisten && strchr(info->vnclisten, ':') == NULL) {
   1.530                  flexarray_set(
   1.531                      dm_args, num++,
   1.532 -                    libxl_sprintf(gc, "%s:%d%s",
   1.533 +                    libxl__sprintf(gc, "%s:%d%s",
   1.534                                    info->vnclisten,
   1.535                                    info->vncdisplay,
   1.536                                    info->vncpasswd ? ",password" : ""));
   1.537              } else {
   1.538 -                flexarray_set(dm_args, num++, libxl_sprintf(gc, "127.0.0.1:%d", info->vncdisplay));
   1.539 +                flexarray_set(dm_args, num++, libxl__sprintf(gc, "127.0.0.1:%d", info->vncdisplay));
   1.540              }
   1.541          } else if (info->vnclisten) {
   1.542              if (strchr(info->vnclisten, ':') != NULL) {
   1.543                  flexarray_set(dm_args, num++, info->vnclisten);
   1.544              } else {
   1.545 -                flexarray_set(dm_args, num++, libxl_sprintf(gc, "%s:0", info->vnclisten));
   1.546 +                flexarray_set(dm_args, num++, libxl__sprintf(gc, "%s:0", info->vnclisten));
   1.547              }
   1.548          } else {
   1.549              flexarray_set(dm_args, num++, "127.0.0.1:0");
   1.550 @@ -1153,7 +1153,7 @@ static char ** libxl_build_device_model_
   1.551  
   1.552          if (info->videoram) {
   1.553              flexarray_set(dm_args, num++, "-videoram");
   1.554 -            flexarray_set(dm_args, num++, libxl_sprintf(gc, "%d", info->videoram));
   1.555 +            flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->videoram));
   1.556          }
   1.557          if (info->stdvga) {
   1.558              flexarray_set(dm_args, num++, "-std-vga");
   1.559 @@ -1179,24 +1179,24 @@ static char ** libxl_build_device_model_
   1.560          }
   1.561          if (info->vcpus > 1) {
   1.562              flexarray_set(dm_args, num++, "-vcpus");
   1.563 -            flexarray_set(dm_args, num++, libxl_sprintf(gc, "%d", info->vcpus));
   1.564 +            flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->vcpus));
   1.565          }
   1.566          if (info->vcpu_avail) {
   1.567              flexarray_set(dm_args, num++, "-vcpu_avail");
   1.568 -            flexarray_set(dm_args, num++, libxl_sprintf(gc, "0x%x", info->vcpu_avail));
   1.569 +            flexarray_set(dm_args, num++, libxl__sprintf(gc, "0x%x", info->vcpu_avail));
   1.570          }
   1.571          for (i = 0; i < num_vifs; i++) {
   1.572              if (vifs[i].nictype == NICTYPE_IOEMU) {
   1.573 -                char *smac = libxl_sprintf(gc, "%02x:%02x:%02x:%02x:%02x:%02x",
   1.574 +                char *smac = libxl__sprintf(gc, "%02x:%02x:%02x:%02x:%02x:%02x",
   1.575                                             vifs[i].mac[0], vifs[i].mac[1], vifs[i].mac[2],
   1.576                                             vifs[i].mac[3], vifs[i].mac[4], vifs[i].mac[5]);
   1.577                  if (!vifs[i].ifname)
   1.578 -                    vifs[i].ifname = libxl_sprintf(gc, "tap%d.%d", info->domid, vifs[i].devid);
   1.579 +                    vifs[i].ifname = libxl__sprintf(gc, "tap%d.%d", info->domid, vifs[i].devid);
   1.580                  flexarray_set(dm_args, num++, "-net");
   1.581 -                flexarray_set(dm_args, num++, libxl_sprintf(gc, "nic,vlan=%d,macaddr=%s,model=%s",
   1.582 +                flexarray_set(dm_args, num++, libxl__sprintf(gc, "nic,vlan=%d,macaddr=%s,model=%s",
   1.583                              vifs[i].devid, smac, vifs[i].model));
   1.584                  flexarray_set(dm_args, num++, "-net");
   1.585 -                flexarray_set(dm_args, num++, libxl_sprintf(gc, "tap,vlan=%d,ifname=%s,bridge=%s,script=no",
   1.586 +                flexarray_set(dm_args, num++, libxl__sprintf(gc, "tap,vlan=%d,ifname=%s,bridge=%s,script=no",
   1.587                              vifs[i].devid, vifs[i].ifname, vifs[i].bridge));
   1.588                  ioemu_vifs++;
   1.589              }
   1.590 @@ -1239,7 +1239,7 @@ static char ** libxl_build_device_model_
   1.591      flexarray_set(dm_args, num++, "qemu-system-xen");
   1.592      flexarray_set(dm_args, num++, "-xen-domid");
   1.593  
   1.594 -    flexarray_set(dm_args, num++, libxl_sprintf(gc, "%d", info->domid));
   1.595 +    flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->domid));
   1.596  
   1.597      if (info->dom_name) {
   1.598          flexarray_set(dm_args, num++, "-name");
   1.599 @@ -1262,11 +1262,11 @@ static char ** libxl_build_device_model_
   1.600  
   1.601          if (strchr(listen, ':') != NULL)
   1.602              flexarray_set(dm_args, num++,
   1.603 -                    libxl_sprintf(gc, "%s%s", listen,
   1.604 +                    libxl__sprintf(gc, "%s%s", listen,
   1.605                          info->vncunused ? ",to=99" : ""));
   1.606          else
   1.607              flexarray_set(dm_args, num++,
   1.608 -                    libxl_sprintf(gc, "%s:%d%s", listen, display,
   1.609 +                    libxl__sprintf(gc, "%s:%d%s", listen, display,
   1.610                          info->vncunused ? ",to=99" : ""));
   1.611      }
   1.612      if (info->sdl) {
   1.613 @@ -1293,7 +1293,7 @@ static char ** libxl_build_device_model_
   1.614  
   1.615          if (info->boot) {
   1.616              flexarray_set(dm_args, num++, "-boot");
   1.617 -            flexarray_set(dm_args, num++, libxl_sprintf(gc, "order=%s", info->boot));
   1.618 +            flexarray_set(dm_args, num++, libxl__sprintf(gc, "order=%s", info->boot));
   1.619          }
   1.620          if (info->usb || info->usbdevice) {
   1.621              flexarray_set(dm_args, num++, "-usb");
   1.622 @@ -1312,22 +1312,22 @@ static char ** libxl_build_device_model_
   1.623          if (info->vcpus > 1) {
   1.624              flexarray_set(dm_args, num++, "-smp");
   1.625              if (info->vcpu_avail)
   1.626 -                flexarray_set(dm_args, num++, libxl_sprintf(gc, "%d,maxcpus=%d", info->vcpus, info->vcpu_avail));
   1.627 +                flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d,maxcpus=%d", info->vcpus, info->vcpu_avail));
   1.628              else
   1.629 -                flexarray_set(dm_args, num++, libxl_sprintf(gc, "%d", info->vcpus));
   1.630 +                flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->vcpus));
   1.631          }
   1.632          for (i = 0; i < num_vifs; i++) {
   1.633              if (vifs[i].nictype == NICTYPE_IOEMU) {
   1.634 -                char *smac = libxl_sprintf(gc, "%02x:%02x:%02x:%02x:%02x:%02x",
   1.635 +                char *smac = libxl__sprintf(gc, "%02x:%02x:%02x:%02x:%02x:%02x",
   1.636                                             vifs[i].mac[0], vifs[i].mac[1], vifs[i].mac[2],
   1.637                                             vifs[i].mac[3], vifs[i].mac[4], vifs[i].mac[5]);
   1.638                  if (!vifs[i].ifname)
   1.639 -                    vifs[i].ifname = libxl_sprintf(gc, "tap%d.%d", info->domid, vifs[i].devid);
   1.640 +                    vifs[i].ifname = libxl__sprintf(gc, "tap%d.%d", info->domid, vifs[i].devid);
   1.641                  flexarray_set(dm_args, num++, "-net");
   1.642 -                flexarray_set(dm_args, num++, libxl_sprintf(gc, "nic,vlan=%d,macaddr=%s,model=%s",
   1.643 +                flexarray_set(dm_args, num++, libxl__sprintf(gc, "nic,vlan=%d,macaddr=%s,model=%s",
   1.644                              vifs[i].devid, smac, vifs[i].model));
   1.645                  flexarray_set(dm_args, num++, "-net");
   1.646 -                flexarray_set(dm_args, num++, libxl_sprintf(gc, "tap,vlan=%d,ifname=%s,script=no",
   1.647 +                flexarray_set(dm_args, num++, libxl__sprintf(gc, "tap,vlan=%d,ifname=%s,script=no",
   1.648                              vifs[i].devid, vifs[i].ifname));
   1.649                  ioemu_vifs++;
   1.650              }
   1.651 @@ -1356,7 +1356,7 @@ static char ** libxl_build_device_model_
   1.652              flexarray_set(dm_args, num++, "-cdrom");
   1.653              flexarray_set(dm_args, num++, disks[i].physpath);
   1.654          }else{
   1.655 -            flexarray_set(dm_args, num++, libxl_sprintf(gc, "-%s", disks[i].virtpath));
   1.656 +            flexarray_set(dm_args, num++, libxl__sprintf(gc, "-%s", disks[i].virtpath));
   1.657              flexarray_set(dm_args, num++, disks[i].physpath);
   1.658          }
   1.659          libxl_device_disk_destroy(&disks[i]);
   1.660 @@ -1443,7 +1443,7 @@ static int libxl_write_dmargs(libxl_ctx 
   1.661      roperm[1].id = domid;
   1.662      roperm[1].perms = XS_PERM_READ;
   1.663  
   1.664 -    vm_path = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "/local/domain/%d/vm", guest_domid));
   1.665 +    vm_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "/local/domain/%d/vm", guest_domid));
   1.666  
   1.667      i = 0;
   1.668      dmargs_size = 0;
   1.669 @@ -1462,18 +1462,18 @@ static int libxl_write_dmargs(libxl_ctx 
   1.670          }
   1.671          i++;
   1.672      }
   1.673 -    path = libxl_sprintf(&gc, "%s/image/dmargs", vm_path);
   1.674 +    path = libxl__sprintf(&gc, "%s/image/dmargs", vm_path);
   1.675  
   1.676  retry_transaction:
   1.677      t = xs_transaction_start(ctx->xsh);
   1.678      xs_write(ctx->xsh, t, path, dmargs, strlen(dmargs));
   1.679      xs_set_permissions(ctx->xsh, t, path, roperm, ARRAY_SIZE(roperm));
   1.680 -    xs_set_permissions(ctx->xsh, t, libxl_sprintf(&gc, "%s/rtc/timeoffset", vm_path), roperm, ARRAY_SIZE(roperm));
   1.681 +    xs_set_permissions(ctx->xsh, t, libxl__sprintf(&gc, "%s/rtc/timeoffset", vm_path), roperm, ARRAY_SIZE(roperm));
   1.682      if (!xs_transaction_end(ctx->xsh, t, 0))
   1.683          if (errno == EAGAIN)
   1.684              goto retry_transaction;
   1.685      free(dmargs);
   1.686 -    libxl_free_all(&gc);
   1.687 +    libxl__free_all(&gc);
   1.688      return 0;
   1.689  }
   1.690  
   1.691 @@ -1505,7 +1505,7 @@ static int libxl_create_stubdom(libxl_ct
   1.692  
   1.693      memset(&c_info, 0x00, sizeof(libxl_domain_create_info));
   1.694      c_info.hvm = 0;
   1.695 -    c_info.name = libxl_sprintf(&gc, "%s-dm", _libxl_domid_to_name(&gc, info->domid));
   1.696 +    c_info.name = libxl__sprintf(&gc, "%s-dm", libxl__domid_to_name(&gc, info->domid));
   1.697  
   1.698      libxl_uuid_copy(&c_info.uuid, &info->uuid);
   1.699  
   1.700 @@ -1513,8 +1513,8 @@ static int libxl_create_stubdom(libxl_ct
   1.701      b_info.max_vcpus = 1;
   1.702      b_info.max_memkb = 32 * 1024;
   1.703      b_info.target_memkb = b_info.max_memkb;
   1.704 -    b_info.kernel.path = libxl_abs_path(&gc, "ioemu-stubdom.gz", libxl_xenfirmwaredir_path());
   1.705 -    b_info.u.pv.cmdline = libxl_sprintf(&gc, " -d %d", info->domid);
   1.706 +    b_info.kernel.path = libxl__abs_path(&gc, "ioemu-stubdom.gz", libxl_xenfirmwaredir_path());
   1.707 +    b_info.u.pv.cmdline = libxl__sprintf(&gc, " -d %d", info->domid);
   1.708      b_info.u.pv.ramdisk.path = "";
   1.709      b_info.u.pv.features = "";
   1.710      b_info.hvm = 0;
   1.711 @@ -1527,11 +1527,11 @@ static int libxl_create_stubdom(libxl_ct
   1.712          goto out_free;
   1.713  
   1.714      libxl_write_dmargs(ctx, domid, info->domid, args);
   1.715 -    libxl_xs_write(&gc, XBT_NULL,
   1.716 -                   libxl_sprintf(&gc, "%s/image/device-model-domid", libxl_xs_get_dompath(&gc, info->domid)),
   1.717 +    libxl__xs_write(&gc, XBT_NULL,
   1.718 +                   libxl__sprintf(&gc, "%s/image/device-model-domid", libxl__xs_get_dompath(&gc, info->domid)),
   1.719                     "%d", domid);
   1.720 -    libxl_xs_write(&gc, XBT_NULL,
   1.721 -                   libxl_sprintf(&gc, "%s/target", libxl_xs_get_dompath(&gc, domid)),
   1.722 +    libxl__xs_write(&gc, XBT_NULL,
   1.723 +                   libxl__sprintf(&gc, "%s/target", libxl__xs_get_dompath(&gc, domid)),
   1.724                     "%d", info->domid);
   1.725      ret = xc_domain_set_target(ctx->xch, domid, info->domid);
   1.726      if (ret<0) {
   1.727 @@ -1547,10 +1547,10 @@ static int libxl_create_stubdom(libxl_ct
   1.728      perm[1].perms = XS_PERM_READ;
   1.729  retry_transaction:
   1.730      t = xs_transaction_start(ctx->xsh);
   1.731 -    xs_mkdir(ctx->xsh, t, libxl_sprintf(&gc, "/local/domain/0/device-model/%d", info->domid));
   1.732 -    xs_set_permissions(ctx->xsh, t, libxl_sprintf(&gc, "/local/domain/0/device-model/%d", info->domid), perm, ARRAY_SIZE(perm));
   1.733 -    xs_mkdir(ctx->xsh, t, libxl_sprintf(&gc, "/local/domain/%d/device/vfs", domid));
   1.734 -    xs_set_permissions(ctx->xsh, t, libxl_sprintf(&gc, "/local/domain/%d/device/vfs",domid), perm, ARRAY_SIZE(perm));
   1.735 +    xs_mkdir(ctx->xsh, t, libxl__sprintf(&gc, "/local/domain/0/device-model/%d", info->domid));
   1.736 +    xs_set_permissions(ctx->xsh, t, libxl__sprintf(&gc, "/local/domain/0/device-model/%d", info->domid), perm, ARRAY_SIZE(perm));
   1.737 +    xs_mkdir(ctx->xsh, t, libxl__sprintf(&gc, "/local/domain/%d/device/vfs", domid));
   1.738 +    xs_set_permissions(ctx->xsh, t, libxl__sprintf(&gc, "/local/domain/%d/device/vfs",domid), perm, ARRAY_SIZE(perm));
   1.739      if (!xs_transaction_end(ctx->xsh, t, 0))
   1.740          if (errno == EAGAIN)
   1.741              goto retry_transaction;
   1.742 @@ -1579,7 +1579,7 @@ retry_transaction:
   1.743      if (info->serial)
   1.744          num_console++;
   1.745  
   1.746 -    console = libxl_calloc(&gc, num_console, sizeof(libxl_device_console));
   1.747 +    console = libxl__calloc(&gc, num_console, sizeof(libxl_device_console));
   1.748      if (!console) {
   1.749          ret = ERROR_NOMEM;
   1.750          goto out_free;
   1.751 @@ -1591,9 +1591,9 @@ retry_transaction:
   1.752          console[i].domid = domid;
   1.753          if (!i) {
   1.754              char *filename;
   1.755 -            char *name = libxl_sprintf(&gc, "qemu-dm-%s", libxl_domid_to_name(ctx, info->domid));
   1.756 +            char *name = libxl__sprintf(&gc, "qemu-dm-%s", libxl_domid_to_name(ctx, info->domid));
   1.757              libxl_create_logfile(ctx, name, &filename);
   1.758 -            console[i].output = libxl_sprintf(&gc, "file:%s", filename);
   1.759 +            console[i].output = libxl__sprintf(&gc, "file:%s", filename);
   1.760              console[i].build_state = &state;
   1.761              free(filename);
   1.762          } else
   1.763 @@ -1616,7 +1616,7 @@ retry_transaction:
   1.764      if (starting_r) {
   1.765          *starting_r = calloc(sizeof(libxl_device_model_starting), 1);
   1.766          (*starting_r)->domid = info->domid;
   1.767 -        (*starting_r)->dom_path = libxl_xs_get_dompath(&gc, info->domid);
   1.768 +        (*starting_r)->dom_path = libxl__xs_get_dompath(&gc, info->domid);
   1.769          (*starting_r)->for_spawn = NULL;
   1.770      }
   1.771  
   1.772 @@ -1625,7 +1625,7 @@ retry_transaction:
   1.773  out_free:
   1.774      free(args);
   1.775  out:
   1.776 -    libxl_free_all(&gc);
   1.777 +    libxl__free_all(&gc);
   1.778      return ret;
   1.779  }
   1.780  
   1.781 @@ -1660,11 +1660,11 @@ int libxl_create_device_model(libxl_ctx 
   1.782          goto out;
   1.783      }
   1.784  
   1.785 -    path = libxl_sprintf(&gc, "/local/domain/0/device-model/%d", info->domid);
   1.786 +    path = libxl__sprintf(&gc, "/local/domain/0/device-model/%d", info->domid);
   1.787      xs_mkdir(ctx->xsh, XBT_NULL, path);
   1.788 -    libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/disable_pf", path), "%d", !info->xen_platform_pci);
   1.789 -
   1.790 -    libxl_create_logfile(ctx, libxl_sprintf(&gc, "qemu-dm-%s", info->dom_name), &logfile);
   1.791 +    libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/disable_pf", path), "%d", !info->xen_platform_pci);
   1.792 +
   1.793 +    libxl_create_logfile(ctx, libxl__sprintf(&gc, "qemu-dm-%s", info->dom_name), &logfile);
   1.794      logfile_w = open(logfile, O_WRONLY|O_CREAT, 0644);
   1.795      free(logfile);
   1.796      null = open("/dev/null", O_RDONLY);
   1.797 @@ -1682,7 +1682,7 @@ int libxl_create_device_model(libxl_ctx 
   1.798      }
   1.799  
   1.800      p->domid = info->domid;
   1.801 -    p->dom_path = libxl_xs_get_dompath(&gc, info->domid);
   1.802 +    p->dom_path = libxl__xs_get_dompath(&gc, info->domid);
   1.803      if (!p->dom_path) {
   1.804          rc = ERROR_FAIL;
   1.805          goto out_close;
   1.806 @@ -1692,25 +1692,25 @@ int libxl_create_device_model(libxl_ctx 
   1.807  retry_transaction:
   1.808          /* Find uuid and the write the vnc password to xenstore for qemu. */
   1.809          t = xs_transaction_start(ctx->xsh);
   1.810 -        vm_path = libxl_xs_read(&gc,t,libxl_sprintf(&gc, "%s/vm", p->dom_path));
   1.811 +        vm_path = libxl__xs_read(&gc,t,libxl__sprintf(&gc, "%s/vm", p->dom_path));
   1.812          if (vm_path) {
   1.813              /* Now write the vncpassword into it. */
   1.814 -            pass_stuff = libxl_calloc(&gc, 2, sizeof(char *));
   1.815 +            pass_stuff = libxl__calloc(&gc, 2, sizeof(char *));
   1.816              pass_stuff[0] = "vncpasswd";
   1.817              pass_stuff[1] = info->vncpasswd;
   1.818 -            libxl_xs_writev(&gc,t,vm_path,pass_stuff);
   1.819 +            libxl__xs_writev(&gc,t,vm_path,pass_stuff);
   1.820              if (!xs_transaction_end(ctx->xsh, t, 0))
   1.821                  if (errno == EAGAIN)
   1.822                      goto retry_transaction;
   1.823          }
   1.824      }
   1.825  
   1.826 -    rc = libxl_spawn_spawn(ctx, p, "device model", dm_xenstore_record_pid);
   1.827 +    rc = libxl__spawn_spawn(ctx, p, "device model", dm_xenstore_record_pid);
   1.828      if (rc < 0)
   1.829          goto out_close;
   1.830      if (!rc) { /* inner child */
   1.831 -        libxl_exec(null, logfile_w, logfile_w,
   1.832 -                   libxl_abs_path(&gc, info->device_model, libxl_private_bindir_path()),
   1.833 +        libxl__exec(null, logfile_w, logfile_w,
   1.834 +                   libxl__abs_path(&gc, info->device_model, libxl_private_bindir_path()),
   1.835                     args);
   1.836      }
   1.837  
   1.838 @@ -1721,7 +1721,7 @@ out_close:
   1.839      close(logfile_w);
   1.840      free(args);
   1.841  out:
   1.842 -    libxl_free_all(&gc);
   1.843 +    libxl__free_all(&gc);
   1.844      return rc;
   1.845  }
   1.846  
   1.847 @@ -1729,7 +1729,7 @@ int libxl_detach_device_model(libxl_ctx 
   1.848                                libxl_device_model_starting *starting)
   1.849  {
   1.850      int rc;
   1.851 -    rc = libxl_spawn_detach(ctx, starting->for_spawn);
   1.852 +    rc = libxl__spawn_detach(ctx, starting->for_spawn);
   1.853      if (starting->for_spawn)
   1.854          free(starting->for_spawn);
   1.855      free(starting);
   1.856 @@ -1740,10 +1740,10 @@ int libxl_detach_device_model(libxl_ctx 
   1.857  int libxl_confirm_device_model_startup(libxl_ctx *ctx,
   1.858                                         libxl_device_model_starting *starting)
   1.859  {
   1.860 -    int problem = libxl_wait_for_device_model(ctx, starting->domid, "running", NULL, NULL);
   1.861 +    int problem = libxl__wait_for_device_model(ctx, starting->domid, "running", NULL, NULL);
   1.862      int detach;
   1.863      if ( !problem )
   1.864 -        problem = libxl_spawn_check(ctx, starting->for_spawn);
   1.865 +        problem = libxl__spawn_check(ctx, starting->for_spawn);
   1.866      detach = libxl_detach_device_model(ctx, starting);
   1.867      return problem ? problem : detach;
   1.868  }
   1.869 @@ -1794,7 +1794,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
   1.870  
   1.871              device_physdisk_major_minor(disk->physpath, &major, &minor);
   1.872              flexarray_set(back, boffset++, "physical-device");
   1.873 -            flexarray_set(back, boffset++, libxl_sprintf(&gc, "%x:%x", major, minor));
   1.874 +            flexarray_set(back, boffset++, libxl__sprintf(&gc, "%x:%x", major, minor));
   1.875  
   1.876              flexarray_set(back, boffset++, "params");
   1.877              flexarray_set(back, boffset++, disk->physpath);
   1.878 @@ -1817,19 +1817,19 @@ int libxl_device_disk_add(libxl_ctx *ctx
   1.879                      goto out_free;
   1.880                  }
   1.881                  flexarray_set(back, boffset++, "tapdisk-params");
   1.882 -                flexarray_set(back, boffset++, libxl_sprintf(&gc, "%s:%s", device_disk_string_of_phystype(disk->phystype), disk->physpath));
   1.883 +                flexarray_set(back, boffset++, libxl__sprintf(&gc, "%s:%s", device_disk_string_of_phystype(disk->phystype), disk->physpath));
   1.884                  flexarray_set(back, boffset++, "params");
   1.885 -                flexarray_set(back, boffset++, libxl_strdup(&gc, dev));
   1.886 +                flexarray_set(back, boffset++, libxl__strdup(&gc, dev));
   1.887                  backend_type = "phy";
   1.888                  device_physdisk_major_minor(dev, &major, &minor);
   1.889                  flexarray_set(back, boffset++, "physical-device");
   1.890 -                flexarray_set(back, boffset++, libxl_sprintf(&gc, "%x:%x", major, minor));
   1.891 +                flexarray_set(back, boffset++, libxl__sprintf(&gc, "%x:%x", major, minor));
   1.892                  device.backend_kind = DEVICE_VBD;
   1.893  
   1.894                  break;
   1.895              }
   1.896              flexarray_set(back, boffset++, "params");
   1.897 -            flexarray_set(back, boffset++, libxl_sprintf(&gc, "%s:%s",
   1.898 +            flexarray_set(back, boffset++, libxl__sprintf(&gc, "%s:%s",
   1.899                            device_disk_string_of_phystype(disk->phystype), disk->physpath));
   1.900  
   1.901              device.backend_kind = DEVICE_TAP;
   1.902 @@ -1842,15 +1842,15 @@ int libxl_device_disk_add(libxl_ctx *ctx
   1.903      }
   1.904  
   1.905      flexarray_set(back, boffset++, "frontend-id");
   1.906 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", disk->domid));
   1.907 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", disk->domid));
   1.908      flexarray_set(back, boffset++, "online");
   1.909      flexarray_set(back, boffset++, "1");
   1.910      flexarray_set(back, boffset++, "removable");
   1.911 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", (disk->unpluggable) ? 1 : 0));
   1.912 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", (disk->unpluggable) ? 1 : 0));
   1.913      flexarray_set(back, boffset++, "bootable");
   1.914 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", 1));
   1.915 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", 1));
   1.916      flexarray_set(back, boffset++, "state");
   1.917 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", 1));
   1.918 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", 1));
   1.919      flexarray_set(back, boffset++, "dev");
   1.920      flexarray_set(back, boffset++, disk->virtpath);
   1.921      flexarray_set(back, boffset++, "type");
   1.922 @@ -1859,11 +1859,11 @@ int libxl_device_disk_add(libxl_ctx *ctx
   1.923      flexarray_set(back, boffset++, disk->readwrite ? "w" : "r");
   1.924  
   1.925      flexarray_set(front, foffset++, "backend-id");
   1.926 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", disk->backend_domid));
   1.927 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", disk->backend_domid));
   1.928      flexarray_set(front, foffset++, "state");
   1.929 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", 1));
   1.930 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", 1));
   1.931      flexarray_set(front, foffset++, "virtual-device");
   1.932 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", devid));
   1.933 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", devid));
   1.934      flexarray_set(front, foffset++, "device-type");
   1.935      flexarray_set(front, foffset++, disk->is_cdrom ? "cdrom" : "disk");
   1.936  
   1.937 @@ -1872,9 +1872,9 @@ int libxl_device_disk_add(libxl_ctx *ctx
   1.938          flexarray_set(front, foffset++, "x86_32-abi"); /* hardcoded ! */
   1.939      }
   1.940  
   1.941 -    libxl_device_generic_add(ctx, &device,
   1.942 -                             libxl_xs_kvs_of_flexarray(&gc, back, boffset),
   1.943 -                             libxl_xs_kvs_of_flexarray(&gc, front, foffset));
   1.944 +    libxl__device_generic_add(ctx, &device,
   1.945 +                             libxl__xs_kvs_of_flexarray(&gc, back, boffset),
   1.946 +                             libxl__xs_kvs_of_flexarray(&gc, front, foffset));
   1.947  
   1.948      rc = 0;
   1.949  
   1.950 @@ -1882,7 +1882,7 @@ out_free:
   1.951      flexarray_free(back);
   1.952      flexarray_free(front);
   1.953  out:
   1.954 -    libxl_free_all(&gc);
   1.955 +    libxl__free_all(&gc);
   1.956      return rc;
   1.957  }
   1.958  
   1.959 @@ -1900,7 +1900,7 @@ int libxl_device_disk_del(libxl_ctx *ctx
   1.960      device.domid            = disk->domid;
   1.961      device.devid            = devid;
   1.962      device.kind             = DEVICE_VBD;
   1.963 -    return libxl_device_del(ctx, &device, wait);
   1.964 +    return libxl__device_del(ctx, &device, wait);
   1.965  }
   1.966  
   1.967  char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk)
   1.968 @@ -1931,7 +1931,7 @@ char * libxl_device_disk_local_attach(li
   1.969              break;
   1.970      }
   1.971      ret = strdup(dev);
   1.972 -    libxl_free_all(&gc);
   1.973 +    libxl__free_all(&gc);
   1.974      return ret;
   1.975  }
   1.976  
   1.977 @@ -1971,12 +1971,12 @@ int libxl_device_nic_add(libxl_ctx *ctx,
   1.978      }
   1.979  
   1.980      if (nic->devid == -1) {
   1.981 -        if (!(dompath = libxl_xs_get_dompath(&gc, domid))) {
   1.982 +        if (!(dompath = libxl__xs_get_dompath(&gc, domid))) {
   1.983              rc = ERROR_FAIL;
   1.984              goto out_free;
   1.985          }
   1.986 -        if (!(l = libxl_xs_directory(&gc, XBT_NULL,
   1.987 -                                     libxl_sprintf(&gc, "%s/device/vif", dompath), &nb))) {
   1.988 +        if (!(l = libxl__xs_directory(&gc, XBT_NULL,
   1.989 +                                     libxl__sprintf(&gc, "%s/device/vif", dompath), &nb))) {
   1.990              nic->devid = 0;
   1.991          } else {
   1.992              nic->devid = strtoul(l[nb - 1], NULL, 10) + 1;
   1.993 @@ -1991,30 +1991,30 @@ int libxl_device_nic_add(libxl_ctx *ctx,
   1.994      device.kind = DEVICE_VIF;
   1.995  
   1.996      flexarray_set(back, boffset++, "frontend-id");
   1.997 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", nic->domid));
   1.998 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", nic->domid));
   1.999      flexarray_set(back, boffset++, "online");
  1.1000      flexarray_set(back, boffset++, "1");
  1.1001      flexarray_set(back, boffset++, "state");
  1.1002 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", 1));
  1.1003 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", 1));
  1.1004      flexarray_set(back, boffset++, "script");
  1.1005      flexarray_set(back, boffset++, nic->script);
  1.1006      flexarray_set(back, boffset++, "mac");
  1.1007 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
  1.1008 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
  1.1009                                                   nic->mac[0], nic->mac[1], nic->mac[2],
  1.1010                                                   nic->mac[3], nic->mac[4], nic->mac[5]));
  1.1011      flexarray_set(back, boffset++, "bridge");
  1.1012 -    flexarray_set(back, boffset++, libxl_strdup(&gc, nic->bridge));
  1.1013 +    flexarray_set(back, boffset++, libxl__strdup(&gc, nic->bridge));
  1.1014      flexarray_set(back, boffset++, "handle");
  1.1015 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", nic->devid));
  1.1016 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", nic->devid));
  1.1017  
  1.1018      flexarray_set(front, foffset++, "backend-id");
  1.1019 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", nic->backend_domid));
  1.1020 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", nic->backend_domid));
  1.1021      flexarray_set(front, foffset++, "state");
  1.1022 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", 1));
  1.1023 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", 1));
  1.1024      flexarray_set(front, foffset++, "handle");
  1.1025 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", nic->devid));
  1.1026 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", nic->devid));
  1.1027      flexarray_set(front, foffset++, "mac");
  1.1028 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
  1.1029 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
  1.1030                                                    nic->mac[0], nic->mac[1], nic->mac[2],
  1.1031                                                    nic->mac[3], nic->mac[4], nic->mac[5]));
  1.1032      if (0 /* protocol != native*/) {
  1.1033 @@ -2022,9 +2022,9 @@ int libxl_device_nic_add(libxl_ctx *ctx,
  1.1034          flexarray_set(front, foffset++, "x86_32-abi"); /* hardcoded ! */
  1.1035      }
  1.1036  
  1.1037 -    libxl_device_generic_add(ctx, &device,
  1.1038 -                             libxl_xs_kvs_of_flexarray(&gc, back, boffset),
  1.1039 -                             libxl_xs_kvs_of_flexarray(&gc, front, foffset));
  1.1040 +    libxl__device_generic_add(ctx, &device,
  1.1041 +                             libxl__xs_kvs_of_flexarray(&gc, back, boffset),
  1.1042 +                             libxl__xs_kvs_of_flexarray(&gc, front, foffset));
  1.1043  
  1.1044      /* FIXME: wait for plug */
  1.1045      rc = 0;
  1.1046 @@ -2032,7 +2032,7 @@ out_free:
  1.1047      flexarray_free(back);
  1.1048      flexarray_free(front);
  1.1049  out:
  1.1050 -    libxl_free_all(&gc);
  1.1051 +    libxl__free_all(&gc);
  1.1052      return rc;
  1.1053  }
  1.1054  
  1.1055 @@ -2048,7 +2048,7 @@ int libxl_device_nic_del(libxl_ctx *ctx,
  1.1056      device.domid            = nic->domid;
  1.1057      device.kind             = DEVICE_VIF;
  1.1058  
  1.1059 -    return libxl_device_del(ctx, &device, wait);
  1.1060 +    return libxl__device_del(ctx, &device, wait);
  1.1061  }
  1.1062  
  1.1063  libxl_nicinfo *libxl_list_nics(libxl_ctx *ctx, uint32_t domid, unsigned int *nb)
  1.1064 @@ -2060,50 +2060,50 @@ libxl_nicinfo *libxl_list_nics(libxl_ctx
  1.1065      unsigned int nb_nics, i;
  1.1066      libxl_nicinfo *res, *nics;
  1.1067  
  1.1068 -    dompath = libxl_xs_get_dompath(&gc, domid);
  1.1069 +    dompath = libxl__xs_get_dompath(&gc, domid);
  1.1070      if (!dompath)
  1.1071          goto err;
  1.1072 -    list = l = libxl_xs_directory(&gc, XBT_NULL,
  1.1073 -                           libxl_sprintf(&gc, "%s/device/vif", dompath), &nb_nics);
  1.1074 +    list = l = libxl__xs_directory(&gc, XBT_NULL,
  1.1075 +                           libxl__sprintf(&gc, "%s/device/vif", dompath), &nb_nics);
  1.1076      if (!l)
  1.1077          goto err;
  1.1078      nics = res = calloc(nb_nics, sizeof (libxl_device_nic));
  1.1079      if (!res)
  1.1080          goto err;
  1.1081      for (*nb = nb_nics; nb_nics > 0; --nb_nics, ++l, ++nics) {
  1.1082 -        nic_path_fe = libxl_sprintf(&gc, "%s/device/vif/%s", dompath, *l);
  1.1083 +        nic_path_fe = libxl__sprintf(&gc, "%s/device/vif/%s", dompath, *l);
  1.1084  
  1.1085          nics->backend = xs_read(ctx->xsh, XBT_NULL,
  1.1086 -                                libxl_sprintf(&gc, "%s/backend", nic_path_fe), NULL);
  1.1087 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend-id", nic_path_fe));
  1.1088 +                                libxl__sprintf(&gc, "%s/backend", nic_path_fe), NULL);
  1.1089 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", nic_path_fe));
  1.1090          nics->backend_id = val ? strtoul(val, NULL, 10) : -1;
  1.1091  
  1.1092          nics->devid = strtoul(*l, NULL, 10);
  1.1093 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/state", nic_path_fe));
  1.1094 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/state", nic_path_fe));
  1.1095          nics->state = val ? strtoul(val, NULL, 10) : -1;
  1.1096 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/mac", nic_path_fe));
  1.1097 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", nic_path_fe));
  1.1098          for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
  1.1099               ++i, tok = strtok(NULL, ":")) {
  1.1100              nics->mac[i] = strtoul(tok, NULL, 16);
  1.1101          }
  1.1102 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/event-channel", nic_path_fe));
  1.1103 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/event-channel", nic_path_fe));
  1.1104          nics->evtch = val ? strtol(val, NULL, 10) : -1;
  1.1105 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/tx-ring-ref", nic_path_fe));
  1.1106 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/tx-ring-ref", nic_path_fe));
  1.1107          nics->rref_tx = val ? strtol(val, NULL, 10) : -1;
  1.1108 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/rx-ring-ref", nic_path_fe));
  1.1109 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/rx-ring-ref", nic_path_fe));
  1.1110          nics->rref_rx = val ? strtol(val, NULL, 10) : -1;
  1.1111          nics->frontend = xs_read(ctx->xsh, XBT_NULL,
  1.1112 -                                 libxl_sprintf(&gc, "%s/frontend", nics->backend), NULL);
  1.1113 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/frontend-id", nics->backend));
  1.1114 +                                 libxl__sprintf(&gc, "%s/frontend", nics->backend), NULL);
  1.1115 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/frontend-id", nics->backend));
  1.1116          nics->frontend_id = val ? strtoul(val, NULL, 10) : -1;
  1.1117          nics->script = xs_read(ctx->xsh, XBT_NULL,
  1.1118 -                               libxl_sprintf(&gc, "%s/script", nics->backend), NULL);
  1.1119 +                               libxl__sprintf(&gc, "%s/script", nics->backend), NULL);
  1.1120      }
  1.1121  
  1.1122 -    libxl_free_all(&gc);
  1.1123 +    libxl__free_all(&gc);
  1.1124      return res;
  1.1125  err:
  1.1126 -    libxl_free_all(&gc);
  1.1127 +    libxl__free_all(&gc);
  1.1128      return NULL;
  1.1129  }
  1.1130  
  1.1131 @@ -2129,15 +2129,15 @@ int libxl_device_net2_add(libxl_ctx *ctx
  1.1132          goto err_free;
  1.1133      }
  1.1134  
  1.1135 -    if (!(dompath = libxl_xs_get_dompath(&gc, domid))) {
  1.1136 +    if (!(dompath = libxl__xs_get_dompath(&gc, domid))) {
  1.1137          rc = ERROR_FAIL;
  1.1138          goto err_free;
  1.1139      }
  1.1140 -    dom = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/name", dompath));
  1.1141 +    dom = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/name", dompath));
  1.1142  
  1.1143      if (net2->devid == -1) {
  1.1144 -        if (!(l = libxl_xs_directory(&gc, XBT_NULL,
  1.1145 -                                     libxl_sprintf(&gc, "%s/device/vif2", dompath), &nb))) {
  1.1146 +        if (!(l = libxl__xs_directory(&gc, XBT_NULL,
  1.1147 +                                     libxl__sprintf(&gc, "%s/device/vif2", dompath), &nb))) {
  1.1148              net2->devid = 0;
  1.1149          } else {
  1.1150              net2->devid = strtoul(l[nb - 1], NULL, 10) + 1;
  1.1151 @@ -2154,62 +2154,62 @@ int libxl_device_net2_add(libxl_ctx *ctx
  1.1152      flexarray_set(back, boffset++, "domain");
  1.1153      flexarray_set(back, boffset++, dom);
  1.1154      flexarray_set(back, boffset++, "frontend-id");
  1.1155 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", net2->domid));
  1.1156 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", net2->domid));
  1.1157  
  1.1158      flexarray_set(back, boffset++, "local-trusted");
  1.1159 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", net2->back_trusted));
  1.1160 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", net2->back_trusted));
  1.1161      flexarray_set(back, boffset++, "mac");
  1.1162 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
  1.1163 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
  1.1164                                                   net2->back_mac[0], net2->back_mac[1],
  1.1165                                                   net2->back_mac[2], net2->back_mac[3],
  1.1166                                                   net2->back_mac[4], net2->back_mac[5]));
  1.1167  
  1.1168      flexarray_set(back, boffset++, "remote-trusted");
  1.1169 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", net2->trusted));
  1.1170 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", net2->trusted));
  1.1171      flexarray_set(back, boffset++, "remote-mac");
  1.1172 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
  1.1173 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
  1.1174                                                   net2->front_mac[0], net2->front_mac[1],
  1.1175                                                   net2->front_mac[2], net2->front_mac[3],
  1.1176                                                   net2->front_mac[4], net2->front_mac[5]));
  1.1177  
  1.1178      flexarray_set(back, boffset++, "max-bypasses");
  1.1179 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", net2->max_bypasses));
  1.1180 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", net2->max_bypasses));
  1.1181      flexarray_set(back, boffset++, "filter-mac");
  1.1182 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", !!(net2->filter_mac)));
  1.1183 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", !!(net2->filter_mac)));
  1.1184      flexarray_set(back, boffset++, "handle");
  1.1185 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", net2->devid));
  1.1186 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", net2->devid));
  1.1187      flexarray_set(back, boffset++, "online");
  1.1188      flexarray_set(back, boffset++, "1");
  1.1189      flexarray_set(back, boffset++, "state");
  1.1190      flexarray_set(back, boffset++, "1");
  1.1191  
  1.1192      flexarray_set(front, foffset++, "backend-id");
  1.1193 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", net2->backend_domid));
  1.1194 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", net2->backend_domid));
  1.1195  
  1.1196      flexarray_set(front, foffset++, "local-trusted");
  1.1197 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", net2->trusted));
  1.1198 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", net2->trusted));
  1.1199      flexarray_set(front, foffset++, "mac");
  1.1200 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
  1.1201 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
  1.1202                                                    net2->front_mac[0], net2->front_mac[1],
  1.1203                                                    net2->front_mac[2], net2->front_mac[3],
  1.1204                                                    net2->front_mac[4], net2->front_mac[5]));
  1.1205  
  1.1206      flexarray_set(front, foffset++, "remote-trusted");
  1.1207 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", net2->back_trusted));
  1.1208 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", net2->back_trusted));
  1.1209      flexarray_set(front, foffset++, "remote-mac");
  1.1210 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
  1.1211 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
  1.1212                                                    net2->back_mac[0], net2->back_mac[1],
  1.1213                                                    net2->back_mac[2], net2->back_mac[3],
  1.1214                                                    net2->back_mac[4], net2->back_mac[5]));
  1.1215  
  1.1216      flexarray_set(front, foffset++, "filter-mac");
  1.1217 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", !!(net2->filter_mac)));
  1.1218 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", !!(net2->filter_mac)));
  1.1219      flexarray_set(front, foffset++, "state");
  1.1220      flexarray_set(front, foffset++, "1");
  1.1221  
  1.1222 -    libxl_device_generic_add(ctx, &device,
  1.1223 -                             libxl_xs_kvs_of_flexarray(&gc, back, boffset),
  1.1224 -                             libxl_xs_kvs_of_flexarray(&gc, front, foffset));
  1.1225 +    libxl__device_generic_add(ctx, &device,
  1.1226 +                             libxl__xs_kvs_of_flexarray(&gc, back, boffset),
  1.1227 +                             libxl__xs_kvs_of_flexarray(&gc, front, foffset));
  1.1228  
  1.1229      /* FIXME: wait for plug */
  1.1230      rc = 0;
  1.1231 @@ -2217,7 +2217,7 @@ err_free:
  1.1232      flexarray_free(back);
  1.1233      flexarray_free(front);
  1.1234  err:
  1.1235 -    libxl_free_all(&gc);
  1.1236 +    libxl__free_all(&gc);
  1.1237      return rc;
  1.1238  }
  1.1239  
  1.1240 @@ -2230,11 +2230,11 @@ libxl_net2info *libxl_device_net2_list(l
  1.1241      unsigned int nb_net2s, i;
  1.1242      libxl_net2info *res, *net2s;
  1.1243  
  1.1244 -    dompath = libxl_xs_get_dompath(&gc, domid);
  1.1245 +    dompath = libxl__xs_get_dompath(&gc, domid);
  1.1246      if (!dompath)
  1.1247          goto err;
  1.1248 -    l = libxl_xs_directory(&gc, XBT_NULL,
  1.1249 -                           libxl_sprintf(&gc, "%s/device/vif2", dompath), &nb_net2s);
  1.1250 +    l = libxl__xs_directory(&gc, XBT_NULL,
  1.1251 +                           libxl__sprintf(&gc, "%s/device/vif2", dompath), &nb_net2s);
  1.1252      if (!l)
  1.1253          goto err;
  1.1254      res = calloc(nb_net2s, sizeof (libxl_net2info));
  1.1255 @@ -2242,43 +2242,43 @@ libxl_net2info *libxl_device_net2_list(l
  1.1256          goto err;
  1.1257      net2s = res;
  1.1258      for (*nb = nb_net2s; nb_net2s > 0; --nb_net2s, ++l, ++net2s) {
  1.1259 -        net2_path_fe = libxl_sprintf(&gc, "%s/device/vif2/%s", dompath, *l);
  1.1260 -
  1.1261 -        net2s->backend = libxl_xs_read(&gc, XBT_NULL,
  1.1262 -                                       libxl_sprintf(&gc, "%s/backend", net2_path_fe));
  1.1263 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend-id", net2_path_fe));
  1.1264 +        net2_path_fe = libxl__sprintf(&gc, "%s/device/vif2/%s", dompath, *l);
  1.1265 +
  1.1266 +        net2s->backend = libxl__xs_read(&gc, XBT_NULL,
  1.1267 +                                       libxl__sprintf(&gc, "%s/backend", net2_path_fe));
  1.1268 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", net2_path_fe));
  1.1269          net2s->backend_id = val ? strtoul(val, NULL, 10) : -1;
  1.1270  
  1.1271          net2s->devid = strtoul(*l, NULL, 10);
  1.1272 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/state", net2_path_fe));
  1.1273 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/state", net2_path_fe));
  1.1274          net2s->state = val ? strtoul(val, NULL, 10) : -1;
  1.1275  
  1.1276 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/mac", net2_path_fe));
  1.1277 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", net2_path_fe));
  1.1278          for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
  1.1279               ++i, tok = strtok(NULL, ":")) {
  1.1280              net2s->mac[i] = strtoul(tok, NULL, 16);
  1.1281          }
  1.1282 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/remote-trusted", net2_path_fe));
  1.1283 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/remote-trusted", net2_path_fe));
  1.1284          net2s->trusted = val ? strtoul(val, NULL, 10) : -1;
  1.1285  
  1.1286 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/remote-mac", net2_path_fe));
  1.1287 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/remote-mac", net2_path_fe));
  1.1288          for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
  1.1289               ++i, tok = strtok(NULL, ":")) {
  1.1290              net2s->back_mac[i] = strtoul(tok, NULL, 16);
  1.1291          }
  1.1292 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/filter-mac", net2_path_fe));
  1.1293 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/filter-mac", net2_path_fe));
  1.1294          net2s->filter_mac = val ? strtoul(val, NULL, 10) : -1;
  1.1295  
  1.1296 -        net2s->frontend = libxl_xs_read(&gc, XBT_NULL,
  1.1297 -                                        libxl_sprintf(&gc, "%s/frontend", net2s->backend));
  1.1298 -        val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/frontend-id", net2s->backend));
  1.1299 +        net2s->frontend = libxl__xs_read(&gc, XBT_NULL,
  1.1300 +                                        libxl__sprintf(&gc, "%s/frontend", net2s->backend));
  1.1301 +        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/frontend-id", net2s->backend));
  1.1302          net2s->frontend_id = val ? strtoul(val, NULL, 10) : -1;
  1.1303      }
  1.1304  
  1.1305 -    libxl_free_all(&gc);
  1.1306 +    libxl__free_all(&gc);
  1.1307      return res;
  1.1308  err:
  1.1309 -    libxl_free_all(&gc);
  1.1310 +    libxl__free_all(&gc);
  1.1311      return NULL;
  1.1312  }
  1.1313  
  1.1314 @@ -2293,7 +2293,7 @@ int libxl_device_net2_del(libxl_ctx *ctx
  1.1315      device.domid            = net2->domid;
  1.1316      device.kind             = DEVICE_VIF2;
  1.1317  
  1.1318 -    return libxl_device_del(ctx, &device, wait);
  1.1319 +    return libxl__device_del(ctx, &device, wait);
  1.1320  }
  1.1321  
  1.1322  
  1.1323 @@ -2310,13 +2310,13 @@ int libxl_device_console_add(libxl_ctx *
  1.1324  
  1.1325      if (console->build_state) {
  1.1326          xs_transaction_t t;
  1.1327 -        char **ents = (char **) libxl_calloc(&gc, 11, sizeof(char *));
  1.1328 +        char **ents = (char **) libxl__calloc(&gc, 11, sizeof(char *));
  1.1329          ents[0] = "console/port";
  1.1330 -        ents[1] = libxl_sprintf(&gc, "%"PRIu32, console->build_state->console_port);
  1.1331 +        ents[1] = libxl__sprintf(&gc, "%"PRIu32, console->build_state->console_port);
  1.1332          ents[2] = "console/ring-ref";
  1.1333 -        ents[3] = libxl_sprintf(&gc, "%lu", console->build_state->console_mfn);
  1.1334 +        ents[3] = libxl__sprintf(&gc, "%lu", console->build_state->console_mfn);
  1.1335          ents[4] = "console/limit";
  1.1336 -        ents[5] = libxl_sprintf(&gc, "%d", LIBXL_XENCONSOLE_LIMIT);
  1.1337 +        ents[5] = libxl__sprintf(&gc, "%d", LIBXL_XENCONSOLE_LIMIT);
  1.1338          ents[6] = "console/type";
  1.1339          if (console->consback == LIBXL_CONSBACK_XENCONSOLED)
  1.1340              ents[7] = "xenconsoled";
  1.1341 @@ -2326,7 +2326,7 @@ int libxl_device_console_add(libxl_ctx *
  1.1342          ents[9] = console->output;
  1.1343  retry_transaction:
  1.1344          t = xs_transaction_start(ctx->xsh);
  1.1345 -        libxl_xs_writev(&gc, t, libxl_xs_get_dompath(&gc, console->domid), ents);
  1.1346 +        libxl__xs_writev(&gc, t, libxl__xs_get_dompath(&gc, console->domid), ents);
  1.1347          if (!xs_transaction_end(ctx->xsh, t, 0))
  1.1348              if (errno == EAGAIN)
  1.1349                  goto retry_transaction;
  1.1350 @@ -2351,13 +2351,13 @@ retry_transaction:
  1.1351      device.kind = DEVICE_CONSOLE;
  1.1352  
  1.1353      flexarray_set(back, boffset++, "frontend-id");
  1.1354 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", console->domid));
  1.1355 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", console->domid));
  1.1356      flexarray_set(back, boffset++, "online");
  1.1357      flexarray_set(back, boffset++, "1");
  1.1358      flexarray_set(back, boffset++, "state");
  1.1359 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", 1));
  1.1360 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", 1));
  1.1361      flexarray_set(back, boffset++, "domain");
  1.1362 -    flexarray_set(back, boffset++, _libxl_domid_to_name(&gc, domid));
  1.1363 +    flexarray_set(back, boffset++, libxl__domid_to_name(&gc, domid));
  1.1364      flexarray_set(back, boffset++, "protocol");
  1.1365      flexarray_set(back, boffset++, LIBXL_XENCONSOLE_PROTOCOL);
  1.1366  
  1.1367 @@ -2365,11 +2365,11 @@ retry_transaction:
  1.1368       * it has already been added to console/ */
  1.1369      if (device.devid > 0) {
  1.1370          flexarray_set(front, foffset++, "backend-id");
  1.1371 -        flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", console->backend_domid));
  1.1372 +        flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", console->backend_domid));
  1.1373          flexarray_set(front, foffset++, "state");
  1.1374 -        flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", 1));
  1.1375 +        flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", 1));
  1.1376          flexarray_set(front, foffset++, "limit");
  1.1377 -        flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", LIBXL_XENCONSOLE_LIMIT));
  1.1378 +        flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", LIBXL_XENCONSOLE_LIMIT));
  1.1379          flexarray_set(front, foffset++, "protocol");
  1.1380          flexarray_set(front, foffset++, LIBXL_XENCONSOLE_PROTOCOL);
  1.1381          flexarray_set(front, foffset++, "type");
  1.1382 @@ -2381,15 +2381,15 @@ retry_transaction:
  1.1383          flexarray_set(front, foffset++, console->output);
  1.1384      }
  1.1385  
  1.1386 -    libxl_device_generic_add(ctx, &device,
  1.1387 -                             libxl_xs_kvs_of_flexarray(&gc, back, boffset),
  1.1388 -                             libxl_xs_kvs_of_flexarray(&gc, front, foffset));
  1.1389 +    libxl__device_generic_add(ctx, &device,
  1.1390 +                             libxl__xs_kvs_of_flexarray(&gc, back, boffset),
  1.1391 +                             libxl__xs_kvs_of_flexarray(&gc, front, foffset));
  1.1392      rc = 0;
  1.1393  out_free:
  1.1394      flexarray_free(back);
  1.1395      flexarray_free(front);
  1.1396  out:
  1.1397 -    libxl_free_all(&gc);
  1.1398 +    libxl__free_all(&gc);
  1.1399      return rc;
  1.1400  }
  1.1401  
  1.1402 @@ -2423,28 +2423,28 @@ int libxl_device_vkb_add(libxl_ctx *ctx,
  1.1403      device.kind = DEVICE_VKBD;
  1.1404  
  1.1405      flexarray_set(back, boffset++, "frontend-id");
  1.1406 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vkb->domid));
  1.1407 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vkb->domid));
  1.1408      flexarray_set(back, boffset++, "online");
  1.1409      flexarray_set(back, boffset++, "1");
  1.1410      flexarray_set(back, boffset++, "state");
  1.1411 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", 1));
  1.1412 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", 1));
  1.1413      flexarray_set(back, boffset++, "domain");
  1.1414 -    flexarray_set(back, boffset++, _libxl_domid_to_name(&gc, domid));
  1.1415 +    flexarray_set(back, boffset++, libxl__domid_to_name(&gc, domid));
  1.1416  
  1.1417      flexarray_set(front, foffset++, "backend-id");
  1.1418 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", vkb->backend_domid));
  1.1419 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", vkb->backend_domid));
  1.1420      flexarray_set(front, foffset++, "state");
  1.1421 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", 1));
  1.1422 -
  1.1423 -    libxl_device_generic_add(ctx, &device,
  1.1424 -                             libxl_xs_kvs_of_flexarray(&gc, back, boffset),
  1.1425 -                             libxl_xs_kvs_of_flexarray(&gc, front, foffset));
  1.1426 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", 1));
  1.1427 +
  1.1428 +    libxl__device_generic_add(ctx, &device,
  1.1429 +                             libxl__xs_kvs_of_flexarray(&gc, back, boffset),
  1.1430 +                             libxl__xs_kvs_of_flexarray(&gc, front, foffset));
  1.1431      rc = 0;
  1.1432  out_free:
  1.1433      flexarray_free(back);
  1.1434      flexarray_free(front);
  1.1435  out:
  1.1436 -    libxl_free_all(&gc);
  1.1437 +    libxl__free_all(&gc);
  1.1438      return rc;
  1.1439  }
  1.1440  
  1.1441 @@ -2467,10 +2467,10 @@ libxl_device_disk *libxl_device_disk_lis
  1.1442      unsigned int numl, len;
  1.1443      char *type;
  1.1444  
  1.1445 -    be_path_vbd = libxl_sprintf(&gc, "%s/backend/vbd/%d", libxl_xs_get_dompath(&gc, 0), domid);
  1.1446 -    be_path_tap = libxl_sprintf(&gc, "%s/backend/tap/%d", libxl_xs_get_dompath(&gc, 0), domid);
  1.1447 -
  1.1448 -    b = l = libxl_xs_directory(&gc, XBT_NULL, be_path_vbd, &numl);
  1.1449 +    be_path_vbd = libxl__sprintf(&gc, "%s/backend/vbd/%d", libxl__xs_get_dompath(&gc, 0), domid);
  1.1450 +    be_path_tap = libxl__sprintf(&gc, "%s/backend/tap/%d", libxl__xs_get_dompath(&gc, 0), domid);
  1.1451 +
  1.1452 +    b = l = libxl__xs_directory(&gc, XBT_NULL, be_path_vbd, &numl);
  1.1453      if (l) {
  1.1454          ret = realloc(ret, sizeof(libxl_device_disk) * numl);
  1.1455          disks = ret;
  1.1456 @@ -2479,19 +2479,19 @@ libxl_device_disk *libxl_device_disk_lis
  1.1457          for (; disks < dend; ++disks, ++l) {
  1.1458              disks->backend_domid = 0;
  1.1459              disks->domid = domid;
  1.1460 -            disks->physpath = xs_read(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "%s/%s/params", be_path_vbd, *l), &len);
  1.1461 -            libxl_string_to_phystype(ctx, libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/type", be_path_vbd, *l)), &(disks->phystype));
  1.1462 -            disks->virtpath = xs_read(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "%s/%s/dev", be_path_vbd, *l), &len);
  1.1463 -            disks->unpluggable = atoi(libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/removable", be_path_vbd, *l)));
  1.1464 -            if (!strcmp(libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/mode", be_path_vbd, *l)), "w"))
  1.1465 +            disks->physpath = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/%s/params", be_path_vbd, *l), &len);
  1.1466 +            libxl_string_to_phystype(ctx, libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/type", be_path_vbd, *l)), &(disks->phystype));
  1.1467 +            disks->virtpath = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/%s/dev", be_path_vbd, *l), &len);
  1.1468 +            disks->unpluggable = atoi(libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/removable", be_path_vbd, *l)));
  1.1469 +            if (!strcmp(libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/mode", be_path_vbd, *l)), "w"))
  1.1470                  disks->readwrite = 1;
  1.1471              else
  1.1472                  disks->readwrite = 0;
  1.1473 -            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))));
  1.1474 +            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))));
  1.1475              disks->is_cdrom = !strcmp(type, "cdrom");
  1.1476          }
  1.1477      }
  1.1478 -    b = l = libxl_xs_directory(&gc, XBT_NULL, be_path_tap, &numl);
  1.1479 +    b = l = libxl__xs_directory(&gc, XBT_NULL, be_path_tap, &numl);
  1.1480      if (l) {
  1.1481          ret = realloc(ret, sizeof(libxl_device_disk) * (*num + numl));
  1.1482          disks = ret + *num;
  1.1483 @@ -2499,19 +2499,19 @@ libxl_device_disk *libxl_device_disk_lis
  1.1484          for (dend = ret + *num; disks < dend; ++disks, ++l) {
  1.1485              disks->backend_domid = 0;
  1.1486              disks->domid = domid;
  1.1487 -            disks->physpath = xs_read(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "%s/%s/params", be_path_tap, *l), &len);
  1.1488 -            libxl_string_to_phystype(ctx, libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/type", be_path_tap, *l)), &(disks->phystype));
  1.1489 -            disks->virtpath = xs_read(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "%s/%s/dev", be_path_tap, *l), &len);
  1.1490 -            disks->unpluggable = atoi(libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/removable", be_path_tap, *l)));
  1.1491 -            if (!strcmp(libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/%s/mode", be_path_tap, *l)), "w"))
  1.1492 +            disks->physpath = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/%s/params", be_path_tap, *l), &len);
  1.1493 +            libxl_string_to_phystype(ctx, libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/type", be_path_tap, *l)), &(disks->phystype));
  1.1494 +            disks->virtpath = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/%s/dev", be_path_tap, *l), &len);
  1.1495 +            disks->unpluggable = atoi(libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/removable", be_path_tap, *l)));
  1.1496 +            if (!strcmp(libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/mode", be_path_tap, *l)), "w"))
  1.1497                  disks->readwrite = 1;
  1.1498              else
  1.1499                  disks->readwrite = 0;
  1.1500 -            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))));
  1.1501 +            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))));
  1.1502              disks->is_cdrom = !strcmp(type, "cdrom");
  1.1503          }
  1.1504      }
  1.1505 -    libxl_free_all(&gc);
  1.1506 +    libxl__free_all(&gc);
  1.1507      return ret;
  1.1508  }
  1.1509  
  1.1510 @@ -2522,31 +2522,31 @@ int libxl_device_disk_getinfo(libxl_ctx 
  1.1511      char *dompath, *diskpath;
  1.1512      char *val;
  1.1513  
  1.1514 -    dompath = libxl_xs_get_dompath(&gc, domid);
  1.1515 +    dompath = libxl__xs_get_dompath(&gc, domid);
  1.1516      diskinfo->devid = device_disk_dev_number(disk->virtpath);
  1.1517  
  1.1518      /* tap devices entries in xenstore are written as vbd devices. */
  1.1519 -    diskpath = libxl_sprintf(&gc, "%s/device/vbd/%d", dompath, diskinfo->devid);
  1.1520 +    diskpath = libxl__sprintf(&gc, "%s/device/vbd/%d", dompath, diskinfo->devid);
  1.1521      diskinfo->backend = xs_read(ctx->xsh, XBT_NULL,
  1.1522 -                                libxl_sprintf(&gc, "%s/backend", diskpath), NULL);
  1.1523 +                                libxl__sprintf(&gc, "%s/backend", diskpath), NULL);
  1.1524      if (!diskinfo->backend) {
  1.1525 -        libxl_free_all(&gc);
  1.1526 +        libxl__free_all(&gc);
  1.1527          return ERROR_FAIL;
  1.1528      }
  1.1529 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend-id", diskpath));
  1.1530 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", diskpath));
  1.1531      diskinfo->backend_id = val ? strtoul(val, NULL, 10) : -1;
  1.1532 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/state", diskpath));
  1.1533 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/state", diskpath));
  1.1534      diskinfo->state = val ? strtoul(val, NULL, 10) : -1;
  1.1535 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/event-channel", diskpath));
  1.1536 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/event-channel", diskpath));
  1.1537      diskinfo->evtch = val ? strtoul(val, NULL, 10) : -1;
  1.1538 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/ring-ref", diskpath));
  1.1539 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/ring-ref", diskpath));
  1.1540      diskinfo->rref = val ? strtoul(val, NULL, 10) : -1;
  1.1541      diskinfo->frontend = xs_read(ctx->xsh, XBT_NULL,
  1.1542 -                                 libxl_sprintf(&gc, "%s/frontend", diskinfo->backend), NULL);
  1.1543 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/frontend-id", diskinfo->backend));
  1.1544 +                                 libxl__sprintf(&gc, "%s/frontend", diskinfo->backend), NULL);
  1.1545 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/frontend-id", diskinfo->backend));
  1.1546      diskinfo->frontend_id = val ? strtoul(val, NULL, 10) : -1;
  1.1547  
  1.1548 -    libxl_free_all(&gc);
  1.1549 +    libxl__free_all(&gc);
  1.1550      return 0;
  1.1551  }
  1.1552  
  1.1553 @@ -2603,20 +2603,20 @@ static int libxl_build_xenpv_qemu_args(l
  1.1554      if (vfb != NULL) {
  1.1555          info->vnc = vfb->vnc;
  1.1556          if (vfb->vnclisten)
  1.1557 -            info->vnclisten = libxl_strdup(gc, vfb->vnclisten);
  1.1558 +            info->vnclisten = libxl__strdup(gc, vfb->vnclisten);
  1.1559          info->vncdisplay = vfb->vncdisplay;
  1.1560          info->vncunused = vfb->vncunused;
  1.1561          if (vfb->vncpasswd)
  1.1562              info->vncpasswd = vfb->vncpasswd;
  1.1563          if (vfb->keymap)
  1.1564 -            info->keymap = libxl_strdup(gc, vfb->keymap);
  1.1565 +            info->keymap = libxl__strdup(gc, vfb->keymap);
  1.1566          info->sdl = vfb->sdl;
  1.1567          info->opengl = vfb->opengl;
  1.1568      } else
  1.1569          info->nographic = 1;
  1.1570      info->domid = domid;
  1.1571      info->dom_name = libxl_domid_to_name(ctx, domid);
  1.1572 -    info->device_model = libxl_abs_path(gc, "qemu-dm", libxl_libexec_path());
  1.1573 +    info->device_model = libxl__abs_path(gc, "qemu-dm", libxl_libexec_path());
  1.1574      info->type = XENPV;
  1.1575      return 0;
  1.1576  }
  1.1577 @@ -2629,7 +2629,7 @@ int libxl_create_xenpv_qemu(libxl_ctx *c
  1.1578  
  1.1579      libxl_build_xenpv_qemu_args(&gc, domid, vfb, &info);
  1.1580      libxl_create_device_model(ctx, &info, NULL, 0, NULL, 0, starting_r);
  1.1581 -    libxl_free_all(&gc);
  1.1582 +    libxl__free_all(&gc);
  1.1583      return 0;
  1.1584  }
  1.1585  
  1.1586 @@ -2662,27 +2662,27 @@ int libxl_device_vfb_add(libxl_ctx *ctx,
  1.1587      device.kind = DEVICE_VFB;
  1.1588  
  1.1589      flexarray_set(back, boffset++, "frontend-id");
  1.1590 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vfb->domid));
  1.1591 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vfb->domid));
  1.1592      flexarray_set(back, boffset++, "online");
  1.1593      flexarray_set(back, boffset++, "1");
  1.1594      flexarray_set(back, boffset++, "state");
  1.1595 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", 1));
  1.1596 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", 1));
  1.1597      flexarray_set(back, boffset++, "domain");
  1.1598 -    flexarray_set(back, boffset++, _libxl_domid_to_name(&gc, domid));
  1.1599 +    flexarray_set(back, boffset++, libxl__domid_to_name(&gc, domid));
  1.1600      flexarray_set(back, boffset++, "vnc");
  1.1601 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vfb->vnc));
  1.1602 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vfb->vnc));
  1.1603      flexarray_set(back, boffset++, "vnclisten");
  1.1604      flexarray_set(back, boffset++, vfb->vnclisten);
  1.1605      flexarray_set(back, boffset++, "vncpasswd");
  1.1606      flexarray_set(back, boffset++, vfb->vncpasswd);
  1.1607      flexarray_set(back, boffset++, "vncdisplay");
  1.1608 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vfb->vncdisplay));
  1.1609 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vfb->vncdisplay));
  1.1610      flexarray_set(back, boffset++, "vncunused");
  1.1611 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vfb->vncunused));
  1.1612 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vfb->vncunused));
  1.1613      flexarray_set(back, boffset++, "sdl");
  1.1614 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vfb->sdl));
  1.1615 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vfb->sdl));
  1.1616      flexarray_set(back, boffset++, "opengl");
  1.1617 -    flexarray_set(back, boffset++, libxl_sprintf(&gc, "%d", vfb->opengl));
  1.1618 +    flexarray_set(back, boffset++, libxl__sprintf(&gc, "%d", vfb->opengl));
  1.1619      if (vfb->xauthority) {
  1.1620          flexarray_set(back, boffset++, "xauthority");
  1.1621          flexarray_set(back, boffset++, vfb->xauthority);
  1.1622 @@ -2693,19 +2693,19 @@ int libxl_device_vfb_add(libxl_ctx *ctx,
  1.1623      }
  1.1624  
  1.1625      flexarray_set(front, foffset++, "backend-id");
  1.1626 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", vfb->backend_domid));
  1.1627 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", vfb->backend_domid));
  1.1628      flexarray_set(front, foffset++, "state");
  1.1629 -    flexarray_set(front, foffset++, libxl_sprintf(&gc, "%d", 1));
  1.1630 -
  1.1631 -    libxl_device_generic_add(ctx, &device,
  1.1632 -                             libxl_xs_kvs_of_flexarray(&gc, back, boffset),
  1.1633 -                             libxl_xs_kvs_of_flexarray(&gc, front, foffset));
  1.1634 +    flexarray_set(front, foffset++, libxl__sprintf(&gc, "%d", 1));
  1.1635 +
  1.1636 +    libxl__device_generic_add(ctx, &device,
  1.1637 +                             libxl__xs_kvs_of_flexarray(&gc, back, boffset),
  1.1638 +                             libxl__xs_kvs_of_flexarray(&gc, front, foffset));
  1.1639      rc = 0;
  1.1640  out_free:
  1.1641      flexarray_free(front);
  1.1642      flexarray_free(back);
  1.1643  out:
  1.1644 -    libxl_free_all(&gc);
  1.1645 +    libxl__free_all(&gc);
  1.1646      return rc;
  1.1647  }
  1.1648  
  1.1649 @@ -2726,10 +2726,10 @@ int libxl_domain_setmaxmem(libxl_ctx *ct
  1.1650      libxl_gc gc = LIBXL_INIT_GC(ctx);
  1.1651      char *mem, *endptr;
  1.1652      uint32_t memorykb;
  1.1653 -    char *dompath = libxl_xs_get_dompath(&gc, domid);
  1.1654 +    char *dompath = libxl__xs_get_dompath(&gc, domid);
  1.1655      int rc = 1;
  1.1656  
  1.1657 -    mem = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/memory/target", dompath));
  1.1658 +    mem = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/memory/target", dompath));
  1.1659      if (!mem) {
  1.1660          XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "cannot get memory info from %s/memory/target\n", dompath);
  1.1661          goto out;
  1.1662 @@ -2746,11 +2746,11 @@ int libxl_domain_setmaxmem(libxl_ctx *ct
  1.1663      }
  1.1664  
  1.1665      if (domid != 0)
  1.1666 -        libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/memory/static-max", dompath), "%"PRIu32, max_memkb);
  1.1667 +        libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/memory/static-max", dompath), "%"PRIu32, max_memkb);
  1.1668  
  1.1669      rc = 0;
  1.1670  out:
  1.1671 -    libxl_free_all(&gc);
  1.1672 +    libxl__free_all(&gc);
  1.1673      return rc;
  1.1674  }
  1.1675  
  1.1676 @@ -2760,13 +2760,13 @@ int libxl_set_memory_target(libxl_ctx *c
  1.1677      int rc = 1;
  1.1678      uint32_t memorykb = 0, videoram = 0;
  1.1679      char *memmax, *endptr, *videoram_s = NULL;
  1.1680 -    char *dompath = libxl_xs_get_dompath(&gc, domid);
  1.1681 +    char *dompath = libxl__xs_get_dompath(&gc, domid);
  1.1682      xc_domaininfo_t info;
  1.1683      libxl_dominfo ptr;
  1.1684      char *uuid;
  1.1685  
  1.1686      if (domid) {
  1.1687 -        memmax = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/memory/static-max", dompath));
  1.1688 +        memmax = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/memory/static-max", dompath));
  1.1689          if (!memmax) {
  1.1690              XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
  1.1691                  "cannot get memory info from %s/memory/static-max\n", dompath);
  1.1692 @@ -2786,17 +2786,17 @@ int libxl_set_memory_target(libxl_ctx *c
  1.1693          }
  1.1694      }
  1.1695  
  1.1696 -    videoram_s = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/memory/videoram", dompath));
  1.1697 +    videoram_s = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/memory/videoram", dompath));
  1.1698      videoram = videoram_s ? atoi(videoram_s) : 0;
  1.1699  
  1.1700 -    libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/memory/target", dompath), "%"PRIu32, target_memkb);
  1.1701 +    libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/memory/target", dompath), "%"PRIu32, target_memkb);
  1.1702  
  1.1703      rc = xc_domain_getinfolist(ctx->xch, domid, 1, &info);
  1.1704      if (rc != 1 || info.domain != domid)
  1.1705          goto out;
  1.1706      xcinfo2xlinfo(&info, &ptr);
  1.1707 -    uuid = libxl_uuid2string(&gc, ptr.uuid);
  1.1708 -    libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "/vm/%s/memory", uuid), "%"PRIu32, target_memkb / 1024);
  1.1709 +    uuid = libxl__uuid2string(&gc, ptr.uuid);
  1.1710 +    libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "/vm/%s/memory", uuid), "%"PRIu32, target_memkb / 1024);
  1.1711  
  1.1712      if (enforce || !domid)
  1.1713          memorykb = target_memkb;
  1.1714 @@ -2806,7 +2806,7 @@ int libxl_set_memory_target(libxl_ctx *c
  1.1715      rc = xc_domain_memory_set_pod_target(ctx->xch, domid, (target_memkb - videoram) / 4, NULL, NULL, NULL);
  1.1716  
  1.1717  out:
  1.1718 -    libxl_free_all(&gc);
  1.1719 +    libxl__free_all(&gc);
  1.1720      return rc;
  1.1721  }
  1.1722  
  1.1723 @@ -2969,14 +2969,14 @@ int libxl_set_vcpuonline(libxl_ctx *ctx,
  1.1724          XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting domain info list");
  1.1725          goto out;
  1.1726      }
  1.1727 -    if (!(dompath = libxl_xs_get_dompath(&gc, domid)))
  1.1728 +    if (!(dompath = libxl__xs_get_dompath(&gc, domid)))
  1.1729          goto out;
  1.1730  
  1.1731  retry_transaction:
  1.1732      t = xs_transaction_start(ctx->xsh);
  1.1733      for (i = 0; i <= info.vcpu_max_id; i++)
  1.1734 -        libxl_xs_write(&gc, t,
  1.1735 -                       libxl_sprintf(&gc, "%s/cpu/%u/availability", dompath, i),
  1.1736 +        libxl__xs_write(&gc, t,
  1.1737 +                       libxl__sprintf(&gc, "%s/cpu/%u/availability", dompath, i),
  1.1738                         "%s", ((1 << i) & bitmask) ? "online" : "offline");
  1.1739      if (!xs_transaction_end(ctx->xsh, t, 0)) {
  1.1740          if (errno == EAGAIN)
  1.1741 @@ -2984,7 +2984,7 @@ retry_transaction:
  1.1742      } else
  1.1743          rc = 0;
  1.1744  out:
  1.1745 -    libxl_free_all(&gc);
  1.1746 +    libxl__free_all(&gc);
  1.1747      return rc;
  1.1748  }
  1.1749  
  1.1750 @@ -3099,11 +3099,11 @@ int libxl_send_trigger(libxl_ctx *ctx, u
  1.1751  int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq)
  1.1752  {
  1.1753      libxl_gc gc = LIBXL_INIT_GC(ctx);
  1.1754 -    char *dompath = libxl_xs_get_dompath(&gc, domid);
  1.1755 -
  1.1756 -    libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/control/sysrq", dompath), "%c", sysrq);
  1.1757 -
  1.1758 -    libxl_free_all(&gc);
  1.1759 +    char *dompath = libxl__xs_get_dompath(&gc, domid);
  1.1760 +
  1.1761 +    libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/control/sysrq", dompath), "%c", sysrq);
  1.1762 +
  1.1763 +    libxl__free_all(&gc);
  1.1764      return 0;
  1.1765  }
  1.1766  
  1.1767 @@ -3191,14 +3191,14 @@ void libxl_xen_console_read_finish(libxl
  1.1768  uint32_t libxl_vm_get_start_time(libxl_ctx *ctx, uint32_t domid)
  1.1769  {
  1.1770      libxl_gc gc = LIBXL_INIT_GC(ctx);
  1.1771 -    char *dompath = libxl_xs_get_dompath(&gc, domid);
  1.1772 +    char *dompath = libxl__xs_get_dompath(&gc, domid);
  1.1773      char *vm_path, *start_time;
  1.1774      uint32_t ret;
  1.1775  
  1.1776 -    vm_path = libxl_xs_read(
  1.1777 -        &gc, XBT_NULL, libxl_sprintf(&gc, "%s/vm", dompath));
  1.1778 -    start_time = libxl_xs_read(
  1.1779 -        &gc, XBT_NULL, libxl_sprintf(&gc, "%s/start_time", vm_path));
  1.1780 +    vm_path = libxl__xs_read(
  1.1781 +        &gc, XBT_NULL, libxl__sprintf(&gc, "%s/vm", dompath));
  1.1782 +    start_time = libxl__xs_read(
  1.1783 +        &gc, XBT_NULL, libxl__sprintf(&gc, "%s/start_time", vm_path));
  1.1784      if (start_time == NULL) {
  1.1785          XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, -1,
  1.1786                          "Can't get start time of domain '%d'", domid);
  1.1787 @@ -3206,7 +3206,7 @@ uint32_t libxl_vm_get_start_time(libxl_c
  1.1788      }else{
  1.1789          ret = strtoul(start_time, NULL, 10);
  1.1790      }
  1.1791 -    libxl_free_all(&gc);
  1.1792 +    libxl__free_all(&gc);
  1.1793      return ret;
  1.1794  }
  1.1795  
     2.1 --- a/tools/libxl/libxl.h	Wed Sep 08 16:35:40 2010 +0100
     2.2 +++ b/tools/libxl/libxl.h	Wed Sep 08 16:44:24 2010 +0100
     2.3 @@ -119,7 +119,7 @@
     2.4   *
     2.5   * No temporary objects allocated from the pool may be explicitly freed.
     2.6   * Therefore public functions which initialize a libxl_gc MUST call
     2.7 - * libxl_free_all() before returning.
     2.8 + * libxl__free_all() before returning.
     2.9   */
    2.10  #ifndef LIBXL_H
    2.11  #define LIBXL_H
     3.1 --- a/tools/libxl/libxl_blktap2.c	Wed Sep 08 16:35:40 2010 +0100
     3.2 +++ b/tools/libxl/libxl_blktap2.c	Wed Sep 08 16:44:24 2010 +0100
     3.3 @@ -35,15 +35,15 @@ const char *libxl_blktap_devpath(libxl_g
     3.4      type = device_disk_string_of_phystype(phystype);
     3.5      minor = tap_ctl_find_minor(type, disk);
     3.6      if (minor >= 0) {
     3.7 -        devname = libxl_sprintf(gc, "/dev/xen/blktap-2/tapdev%d", minor);
     3.8 +        devname = libxl__sprintf(gc, "/dev/xen/blktap-2/tapdev%d", minor);
     3.9          if (devname)
    3.10              return devname;
    3.11      }
    3.12  
    3.13 -    params = libxl_sprintf(gc, "%s:%s", type, disk);
    3.14 +    params = libxl__sprintf(gc, "%s:%s", type, disk);
    3.15      err = tap_ctl_create(params, &devname);
    3.16      if (!err) {
    3.17 -        libxl_ptr_add(gc, devname);
    3.18 +        libxl__ptr_add(gc, devname);
    3.19          return devname;
    3.20      }
    3.21  
     4.1 --- a/tools/libxl/libxl_bootloader.c	Wed Sep 08 16:35:40 2010 +0100
     4.2 +++ b/tools/libxl/libxl_bootloader.c	Wed Sep 08 16:44:24 2010 +0100
     4.3 @@ -45,20 +45,20 @@ static char **make_bootloader_args(libxl
     4.4      flexarray_set(args, nr++, (char *)info->u.pv.bootloader);
     4.5  
     4.6      if (info->kernel.path)
     4.7 -        flexarray_set(args, nr++, libxl_sprintf(gc, "--kernel=%s", info->kernel.path));
     4.8 +        flexarray_set(args, nr++, libxl__sprintf(gc, "--kernel=%s", info->kernel.path));
     4.9      if (info->u.pv.ramdisk.path)
    4.10 -        flexarray_set(args, nr++, libxl_sprintf(gc, "--ramdisk=%s", info->u.pv.ramdisk.path));
    4.11 +        flexarray_set(args, nr++, libxl__sprintf(gc, "--ramdisk=%s", info->u.pv.ramdisk.path));
    4.12      if (info->u.pv.cmdline && *info->u.pv.cmdline != '\0')
    4.13 -        flexarray_set(args, nr++, libxl_sprintf(gc, "--args=%s", info->u.pv.cmdline));
    4.14 +        flexarray_set(args, nr++, libxl__sprintf(gc, "--args=%s", info->u.pv.cmdline));
    4.15  
    4.16 -    flexarray_set(args, nr++, libxl_sprintf(gc, "--output=%s", fifo));
    4.17 +    flexarray_set(args, nr++, libxl__sprintf(gc, "--output=%s", fifo));
    4.18      flexarray_set(args, nr++, "--output-format=simple0");
    4.19 -    flexarray_set(args, nr++, libxl_sprintf(gc, "--output-directory=%s", "/var/run/libxl/"));
    4.20 +    flexarray_set(args, nr++, libxl__sprintf(gc, "--output-directory=%s", "/var/run/libxl/"));
    4.21  
    4.22      if (info->u.pv.bootloader_args) {
    4.23          char *saveptr;
    4.24          /* Operate on a duplicate since strtok modifes the argument */
    4.25 -        char *dup = libxl_strdup(gc, info->u.pv.bootloader_args);
    4.26 +        char *dup = libxl__strdup(gc, info->u.pv.bootloader_args);
    4.27          char *t = strtok_r(dup, " \t\n", &saveptr);
    4.28          do {
    4.29              flexarray_set(args, nr++, t);
    4.30 @@ -126,7 +126,7 @@ static pid_t fork_exec_bootloader(int *m
    4.31          return -1;
    4.32      else if (pid == 0) {
    4.33          setenv("TERM", "vt100", 1);
    4.34 -        libxl_exec(-1, -1, -1, arg0, args);
    4.35 +        libxl__exec(-1, -1, -1, arg0, args);
    4.36          return -1;
    4.37      }
    4.38  
    4.39 @@ -263,7 +263,7 @@ static char * bootloader_interact(libxl_
    4.40          }
    4.41      }
    4.42  
    4.43 -    libxl_ptr_add(gc, output);
    4.44 +    libxl__ptr_add(gc, output);
    4.45      return output;
    4.46  
    4.47  out_err:
    4.48 @@ -383,8 +383,8 @@ int libxl_run_bootloader(libxl_ctx *ctx,
    4.49          goto out_close;
    4.50      }
    4.51  
    4.52 -    dom_console_xs_path = libxl_sprintf(&gc, "%s/console/tty", libxl_xs_get_dompath(&gc, domid));
    4.53 -    libxl_xs_write(&gc, XBT_NULL, dom_console_xs_path, "%s", dom_console_slave_tty_path);
    4.54 +    dom_console_xs_path = libxl__sprintf(&gc, "%s/console/tty", libxl__xs_get_dompath(&gc, domid));
    4.55 +    libxl__xs_write(&gc, XBT_NULL, dom_console_xs_path, "%s", dom_console_slave_tty_path);
    4.56  
    4.57      pid = fork_exec_bootloader(&bootloader_fd, (char *)info->u.pv.bootloader, args);
    4.58      if (pid < 0) {
    4.59 @@ -441,7 +441,7 @@ out_close:
    4.60      free(args);
    4.61  
    4.62  out:
    4.63 -    libxl_free_all(&gc);
    4.64 +    libxl__free_all(&gc);
    4.65      return rc;
    4.66  }
    4.67  
     5.1 --- a/tools/libxl/libxl_device.c	Wed Sep 08 16:35:40 2010 +0100
     5.2 +++ b/tools/libxl/libxl_device.c	Wed Sep 08 16:44:24 2010 +0100
     5.3 @@ -39,7 +39,7 @@ static const char *string_of_kinds[] = {
     5.4      [DEVICE_CONSOLE] = "console",
     5.5  };
     5.6  
     5.7 -int libxl_device_generic_add(libxl_ctx *ctx, libxl_device *device,
     5.8 +int libxl__device_generic_add(libxl_ctx *ctx, libxl_device *device,
     5.9                               char **bents, char **fents)
    5.10  {
    5.11      libxl_gc gc = LIBXL_INIT_GC(ctx);
    5.12 @@ -54,12 +54,12 @@ int libxl_device_generic_add(libxl_ctx *
    5.13          goto out;
    5.14      }
    5.15  
    5.16 -    dom_path_backend = libxl_xs_get_dompath(&gc, device->backend_domid);
    5.17 -    dom_path = libxl_xs_get_dompath(&gc, device->domid);
    5.18 +    dom_path_backend = libxl__xs_get_dompath(&gc, device->backend_domid);
    5.19 +    dom_path = libxl__xs_get_dompath(&gc, device->domid);
    5.20  
    5.21 -    frontend_path = libxl_sprintf(&gc, "%s/device/%s/%d",
    5.22 +    frontend_path = libxl__sprintf(&gc, "%s/device/%s/%d",
    5.23                                    dom_path, string_of_kinds[device->kind], device->devid);
    5.24 -    backend_path = libxl_sprintf(&gc, "%s/backend/%s/%u/%d",
    5.25 +    backend_path = libxl__sprintf(&gc, "%s/backend/%s/%u/%d",
    5.26                                   dom_path_backend, string_of_kinds[device->backend_kind], device->domid, device->devid);
    5.27  
    5.28      frontend_perms[0].id = device->domid;
    5.29 @@ -80,16 +80,16 @@ retry_transaction:
    5.30          xs_rm(ctx->xsh, t, frontend_path);
    5.31          xs_mkdir(ctx->xsh, t, frontend_path);
    5.32          xs_set_permissions(ctx->xsh, t, frontend_path, frontend_perms, ARRAY_SIZE(frontend_perms));
    5.33 -        xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/backend", frontend_path), backend_path, strlen(backend_path));
    5.34 -        libxl_xs_writev(&gc, t, frontend_path, fents);
    5.35 +        xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/backend", frontend_path), backend_path, strlen(backend_path));
    5.36 +        libxl__xs_writev(&gc, t, frontend_path, fents);
    5.37      }
    5.38  
    5.39      if (bents) {
    5.40          xs_rm(ctx->xsh, t, backend_path);
    5.41          xs_mkdir(ctx->xsh, t, backend_path);
    5.42          xs_set_permissions(ctx->xsh, t, backend_path, backend_perms, ARRAY_SIZE(backend_perms));
    5.43 -        xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/frontend", backend_path), frontend_path, strlen(frontend_path));
    5.44 -        libxl_xs_writev(&gc, t, backend_path, bents);
    5.45 +        xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/frontend", backend_path), frontend_path, strlen(frontend_path));
    5.46 +        libxl__xs_writev(&gc, t, backend_path, bents);
    5.47      }
    5.48  
    5.49      if (!xs_transaction_end(ctx->xsh, t, 0)) {
    5.50 @@ -100,7 +100,7 @@ retry_transaction:
    5.51      }
    5.52      rc = 0;
    5.53  out:
    5.54 -    libxl_free_all(&gc);
    5.55 +    libxl__free_all(&gc);
    5.56      return rc;
    5.57  }
    5.58  
    5.59 @@ -226,12 +226,12 @@ int device_disk_dev_number(char *virtpat
    5.60      return -1;
    5.61  }
    5.62  
    5.63 -int libxl_device_destroy(libxl_ctx *ctx, char *be_path, int force)
    5.64 +int libxl__device_destroy(libxl_ctx *ctx, char *be_path, int force)
    5.65  {
    5.66      libxl_gc gc = LIBXL_INIT_GC(ctx);
    5.67      xs_transaction_t t;
    5.68 -    char *state_path = libxl_sprintf(&gc, "%s/state", be_path);
    5.69 -    char *state = libxl_xs_read(&gc, XBT_NULL, state_path);
    5.70 +    char *state_path = libxl__sprintf(&gc, "%s/state", be_path);
    5.71 +    char *state = libxl__xs_read(&gc, XBT_NULL, state_path);
    5.72      int rc = 0;
    5.73  
    5.74      if (!state)
    5.75 @@ -243,7 +243,7 @@ int libxl_device_destroy(libxl_ctx *ctx,
    5.76  
    5.77  retry_transaction:
    5.78      t = xs_transaction_start(ctx->xsh);
    5.79 -    xs_write(ctx->xsh, t, libxl_sprintf(&gc, "%s/online", be_path), "0", strlen("0"));
    5.80 +    xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/online", be_path), "0", strlen("0"));
    5.81      xs_write(ctx->xsh, t, state_path, "5", strlen("5"));
    5.82      if (!xs_transaction_end(ctx->xsh, t, 0)) {
    5.83          if (errno == EAGAIN)
    5.84 @@ -258,7 +258,7 @@ retry_transaction:
    5.85          rc = 1;
    5.86      }
    5.87  out:
    5.88 -    libxl_free_all(&gc);
    5.89 +    libxl__free_all(&gc);
    5.90      return rc;
    5.91  }
    5.92  
    5.93 @@ -277,7 +277,7 @@ static int wait_for_dev_destroy(libxl_ct
    5.94      if (select(nfds, &rfds, NULL, NULL, tv) > 0) {
    5.95          l1 = xs_read_watch(ctx->xsh, &n);
    5.96          if (l1 != NULL) {
    5.97 -            char *state = libxl_xs_read(&gc, XBT_NULL, l1[XS_WATCH_PATH]);
    5.98 +            char *state = libxl__xs_read(&gc, XBT_NULL, l1[XS_WATCH_PATH]);
    5.99              if (!state || atoi(state) == 6) {
   5.100                  xs_unwatch(ctx->xsh, l1[0], l1[1]);
   5.101                  xs_rm(ctx->xsh, XBT_NULL, l1[XS_WATCH_TOKEN]);
   5.102 @@ -287,11 +287,11 @@ static int wait_for_dev_destroy(libxl_ct
   5.103              free(l1);
   5.104          }
   5.105      }
   5.106 -    libxl_free_all(&gc);
   5.107 +    libxl__free_all(&gc);
   5.108      return rc;
   5.109  }
   5.110  
   5.111 -int libxl_devices_destroy(libxl_ctx *ctx, uint32_t domid, int force)
   5.112 +int libxl__devices_destroy(libxl_ctx *ctx, uint32_t domid, int force)
   5.113  {
   5.114      libxl_gc gc = LIBXL_INIT_GC(ctx);
   5.115      char *path, *be_path, *fe_path;
   5.116 @@ -301,8 +301,8 @@ int libxl_devices_destroy(libxl_ctx *ctx
   5.117      flexarray_t *toremove;
   5.118  
   5.119      toremove = flexarray_make(16, 1);
   5.120 -    path = libxl_sprintf(&gc, "/local/domain/%d/device", domid);
   5.121 -    l1 = libxl_xs_directory(&gc, XBT_NULL, path, &num1);
   5.122 +    path = libxl__sprintf(&gc, "/local/domain/%d/device", domid);
   5.123 +    l1 = libxl__xs_directory(&gc, XBT_NULL, path, &num1);
   5.124      if (!l1) {
   5.125          XL_LOG(ctx, XL_LOG_ERROR, "%s is empty", path);
   5.126          goto out;
   5.127 @@ -310,17 +310,17 @@ int libxl_devices_destroy(libxl_ctx *ctx
   5.128      for (i = 0; i < num1; i++) {
   5.129          if (!strcmp("vfs", l1[i]))
   5.130              continue;
   5.131 -        path = libxl_sprintf(&gc, "/local/domain/%d/device/%s", domid, l1[i]);
   5.132 -        l2 = libxl_xs_directory(&gc, XBT_NULL, path, &num2);
   5.133 +        path = libxl__sprintf(&gc, "/local/domain/%d/device/%s", domid, l1[i]);
   5.134 +        l2 = libxl__xs_directory(&gc, XBT_NULL, path, &num2);
   5.135          if (!l2)
   5.136              continue;
   5.137          for (j = 0; j < num2; j++) {
   5.138 -            fe_path = libxl_sprintf(&gc, "/local/domain/%d/device/%s/%s", domid, l1[i], l2[j]);
   5.139 -            be_path = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend", fe_path));
   5.140 +            fe_path = libxl__sprintf(&gc, "/local/domain/%d/device/%s/%s", domid, l1[i], l2[j]);
   5.141 +            be_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend", fe_path));
   5.142              if (be_path != NULL) {
   5.143 -                if (libxl_device_destroy(ctx, be_path, force) > 0)
   5.144 +                if (libxl__device_destroy(ctx, be_path, force) > 0)
   5.145                      n_watches++;
   5.146 -                flexarray_set(toremove, n++, libxl_dirname(&gc, be_path));
   5.147 +                flexarray_set(toremove, n++, libxl__dirname(&gc, be_path));
   5.148              } else {
   5.149                  xs_rm(ctx->xsh, XBT_NULL, path);
   5.150              }
   5.151 @@ -349,23 +349,23 @@ int libxl_devices_destroy(libxl_ctx *ctx
   5.152      }
   5.153  out:
   5.154      flexarray_free(toremove);
   5.155 -    libxl_free_all(&gc);
   5.156 +    libxl__free_all(&gc);
   5.157      return 0;
   5.158  }
   5.159  
   5.160 -int libxl_device_del(libxl_ctx *ctx, libxl_device *dev, int wait)
   5.161 +int libxl__device_del(libxl_ctx *ctx, libxl_device *dev, int wait)
   5.162  {
   5.163      libxl_gc gc = LIBXL_INIT_GC(ctx);
   5.164      char *dom_path_backend, *backend_path;
   5.165      int rc;
   5.166  
   5.167      /* Create strings */
   5.168 -    dom_path_backend    = libxl_xs_get_dompath(&gc, dev->backend_domid);
   5.169 -    backend_path        = libxl_sprintf(&gc, "%s/backend/%s/%u/%d",
   5.170 +    dom_path_backend    = libxl__xs_get_dompath(&gc, dev->backend_domid);
   5.171 +    backend_path        = libxl__sprintf(&gc, "%s/backend/%s/%u/%d",
   5.172                                      dom_path_backend, 
   5.173                                      string_of_kinds[dev->backend_kind], 
   5.174                                      dev->domid, dev->devid);
   5.175 -    rc = libxl_device_destroy(ctx, backend_path, !wait);
   5.176 +    rc = libxl__device_destroy(ctx, backend_path, !wait);
   5.177      if (rc == -1) {
   5.178          rc = ERROR_FAIL;
   5.179          goto out;
   5.180 @@ -381,11 +381,11 @@ int libxl_device_del(libxl_ctx *ctx, lib
   5.181      rc = 0;
   5.182  
   5.183  out:
   5.184 -    libxl_free_all(&gc);
   5.185 +    libxl__free_all(&gc);
   5.186      return rc;
   5.187  }
   5.188  
   5.189 -int libxl_wait_for_device_model(libxl_ctx *ctx,
   5.190 +int libxl__wait_for_device_model(libxl_ctx *ctx,
   5.191                                  uint32_t domid, char *state,
   5.192                                  int (*check_callback)(libxl_ctx *ctx,
   5.193                                                        uint32_t domid,
   5.194 @@ -406,7 +406,7 @@ int libxl_wait_for_device_model(libxl_ct
   5.195      char **l = NULL;
   5.196  
   5.197      xsh = xs_daemon_open();
   5.198 -    path = libxl_sprintf(&gc, "/local/domain/0/device-model/%d/state", domid);
   5.199 +    path = libxl__sprintf(&gc, "/local/domain/0/device-model/%d/state", domid);
   5.200      xs_watch(xsh, path, path);
   5.201      tv.tv_sec = LIBXL_DEVICE_MODEL_START_TIMEOUT;
   5.202      tv.tv_usec = 0;
   5.203 @@ -428,7 +428,7 @@ int libxl_wait_for_device_model(libxl_ct
   5.204          free(p);
   5.205          xs_unwatch(xsh, path, path);
   5.206          xs_daemon_close(xsh);
   5.207 -        libxl_free_all(&gc);
   5.208 +        libxl__free_all(&gc);
   5.209          return rc;
   5.210  again:
   5.211          free(p);
   5.212 @@ -446,17 +446,17 @@ again:
   5.213      xs_unwatch(xsh, path, path);
   5.214      xs_daemon_close(xsh);
   5.215      XL_LOG(ctx, XL_LOG_ERROR, "Device Model not ready");
   5.216 -    libxl_free_all(&gc);
   5.217 +    libxl__free_all(&gc);
   5.218      return -1;
   5.219  }
   5.220  
   5.221 -int libxl_wait_for_backend(libxl_ctx *ctx, char *be_path, char *state)
   5.222 +int libxl__wait_for_backend(libxl_ctx *ctx, char *be_path, char *state)
   5.223  {
   5.224      libxl_gc gc = LIBXL_INIT_GC(ctx);
   5.225      int watchdog = 100;
   5.226      unsigned int len;
   5.227      char *p;
   5.228 -    char *path = libxl_sprintf(&gc, "%s/state", be_path);
   5.229 +    char *path = libxl__sprintf(&gc, "%s/state", be_path);
   5.230      int rc = -1;
   5.231  
   5.232      while (watchdog > 0) {
   5.233 @@ -482,7 +482,7 @@ int libxl_wait_for_backend(libxl_ctx *ct
   5.234      }
   5.235      XL_LOG(ctx, XL_LOG_ERROR, "Backend %s not ready", be_path);
   5.236  out:
   5.237 -    libxl_free_all(&gc);
   5.238 +    libxl__free_all(&gc);
   5.239      return rc;
   5.240  }
   5.241  
     6.1 --- a/tools/libxl/libxl_dom.c	Wed Sep 08 16:35:40 2010 +0100
     6.2 +++ b/tools/libxl/libxl_dom.c	Wed Sep 08 16:44:24 2010 +0100
     6.3 @@ -96,43 +96,43 @@ int build_post(libxl_ctx *ctx, uint32_t 
     6.4      xc_cpuid_apply_policy(ctx->xch, domid);
     6.5  #endif
     6.6  
     6.7 -    ents = libxl_calloc(&gc, 12 + (info->max_vcpus * 2) + 2, sizeof(char *));
     6.8 +    ents = libxl__calloc(&gc, 12 + (info->max_vcpus * 2) + 2, sizeof(char *));
     6.9      ents[0] = "memory/static-max";
    6.10 -    ents[1] = libxl_sprintf(&gc, "%d", info->max_memkb);
    6.11 +    ents[1] = libxl__sprintf(&gc, "%d", info->max_memkb);
    6.12      ents[2] = "memory/target";
    6.13 -    ents[3] = libxl_sprintf(&gc, "%d", info->target_memkb);
    6.14 +    ents[3] = libxl__sprintf(&gc, "%d", info->target_memkb);
    6.15      ents[4] = "memory/videoram";
    6.16 -    ents[5] = libxl_sprintf(&gc, "%d", info->video_memkb);
    6.17 +    ents[5] = libxl__sprintf(&gc, "%d", info->video_memkb);
    6.18      ents[6] = "domid";
    6.19 -    ents[7] = libxl_sprintf(&gc, "%d", domid);
    6.20 +    ents[7] = libxl__sprintf(&gc, "%d", domid);
    6.21      ents[8] = "store/port";
    6.22 -    ents[9] = libxl_sprintf(&gc, "%"PRIu32, state->store_port);
    6.23 +    ents[9] = libxl__sprintf(&gc, "%"PRIu32, state->store_port);
    6.24      ents[10] = "store/ring-ref";
    6.25 -    ents[11] = libxl_sprintf(&gc, "%lu", state->store_mfn);
    6.26 +    ents[11] = libxl__sprintf(&gc, "%lu", state->store_mfn);
    6.27      for (i = 0; i < info->max_vcpus; i++) {
    6.28 -        ents[12+(i*2)]   = libxl_sprintf(&gc, "cpu/%d/availability", i);
    6.29 +        ents[12+(i*2)]   = libxl__sprintf(&gc, "cpu/%d/availability", i);
    6.30          ents[12+(i*2)+1] = (i && info->cur_vcpus && !(info->cur_vcpus & (1 << i)))
    6.31                              ? "offline" : "online";
    6.32      }
    6.33  
    6.34 -    dom_path = libxl_xs_get_dompath(&gc, domid);
    6.35 +    dom_path = libxl__xs_get_dompath(&gc, domid);
    6.36      if (!dom_path)
    6.37          return ERROR_FAIL;
    6.38  
    6.39 -    vm_path = xs_read(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "%s/vm", dom_path), NULL);
    6.40 +    vm_path = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/vm", dom_path), NULL);
    6.41  retry_transaction:
    6.42      t = xs_transaction_start(ctx->xsh);
    6.43  
    6.44 -    libxl_xs_writev(&gc, t, dom_path, ents);
    6.45 -    libxl_xs_writev(&gc, t, dom_path, local_ents);
    6.46 -    libxl_xs_writev(&gc, t, vm_path, vms_ents);
    6.47 +    libxl__xs_writev(&gc, t, dom_path, ents);
    6.48 +    libxl__xs_writev(&gc, t, dom_path, local_ents);
    6.49 +    libxl__xs_writev(&gc, t, vm_path, vms_ents);
    6.50  
    6.51      if (!xs_transaction_end(ctx->xsh, t, 0))
    6.52          if (errno == EAGAIN)
    6.53              goto retry_transaction;
    6.54      xs_introduce_domain(ctx->xsh, domid, state->store_mfn, state->store_port);
    6.55      free(vm_path);
    6.56 -    libxl_free_all(&gc);
    6.57 +    libxl__free_all(&gc);
    6.58      return 0;
    6.59  }
    6.60  
    6.61 @@ -232,7 +232,7 @@ int build_hvm(libxl_ctx *ctx, uint32_t d
    6.62          domid,
    6.63          (info->max_memkb - info->video_memkb) / 1024,
    6.64          (info->target_memkb - info->video_memkb) / 1024,
    6.65 -        libxl_abs_path(&gc, (char *)info->kernel.path,
    6.66 +        libxl__abs_path(&gc, (char *)info->kernel.path,
    6.67                         libxl_xenfirmwaredir_path()));
    6.68      if (ret) {
    6.69          XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "hvm building failed");
    6.70 @@ -246,7 +246,7 @@ int build_hvm(libxl_ctx *ctx, uint32_t d
    6.71      }
    6.72      rc = 0;
    6.73  out:
    6.74 -    libxl_free_all(&gc);
    6.75 +    libxl__free_all(&gc);
    6.76      return 0;
    6.77  }
    6.78  
    6.79 @@ -317,8 +317,8 @@ static int core_suspend_callback(void *d
    6.80          }
    6.81          return 1;
    6.82      }
    6.83 -    path = libxl_sprintf(si->gc, "%s/control/shutdown", libxl_xs_get_dompath(si->gc, si->domid));
    6.84 -    libxl_xs_write(si->gc, XBT_NULL, path, "suspend");
    6.85 +    path = libxl__sprintf(si->gc, "%s/control/shutdown", libxl__xs_get_dompath(si->gc, si->domid));
    6.86 +    libxl__xs_write(si->gc, XBT_NULL, path, "suspend");
    6.87      if (si->hvm) {
    6.88          unsigned long hvm_pvdrv, hvm_s_state;
    6.89          xc_get_hvm_param(ctx->xch, si->domid, HVM_PARAM_CALLBACK_IRQ, &hvm_pvdrv);
    6.90 @@ -341,12 +341,12 @@ static int core_suspend_callback(void *d
    6.91              if (shutdown_reason == SHUTDOWN_suspend)
    6.92                  return 1;
    6.93          }
    6.94 -        state = libxl_xs_read(si->gc, XBT_NULL, path);
    6.95 +        state = libxl__xs_read(si->gc, XBT_NULL, path);
    6.96          watchdog--;
    6.97      }
    6.98      if (!strcmp(state, "suspend")) {
    6.99          XL_LOG(ctx, XL_LOG_ERROR, "guest didn't suspend in time");
   6.100 -        libxl_xs_write(si->gc, XBT_NULL, path, "");
   6.101 +        libxl__xs_write(si->gc, XBT_NULL, path, "");
   6.102      }
   6.103      return 1;
   6.104  }
   6.105 @@ -409,11 +409,11 @@ int save_device_model(libxl_ctx *ctx, ui
   6.106      libxl_gc gc = LIBXL_INIT_GC(ctx);
   6.107      int fd2, c;
   6.108      char buf[1024];
   6.109 -    char *filename = libxl_sprintf(&gc, "/var/lib/xen/qemu-save.%d", domid);
   6.110 +    char *filename = libxl__sprintf(&gc, "/var/lib/xen/qemu-save.%d", domid);
   6.111  
   6.112      XL_LOG(ctx, XL_LOG_DEBUG, "Saving device model state to %s", filename);
   6.113 -    libxl_xs_write(&gc, XBT_NULL, libxl_sprintf(&gc, "/local/domain/0/device-model/%d/command", domid), "save");
   6.114 -    libxl_wait_for_device_model(ctx, domid, "paused", NULL, NULL);
   6.115 +    libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "/local/domain/0/device-model/%d/command", domid), "save");
   6.116 +    libxl__wait_for_device_model(ctx, domid, "paused", NULL, NULL);
   6.117  
   6.118      c = libxl_write_exactly(ctx, fd, QEMU_SIGNATURE, strlen(QEMU_SIGNATURE),
   6.119                              "saved-state file", "qemu signature");
   6.120 @@ -424,25 +424,25 @@ int save_device_model(libxl_ctx *ctx, ui
   6.121          if (c < 0) {
   6.122              if (errno == EINTR)
   6.123                  continue;
   6.124 -            libxl_free_all(&gc);
   6.125 +            libxl__free_all(&gc);
   6.126              return errno;
   6.127          }
   6.128          c = libxl_write_exactly(
   6.129              ctx, fd, buf, c, "saved-state file", "qemu state");
   6.130          if (c) {
   6.131 -            libxl_free_all(&gc);
   6.132 +            libxl__free_all(&gc);
   6.133              return c;
   6.134          }
   6.135      }
   6.136      close(fd2);
   6.137      unlink(filename);
   6.138 -    libxl_free_all(&gc);
   6.139 +    libxl__free_all(&gc);
   6.140      return 0;
   6.141  }
   6.142  
   6.143 -char *libxl_uuid2string(libxl_gc *gc, const libxl_uuid uuid)
   6.144 +char *libxl__uuid2string(libxl_gc *gc, const libxl_uuid uuid)
   6.145  {
   6.146 -    char *s = libxl_sprintf(gc, LIBXL_UUID_FMT, LIBXL_UUID_BYTES(uuid));
   6.147 +    char *s = libxl__sprintf(gc, LIBXL_UUID_FMT, LIBXL_UUID_BYTES(uuid));
   6.148      if (!s)
   6.149          XL_LOG(libxl_gc_owner(gc), XL_LOG_ERROR, "cannot allocate for uuid");
   6.150      return s;
   6.151 @@ -463,9 +463,9 @@ static const char *userdata_path(libxl_g
   6.152                       " for domain %"PRIu32, domid);
   6.153          return NULL;
   6.154      }
   6.155 -    uuid_string = libxl_sprintf(gc, LIBXL_UUID_FMT, LIBXL_UUID_BYTES(info.uuid));
   6.156 +    uuid_string = libxl__sprintf(gc, LIBXL_UUID_FMT, LIBXL_UUID_BYTES(info.uuid));
   6.157  
   6.158 -    path = libxl_sprintf(gc, "/var/lib/xen/"
   6.159 +    path = libxl__sprintf(gc, "/var/lib/xen/"
   6.160                           "userdata-%s.%u.%s.%s",
   6.161                           wh, domid, uuid_string, userdata_userid);
   6.162      if (!path)
   6.163 @@ -509,7 +509,7 @@ void libxl__userdata_destroyall(libxl_ct
   6.164      }
   6.165      globfree(&gl);
   6.166  out:
   6.167 -    libxl_free_all(&gc);
   6.168 +    libxl__free_all(&gc);
   6.169  }
   6.170  
   6.171  int libxl_userdata_store(libxl_ctx *ctx, uint32_t domid,
   6.172 @@ -577,7 +577,7 @@ err:
   6.173          XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "cannot write %s for %s",
   6.174                   newfilename, filename);
   6.175  out:
   6.176 -    libxl_free_all(&gc);
   6.177 +    libxl__free_all(&gc);
   6.178      return rc;
   6.179  }
   6.180  
   6.181 @@ -610,6 +610,6 @@ int libxl_userdata_retrieve(libxl_ctx *c
   6.182      if (datalen_r) *datalen_r = datalen;
   6.183      rc = 0;
   6.184  out:
   6.185 -    libxl_free_all(&gc);
   6.186 +    libxl__free_all(&gc);
   6.187      return rc;
   6.188  }
     7.1 --- a/tools/libxl/libxl_exec.c	Wed Sep 08 16:35:40 2010 +0100
     7.2 +++ b/tools/libxl/libxl_exec.c	Wed Sep 08 16:44:24 2010 +0100
     7.3 @@ -35,7 +35,7 @@ static int call_waitpid(pid_t (*waitpid_
     7.4      return (waitpid_cb) ? waitpid_cb(pid, status, options) : waitpid(pid, status, options);
     7.5  }
     7.6  
     7.7 -void libxl_exec(int stdinfd, int stdoutfd, int stderrfd, char *arg0, char **args)
     7.8 +void libxl__exec(int stdinfd, int stdoutfd, int stderrfd, char *arg0, char **args)
     7.9       /* call this in the child */
    7.10  {
    7.11      int i;
    7.12 @@ -88,7 +88,7 @@ void libxl_report_child_exitstatus(libxl
    7.13      }
    7.14  }
    7.15  
    7.16 -int libxl_spawn_spawn(libxl_ctx *ctx,
    7.17 +int libxl__spawn_spawn(libxl_ctx *ctx,
    7.18                        libxl_device_model_starting *starting,
    7.19                        const char *what,
    7.20                        void (*intermediate_hook)(void *for_spawn,
    7.21 @@ -151,7 +151,7 @@ static void report_spawn_intermediate_st
    7.22      }
    7.23  }
    7.24  
    7.25 -int libxl_spawn_detach(libxl_ctx *ctx,
    7.26 +int libxl__spawn_detach(libxl_ctx *ctx,
    7.27                         libxl_spawn_starting *for_spawn)
    7.28  {
    7.29      int r, status;
    7.30 @@ -184,7 +184,7 @@ int libxl_spawn_detach(libxl_ctx *ctx,
    7.31      return rc;
    7.32  }
    7.33  
    7.34 -int libxl_spawn_check(libxl_ctx *ctx, void *for_spawn_void)
    7.35 +int libxl__spawn_check(libxl_ctx *ctx, void *for_spawn_void)
    7.36  {
    7.37      libxl_spawn_starting *for_spawn = for_spawn_void;
    7.38      pid_t got;
     8.1 --- a/tools/libxl/libxl_internal.c	Wed Sep 08 16:35:40 2010 +0100
     8.2 +++ b/tools/libxl/libxl_internal.c	Wed Sep 08 16:44:24 2010 +0100
     8.3 @@ -29,12 +29,12 @@
     8.4  #include "libxl_internal.h"
     8.5  #include "libxl_utils.h"
     8.6  
     8.7 -int libxl_error_set(libxl_ctx *ctx, int code)
     8.8 +int libxl__error_set(libxl_ctx *ctx, int code)
     8.9  {
    8.10      return 0;
    8.11  }
    8.12  
    8.13 -int libxl_ptr_add(libxl_gc *gc, void *ptr)
    8.14 +int libxl__ptr_add(libxl_gc *gc, void *ptr)
    8.15  {
    8.16      int i;
    8.17      void **re;
    8.18 @@ -65,7 +65,7 @@ int libxl_ptr_add(libxl_gc *gc, void *pt
    8.19      return 0;
    8.20  }
    8.21  
    8.22 -void libxl_free_all(libxl_gc *gc)
    8.23 +void libxl__free_all(libxl_gc *gc)
    8.24  {
    8.25      void *ptr;
    8.26      int i;
    8.27 @@ -78,31 +78,31 @@ void libxl_free_all(libxl_gc *gc)
    8.28      free(gc->alloc_ptrs);
    8.29  }
    8.30  
    8.31 -void *libxl_zalloc(libxl_gc *gc, int bytes)
    8.32 +void *libxl__zalloc(libxl_gc *gc, int bytes)
    8.33  {
    8.34      void *ptr = calloc(bytes, 1);
    8.35      if (!ptr) {
    8.36 -        libxl_error_set(libxl_gc_owner(gc), ENOMEM);
    8.37 +        libxl__error_set(libxl_gc_owner(gc), ENOMEM);
    8.38          return NULL;
    8.39      }
    8.40  
    8.41 -    libxl_ptr_add(gc, ptr);
    8.42 +    libxl__ptr_add(gc, ptr);
    8.43      return ptr;
    8.44  }
    8.45  
    8.46 -void *libxl_calloc(libxl_gc *gc, size_t nmemb, size_t size)
    8.47 +void *libxl__calloc(libxl_gc *gc, size_t nmemb, size_t size)
    8.48  {
    8.49      void *ptr = calloc(nmemb, size);
    8.50      if (!ptr) {
    8.51 -        libxl_error_set(libxl_gc_owner(gc), ENOMEM);
    8.52 +        libxl__error_set(libxl_gc_owner(gc), ENOMEM);
    8.53          return NULL;
    8.54      }
    8.55  
    8.56 -    libxl_ptr_add(gc, ptr);
    8.57 +    libxl__ptr_add(gc, ptr);
    8.58      return ptr;
    8.59  }
    8.60  
    8.61 -char *libxl_sprintf(libxl_gc *gc, const char *fmt, ...)
    8.62 +char *libxl__sprintf(libxl_gc *gc, const char *fmt, ...)
    8.63  {
    8.64      char *s;
    8.65      va_list ap;
    8.66 @@ -116,7 +116,7 @@ char *libxl_sprintf(libxl_gc *gc, const 
    8.67          return NULL;
    8.68      }
    8.69  
    8.70 -    s = libxl_zalloc(gc, ret + 1);
    8.71 +    s = libxl__zalloc(gc, ret + 1);
    8.72      if (s) {
    8.73          va_start(ap, fmt);
    8.74          ret = vsnprintf(s, ret + 1, fmt, ap);
    8.75 @@ -125,20 +125,20 @@ char *libxl_sprintf(libxl_gc *gc, const 
    8.76      return s;
    8.77  }
    8.78  
    8.79 -char *libxl_strdup(libxl_gc *gc, const char *c)
    8.80 +char *libxl__strdup(libxl_gc *gc, const char *c)
    8.81  {
    8.82      char *s = strdup(c);
    8.83  
    8.84      if (s)
    8.85 -        libxl_ptr_add(gc, s);
    8.86 +        libxl__ptr_add(gc, s);
    8.87  
    8.88      return s;
    8.89  }
    8.90  
    8.91 -char *libxl_dirname(libxl_gc *gc, const char *s)
    8.92 +char *libxl__dirname(libxl_gc *gc, const char *s)
    8.93  {
    8.94      char *c;
    8.95 -    char *ptr = libxl_strdup(gc, s);
    8.96 +    char *ptr = libxl__strdup(gc, s);
    8.97  
    8.98      c = strrchr(ptr, '/');
    8.99      if (!c)
   8.100 @@ -184,11 +184,11 @@ void xl_log(libxl_ctx *ctx, xentoollog_l
   8.101      va_end(ap);
   8.102  }
   8.103  
   8.104 -char *libxl_abs_path(libxl_gc *gc, char *s, const char *path)
   8.105 +char *libxl__abs_path(libxl_gc *gc, char *s, const char *path)
   8.106  {
   8.107      if (!s || s[0] == '/')
   8.108          return s;
   8.109 -    return libxl_sprintf(gc, "%s/%s", path, s);
   8.110 +    return libxl__sprintf(gc, "%s/%s", path, s);
   8.111  }
   8.112  
   8.113  
     9.1 --- a/tools/libxl/libxl_internal.h	Wed Sep 08 16:35:40 2010 +0100
     9.2 +++ b/tools/libxl/libxl_internal.h	Wed Sep 08 16:44:24 2010 +0100
     9.3 @@ -122,22 +122,22 @@ static inline libxl_ctx *libxl_gc_owner(
     9.4  }
     9.5  
     9.6  /* memory allocation tracking/helpers */
     9.7 -_hidden int libxl_ptr_add(libxl_gc *gc, void *ptr);
     9.8 -_hidden void libxl_free_all(libxl_gc *gc);
     9.9 -_hidden void *libxl_zalloc(libxl_gc *gc, int bytes);
    9.10 -_hidden void *libxl_calloc(libxl_gc *gc, size_t nmemb, size_t size);
    9.11 -_hidden char *libxl_sprintf(libxl_gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
    9.12 -_hidden char *libxl_strdup(libxl_gc *gc, const char *c);
    9.13 -_hidden char *libxl_dirname(libxl_gc *gc, const char *s);
    9.14 +_hidden int libxl__ptr_add(libxl_gc *gc, void *ptr);
    9.15 +_hidden void libxl__free_all(libxl_gc *gc);
    9.16 +_hidden void *libxl__zalloc(libxl_gc *gc, int bytes);
    9.17 +_hidden void *libxl__calloc(libxl_gc *gc, size_t nmemb, size_t size);
    9.18 +_hidden char *libxl__sprintf(libxl_gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
    9.19 +_hidden char *libxl__strdup(libxl_gc *gc, const char *c);
    9.20 +_hidden char *libxl__dirname(libxl_gc *gc, const char *s);
    9.21  
    9.22 -_hidden char **libxl_xs_kvs_of_flexarray(libxl_gc *gc, flexarray_t *array, int length);
    9.23 -_hidden int libxl_xs_writev(libxl_gc *gc, xs_transaction_t t,
    9.24 +_hidden char **libxl__xs_kvs_of_flexarray(libxl_gc *gc, flexarray_t *array, int length);
    9.25 +_hidden int libxl__xs_writev(libxl_gc *gc, xs_transaction_t t,
    9.26                      char *dir, char **kvs);
    9.27 -_hidden int libxl_xs_write(libxl_gc *gc, xs_transaction_t t,
    9.28 +_hidden int libxl__xs_write(libxl_gc *gc, xs_transaction_t t,
    9.29                     char *path, char *fmt, ...) PRINTF_ATTRIBUTE(4, 5);
    9.30 -_hidden char *libxl_xs_get_dompath(libxl_gc *gc, uint32_t domid); // logs errs
    9.31 -_hidden char *libxl_xs_read(libxl_gc *gc, xs_transaction_t t, char *path);
    9.32 -_hidden char **libxl_xs_directory(libxl_gc *gc, xs_transaction_t t, char *path, unsigned int *nb);
    9.33 +_hidden char *libxl__xs_get_dompath(libxl_gc *gc, uint32_t domid); // logs errs
    9.34 +_hidden char *libxl__xs_read(libxl_gc *gc, xs_transaction_t t, char *path);
    9.35 +_hidden char **libxl__xs_directory(libxl_gc *gc, xs_transaction_t t, char *path, unsigned int *nb);
    9.36  
    9.37  /* from xl_dom */
    9.38  _hidden int is_hvm(libxl_ctx *ctx, uint32_t domid);
    9.39 @@ -168,19 +168,19 @@ static inline libxl_ctx *libxl_gc_owner(
    9.40  _hidden int device_physdisk_major_minor(const char *physpath, int *major, int *minor);
    9.41  _hidden int device_disk_dev_number(char *virtpath);
    9.42  
    9.43 -_hidden int libxl_device_generic_add(libxl_ctx *ctx, libxl_device *device,
    9.44 +_hidden int libxl__device_generic_add(libxl_ctx *ctx, libxl_device *device,
    9.45                               char **bents, char **fents);
    9.46 -_hidden int libxl_device_del(libxl_ctx *ctx, libxl_device *dev, int wait);
    9.47 -_hidden int libxl_device_destroy(libxl_ctx *ctx, char *be_path, int force);
    9.48 -_hidden int libxl_devices_destroy(libxl_ctx *ctx, uint32_t domid, int force);
    9.49 -_hidden int libxl_wait_for_device_model(libxl_ctx *ctx,
    9.50 +_hidden int libxl__device_del(libxl_ctx *ctx, libxl_device *dev, int wait);
    9.51 +_hidden int libxl__device_destroy(libxl_ctx *ctx, char *be_path, int force);
    9.52 +_hidden int libxl__devices_destroy(libxl_ctx *ctx, uint32_t domid, int force);
    9.53 +_hidden int libxl__wait_for_device_model(libxl_ctx *ctx,
    9.54                                  uint32_t domid, char *state,
    9.55                                  int (*check_callback)(libxl_ctx *ctx,
    9.56                                                        uint32_t domid,
    9.57                                                        const char *state,
    9.58                                                        void *userdata),
    9.59                                  void *check_callback_userdata);
    9.60 -_hidden int libxl_wait_for_backend(libxl_ctx *ctx, char *be_path, char *state);
    9.61 +_hidden int libxl__wait_for_backend(libxl_ctx *ctx, char *be_path, char *state);
    9.62  
    9.63  /* from xenguest (helper */
    9.64  _hidden int hvm_build_set_params(xc_interface *handle, uint32_t domid,
    9.65 @@ -205,42 +205,42 @@ struct libxl__device_model_starting {
    9.66      int domid;
    9.67  };
    9.68  
    9.69 -_hidden int libxl_spawn_spawn(libxl_ctx *ctx,
    9.70 +_hidden int libxl__spawn_spawn(libxl_ctx *ctx,
    9.71                        libxl_device_model_starting *starting,
    9.72                        const char *what,
    9.73                        void (*intermediate_hook)(void *for_spawn, pid_t innerchild));
    9.74    /* Logs errors.  A copy of "what" is taken.  Return values:
    9.75     *  < 0   error, for_spawn need not be detached
    9.76     *   +1   caller is the parent, must call detach on *for_spawn eventually
    9.77 -   *    0   caller is now the inner child, should probably call libxl_exec
    9.78 +   *    0   caller is now the inner child, should probably call libxl__exec
    9.79     * Caller, may pass 0 for for_spawn, in which case no need to detach.
    9.80     */
    9.81 -_hidden int libxl_spawn_detach(libxl_ctx *ctx,
    9.82 +_hidden int libxl__spawn_detach(libxl_ctx *ctx,
    9.83                         libxl_spawn_starting *for_spawn);
    9.84    /* Logs errors.  Idempotent, but only permitted after successful
    9.85 -   * call to libxl_spawn_spawn, and no point calling it again if it fails. */
    9.86 -_hidden int libxl_spawn_check(libxl_ctx *ctx,
    9.87 +   * call to libxl__spawn_spawn, and no point calling it again if it fails. */
    9.88 +_hidden int libxl__spawn_check(libxl_ctx *ctx,
    9.89                        void *for_spawn);
    9.90    /* Logs errors but also returns them.
    9.91     * for_spawn must actually be a  libxl_spawn_starting*  but
    9.92     * we take void* so you can pass this function directly to
    9.93 -   * libxl_wait_for_device_model.  Caller must still call detach. */
    9.94 +   * libxl__wait_for_device_model.  Caller must still call detach. */
    9.95  
    9.96   /* low-level stuff, for synchronous subprocesses etc. */
    9.97  
    9.98 -_hidden void libxl_exec(int stdinfd, int stdoutfd, int stderrfd, char *arg0, char **args); // logs errors, never returns
    9.99 -_hidden void libxl_log_child_exitstatus(libxl_gc *gc,
   9.100 +_hidden void libxl__exec(int stdinfd, int stdoutfd, int stderrfd, char *arg0, char **args); // logs errors, never returns
   9.101 +_hidden void libxl__log_child_exitstatus(libxl_gc *gc,
   9.102                                  const char *what, pid_t pid, int status);
   9.103  
   9.104 -_hidden char *libxl_abs_path(libxl_gc *gc, char *s, const char *path);
   9.105 +_hidden char *libxl__abs_path(libxl_gc *gc, char *s, const char *path);
   9.106  
   9.107  #define XL_LOG_DEBUG   XTL_DEBUG
   9.108  #define XL_LOG_INFO    XTL_INFO
   9.109  #define XL_LOG_WARNING XTL_WARN
   9.110  #define XL_LOG_ERROR   XTL_ERROR
   9.111  
   9.112 -_hidden char *_libxl_domid_to_name(libxl_gc *gc, uint32_t domid);
   9.113 -_hidden char *_libxl_poolid_to_name(libxl_gc *gc, uint32_t poolid);
   9.114 +_hidden char *libxl__domid_to_name(libxl_gc *gc, uint32_t domid);
   9.115 +_hidden char *libxl__poolid_to_name(libxl_gc *gc, uint32_t poolid);
   9.116  
   9.117  /*
   9.118   * blktap2 support
   9.119 @@ -261,7 +261,7 @@ const char *libxl_blktap_devpath(libxl_g
   9.120                                   const char *disk,
   9.121                                   libxl_disk_phystype phystype);
   9.122  
   9.123 -_hidden char *libxl_uuid2string(libxl_gc *gc, const libxl_uuid uuid);
   9.124 +_hidden char *libxl__uuid2string(libxl_gc *gc, const libxl_uuid uuid);
   9.125  
   9.126  struct libxl__xen_console_reader {
   9.127      char *buffer;
   9.128 @@ -272,7 +272,7 @@ struct libxl__xen_console_reader {
   9.129      unsigned int index;
   9.130  };
   9.131  
   9.132 -_hidden int libxl_error_set(libxl_ctx *ctx, int code);
   9.133 +_hidden int libxl__error_set(libxl_ctx *ctx, int code);
   9.134  
   9.135  _hidden int libxl__file_reference_map(libxl_file_reference *f);
   9.136  _hidden int libxl__file_reference_unmap(libxl_file_reference *f);
    10.1 --- a/tools/libxl/libxl_pci.c	Wed Sep 08 16:35:40 2010 +0100
    10.2 +++ b/tools/libxl/libxl_pci.c	Wed Sep 08 16:44:24 2010 +0100
    10.3 @@ -224,38 +224,38 @@ static int libxl_create_pci_backend(libx
    10.4      device.kind = DEVICE_PCI;
    10.5  
    10.6      flexarray_set(back, boffset++, "frontend-id");
    10.7 -    flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", domid));
    10.8 +    flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", domid));
    10.9      flexarray_set(back, boffset++, "online");
   10.10      flexarray_set(back, boffset++, "1");
   10.11      flexarray_set(back, boffset++, "state");
   10.12 -    flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", 1));
   10.13 +    flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", 1));
   10.14      flexarray_set(back, boffset++, "domain");
   10.15 -    flexarray_set(back, boffset++, _libxl_domid_to_name(gc, domid));
   10.16 +    flexarray_set(back, boffset++, libxl__domid_to_name(gc, domid));
   10.17      for (i = 0; i < num; i++) {
   10.18 -        flexarray_set(back, boffset++, libxl_sprintf(gc, "key-%d", i));
   10.19 -        flexarray_set(back, boffset++, libxl_sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
   10.20 -        flexarray_set(back, boffset++, libxl_sprintf(gc, "dev-%d", i));
   10.21 -        flexarray_set(back, boffset++, libxl_sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
   10.22 +        flexarray_set(back, boffset++, libxl__sprintf(gc, "key-%d", i));
   10.23 +        flexarray_set(back, boffset++, libxl__sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
   10.24 +        flexarray_set(back, boffset++, libxl__sprintf(gc, "dev-%d", i));
   10.25 +        flexarray_set(back, boffset++, libxl__sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
   10.26          if (pcidev->vdevfn) {
   10.27 -            flexarray_set(back, boffset++, libxl_sprintf(gc, "vdevfn-%d", i));
   10.28 -            flexarray_set(back, boffset++, libxl_sprintf(gc, "%x", pcidev->vdevfn));
   10.29 +            flexarray_set(back, boffset++, libxl__sprintf(gc, "vdevfn-%d", i));
   10.30 +            flexarray_set(back, boffset++, libxl__sprintf(gc, "%x", pcidev->vdevfn));
   10.31          }
   10.32 -        flexarray_set(back, boffset++, libxl_sprintf(gc, "opts-%d", i));
   10.33 -        flexarray_set(back, boffset++, libxl_sprintf(gc, "msitranslate=%d,power_mgmt=%d", pcidev->msitranslate, pcidev->power_mgmt));
   10.34 -        flexarray_set(back, boffset++, libxl_sprintf(gc, "state-%d", i));
   10.35 -        flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", 1));
   10.36 +        flexarray_set(back, boffset++, libxl__sprintf(gc, "opts-%d", i));
   10.37 +        flexarray_set(back, boffset++, libxl__sprintf(gc, "msitranslate=%d,power_mgmt=%d", pcidev->msitranslate, pcidev->power_mgmt));
   10.38 +        flexarray_set(back, boffset++, libxl__sprintf(gc, "state-%d", i));
   10.39 +        flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", 1));
   10.40      }
   10.41      flexarray_set(back, boffset++, "num_devs");
   10.42 -    flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", num));
   10.43 +    flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", num));
   10.44  
   10.45      flexarray_set(front, foffset++, "backend-id");
   10.46 -    flexarray_set(front, foffset++, libxl_sprintf(gc, "%d", 0));
   10.47 +    flexarray_set(front, foffset++, libxl__sprintf(gc, "%d", 0));
   10.48      flexarray_set(front, foffset++, "state");
   10.49 -    flexarray_set(front, foffset++, libxl_sprintf(gc, "%d", 1));
   10.50 +    flexarray_set(front, foffset++, libxl__sprintf(gc, "%d", 1));
   10.51  
   10.52 -    libxl_device_generic_add(ctx, &device,
   10.53 -                             libxl_xs_kvs_of_flexarray(gc, back, boffset),
   10.54 -                             libxl_xs_kvs_of_flexarray(gc, front, foffset));
   10.55 +    libxl__device_generic_add(ctx, &device,
   10.56 +                             libxl__xs_kvs_of_flexarray(gc, back, boffset),
   10.57 +                             libxl__xs_kvs_of_flexarray(gc, front, foffset));
   10.58  
   10.59      flexarray_free(back);
   10.60      flexarray_free(front);
   10.61 @@ -271,13 +271,13 @@ static int libxl_device_pci_add_xenstore
   10.62      unsigned int boffset = 0;
   10.63      xs_transaction_t t;
   10.64  
   10.65 -    be_path = libxl_sprintf(gc, "%s/backend/pci/%d/0", libxl_xs_get_dompath(gc, 0), domid);
   10.66 -    num_devs = libxl_xs_read(gc, XBT_NULL, libxl_sprintf(gc, "%s/num_devs", be_path));
   10.67 +    be_path = libxl__sprintf(gc, "%s/backend/pci/%d/0", libxl__xs_get_dompath(gc, 0), domid);
   10.68 +    num_devs = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/num_devs", be_path));
   10.69      if (!num_devs)
   10.70          return libxl_create_pci_backend(gc, domid, pcidev, 1);
   10.71  
   10.72      if (!is_hvm(ctx, domid)) {
   10.73 -        if (libxl_wait_for_backend(ctx, be_path, "4") < 0)
   10.74 +        if (libxl__wait_for_backend(ctx, be_path, "4") < 0)
   10.75              return ERROR_FAIL;
   10.76      }
   10.77  
   10.78 @@ -287,27 +287,27 @@ static int libxl_device_pci_add_xenstore
   10.79  
   10.80      XL_LOG(ctx, XL_LOG_DEBUG, "Adding new pci device to xenstore");
   10.81      num = atoi(num_devs);
   10.82 -    flexarray_set(back, boffset++, libxl_sprintf(gc, "key-%d", num));
   10.83 -    flexarray_set(back, boffset++, libxl_sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
   10.84 -    flexarray_set(back, boffset++, libxl_sprintf(gc, "dev-%d", num));
   10.85 -    flexarray_set(back, boffset++, libxl_sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
   10.86 +    flexarray_set(back, boffset++, libxl__sprintf(gc, "key-%d", num));
   10.87 +    flexarray_set(back, boffset++, libxl__sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
   10.88 +    flexarray_set(back, boffset++, libxl__sprintf(gc, "dev-%d", num));
   10.89 +    flexarray_set(back, boffset++, libxl__sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
   10.90      if (pcidev->vdevfn) {
   10.91 -        flexarray_set(back, boffset++, libxl_sprintf(gc, "vdevfn-%d", num));
   10.92 -        flexarray_set(back, boffset++, libxl_sprintf(gc, "%x", pcidev->vdevfn));
   10.93 +        flexarray_set(back, boffset++, libxl__sprintf(gc, "vdevfn-%d", num));
   10.94 +        flexarray_set(back, boffset++, libxl__sprintf(gc, "%x", pcidev->vdevfn));
   10.95      }
   10.96 -    flexarray_set(back, boffset++, libxl_sprintf(gc, "opts-%d", num));
   10.97 -    flexarray_set(back, boffset++, libxl_sprintf(gc, "msitranslate=%d,power_mgmt=%d", pcidev->msitranslate, pcidev->power_mgmt));
   10.98 -    flexarray_set(back, boffset++, libxl_sprintf(gc, "state-%d", num));
   10.99 -    flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", 1));
  10.100 +    flexarray_set(back, boffset++, libxl__sprintf(gc, "opts-%d", num));
  10.101 +    flexarray_set(back, boffset++, libxl__sprintf(gc, "msitranslate=%d,power_mgmt=%d", pcidev->msitranslate, pcidev->power_mgmt));
  10.102 +    flexarray_set(back, boffset++, libxl__sprintf(gc, "state-%d", num));
  10.103 +    flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", 1));
  10.104      flexarray_set(back, boffset++, "num_devs");
  10.105 -    flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", num + 1));
  10.106 +    flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", num + 1));
  10.107      flexarray_set(back, boffset++, "state");
  10.108 -    flexarray_set(back, boffset++, libxl_sprintf(gc, "%d", 7));
  10.109 +    flexarray_set(back, boffset++, libxl__sprintf(gc, "%d", 7));
  10.110  
  10.111  retry_transaction:
  10.112      t = xs_transaction_start(ctx->xsh);
  10.113 -    libxl_xs_writev(gc, t, be_path,
  10.114 -                    libxl_xs_kvs_of_flexarray(gc, back, boffset));
  10.115 +    libxl__xs_writev(gc, t, be_path,
  10.116 +                    libxl__xs_kvs_of_flexarray(gc, back, boffset));
  10.117      if (!xs_transaction_end(ctx->xsh, t, 0))
  10.118          if (errno == EAGAIN)
  10.119              goto retry_transaction;
  10.120 @@ -324,22 +324,22 @@ static int libxl_device_pci_remove_xenst
  10.121      xs_transaction_t t;
  10.122      unsigned int domain = 0, bus = 0, dev = 0, func = 0;
  10.123  
  10.124 -    be_path = libxl_sprintf(gc, "%s/backend/pci/%d/0", libxl_xs_get_dompath(gc, 0), domid);
  10.125 -    num_devs_path = libxl_sprintf(gc, "%s/num_devs", be_path);
  10.126 -    num_devs = libxl_xs_read(gc, XBT_NULL, num_devs_path);
  10.127 +    be_path = libxl__sprintf(gc, "%s/backend/pci/%d/0", libxl__xs_get_dompath(gc, 0), domid);
  10.128 +    num_devs_path = libxl__sprintf(gc, "%s/num_devs", be_path);
  10.129 +    num_devs = libxl__xs_read(gc, XBT_NULL, num_devs_path);
  10.130      if (!num_devs)
  10.131          return ERROR_INVAL;
  10.132      num = atoi(num_devs);
  10.133  
  10.134      if (!is_hvm(ctx, domid)) {
  10.135 -        if (libxl_wait_for_backend(ctx, be_path, "4") < 0) {
  10.136 +        if (libxl__wait_for_backend(ctx, be_path, "4") < 0) {
  10.137              XL_LOG(ctx, XL_LOG_DEBUG, "pci backend at %s is not ready", be_path);
  10.138              return ERROR_FAIL;
  10.139          }
  10.140      }
  10.141  
  10.142      for (i = 0; i < num; i++) {
  10.143 -        xsdev = libxl_xs_read(gc, XBT_NULL, libxl_sprintf(gc, "%s/dev-%d", be_path, i));
  10.144 +        xsdev = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/dev-%d", be_path, i));
  10.145          sscanf(xsdev, PCI_BDF, &domain, &bus, &dev, &func);
  10.146          if (domain == pcidev->domain && bus == pcidev->bus &&
  10.147              pcidev->dev == dev && pcidev->func == func) {
  10.148 @@ -353,14 +353,14 @@ static int libxl_device_pci_remove_xenst
  10.149  
  10.150  retry_transaction:
  10.151      t = xs_transaction_start(ctx->xsh);
  10.152 -    xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/state-%d", be_path, i), "5", strlen("5"));
  10.153 -    xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/state", be_path), "7", strlen("7"));
  10.154 +    xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/state-%d", be_path, i), "5", strlen("5"));
  10.155 +    xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/state", be_path), "7", strlen("7"));
  10.156      if (!xs_transaction_end(ctx->xsh, t, 0))
  10.157          if (errno == EAGAIN)
  10.158              goto retry_transaction;
  10.159  
  10.160      if (!is_hvm(ctx, domid)) {
  10.161 -        if (libxl_wait_for_backend(ctx, be_path, "4") < 0) {
  10.162 +        if (libxl__wait_for_backend(ctx, be_path, "4") < 0) {
  10.163              XL_LOG(ctx, XL_LOG_DEBUG, "pci backend at %s is not ready", be_path);
  10.164              return ERROR_FAIL;
  10.165          }
  10.166 @@ -368,42 +368,42 @@ retry_transaction:
  10.167  
  10.168  retry_transaction2:
  10.169      t = xs_transaction_start(ctx->xsh);
  10.170 -    xs_rm(ctx->xsh, t, libxl_sprintf(gc, "%s/state-%d", be_path, i));
  10.171 -    xs_rm(ctx->xsh, t, libxl_sprintf(gc, "%s/key-%d", be_path, i));
  10.172 -    xs_rm(ctx->xsh, t, libxl_sprintf(gc, "%s/dev-%d", be_path, i));
  10.173 -    xs_rm(ctx->xsh, t, libxl_sprintf(gc, "%s/vdev-%d", be_path, i));
  10.174 -    xs_rm(ctx->xsh, t, libxl_sprintf(gc, "%s/opts-%d", be_path, i));
  10.175 -    xs_rm(ctx->xsh, t, libxl_sprintf(gc, "%s/vdevfn-%d", be_path, i));
  10.176 -    libxl_xs_write(gc, t, num_devs_path, "%d", num - 1);
  10.177 +    xs_rm(ctx->xsh, t, libxl__sprintf(gc, "%s/state-%d", be_path, i));
  10.178 +    xs_rm(ctx->xsh, t, libxl__sprintf(gc, "%s/key-%d", be_path, i));
  10.179 +    xs_rm(ctx->xsh, t, libxl__sprintf(gc, "%s/dev-%d", be_path, i));
  10.180 +    xs_rm(ctx->xsh, t, libxl__sprintf(gc, "%s/vdev-%d", be_path, i));
  10.181 +    xs_rm(ctx->xsh, t, libxl__sprintf(gc, "%s/opts-%d", be_path, i));
  10.182 +    xs_rm(ctx->xsh, t, libxl__sprintf(gc, "%s/vdevfn-%d", be_path, i));
  10.183 +    libxl__xs_write(gc, t, num_devs_path, "%d", num - 1);
  10.184      for (j = i + 1; j < num; j++) {
  10.185 -        tmppath = libxl_sprintf(gc, "%s/state-%d", be_path, j);
  10.186 -        tmp = libxl_xs_read(gc, t, tmppath);
  10.187 -        xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/state-%d", be_path, j - 1), tmp, strlen(tmp));
  10.188 +        tmppath = libxl__sprintf(gc, "%s/state-%d", be_path, j);
  10.189 +        tmp = libxl__xs_read(gc, t, tmppath);
  10.190 +        xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/state-%d", be_path, j - 1), tmp, strlen(tmp));
  10.191          xs_rm(ctx->xsh, t, tmppath);
  10.192 -        tmppath = libxl_sprintf(gc, "%s/dev-%d", be_path, j);
  10.193 -        tmp = libxl_xs_read(gc, t, tmppath);
  10.194 -        xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/dev-%d", be_path, j - 1), tmp, strlen(tmp));
  10.195 +        tmppath = libxl__sprintf(gc, "%s/dev-%d", be_path, j);
  10.196 +        tmp = libxl__xs_read(gc, t, tmppath);
  10.197 +        xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/dev-%d", be_path, j - 1), tmp, strlen(tmp));
  10.198          xs_rm(ctx->xsh, t, tmppath);
  10.199 -        tmppath = libxl_sprintf(gc, "%s/key-%d", be_path, j);
  10.200 -        tmp = libxl_xs_read(gc, t, tmppath);
  10.201 -        xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/key-%d", be_path, j - 1), tmp, strlen(tmp));
  10.202 +        tmppath = libxl__sprintf(gc, "%s/key-%d", be_path, j);
  10.203 +        tmp = libxl__xs_read(gc, t, tmppath);
  10.204 +        xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/key-%d", be_path, j - 1), tmp, strlen(tmp));
  10.205          xs_rm(ctx->xsh, t, tmppath);
  10.206 -        tmppath = libxl_sprintf(gc, "%s/vdev-%d", be_path, j);
  10.207 -        tmp = libxl_xs_read(gc, t, tmppath);
  10.208 +        tmppath = libxl__sprintf(gc, "%s/vdev-%d", be_path, j);
  10.209 +        tmp = libxl__xs_read(gc, t, tmppath);
  10.210          if (tmp) {
  10.211 -            xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/vdev-%d", be_path, j - 1), tmp, strlen(tmp));
  10.212 +            xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/vdev-%d", be_path, j - 1), tmp, strlen(tmp));
  10.213              xs_rm(ctx->xsh, t, tmppath);
  10.214          }
  10.215 -        tmppath = libxl_sprintf(gc, "%s/opts-%d", be_path, j);
  10.216 -        tmp = libxl_xs_read(gc, t, tmppath);
  10.217 +        tmppath = libxl__sprintf(gc, "%s/opts-%d", be_path, j);
  10.218 +        tmp = libxl__xs_read(gc, t, tmppath);
  10.219          if (tmp) {
  10.220 -            xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/opts-%d", be_path, j - 1), tmp, strlen(tmp));
  10.221 +            xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/opts-%d", be_path, j - 1), tmp, strlen(tmp));
  10.222              xs_rm(ctx->xsh, t, tmppath);
  10.223          }
  10.224 -        tmppath = libxl_sprintf(gc, "%s/vdevfn-%d", be_path, j);
  10.225 -        tmp = libxl_xs_read(gc, t, tmppath);
  10.226 +        tmppath = libxl__sprintf(gc, "%s/vdevfn-%d", be_path, j);
  10.227 +        tmp = libxl__xs_read(gc, t, tmppath);
  10.228          if (tmp) {
  10.229 -            xs_write(ctx->xsh, t, libxl_sprintf(gc, "%s/vdevfn-%d", be_path, j - 1), tmp, strlen(tmp));
  10.230 +            xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/vdevfn-%d", be_path, j - 1), tmp, strlen(tmp));
  10.231              xs_rm(ctx->xsh, t, tmppath);
  10.232          }
  10.233      }
  10.234 @@ -412,8 +412,8 @@ retry_transaction2:
  10.235              goto retry_transaction2;
  10.236  
  10.237      if (num == 1) {
  10.238 -        char *fe_path = libxl_xs_read(gc, XBT_NULL, libxl_sprintf(gc, "%s/frontend", be_path));
  10.239 -        libxl_device_destroy(ctx, be_path, 1);
  10.240 +        char *fe_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/frontend", be_path));
  10.241 +        libxl__device_destroy(ctx, be_path, 1);
  10.242          xs_rm(ctx->xsh, XBT_NULL, be_path);
  10.243          xs_rm(ctx->xsh, XBT_NULL, fe_path);
  10.244          return 0;
  10.245 @@ -431,21 +431,21 @@ static int get_all_assigned_devices(libx
  10.246      *list = NULL;
  10.247      *num = 0;
  10.248  
  10.249 -    domlist = libxl_xs_directory(gc, XBT_NULL, "/local/domain", &nd);
  10.250 +    domlist = libxl__xs_directory(gc, XBT_NULL, "/local/domain", &nd);
  10.251      for(i = 0; i < nd; i++) {
  10.252          char *path, *num_devs;
  10.253  
  10.254 -        path = libxl_sprintf(gc, "/local/domain/0/backend/pci/%s/0/num_devs", domlist[i]);
  10.255 -        num_devs = libxl_xs_read(gc, XBT_NULL, path);
  10.256 +        path = libxl__sprintf(gc, "/local/domain/0/backend/pci/%s/0/num_devs", domlist[i]);
  10.257 +        num_devs = libxl__xs_read(gc, XBT_NULL, path);
  10.258          if ( num_devs ) {
  10.259              int ndev = atoi(num_devs), j;
  10.260              char *devpath, *bdf;
  10.261  
  10.262 -            pcidevs = libxl_calloc(gc, sizeof(*pcidevs), ndev);
  10.263 +            pcidevs = libxl__calloc(gc, sizeof(*pcidevs), ndev);
  10.264              for(j = (pcidevs) ? 0 : ndev; j < ndev; j++) {
  10.265 -                devpath = libxl_sprintf(gc, "/local/domain/0/backend/pci/%s/0/dev-%u",
  10.266 +                devpath = libxl__sprintf(gc, "/local/domain/0/backend/pci/%s/0/dev-%u",
  10.267                                          domlist[i], j);
  10.268 -                bdf = libxl_xs_read(gc, XBT_NULL, devpath);
  10.269 +                bdf = libxl__xs_read(gc, XBT_NULL, devpath);
  10.270                  if ( bdf ) {
  10.271                      unsigned dom, bus, dev, func;
  10.272                      if ( sscanf(bdf, PCI_BDF, &dom, &bus, &dev, &func) != 4 )
  10.273 @@ -510,7 +510,7 @@ int libxl_device_pci_list_assignable(lib
  10.274          }else{
  10.275              XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", SYSFS_PCIBACK_DRIVER);
  10.276          }
  10.277 -        libxl_free_all(&gc);
  10.278 +        libxl__free_all(&gc);
  10.279          return ERROR_FAIL;
  10.280      }
  10.281  
  10.282 @@ -536,7 +536,7 @@ int libxl_device_pci_list_assignable(lib
  10.283  
  10.284      closedir(dir);
  10.285      *list = pcidevs;
  10.286 -    libxl_free_all(&gc);
  10.287 +    libxl__free_all(&gc);
  10.288      return 0;
  10.289  }
  10.290  
  10.291 @@ -573,7 +573,7 @@ static int pci_multifunction_check(libxl
  10.292          if ( pcidev->dev != dev )
  10.293              continue;
  10.294  
  10.295 -        path = libxl_sprintf(gc, "%s/" PCI_BDF, SYSFS_PCIBACK_DRIVER, dom, bus, dev, func);
  10.296 +        path = libxl__sprintf(gc, "%s/" PCI_BDF, SYSFS_PCIBACK_DRIVER, dom, bus, dev, func);
  10.297          if ( lstat(path, &st) ) {
  10.298              if ( errno == ENOENT )
  10.299                  XL_LOG(ctx, XL_LOG_ERROR, PCI_BDF " is not assigned to pciback driver",
  10.300 @@ -613,24 +613,24 @@ static int do_pci_add(libxl_gc *gc, uint
  10.301  
  10.302      hvm = is_hvm(ctx, domid);
  10.303      if (hvm) {
  10.304 -        if (libxl_wait_for_device_model(ctx, domid, "running", NULL, NULL) < 0) {
  10.305 +        if (libxl__wait_for_device_model(ctx, domid, "running", NULL, NULL) < 0) {
  10.306              return ERROR_FAIL;
  10.307          }
  10.308 -        path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
  10.309 -        state = libxl_xs_read(gc, XBT_NULL, path);
  10.310 -        path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
  10.311 +        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
  10.312 +        state = libxl__xs_read(gc, XBT_NULL, path);
  10.313 +        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
  10.314          if (pcidev->vdevfn)
  10.315 -            libxl_xs_write(gc, XBT_NULL, path, PCI_BDF_VDEVFN, pcidev->domain,
  10.316 +            libxl__xs_write(gc, XBT_NULL, path, PCI_BDF_VDEVFN, pcidev->domain,
  10.317                             pcidev->bus, pcidev->dev, pcidev->func, pcidev->vdevfn);
  10.318          else
  10.319 -            libxl_xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
  10.320 +            libxl__xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
  10.321                             pcidev->bus, pcidev->dev, pcidev->func);
  10.322 -        path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/command", domid);
  10.323 +        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", domid);
  10.324          xs_write(ctx->xsh, XBT_NULL, path, "pci-ins", strlen("pci-ins"));
  10.325 -        rc = libxl_wait_for_device_model(ctx, domid, NULL, pci_ins_check, state);
  10.326 -        path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
  10.327 -        vdevfn = libxl_xs_read(gc, XBT_NULL, path);
  10.328 -        path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
  10.329 +        rc = libxl__wait_for_device_model(ctx, domid, NULL, pci_ins_check, state);
  10.330 +        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
  10.331 +        vdevfn = libxl__xs_read(gc, XBT_NULL, path);
  10.332 +        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
  10.333          if ( rc < 0 )
  10.334              XL_LOG(ctx, XL_LOG_ERROR, "qemu refused to add device: %s", vdevfn);
  10.335          else if ( sscanf(vdevfn, "0x%x", &pcidev->vdevfn) != 1 )
  10.336 @@ -639,7 +639,7 @@ static int do_pci_add(libxl_gc *gc, uint
  10.337          if ( rc )
  10.338              return ERROR_FAIL;
  10.339      } else {
  10.340 -        char *sysfs_path = libxl_sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/resource", pcidev->domain,
  10.341 +        char *sysfs_path = libxl__sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/resource", pcidev->domain,
  10.342                                           pcidev->bus, pcidev->dev, pcidev->func);
  10.343          FILE *f = fopen(sysfs_path, "r");
  10.344          unsigned long long start = 0, end = 0, flags = 0, size = 0;
  10.345 @@ -674,7 +674,7 @@ static int do_pci_add(libxl_gc *gc, uint
  10.346              }
  10.347          }
  10.348          fclose(f);
  10.349 -        sysfs_path = libxl_sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/irq", pcidev->domain,
  10.350 +        sysfs_path = libxl__sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/irq", pcidev->domain,
  10.351                                     pcidev->bus, pcidev->dev, pcidev->func);
  10.352          f = fopen(sysfs_path, "r");
  10.353          if (f == NULL) {
  10.354 @@ -717,10 +717,10 @@ static int libxl_device_pci_reset(libxl_
  10.355      char *reset;
  10.356      int fd, rc;
  10.357  
  10.358 -    reset = libxl_sprintf(gc, "%s/pciback/do_flr", SYSFS_PCI_DEV);
  10.359 +    reset = libxl__sprintf(gc, "%s/pciback/do_flr", SYSFS_PCI_DEV);
  10.360      fd = open(reset, O_WRONLY);
  10.361      if (fd > 0) {
  10.362 -        char *buf = libxl_sprintf(gc, PCI_BDF, domain, bus, dev, func);
  10.363 +        char *buf = libxl__sprintf(gc, PCI_BDF, domain, bus, dev, func);
  10.364          rc = write(fd, buf, strlen(buf));
  10.365          if (rc < 0)
  10.366              XL_LOG(ctx, XL_LOG_ERROR, "write to %s returned %d", reset, rc);
  10.367 @@ -729,7 +729,7 @@ static int libxl_device_pci_reset(libxl_
  10.368      }
  10.369      if (errno != ENOENT)
  10.370          XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Failed to access pciback path %s", reset);
  10.371 -    reset = libxl_sprintf(gc, "%s/"PCI_BDF"/reset", SYSFS_PCI_DEV, domain, bus, dev, func);
  10.372 +    reset = libxl__sprintf(gc, "%s/"PCI_BDF"/reset", SYSFS_PCI_DEV, domain, bus, dev, func);
  10.373      fd = open(reset, O_WRONLY);
  10.374      if (fd > 0) {
  10.375          rc = write(fd, "1", 1);
  10.376 @@ -812,7 +812,7 @@ int libxl_device_pci_add(libxl_ctx *ctx,
  10.377      }
  10.378  
  10.379  out:
  10.380 -    libxl_free_all(&gc);
  10.381 +    libxl__free_all(&gc);
  10.382      return rc;
  10.383  }
  10.384  
  10.385 @@ -837,29 +837,29 @@ static int do_pci_remove(libxl_gc *gc, u
  10.386  
  10.387      hvm = is_hvm(ctx, domid);
  10.388      if (hvm) {
  10.389 -        if (libxl_wait_for_device_model(ctx, domid, "running", NULL, NULL) < 0) {
  10.390 +        if (libxl__wait_for_device_model(ctx, domid, "running", NULL, NULL) < 0) {
  10.391              return ERROR_FAIL;
  10.392          }
  10.393 -        path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
  10.394 -        state = libxl_xs_read(gc, XBT_NULL, path);
  10.395 -        path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
  10.396 -        libxl_xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
  10.397 +        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
  10.398 +        state = libxl__xs_read(gc, XBT_NULL, path);
  10.399 +        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
  10.400 +        libxl__xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
  10.401                         pcidev->bus, pcidev->dev, pcidev->func);
  10.402 -        path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/command", domid);
  10.403 +        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", domid);
  10.404  
  10.405          /* Remove all functions at once atomically by only signalling
  10.406           * device-model for function 0 */
  10.407          if ( (pcidev->vdevfn & 0x7) == 0 ) {
  10.408              xs_write(ctx->xsh, XBT_NULL, path, "pci-rem", strlen("pci-rem"));
  10.409 -            if (libxl_wait_for_device_model(ctx, domid, "pci-removed", NULL, NULL) < 0) {
  10.410 +            if (libxl__wait_for_device_model(ctx, domid, "pci-removed", NULL, NULL) < 0) {
  10.411                  XL_LOG(ctx, XL_LOG_ERROR, "Device Model didn't respond in time");
  10.412                  return ERROR_FAIL;
  10.413              }
  10.414          }
  10.415 -        path = libxl_sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
  10.416 +        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
  10.417          xs_write(ctx->xsh, XBT_NULL, path, state, strlen(state));
  10.418      } else {
  10.419 -        char *sysfs_path = libxl_sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/resource", pcidev->domain,
  10.420 +        char *sysfs_path = libxl__sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/resource", pcidev->domain,
  10.421                                           pcidev->bus, pcidev->dev, pcidev->func);
  10.422          FILE *f = fopen(sysfs_path, "r");
  10.423          unsigned int start = 0, end = 0, flags = 0, size = 0;
  10.424 @@ -889,7 +889,7 @@ static int do_pci_remove(libxl_gc *gc, u
  10.425          }
  10.426          fclose(f);
  10.427  skip1:
  10.428 -        sysfs_path = libxl_sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/irq", pcidev->domain,
  10.429 +        sysfs_path = libxl__sprintf(gc, SYSFS_PCI_DEV"/"PCI_BDF"/irq", pcidev->domain,
  10.430                                     pcidev->bus, pcidev->dev, pcidev->func);
  10.431          f = fopen(sysfs_path, "r");
  10.432          if (f == NULL) {
  10.433 @@ -961,7 +961,7 @@ int libxl_device_pci_remove(libxl_ctx *c
  10.434      }
  10.435  
  10.436  out:
  10.437 -    libxl_free_all(&gc);
  10.438 +    libxl__free_all(&gc);
  10.439      return rc;
  10.440  }
  10.441  
  10.442 @@ -973,12 +973,12 @@ int libxl_device_pci_list_assigned(libxl
  10.443      unsigned int domain = 0, bus = 0, dev = 0, func = 0, vdevfn = 0;
  10.444      libxl_device_pci *pcidevs;
  10.445  
  10.446 -    be_path = libxl_sprintf(&gc, "%s/backend/pci/%d/0", libxl_xs_get_dompath(&gc, 0), domid);
  10.447 -    num_devs = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/num_devs", be_path));
  10.448 +    be_path = libxl__sprintf(&gc, "%s/backend/pci/%d/0", libxl__xs_get_dompath(&gc, 0), domid);
  10.449 +    num_devs = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/num_devs", be_path));
  10.450      if (!num_devs) {
  10.451          *num = 0;
  10.452          *list = NULL;
  10.453 -        libxl_free_all(&gc);
  10.454 +        libxl__free_all(&gc);
  10.455          return 0;
  10.456      }
  10.457      n = atoi(num_devs);
  10.458 @@ -986,13 +986,13 @@ int libxl_device_pci_list_assigned(libxl
  10.459      *num = n;
  10.460  
  10.461      for (i = 0; i < n; i++) {
  10.462 -        xsdev = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/dev-%d", be_path, i));
  10.463 +        xsdev = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/dev-%d", be_path, i));
  10.464          sscanf(xsdev, PCI_BDF, &domain, &bus, &dev, &func);
  10.465 -        xsvdevfn = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/vdevfn-%d", be_path, i));
  10.466 +        xsvdevfn = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/vdevfn-%d", be_path, i));
  10.467          if (xsvdevfn)
  10.468              vdevfn = strtol(xsvdevfn, (char **) NULL, 16);
  10.469          pcidev_init(pcidevs + i, domain, bus, dev, func, vdevfn);
  10.470 -        xsopts = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/opts-%d", be_path, i));
  10.471 +        xsopts = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/opts-%d", be_path, i));
  10.472          if (xsopts) {
  10.473              char *saveptr;
  10.474              char *p = strtok_r(xsopts, ",=", &saveptr);
  10.475 @@ -1011,7 +1011,7 @@ int libxl_device_pci_list_assigned(libxl
  10.476      }
  10.477      if ( *num )
  10.478          *list = pcidevs;
  10.479 -    libxl_free_all(&gc);
  10.480 +    libxl__free_all(&gc);
  10.481      return 0;
  10.482  }
  10.483  
    11.1 --- a/tools/libxl/libxl_utils.c	Wed Sep 08 16:35:40 2010 +0100
    11.2 +++ b/tools/libxl/libxl_utils.c	Wed Sep 08 16:44:24 2010 +0100
    11.3 @@ -54,11 +54,11 @@ char *libxl_domid_to_name(libxl_ctx *ctx
    11.4      return s;
    11.5  }
    11.6  
    11.7 -char *_libxl_domid_to_name(libxl_gc *gc, uint32_t domid)
    11.8 +char *libxl__domid_to_name(libxl_gc *gc, uint32_t domid)
    11.9  {
   11.10      char *s = libxl_domid_to_name(libxl_gc_owner(gc), domid);
   11.11      if ( s )
   11.12 -        libxl_ptr_add(gc, s);
   11.13 +        libxl__ptr_add(gc, s);
   11.14      return s;
   11.15  }
   11.16  
   11.17 @@ -103,11 +103,11 @@ char *libxl_poolid_to_name(libxl_ctx *ct
   11.18      return s;
   11.19  }
   11.20  
   11.21 -char *_libxl_poolid_to_name(libxl_gc *gc, uint32_t poolid)
   11.22 +char *libxl__poolid_to_name(libxl_gc *gc, uint32_t poolid)
   11.23  {
   11.24      char *s = libxl_poolid_to_name(libxl_gc_owner(gc), poolid);
   11.25      if ( s )
   11.26 -        libxl_ptr_add(gc, s);
   11.27 +        libxl__ptr_add(gc, s);
   11.28      return s;
   11.29  }
   11.30  
   11.31 @@ -145,14 +145,14 @@ int libxl_get_stubdom_id(libxl_ctx *ctx,
   11.32      char * stubdom_id_s;
   11.33      int ret;
   11.34  
   11.35 -    stubdom_id_s = libxl_xs_read(&gc, XBT_NULL,
   11.36 -                                 libxl_sprintf(&gc, "%s/image/device-model-domid",
   11.37 -                                               libxl_xs_get_dompath(&gc, guest_domid)));
   11.38 +    stubdom_id_s = libxl__xs_read(&gc, XBT_NULL,
   11.39 +                                 libxl__sprintf(&gc, "%s/image/device-model-domid",
   11.40 +                                               libxl__xs_get_dompath(&gc, guest_domid)));
   11.41      if (stubdom_id_s)
   11.42          ret = atoi(stubdom_id_s);
   11.43      else
   11.44          ret = 0;
   11.45 -    libxl_free_all(&gc);
   11.46 +    libxl__free_all(&gc);
   11.47      return ret;
   11.48  }
   11.49  
   11.50 @@ -163,7 +163,7 @@ int libxl_is_stubdom(libxl_ctx *ctx, uin
   11.51      uint32_t value;
   11.52      int ret = 0;
   11.53  
   11.54 -    target = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/target", libxl_xs_get_dompath(&gc, domid)));
   11.55 +    target = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/target", libxl__xs_get_dompath(&gc, domid)));
   11.56      if (!target)
   11.57          goto out;
   11.58      value = strtol(target, &endptr, 10);
   11.59 @@ -173,7 +173,7 @@ int libxl_is_stubdom(libxl_ctx *ctx, uin
   11.60          *target_domid = value;
   11.61      ret = 1;
   11.62  out:
   11.63 -    libxl_free_all(&gc);
   11.64 +    libxl__free_all(&gc);
   11.65      return ret;
   11.66  }
   11.67  
   11.68 @@ -198,20 +198,20 @@ int libxl_create_logfile(libxl_ctx *ctx,
   11.69      char *logfile, *logfile_new;
   11.70      int i, rc;
   11.71  
   11.72 -    logfile = libxl_sprintf(&gc, "/var/log/xen/%s.log", name);
   11.73 +    logfile = libxl__sprintf(&gc, "/var/log/xen/%s.log", name);
   11.74      if (stat(logfile, &stat_buf) == 0) {
   11.75          /* file exists, rotate */
   11.76 -        logfile = libxl_sprintf(&gc, "/var/log/xen/%s.log.10", name);
   11.77 +        logfile = libxl__sprintf(&gc, "/var/log/xen/%s.log.10", name);
   11.78          unlink(logfile);
   11.79          for (i = 9; i > 0; i--) {
   11.80 -            logfile = libxl_sprintf(&gc, "/var/log/xen/%s.log.%d", name, i);
   11.81 -            logfile_new = libxl_sprintf(&gc, "/var/log/xen/%s.log.%d", name, i + 1);
   11.82 +            logfile = libxl__sprintf(&gc, "/var/log/xen/%s.log.%d", name, i);
   11.83 +            logfile_new = libxl__sprintf(&gc, "/var/log/xen/%s.log.%d", name, i + 1);
   11.84              rc = logrename(ctx, logfile, logfile_new);
   11.85              if (rc)
   11.86                  goto out;
   11.87          }
   11.88 -        logfile = libxl_sprintf(&gc, "/var/log/xen/%s.log", name);
   11.89 -        logfile_new = libxl_sprintf(&gc, "/var/log/xen/%s.log.1", name);
   11.90 +        logfile = libxl__sprintf(&gc, "/var/log/xen/%s.log", name);
   11.91 +        logfile_new = libxl__sprintf(&gc, "/var/log/xen/%s.log.1", name);
   11.92  
   11.93          rc = logrename(ctx, logfile, logfile_new);
   11.94          if (rc)
   11.95 @@ -225,7 +225,7 @@ int libxl_create_logfile(libxl_ctx *ctx,
   11.96      *full_name = strdup(logfile);
   11.97      rc = 0;
   11.98  out:
   11.99 -    libxl_free_all(&gc);
  11.100 +    libxl__free_all(&gc);
  11.101      return rc;
  11.102  }
  11.103  
  11.104 @@ -455,29 +455,29 @@ int libxl_devid_to_device_nic(libxl_ctx 
  11.105      int rc = ERROR_FAIL;
  11.106  
  11.107      memset(nic, 0, sizeof (libxl_device_nic));
  11.108 -    dompath = libxl_xs_get_dompath(&gc, domid);
  11.109 +    dompath = libxl__xs_get_dompath(&gc, domid);
  11.110      if (!dompath) {
  11.111          goto out;
  11.112      }
  11.113 -    nic_path_fe = libxl_sprintf(&gc, "%s/device/vif/%s", dompath, devid);
  11.114 -    nic_path_be = libxl_xs_read(&gc, XBT_NULL,
  11.115 -                                libxl_sprintf(&gc, "%s/backend", nic_path_fe));
  11.116 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend-id", nic_path_fe));
  11.117 +    nic_path_fe = libxl__sprintf(&gc, "%s/device/vif/%s", dompath, devid);
  11.118 +    nic_path_be = libxl__xs_read(&gc, XBT_NULL,
  11.119 +                                libxl__sprintf(&gc, "%s/backend", nic_path_fe));
  11.120 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", nic_path_fe));
  11.121      if ( NULL == val ) {
  11.122          goto out;
  11.123      }
  11.124      nic->backend_domid = strtoul(val, NULL, 10);
  11.125      nic->devid = strtoul(devid, NULL, 10);
  11.126  
  11.127 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/mac", nic_path_fe));
  11.128 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", nic_path_fe));
  11.129      for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
  11.130           ++i, tok = strtok(NULL, ":")) {
  11.131          nic->mac[i] = strtoul(tok, NULL, 16);
  11.132      }
  11.133 -    nic->script = xs_read(ctx->xsh, XBT_NULL, libxl_sprintf(&gc, "%s/script", nic_path_be), NULL);
  11.134 +    nic->script = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/script", nic_path_be), NULL);
  11.135      rc = 0;
  11.136  out:
  11.137 -    libxl_free_all(&gc);
  11.138 +    libxl__free_all(&gc);
  11.139      return rc;
  11.140  }
  11.141  
  11.142 @@ -495,32 +495,32 @@ int libxl_devid_to_device_disk(libxl_ctx
  11.143          goto out;
  11.144      }
  11.145      rc = ERROR_FAIL;
  11.146 -    dompath = libxl_xs_get_dompath(&gc, domid);
  11.147 -    diskpath = libxl_sprintf(&gc, "%s/device/vbd/%s", dompath, devid);
  11.148 +    dompath = libxl__xs_get_dompath(&gc, domid);
  11.149 +    diskpath = libxl__sprintf(&gc, "%s/device/vbd/%s", dompath, devid);
  11.150      if (!diskpath) {
  11.151          goto out;
  11.152      }
  11.153  
  11.154 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend-id", diskpath));
  11.155 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", diskpath));
  11.156      if (!val)
  11.157          goto out;
  11.158      disk->backend_domid = strtoul(val, NULL, 10);
  11.159      disk->domid = domid;
  11.160 -    be_path = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend", diskpath));
  11.161 -    disk->physpath = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/params", be_path));
  11.162 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/type", be_path));
  11.163 +    be_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend", diskpath));
  11.164 +    disk->physpath = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/params", be_path));
  11.165 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/type", be_path));
  11.166      libxl_string_to_phystype(ctx, val, &(disk->phystype));
  11.167 -    disk->virtpath = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/dev", be_path));
  11.168 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/removable", be_path));
  11.169 +    disk->virtpath = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/dev", be_path));
  11.170 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/removable", be_path));
  11.171      disk->unpluggable = !strcmp(val, "1");
  11.172 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/mode", be_path));
  11.173 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mode", be_path));
  11.174      disk->readwrite = !!strcmp(val, "w");
  11.175 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/device-type", diskpath));
  11.176 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/device-type", diskpath));
  11.177      disk->is_cdrom = !strcmp(val, "cdrom");
  11.178      rc = 0;
  11.179  
  11.180  out:
  11.181 -    libxl_free_all(&gc);
  11.182 +    libxl__free_all(&gc);
  11.183      return rc;
  11.184  }
  11.185  
  11.186 @@ -538,43 +538,43 @@ int libxl_devid_to_device_net2(libxl_ctx
  11.187          goto out;
  11.188      }
  11.189      rc = ERROR_FAIL;
  11.190 -    dompath = libxl_xs_get_dompath(&gc, domid);
  11.191 -    net2path = libxl_sprintf(&gc, "%s/device/vif2/%s", dompath, devid);
  11.192 +    dompath = libxl__xs_get_dompath(&gc, domid);
  11.193 +    net2path = libxl__sprintf(&gc, "%s/device/vif2/%s", dompath, devid);
  11.194      if (!net2path) {
  11.195          goto out;
  11.196      }
  11.197      memset(net2, 0, sizeof (libxl_device_net2));
  11.198 -    be_path = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend", net2path));
  11.199 +    be_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend", net2path));
  11.200  
  11.201      net2->devid = devid_n;
  11.202 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/mac", net2path));
  11.203 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", net2path));
  11.204      for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
  11.205           ++i, tok = strtok(NULL, ":")) {
  11.206          net2->front_mac[i] = strtoul(tok, NULL, 16);
  11.207      }
  11.208 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/remote-mac", net2path));
  11.209 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/remote-mac", net2path));
  11.210      for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
  11.211           ++i, tok = strtok(NULL, ":")) {
  11.212          net2->back_mac[i] = strtoul(tok, NULL, 16);
  11.213      }
  11.214 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/backend-id", net2path));
  11.215 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", net2path));
  11.216      net2->backend_domid = strtoul(val, NULL, 10);
  11.217  
  11.218      net2->domid = domid;
  11.219 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/remote-trusted", be_path));
  11.220 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/remote-trusted", be_path));
  11.221      net2->trusted = strtoul(val, NULL, 10);
  11.222 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/local-trusted", be_path));
  11.223 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/local-trusted", be_path));
  11.224      net2->back_trusted = strtoul(val, NULL, 10);
  11.225 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/filter-mac", be_path));
  11.226 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/filter-mac", be_path));
  11.227      net2->filter_mac = strtoul(val, NULL, 10);
  11.228 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/filter-mac", net2path));
  11.229 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/filter-mac", net2path));
  11.230      net2->front_filter_mac = strtoul(val, NULL, 10);
  11.231 -    val = libxl_xs_read(&gc, XBT_NULL, libxl_sprintf(&gc, "%s/max-bypasses", be_path));
  11.232 +    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/max-bypasses", be_path));
  11.233      net2->max_bypasses = strtoul(val, NULL, 10);
  11.234      rc = 0;
  11.235  
  11.236  out:
  11.237 -    libxl_free_all(&gc);
  11.238 +    libxl__free_all(&gc);
  11.239      return rc;
  11.240  }
  11.241  
  11.242 @@ -607,7 +607,7 @@ int libxl_check_device_model_version(lib
  11.243      char *abs_path = NULL;
  11.244      int rc = -1;
  11.245  
  11.246 -    abs_path = libxl_abs_path(&gc, path, libxl_private_bindir_path());
  11.247 +    abs_path = libxl__abs_path(&gc, path, libxl_private_bindir_path());
  11.248  
  11.249      if (pipe(pipefd))
  11.250          goto out;
  11.251 @@ -672,6 +672,6 @@ int libxl_check_device_model_version(lib
  11.252      }
  11.253      rc = 0;
  11.254  out:
  11.255 -    libxl_free_all(&gc);
  11.256 +    libxl__free_all(&gc);
  11.257      return rc;
  11.258  }
    12.1 --- a/tools/libxl/libxl_xshelp.c	Wed Sep 08 16:35:40 2010 +0100
    12.2 +++ b/tools/libxl/libxl_xshelp.c	Wed Sep 08 16:44:24 2010 +0100
    12.3 @@ -44,7 +44,7 @@ int xs_writev(struct xs_handle *xsh, xs_
    12.4      return 0;
    12.5  }
    12.6  
    12.7 -char **libxl_xs_kvs_of_flexarray(libxl_gc *gc, flexarray_t *array, int length)
    12.8 +char **libxl__xs_kvs_of_flexarray(libxl_gc *gc, flexarray_t *array, int length)
    12.9  {
   12.10      char **kvs;
   12.11      int i;
   12.12 @@ -52,7 +52,7 @@ char **libxl_xs_kvs_of_flexarray(libxl_g
   12.13      if (!length)
   12.14          return NULL;
   12.15  
   12.16 -    kvs = libxl_calloc(gc, length + 2, sizeof(char *));
   12.17 +    kvs = libxl__calloc(gc, length + 2, sizeof(char *));
   12.18      if (kvs) {
   12.19          for (i = 0; i < length; i += 2) {
   12.20              void *ptr;
   12.21 @@ -68,7 +68,7 @@ char **libxl_xs_kvs_of_flexarray(libxl_g
   12.22      return kvs;
   12.23  }
   12.24  
   12.25 -int libxl_xs_writev(libxl_gc *gc, xs_transaction_t t,
   12.26 +int libxl__xs_writev(libxl_gc *gc, xs_transaction_t t,
   12.27                      char *dir, char *kvs[])
   12.28  {
   12.29      libxl_ctx *ctx = libxl_gc_owner(gc);
   12.30 @@ -79,7 +79,7 @@ int libxl_xs_writev(libxl_gc *gc, xs_tra
   12.31          return 0;
   12.32  
   12.33      for (i = 0; kvs[i] != NULL; i += 2) {
   12.34 -        path = libxl_sprintf(gc, "%s/%s", dir, kvs[i]);
   12.35 +        path = libxl__sprintf(gc, "%s/%s", dir, kvs[i]);
   12.36          if (path && kvs[i + 1]) {
   12.37              int length = strlen(kvs[i + 1]);
   12.38              xs_write(ctx->xsh, t, path, kvs[i + 1], length);
   12.39 @@ -88,7 +88,7 @@ int libxl_xs_writev(libxl_gc *gc, xs_tra
   12.40      return 0;
   12.41  }
   12.42  
   12.43 -int libxl_xs_write(libxl_gc *gc, xs_transaction_t t,
   12.44 +int libxl__xs_write(libxl_gc *gc, xs_transaction_t t,
   12.45                     char *path, char *fmt, ...)
   12.46  {
   12.47      libxl_ctx *ctx = libxl_gc_owner(gc);
   12.48 @@ -107,20 +107,20 @@ int libxl_xs_write(libxl_gc *gc, xs_tran
   12.49      return 0;
   12.50  }
   12.51  
   12.52 -char * libxl_xs_read(libxl_gc *gc, xs_transaction_t t, char *path)
   12.53 +char * libxl__xs_read(libxl_gc *gc, xs_transaction_t t, char *path)
   12.54  {
   12.55      libxl_ctx *ctx = libxl_gc_owner(gc);
   12.56      char *ptr;
   12.57  
   12.58      ptr = xs_read(ctx->xsh, t, path, NULL);
   12.59      if (ptr != NULL) {
   12.60 -        libxl_ptr_add(gc, ptr);
   12.61 +        libxl__ptr_add(gc, ptr);
   12.62          return ptr;
   12.63      }
   12.64      return 0;
   12.65  }
   12.66  
   12.67 -char *libxl_xs_get_dompath(libxl_gc *gc, uint32_t domid)
   12.68 +char *libxl__xs_get_dompath(libxl_gc *gc, uint32_t domid)
   12.69  {
   12.70      libxl_ctx *ctx = libxl_gc_owner(gc);
   12.71      char *s = xs_get_domain_path(ctx->xsh, domid);
   12.72 @@ -129,15 +129,15 @@ char *libxl_xs_get_dompath(libxl_gc *gc,
   12.73                       domid);
   12.74          return NULL;
   12.75      }
   12.76 -    libxl_ptr_add(gc, s);
   12.77 +    libxl__ptr_add(gc, s);
   12.78      return s;
   12.79  }
   12.80  
   12.81 -char **libxl_xs_directory(libxl_gc *gc, xs_transaction_t t, char *path, unsigned int *nb)
   12.82 +char **libxl__xs_directory(libxl_gc *gc, xs_transaction_t t, char *path, unsigned int *nb)
   12.83  {
   12.84      libxl_ctx *ctx = libxl_gc_owner(gc);
   12.85      char **ret = NULL;
   12.86      ret = xs_directory(ctx->xsh, XBT_NULL, path, nb);
   12.87 -    libxl_ptr_add(gc, ret);
   12.88 +    libxl__ptr_add(gc, ret);
   12.89      return ret;
   12.90  }
    13.1 --- a/tools/libxl/xl_cmdimpl.c	Wed Sep 08 16:35:40 2010 +0100
    13.2 +++ b/tools/libxl/xl_cmdimpl.c	Wed Sep 08 16:44:24 2010 +0100
    13.3 @@ -4395,7 +4395,7 @@ int main_blockdetach(int argc, char **ar
    13.4          return 1;
    13.5      }
    13.6      if (libxl_device_disk_del(&ctx, &disk, 1)) {
    13.7 -        fprintf(stderr, "libxl_device_del failed.\n");
    13.8 +        fprintf(stderr, "libxl_device_disk_del failed.\n");
    13.9      }
   13.10      return 0;
   13.11  }