debuggers.hg

changeset 22165:d6663c62524a

libxl: Ensure all _hidden functions use libxl__ prefix (manual part)

This patch covers the remaining functions identified by:
rgrep _hidden tools/libxl/*.h | grep -v libxl__

sed -i -e 's/XL_LOG/LIBXL__LOG/g' tools/libxl/*.[ch]
sed -i -e 's/xl_log/libxl__log/g' tools/libxl/*.[ch]
sed -i -e 's/\(build_\(pre\|post\|pv\|hvm\)\)/libxl__\1/g' tools/libxl/*.[ch]
sed -i -e 's/is_hvm/libxl__domain_is_hvm/g' tools/libxl/*.[ch]
sed -i -e 's/get_shutdown_reason/libxl__domain_shutdown_reason/g' tools/libxl/*.[ch]
sed -i -e 's/restore_common/libxl__domain_restore_common/g' tools/libxl/*.[ch]
sed -i -e 's/core_suspend/libxl__domain_suspend_common/g' tools/libxl/*.[ch]
sed -i -e 's/save_device_model/libxl__domain_save_device_model/g' tools/libxl/*.[ch]
sed -i -e 's/device_disk_backend_type_of_phystype/libxl__device_disk_backend_type_of_phystype/g' tools/libxl/*.[ch]
sed -i -e 's/\<libxl_blktap_enabled\>/libxl__blktap_enabled/g' tools/libxl/*.[ch]
sed -i -e 's/\<libxl_blktap_devpath\>/libxl__blktap_devpath/g' tools/libxl/*.[ch]

Add _hidden to libxl__blktap_enabled and libxl__blktap_devpath

Inline dominfo_libxl__domain_shutdown_reason(info) into
libxl__domain_shutdown_reason, its only caller.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Ian Campbell <ian.campbell@citrix.com>
date Wed Sep 08 16:46:27 2010 +0100 (2010-09-08)
parents 23112038074f
children bd331cd1e704
files tools/libxl/libxl.c tools/libxl/libxl_blktap2.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_noblktap2.c tools/libxl/libxl_pci.c tools/libxl/libxl_utils.c tools/libxl/libxl_xshelp.c
line diff
     1.1 --- a/tools/libxl/libxl.c	Wed Sep 08 16:44:24 2010 +0100
     1.2 +++ b/tools/libxl/libxl.c	Wed Sep 08 16:46:27 2010 +0100
     1.3 @@ -48,7 +48,7 @@ int libxl_ctx_init(libxl_ctx *ctx, int v
     1.4  
     1.5      ctx->xch = xc_interface_open(lg,lg,0);
     1.6      if (!ctx->xch) {
     1.7 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, errno, 
     1.8 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, errno, 
     1.9                          "cannot open libxc handle");
    1.10          return ERROR_FAIL;
    1.11      }
    1.12 @@ -57,7 +57,7 @@ int libxl_ctx_init(libxl_ctx *ctx, int v
    1.13      if (!ctx->xsh)
    1.14          ctx->xsh = xs_domain_open();
    1.15      if (!ctx->xsh) {
    1.16 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, errno, 
    1.17 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, errno, 
    1.18                          "cannot connect to xenstore");
    1.19          xc_interface_close(ctx->xch);
    1.20          return ERROR_FAIL;
    1.21 @@ -135,14 +135,14 @@ int libxl_domain_make(libxl_ctx *ctx, li
    1.22  
    1.23      ret = xc_domain_create(ctx->xch, info->ssidref, handle, flags, domid);
    1.24      if (ret < 0) {
    1.25 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "domain creation fail");
    1.26 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "domain creation fail");
    1.27          libxl__free_all(&gc);
    1.28          return ERROR_FAIL;
    1.29      }
    1.30  
    1.31      ret = xc_cpupool_movedomain(ctx->xch, info->poolid, *domid);
    1.32      if (ret < 0) {
    1.33 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "domain move fail");
    1.34 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "domain move fail");
    1.35          libxl__free_all(&gc);
    1.36          return ERROR_FAIL;
    1.37      }
    1.38 @@ -155,7 +155,7 @@ int libxl_domain_make(libxl_ctx *ctx, li
    1.39  
    1.40      vm_path = libxl__sprintf(&gc, "/vm/%s", uuid_string);
    1.41      if (!vm_path) {
    1.42 -        XL_LOG(ctx, XL_LOG_ERROR, "cannot allocate create paths");
    1.43 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot allocate create paths");
    1.44          libxl__free_all(&gc);
    1.45          return ERROR_FAIL;
    1.46      }
    1.47 @@ -235,7 +235,7 @@ int libxl_domain_rename(libxl_ctx *ctx, 
    1.48      if (!trans) {
    1.49          trans = our_trans = xs_transaction_start(ctx->xsh);
    1.50          if (!our_trans) {
    1.51 -            XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, errno,
    1.52 +            LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, errno,
    1.53                              "create xs transaction for domain (re)name");
    1.54              goto x_fail;
    1.55          }
    1.56 @@ -244,13 +244,13 @@ int libxl_domain_rename(libxl_ctx *ctx, 
    1.57      if (old_name) {
    1.58          got_old_name = xs_read(ctx->xsh, trans, name_path, &got_old_len);
    1.59          if (!got_old_name) {
    1.60 -            XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, errno, "check old name"
    1.61 +            LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, errno, "check old name"
    1.62                              " for domain %"PRIu32" allegedly named `%s'",
    1.63                              domid, old_name);
    1.64              goto x_fail;
    1.65          }
    1.66          if (strcmp(old_name, got_old_name)) {
    1.67 -            XL_LOG(ctx, XL_LOG_ERROR, "domain %"PRIu32" allegedly named "
    1.68 +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "domain %"PRIu32" allegedly named "
    1.69                     "`%s' is actually named `%s' - racing ?",
    1.70                     domid, old_name, got_old_name);
    1.71              free(got_old_name);
    1.72 @@ -260,7 +260,7 @@ int libxl_domain_rename(libxl_ctx *ctx, 
    1.73      }
    1.74      if (!xs_write(ctx->xsh, trans, name_path,
    1.75                    new_name, strlen(new_name))) {
    1.76 -        XL_LOG(ctx, XL_LOG_ERROR, "failed to write new name `%s'"
    1.77 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "failed to write new name `%s'"
    1.78                 " for domain %"PRIu32" previously named `%s'",
    1.79                 new_name, domid, old_name);
    1.80          goto x_fail;
    1.81 @@ -270,12 +270,12 @@ int libxl_domain_rename(libxl_ctx *ctx, 
    1.82          if (!xs_transaction_end(ctx->xsh, our_trans, 0)) {
    1.83              trans = our_trans = 0;
    1.84              if (errno != EAGAIN) {
    1.85 -                XL_LOG(ctx, XL_LOG_ERROR, "failed to commit new name `%s'"
    1.86 +                LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "failed to commit new name `%s'"
    1.87                         " for domain %"PRIu32" previously named `%s'",
    1.88                         new_name, domid, old_name);
    1.89                  goto x_fail;
    1.90              }
    1.91 -            XL_LOG(ctx, XL_LOG_DEBUG, "need to retry rename transaction"
    1.92 +            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "need to retry rename transaction"
    1.93                     " for domain %"PRIu32" (name_path=\"%s\", new_name=\"%s\")",
    1.94                     domid, name_path, new_name);
    1.95              goto retry_transaction;
    1.96 @@ -300,14 +300,14 @@ int libxl_domain_build(libxl_ctx *ctx, l
    1.97      struct timeval start_time;
    1.98      int i, ret;
    1.99  
   1.100 -    ret = build_pre(ctx, domid, info, state);
   1.101 +    ret = libxl__build_pre(ctx, domid, info, state);
   1.102      if (ret)
   1.103          goto out;
   1.104  
   1.105      gettimeofday(&start_time, NULL);
   1.106  
   1.107      if (info->hvm) {
   1.108 -        ret = build_hvm(ctx, domid, info, state);
   1.109 +        ret = libxl__build_hvm(ctx, domid, info, state);
   1.110          if (ret)
   1.111              goto out;
   1.112  
   1.113 @@ -319,7 +319,7 @@ int libxl_domain_build(libxl_ctx *ctx, l
   1.114          vments[4] = "start_time";
   1.115          vments[5] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
   1.116      } else {
   1.117 -        ret = build_pv(ctx, domid, info, state);
   1.118 +        ret = libxl__build_pv(ctx, domid, info, state);
   1.119          if (ret)
   1.120              goto out;
   1.121  
   1.122 @@ -340,7 +340,7 @@ int libxl_domain_build(libxl_ctx *ctx, l
   1.123              vments[i++] = (char*) info->u.pv.cmdline;
   1.124          }
   1.125      }
   1.126 -    ret = build_post(ctx, domid, info, state, vments, localents);
   1.127 +    ret = libxl__build_post(ctx, domid, info, state, vments, localents);
   1.128  out:
   1.129      libxl__file_reference_unmap(&info->kernel);
   1.130      if (!info->hvm)
   1.131 @@ -359,11 +359,11 @@ int libxl_domain_restore(libxl_ctx *ctx,
   1.132      struct timeval start_time;
   1.133      int i, ret, esave, flags;
   1.134  
   1.135 -    ret = build_pre(ctx, domid, info, state);
   1.136 +    ret = libxl__build_pre(ctx, domid, info, state);
   1.137      if (ret)
   1.138          goto out;
   1.139  
   1.140 -    ret = restore_common(ctx, domid, info, state, fd);
   1.141 +    ret = libxl__domain_restore_common(ctx, domid, info, state, fd);
   1.142      if (ret)
   1.143          goto out;
   1.144  
   1.145 @@ -395,7 +395,7 @@ int libxl_domain_restore(libxl_ctx *ctx,
   1.146              vments[i++] = (char*) info->u.pv.cmdline;
   1.147          }
   1.148      }
   1.149 -    ret = build_post(ctx, domid, info, state, vments, localents);
   1.150 +    ret = libxl__build_post(ctx, domid, info, state, vments, localents);
   1.151      if (ret)
   1.152          goto out;
   1.153  
   1.154 @@ -415,11 +415,11 @@ out:
   1.155  
   1.156      flags = fcntl(fd, F_GETFL);
   1.157      if (flags == -1) {
   1.158 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unable to get flags on restore fd");
   1.159 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unable to get flags on restore fd");
   1.160      } else {
   1.161          flags &= ~O_NONBLOCK;
   1.162          if (fcntl(fd, F_SETFL, flags) == -1)
   1.163 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unable to put restore fd"
   1.164 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unable to put restore fd"
   1.165                           " back to blocking mode");
   1.166      }
   1.167  
   1.168 @@ -433,21 +433,21 @@ int libxl_domain_resume(libxl_ctx *ctx, 
   1.169      libxl_gc gc = LIBXL_INIT_GC(ctx);
   1.170      int rc = 0;
   1.171  
   1.172 -    if (is_hvm(ctx, domid)) {
   1.173 -        XL_LOG(ctx, XL_LOG_DEBUG, "Called domain_resume on "
   1.174 +    if (libxl__domain_is_hvm(ctx, domid)) {
   1.175 +        LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Called domain_resume on "
   1.176                  "non-cooperative hvm domain %u", domid);
   1.177          rc = ERROR_NI;
   1.178          goto out;
   1.179      }
   1.180      if (xc_domain_resume(ctx->xch, domid, 1)) {
   1.181 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, 
   1.182 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, 
   1.183                          "xc_domain_resume failed for domain %u", 
   1.184                          domid);
   1.185          rc = ERROR_FAIL;
   1.186          goto out;
   1.187      }
   1.188      if (!xs_resume_domain(ctx->xsh, domid)) {
   1.189 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, 
   1.190 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, 
   1.191                          "xs_resume_domain failed for domain %u", 
   1.192                          domid);
   1.193          rc = ERROR_FAIL;
   1.194 @@ -558,13 +558,13 @@ libxl_dominfo * libxl_list_domain(libxl_
   1.195  
   1.196      ptr = calloc(size, sizeof(libxl_dominfo));
   1.197      if (!ptr) {
   1.198 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "allocating domain info");
   1.199 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "allocating domain info");
   1.200          return NULL;
   1.201      }
   1.202  
   1.203      ret = xc_domain_getinfolist(ctx->xch, 0, 1024, info);
   1.204      if (ret<0) {
   1.205 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "geting domain info list");
   1.206 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "geting domain info list");
   1.207          return NULL;
   1.208      }
   1.209  
   1.210 @@ -582,7 +582,7 @@ int libxl_domain_info(libxl_ctx *ctx, li
   1.211  
   1.212      ret = xc_domain_getinfolist(ctx->xch, domid, 1, &xcinfo);
   1.213      if (ret<0) {
   1.214 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "geting domain info list");
   1.215 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "geting domain info list");
   1.216          return ERROR_FAIL;
   1.217      }
   1.218      if (ret==0 || xcinfo.domain != domid) return ERROR_INVAL;
   1.219 @@ -600,13 +600,13 @@ libxl_poolinfo * libxl_list_pool(libxl_c
   1.220  
   1.221      ptr = calloc(size, sizeof(libxl_poolinfo));
   1.222      if (!ptr) {
   1.223 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "allocating cpupool info");
   1.224 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "allocating cpupool info");
   1.225          return NULL;
   1.226      }
   1.227  
   1.228      ret = xc_cpupool_getinfo(ctx->xch, 0, 256, info);
   1.229      if (ret<0) {
   1.230 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting cpupool info");
   1.231 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting cpupool info");
   1.232          return NULL;
   1.233      }
   1.234  
   1.235 @@ -631,7 +631,7 @@ libxl_vminfo * libxl_list_vm(libxl_ctx *
   1.236  
   1.237      ret = xc_domain_getinfolist(ctx->xch, 1, 1024, info);
   1.238      if (ret<0) {
   1.239 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "geting domain info list");
   1.240 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "geting domain info list");
   1.241          return NULL;
   1.242      }
   1.243      for (index = i = 0; i < ret; i++) {
   1.244 @@ -649,14 +649,14 @@ libxl_vminfo * libxl_list_vm(libxl_ctx *
   1.245  int libxl_domain_suspend(libxl_ctx *ctx, libxl_domain_suspend_info *info,
   1.246                           uint32_t domid, int fd)
   1.247  {
   1.248 -    int hvm = is_hvm(ctx, domid);
   1.249 +    int hvm = libxl__domain_is_hvm(ctx, domid);
   1.250      int live = info != NULL && info->flags & XL_SUSPEND_LIVE;
   1.251      int debug = info != NULL && info->flags & XL_SUSPEND_DEBUG;
   1.252      int rc = 0;
   1.253  
   1.254 -    core_suspend(ctx, domid, fd, hvm, live, debug);
   1.255 +    libxl__domain_suspend_common(ctx, domid, fd, hvm, live, debug);
   1.256      if (hvm)
   1.257 -        rc = save_device_model(ctx, domid, fd);
   1.258 +        rc = libxl__domain_save_device_model(ctx, domid, fd);
   1.259      return rc;
   1.260  }
   1.261  
   1.262 @@ -665,7 +665,7 @@ int libxl_domain_pause(libxl_ctx *ctx, u
   1.263      int ret;
   1.264      ret = xc_domain_pause(ctx->xch, domid);
   1.265      if (ret<0) {
   1.266 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "pausing domain %d", domid);
   1.267 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "pausing domain %d", domid);
   1.268          return ERROR_FAIL;
   1.269      }
   1.270      return 0;
   1.271 @@ -677,7 +677,7 @@ int libxl_domain_core_dump(libxl_ctx *ct
   1.272      int ret;
   1.273      ret = xc_domain_dumpcore(ctx->xch, domid, filename);
   1.274      if (ret<0) {
   1.275 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "core dumping domain %d to %s",
   1.276 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "core dumping domain %d to %s",
   1.277                       domid, filename);
   1.278          return ERROR_FAIL;
   1.279      }
   1.280 @@ -691,7 +691,7 @@ int libxl_domain_unpause(libxl_ctx *ctx,
   1.281      char *state;
   1.282      int ret, rc = 0;
   1.283  
   1.284 -    if (is_hvm(ctx, domid)) {
   1.285 +    if (libxl__domain_is_hvm(ctx, domid)) {
   1.286          path = libxl__sprintf(&gc, "/local/domain/0/device-model/%d/state", domid);
   1.287          state = libxl__xs_read(&gc, XBT_NULL, path);
   1.288          if (state != NULL && !strcmp(state, "paused")) {
   1.289 @@ -701,7 +701,7 @@ int libxl_domain_unpause(libxl_ctx *ctx,
   1.290      }
   1.291      ret = xc_domain_unpause(ctx->xch, domid);
   1.292      if (ret<0) {
   1.293 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unpausing domain %d", domid);
   1.294 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unpausing domain %d", domid);
   1.295          rc = ERROR_FAIL;
   1.296      }
   1.297      libxl__free_all(&gc);
   1.298 @@ -736,24 +736,24 @@ int libxl_domain_shutdown(libxl_ctx *ctx
   1.299      shutdown_path = libxl__sprintf(&gc, "%s/control/shutdown", dom_path);
   1.300  
   1.301      xs_write(ctx->xsh, XBT_NULL, shutdown_path, req_table[req], strlen(req_table[req]));
   1.302 -    if (is_hvm(ctx,domid)) {
   1.303 +    if (libxl__domain_is_hvm(ctx,domid)) {
   1.304          unsigned long acpi_s_state = 0;
   1.305          unsigned long pvdriver = 0;
   1.306          int ret;
   1.307          ret = xc_get_hvm_param(ctx->xch, domid, HVM_PARAM_ACPI_S_STATE, &acpi_s_state);
   1.308          if (ret<0) {
   1.309 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting ACPI S-state");
   1.310 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting ACPI S-state");
   1.311              return ERROR_FAIL;
   1.312          }
   1.313          ret = xc_get_hvm_param(ctx->xch, domid, HVM_PARAM_CALLBACK_IRQ, &pvdriver);
   1.314          if (ret<0) {
   1.315 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting HVM callback IRQ");
   1.316 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting HVM callback IRQ");
   1.317              return ERROR_FAIL;
   1.318          }
   1.319          if (!pvdriver || acpi_s_state != 0) {
   1.320              ret = xc_domain_shutdown(ctx->xch, domid, req);
   1.321              if (ret<0) {
   1.322 -                XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unpausing domain");
   1.323 +                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unpausing domain");
   1.324                  return ERROR_FAIL;
   1.325              }
   1.326         }
   1.327 @@ -790,7 +790,7 @@ int libxl_wait_for_disk_ejects(libxl_ctx
   1.328      for (i = 0; i < num_disks; i++) {
   1.329          if (asprintf(&(waiter[i].path), "%s/device/vbd/%d/eject",
   1.330                       libxl__xs_get_dompath(&gc, domid),
   1.331 -                     device_disk_dev_number(disks[i].virtpath)) < 0)
   1.332 +                     libxl__device_disk_dev_number(disks[i].virtpath)) < 0)
   1.333              goto out;
   1.334          if (asprintf(&(waiter[i].token), "%d", LIBXL_EVENT_DISK_EJECT) < 0)
   1.335              goto out;
   1.336 @@ -893,11 +893,11 @@ static int libxl_destroy_device_model(li
   1.337      if (!pid) {
   1.338          int stubdomid = libxl_get_stubdom_id(ctx, domid);
   1.339          if (!stubdomid) {
   1.340 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't find device model's pid");
   1.341 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't find device model's pid");
   1.342              ret = ERROR_INVAL;
   1.343              goto out;
   1.344          }
   1.345 -        XL_LOG(ctx, XL_LOG_ERROR, "Device model is a stubdom, domid=%d\n", stubdomid);
   1.346 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device model is a stubdom, domid=%d\n", stubdomid);
   1.347          ret = libxl_domain_destroy(ctx, stubdomid, 0);
   1.348          goto out;
   1.349      }
   1.350 @@ -905,13 +905,13 @@ static int libxl_destroy_device_model(li
   1.351  
   1.352      ret = kill(atoi(pid), SIGHUP);
   1.353      if (ret < 0 && errno == ESRCH) {
   1.354 -        XL_LOG(ctx, XL_LOG_DEBUG, "Device Model already exited");
   1.355 +        LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Device Model already exited");
   1.356          ret = 0;
   1.357      } else if (ret == 0) {
   1.358 -        XL_LOG(ctx, XL_LOG_DEBUG, "Device Model signaled");
   1.359 +        LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Device Model signaled");
   1.360          ret = 0;
   1.361      } else {
   1.362 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to kill Device Model [%d]",
   1.363 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to kill Device Model [%d]",
   1.364                       atoi(pid));
   1.365      }
   1.366  out:
   1.367 @@ -926,7 +926,7 @@ int libxl_domain_destroy(libxl_ctx *ctx,
   1.368      char *vm_path;
   1.369      int rc, dm_present;
   1.370  
   1.371 -    if (is_hvm(ctx, domid)) {
   1.372 +    if (libxl__domain_is_hvm(ctx, domid)) {
   1.373          dm_present = 1;
   1.374      } else {
   1.375          char *pid;
   1.376 @@ -941,7 +941,7 @@ int libxl_domain_destroy(libxl_ctx *ctx,
   1.377      }
   1.378  
   1.379      if (libxl_device_pci_shutdown(ctx, domid) < 0)
   1.380 -        XL_LOG(ctx, XL_LOG_ERROR, "pci shutdown failed for domid %d", domid);
   1.381 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "pci shutdown failed for domid %d", domid);
   1.382      if (dm_present) {
   1.383          xs_write(ctx->xsh, XBT_NULL,
   1.384                   libxl__sprintf(&gc, "/local/domain/0/device-model/%d/command", domid),
   1.385 @@ -949,28 +949,28 @@ int libxl_domain_destroy(libxl_ctx *ctx,
   1.386      }
   1.387      rc = xc_domain_pause(ctx->xch, domid);
   1.388      if (rc < 0) {
   1.389 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_pause failed for %d", domid);
   1.390 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_pause failed for %d", domid);
   1.391      }
   1.392      if (dm_present) {
   1.393          if (libxl_destroy_device_model(ctx, domid) < 0)
   1.394 -            XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_device_model failed for %d", domid);
   1.395 +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_destroy_device_model failed for %d", domid);
   1.396      }
   1.397      if (libxl__devices_destroy(ctx, domid, force) < 0)
   1.398 -        XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_devices failed for %d", domid);
   1.399 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_destroy_devices failed for %d", domid);
   1.400  
   1.401      vm_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/vm", dom_path));
   1.402      if (vm_path)
   1.403          if (!xs_rm(ctx->xsh, XBT_NULL, vm_path))
   1.404 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vm_path);
   1.405 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xs_rm failed for %s", vm_path);
   1.406  
   1.407      if (!xs_rm(ctx->xsh, XBT_NULL, dom_path))
   1.408 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", dom_path);
   1.409 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xs_rm failed for %s", dom_path);
   1.410  
   1.411      libxl__userdata_destroyall(ctx, domid);
   1.412  
   1.413      rc = xc_domain_destroy(ctx->xch, domid);
   1.414      if (rc < 0) {
   1.415 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_destroy failed for %d", domid);
   1.416 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_destroy failed for %d", domid);
   1.417          rc = ERROR_FAIL;
   1.418          goto out;
   1.419      }
   1.420 @@ -1012,7 +1012,7 @@ int libxl_primary_console_exec(libxl_ctx
   1.421      if (stubdomid)
   1.422          return libxl_console_exec(ctx, stubdomid, 1, LIBXL_CONSTYPE_PV);
   1.423      else {
   1.424 -        if (is_hvm(ctx, domid_vm))
   1.425 +        if (libxl__domain_is_hvm(ctx, domid_vm))
   1.426              return libxl_console_exec(ctx, domid_vm, 0, LIBXL_CONSTYPE_SERIAL);
   1.427          else
   1.428              return libxl_console_exec(ctx, domid_vm, 0, LIBXL_CONSTYPE_PV);
   1.429 @@ -1067,7 +1067,7 @@ int libxl_vncviewer_exec(libxl_ctx *ctx,
   1.430  
   1.431          if ( unlink(tmpname) )
   1.432              /* should never happen */
   1.433 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unlink %s failed", tmpname);
   1.434 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unlink %s failed", tmpname);
   1.435  
   1.436          if ( libxl_write_exactly(ctx, autopass_fd, vnc_pass, strlen(vnc_pass),
   1.437                                      tmpname, "vnc password") ) {
   1.438 @@ -1535,7 +1535,7 @@ static int libxl_create_stubdom(libxl_ct
   1.439                     "%d", info->domid);
   1.440      ret = xc_domain_set_target(ctx->xch, domid, info->domid);
   1.441      if (ret<0) {
   1.442 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "setting target domain %d -> %d", domid, info->domid);
   1.443 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting target domain %d -> %d", domid, info->domid);
   1.444          ret = ERROR_FAIL;
   1.445          goto out_free;
   1.446      }
   1.447 @@ -1774,10 +1774,10 @@ int libxl_device_disk_add(libxl_ctx *ctx
   1.448          goto out_free;
   1.449      }
   1.450  
   1.451 -    backend_type = device_disk_backend_type_of_phystype(disk->phystype);
   1.452 -    devid = device_disk_dev_number(disk->virtpath);
   1.453 +    backend_type = libxl__device_disk_backend_type_of_phystype(disk->phystype);
   1.454 +    devid = libxl__device_disk_dev_number(disk->virtpath);
   1.455      if (devid==-1) {
   1.456 -        XL_LOG(ctx, XL_LOG_ERROR, "Invalid or unsupported"
   1.457 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Invalid or unsupported"
   1.458                 " virtual disk identifier %s", disk->virtpath);
   1.459          rc = ERROR_INVAL;
   1.460          goto out_free;
   1.461 @@ -1792,7 +1792,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
   1.462      switch (disk->phystype) {
   1.463          case PHYSTYPE_PHY: {
   1.464  
   1.465 -            device_physdisk_major_minor(disk->physpath, &major, &minor);
   1.466 +            libxl__device_physdisk_major_minor(disk->physpath, &major, &minor);
   1.467              flexarray_set(back, boffset++, "physical-device");
   1.468              flexarray_set(back, boffset++, libxl__sprintf(&gc, "%x:%x", major, minor));
   1.469  
   1.470 @@ -1809,19 +1809,19 @@ int libxl_device_disk_add(libxl_ctx *ctx
   1.471          case PHYSTYPE_QCOW:
   1.472          case PHYSTYPE_QCOW2:
   1.473          case PHYSTYPE_VHD:
   1.474 -            if (libxl_blktap_enabled(&gc)) {
   1.475 -                const char *dev = libxl_blktap_devpath(&gc,
   1.476 +            if (libxl__blktap_enabled(&gc)) {
   1.477 +                const char *dev = libxl__blktap_devpath(&gc,
   1.478                                                 disk->physpath, disk->phystype);
   1.479                  if (!dev) {
   1.480                      rc = ERROR_FAIL;
   1.481                      goto out_free;
   1.482                  }
   1.483                  flexarray_set(back, boffset++, "tapdisk-params");
   1.484 -                flexarray_set(back, boffset++, libxl__sprintf(&gc, "%s:%s", device_disk_string_of_phystype(disk->phystype), disk->physpath));
   1.485 +                flexarray_set(back, boffset++, libxl__sprintf(&gc, "%s:%s", libxl__device_disk_string_of_phystype(disk->phystype), disk->physpath));
   1.486                  flexarray_set(back, boffset++, "params");
   1.487                  flexarray_set(back, boffset++, libxl__strdup(&gc, dev));
   1.488                  backend_type = "phy";
   1.489 -                device_physdisk_major_minor(dev, &major, &minor);
   1.490 +                libxl__device_physdisk_major_minor(dev, &major, &minor);
   1.491                  flexarray_set(back, boffset++, "physical-device");
   1.492                  flexarray_set(back, boffset++, libxl__sprintf(&gc, "%x:%x", major, minor));
   1.493                  device.backend_kind = DEVICE_VBD;
   1.494 @@ -1830,13 +1830,13 @@ int libxl_device_disk_add(libxl_ctx *ctx
   1.495              }
   1.496              flexarray_set(back, boffset++, "params");
   1.497              flexarray_set(back, boffset++, libxl__sprintf(&gc, "%s:%s",
   1.498 -                          device_disk_string_of_phystype(disk->phystype), disk->physpath));
   1.499 +                          libxl__device_disk_string_of_phystype(disk->phystype), disk->physpath));
   1.500  
   1.501              device.backend_kind = DEVICE_TAP;
   1.502              break;
   1.503  
   1.504          default:
   1.505 -            XL_LOG(ctx, XL_LOG_ERROR, "unrecognized disk physical type: %d\n", disk->phystype);
   1.506 +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk physical type: %d\n", disk->phystype);
   1.507              rc = ERROR_INVAL;
   1.508              goto out_free;
   1.509      }
   1.510 @@ -1892,7 +1892,7 @@ int libxl_device_disk_del(libxl_ctx *ctx
   1.511      libxl_device device;
   1.512      int devid;
   1.513  
   1.514 -    devid = device_disk_dev_number(disk->virtpath);
   1.515 +    devid = libxl__device_disk_dev_number(disk->virtpath);
   1.516      device.backend_domid    = disk->backend_domid;
   1.517      device.backend_devid    = devid;
   1.518      device.backend_kind     = 
   1.519 @@ -1922,12 +1922,12 @@ char * libxl_device_disk_local_attach(li
   1.520          case PHYSTYPE_QCOW:
   1.521          case PHYSTYPE_QCOW2:
   1.522          case PHYSTYPE_VHD:
   1.523 -            if (libxl_blktap_enabled(&gc))
   1.524 -                dev = libxl_blktap_devpath(&gc, disk->physpath, phystype);
   1.525 +            if (libxl__blktap_enabled(&gc))
   1.526 +                dev = libxl__blktap_devpath(&gc, disk->physpath, phystype);
   1.527              break;
   1.528  
   1.529          default:
   1.530 -            XL_LOG(ctx, XL_LOG_ERROR, "unrecognized disk physical type: %d\n", phystype);
   1.531 +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk physical type: %d\n", phystype);
   1.532              break;
   1.533      }
   1.534      ret = strdup(dev);
   1.535 @@ -2523,7 +2523,7 @@ int libxl_device_disk_getinfo(libxl_ctx 
   1.536      char *val;
   1.537  
   1.538      dompath = libxl__xs_get_dompath(&gc, domid);
   1.539 -    diskinfo->devid = device_disk_dev_number(disk->virtpath);
   1.540 +    diskinfo->devid = libxl__device_disk_dev_number(disk->virtpath);
   1.541  
   1.542      /* tap devices entries in xenstore are written as vbd devices. */
   1.543      diskpath = libxl__sprintf(&gc, "%s/device/vbd/%d", dompath, diskinfo->devid);
   1.544 @@ -2568,7 +2568,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u
   1.545              break;
   1.546      }
   1.547      if (i == num) {
   1.548 -        XL_LOG(ctx, XL_LOG_ERROR, "Virtual device not found");
   1.549 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual device not found");
   1.550          goto out;
   1.551      }
   1.552  
   1.553 @@ -2731,17 +2731,17 @@ int libxl_domain_setmaxmem(libxl_ctx *ct
   1.554  
   1.555      mem = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/memory/target", dompath));
   1.556      if (!mem) {
   1.557 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "cannot get memory info from %s/memory/target\n", dompath);
   1.558 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot get memory info from %s/memory/target\n", dompath);
   1.559          goto out;
   1.560      }
   1.561      memorykb = strtoul(mem, &endptr, 10);
   1.562      if (*endptr != '\0') {
   1.563 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "invalid memory %s from %s/memory/target\n", mem, dompath);
   1.564 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "invalid memory %s from %s/memory/target\n", mem, dompath);
   1.565          goto out;
   1.566      }
   1.567  
   1.568      if (max_memkb < memorykb) {
   1.569 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "memory_static_max must be greater than or or equal to memory_dynamic_max\n");
   1.570 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "memory_static_max must be greater than or or equal to memory_dynamic_max\n");
   1.571          goto out;
   1.572      }
   1.573  
   1.574 @@ -2768,19 +2768,19 @@ int libxl_set_memory_target(libxl_ctx *c
   1.575      if (domid) {
   1.576          memmax = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/memory/static-max", dompath));
   1.577          if (!memmax) {
   1.578 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
   1.579 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
   1.580                  "cannot get memory info from %s/memory/static-max\n", dompath);
   1.581              goto out;
   1.582          }
   1.583          memorykb = strtoul(memmax, &endptr, 10);
   1.584          if (*endptr != '\0') {
   1.585 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
   1.586 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
   1.587                  "invalid max memory %s from %s/memory/static-max\n", memmax, dompath);
   1.588              goto out;
   1.589          }
   1.590  
   1.591          if (target_memkb > memorykb) {
   1.592 -            XL_LOG(ctx, XL_LOG_ERROR,
   1.593 +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
   1.594                  "memory_dynamic_max must be less than or equal to memory_static_max\n");
   1.595              goto out;
   1.596          }
   1.597 @@ -2835,7 +2835,7 @@ int libxl_get_physinfo(libxl_ctx *ctx, l
   1.598  
   1.599      rc = xc_physinfo(ctx->xch, &xcphysinfo);
   1.600      if (rc != 0) {
   1.601 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting physinfo");
   1.602 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting physinfo");
   1.603          return ERROR_FAIL;
   1.604      }
   1.605      physinfo->threads_per_core = xcphysinfo.threads_per_core;
   1.606 @@ -2909,11 +2909,11 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ct
   1.607      unsigned num_cpuwords;
   1.608  
   1.609      if (xc_domain_getinfolist(ctx->xch, domid, 1, &domaininfo) != 1) {
   1.610 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting infolist");
   1.611 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting infolist");
   1.612          return NULL;
   1.613      }
   1.614      if (xc_physinfo(ctx->xch, &physinfo) == -1) {
   1.615 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting physinfo");
   1.616 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting physinfo");
   1.617          return NULL;
   1.618      }
   1.619      *nrcpus = physinfo.max_cpu_id + 1;
   1.620 @@ -2929,12 +2929,12 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ct
   1.621              return NULL;
   1.622          }
   1.623          if (xc_vcpu_getinfo(ctx->xch, domid, *nb_vcpu, &vcpuinfo) == -1) {
   1.624 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting vcpu info");
   1.625 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting vcpu info");
   1.626              return NULL;
   1.627          }
   1.628          if (xc_vcpu_getaffinity(ctx->xch, domid, *nb_vcpu,
   1.629              ptr->cpumap, ((*nrcpus) + 7) / 8) == -1) {
   1.630 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting vcpu affinity");
   1.631 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting vcpu affinity");
   1.632              return NULL;
   1.633          }
   1.634          ptr->vcpuid = *nb_vcpu;
   1.635 @@ -2951,7 +2951,7 @@ int libxl_set_vcpuaffinity(libxl_ctx *ct
   1.636                             uint64_t *cpumap, int nrcpus)
   1.637  {
   1.638      if (xc_vcpu_setaffinity(ctx->xch, domid, vcpuid, cpumap, (nrcpus + 7) / 8)) {
   1.639 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "setting vcpu affinity");
   1.640 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting vcpu affinity");
   1.641          return ERROR_FAIL;
   1.642      }
   1.643      return 0;
   1.644 @@ -2966,7 +2966,7 @@ int libxl_set_vcpuonline(libxl_ctx *ctx,
   1.645      int i, rc = ERROR_FAIL;
   1.646  
   1.647      if (libxl_domain_info(ctx, &info, domid) < 0) {
   1.648 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting domain info list");
   1.649 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list");
   1.650          goto out;
   1.651      }
   1.652      if (!(dompath = libxl__xs_get_dompath(&gc, domid)))
   1.653 @@ -2996,7 +2996,7 @@ int libxl_get_sched_id(libxl_ctx *ctx)
   1.654      int sched, ret;
   1.655  
   1.656      if ((ret = xc_sched_id(ctx->xch, &sched)) != 0) {
   1.657 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting domain info list");
   1.658 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list");
   1.659          return ERROR_FAIL;
   1.660      }
   1.661      return sched;
   1.662 @@ -3009,7 +3009,7 @@ int libxl_sched_credit_domain_get(libxl_
   1.663  
   1.664      rc = xc_sched_credit_domain_get(ctx->xch, domid, &sdom);
   1.665      if (rc != 0) {
   1.666 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "setting domain sched credit");
   1.667 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting domain sched credit");
   1.668          return ERROR_FAIL;
   1.669      }
   1.670  
   1.671 @@ -3027,7 +3027,7 @@ int libxl_sched_credit_domain_set(libxl_
   1.672  
   1.673      rc = xc_domain_getinfolist(ctx->xch, domid, 1, &domaininfo);
   1.674      if (rc < 0) {
   1.675 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "getting domain info list");
   1.676 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list");
   1.677          return ERROR_FAIL;
   1.678      }
   1.679      if (rc != 1 || domaininfo.domain != domid)
   1.680 @@ -3035,13 +3035,13 @@ int libxl_sched_credit_domain_set(libxl_
   1.681  
   1.682  
   1.683      if (scinfo->weight < 1 || scinfo->weight > 65535) {
   1.684 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
   1.685 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
   1.686              "Cpu weight out of range, valid values are within range from 1 to 65535");
   1.687          return ERROR_INVAL;
   1.688      }
   1.689  
   1.690      if (scinfo->cap < 0 || scinfo->cap > (domaininfo.max_vcpu_id + 1) * 100) {
   1.691 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
   1.692 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
   1.693              "Cpu cap out of range, valid range is from 0 to %d for specified number of vcpus",
   1.694              ((domaininfo.max_vcpu_id + 1) * 100));
   1.695          return ERROR_INVAL;
   1.696 @@ -3052,7 +3052,7 @@ int libxl_sched_credit_domain_set(libxl_
   1.697  
   1.698      rc = xc_sched_credit_domain_set(ctx->xch, domid, &sdom);
   1.699      if ( rc < 0 ) {
   1.700 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "setting domain sched credit");
   1.701 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting domain sched credit");
   1.702          return ERROR_FAIL;
   1.703      }
   1.704  
   1.705 @@ -3081,14 +3081,14 @@ int libxl_send_trigger(libxl_ctx *ctx, u
   1.706      int trigger_type = trigger_type_from_string(trigger_name);
   1.707  
   1.708      if (trigger_type == -1) {
   1.709 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, -1,
   1.710 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, -1,
   1.711              "Invalid trigger, valid triggers are <nmi|reset|init|power|sleep>");
   1.712          return ERROR_INVAL;
   1.713      }
   1.714  
   1.715      rc = xc_domain_send_trigger(ctx->xch, domid, trigger_type, vcpuid);
   1.716      if (rc != 0) {
   1.717 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
   1.718 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
   1.719              "Send trigger '%s' failed", trigger_name);
   1.720          return ERROR_FAIL;
   1.721      }
   1.722 @@ -3112,7 +3112,7 @@ int libxl_send_debug_keys(libxl_ctx *ctx
   1.723      int ret;
   1.724      ret = xc_send_debug_keys(ctx->xch, keys);
   1.725      if ( ret < 0 ) {
   1.726 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "sending debug keys");
   1.727 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "sending debug keys");
   1.728          return ERROR_FAIL;
   1.729      }
   1.730      return 0;
   1.731 @@ -3126,14 +3126,14 @@ libxl_xen_console_reader *
   1.732      char *buf = malloc(size);
   1.733  
   1.734      if (!buf) {
   1.735 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "cannot malloc buffer for libxl_xen_console_reader,"
   1.736 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot malloc buffer for libxl_xen_console_reader,"
   1.737              " size is %u", size);
   1.738          return NULL;
   1.739      }
   1.740  
   1.741      cr = malloc(sizeof(libxl_xen_console_reader));
   1.742      if (!cr) {
   1.743 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "cannot malloc libxl_xen_console_reader");
   1.744 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot malloc libxl_xen_console_reader");
   1.745          return NULL;
   1.746      }
   1.747  
   1.748 @@ -3165,7 +3165,7 @@ int libxl_xen_console_read_line(libxl_ct
   1.749      ret = xc_readconsolering(ctx->xch, &cr->buffer, &cr->count,
   1.750                               cr->clear, cr->incremental, &cr->index);
   1.751      if (ret < 0) {
   1.752 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "reading console ring buffer");
   1.753 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "reading console ring buffer");
   1.754          return ERROR_FAIL;
   1.755      }
   1.756      if (!ret) {
   1.757 @@ -3200,7 +3200,7 @@ uint32_t libxl_vm_get_start_time(libxl_c
   1.758      start_time = libxl__xs_read(
   1.759          &gc, XBT_NULL, libxl__sprintf(&gc, "%s/start_time", vm_path));
   1.760      if (start_time == NULL) {
   1.761 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, -1,
   1.762 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, -1,
   1.763                          "Can't get start time of domain '%d'", domid);
   1.764          ret = -1;
   1.765      }else{
   1.766 @@ -3218,7 +3218,7 @@ char *libxl_tmem_list(libxl_ctx *ctx, ui
   1.767      rc = xc_tmem_control(ctx->xch, -1, TMEMC_LIST, domid, 32768, use_long,
   1.768                           0, _buf);
   1.769      if (rc < 0) {
   1.770 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
   1.771 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
   1.772              "Can not get tmem list");
   1.773          return NULL;
   1.774      }
   1.775 @@ -3233,7 +3233,7 @@ int libxl_tmem_freeze(libxl_ctx *ctx, ui
   1.776      rc = xc_tmem_control(ctx->xch, -1, TMEMC_FREEZE, domid, 0, 0,
   1.777                           0, NULL);
   1.778      if (rc < 0) {
   1.779 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
   1.780 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
   1.781              "Can not freeze tmem pools");
   1.782          return ERROR_FAIL;
   1.783      }
   1.784 @@ -3248,7 +3248,7 @@ int libxl_tmem_destroy(libxl_ctx *ctx, u
   1.785      rc = xc_tmem_control(ctx->xch, -1, TMEMC_DESTROY, domid, 0, 0,
   1.786                           0, NULL);
   1.787      if (rc < 0) {
   1.788 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
   1.789 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
   1.790              "Can not destroy tmem pools");
   1.791          return ERROR_FAIL;
   1.792      }
   1.793 @@ -3263,7 +3263,7 @@ int libxl_tmem_thaw(libxl_ctx *ctx, uint
   1.794      rc = xc_tmem_control(ctx->xch, -1, TMEMC_THAW, domid, 0, 0,
   1.795                           0, NULL);
   1.796      if (rc < 0) {
   1.797 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
   1.798 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
   1.799              "Can not thaw tmem pools");
   1.800          return ERROR_FAIL;
   1.801      }
   1.802 @@ -3289,13 +3289,13 @@ int libxl_tmem_set(libxl_ctx *ctx, uint3
   1.803      int32_t subop = tmem_setop_from_string(name);
   1.804  
   1.805      if (subop == -1) {
   1.806 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, -1,
   1.807 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, -1,
   1.808              "Invalid set, valid sets are <weight|cap|compress>");
   1.809          return ERROR_INVAL;
   1.810      }
   1.811      rc = xc_tmem_control(ctx->xch, -1, subop, domid, set, 0, 0, NULL);
   1.812      if (rc < 0) {
   1.813 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
   1.814 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
   1.815              "Can not set tmem %s", name);
   1.816          return ERROR_FAIL;
   1.817      }
   1.818 @@ -3310,7 +3310,7 @@ int libxl_tmem_shared_auth(libxl_ctx *ct
   1.819  
   1.820      rc = xc_tmem_auth(ctx->xch, domid, uuid, auth);
   1.821      if (rc < 0) {
   1.822 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
   1.823 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
   1.824              "Can not set tmem shared auth");
   1.825          return ERROR_FAIL;
   1.826      }
   1.827 @@ -3324,7 +3324,7 @@ int libxl_tmem_freeable(libxl_ctx *ctx)
   1.828  
   1.829      rc = xc_tmem_control(ctx->xch, -1, TMEMC_QUERY_FREEABLE_MB, -1, 0, 0, 0, 0);
   1.830      if (rc < 0) {
   1.831 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc,
   1.832 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
   1.833              "Can not get tmem freeable memory");
   1.834          return ERROR_FAIL;
   1.835      }
     2.1 --- a/tools/libxl/libxl_blktap2.c	Wed Sep 08 16:44:24 2010 +0100
     2.2 +++ b/tools/libxl/libxl_blktap2.c	Wed Sep 08 16:46:27 2010 +0100
     2.3 @@ -18,13 +18,13 @@
     2.4  
     2.5  #include "tap-ctl.h"
     2.6  
     2.7 -int libxl_blktap_enabled(libxl_gc *gc)
     2.8 +int libxl__blktap_enabled(libxl_gc *gc)
     2.9  {
    2.10      const char *msg;
    2.11      return !tap_ctl_check(&msg);
    2.12  }
    2.13  
    2.14 -const char *libxl_blktap_devpath(libxl_gc *gc,
    2.15 +const char *libxl__blktap_devpath(libxl_gc *gc,
    2.16                                   const char *disk,
    2.17                                   libxl_disk_phystype phystype)
    2.18  {
    2.19 @@ -32,7 +32,7 @@ const char *libxl_blktap_devpath(libxl_g
    2.20      char *params, *devname = NULL;
    2.21      int minor, err;
    2.22  
    2.23 -    type = device_disk_string_of_phystype(phystype);
    2.24 +    type = libxl__device_disk_string_of_phystype(phystype);
    2.25      minor = tap_ctl_find_minor(type, disk);
    2.26      if (minor >= 0) {
    2.27          devname = libxl__sprintf(gc, "/dev/xen/blktap-2/tapdev%d", minor);
     3.1 --- a/tools/libxl/libxl_device.c	Wed Sep 08 16:44:24 2010 +0100
     3.2 +++ b/tools/libxl/libxl_device.c	Wed Sep 08 16:46:27 2010 +0100
     3.3 @@ -96,7 +96,7 @@ retry_transaction:
     3.4          if (errno == EAGAIN)
     3.5              goto retry_transaction;
     3.6          else
     3.7 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs transaction failed");
     3.8 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xs transaction failed");
     3.9      }
    3.10      rc = 0;
    3.11  out:
    3.12 @@ -104,7 +104,7 @@ out:
    3.13      return rc;
    3.14  }
    3.15  
    3.16 -char *device_disk_string_of_phystype(libxl_disk_phystype phystype)
    3.17 +char *libxl__device_disk_string_of_phystype(libxl_disk_phystype phystype)
    3.18  {
    3.19      switch (phystype) {
    3.20          case PHYSTYPE_QCOW: return "qcow";
    3.21 @@ -117,7 +117,7 @@ char *device_disk_string_of_phystype(lib
    3.22      }
    3.23  }
    3.24  
    3.25 -char *device_disk_backend_type_of_phystype(libxl_disk_phystype phystype)
    3.26 +char *libxl__device_disk_backend_type_of_phystype(libxl_disk_phystype phystype)
    3.27  {
    3.28      switch (phystype) {
    3.29          case PHYSTYPE_QCOW: return "tap";
    3.30 @@ -130,7 +130,7 @@ char *device_disk_backend_type_of_physty
    3.31      }
    3.32  }
    3.33  
    3.34 -int device_physdisk_major_minor(const char *physpath, int *major, int *minor)
    3.35 +int libxl__device_physdisk_major_minor(const char *physpath, int *major, int *minor)
    3.36  {
    3.37      struct stat buf;
    3.38      if (stat(physpath, &buf) < 0)
    3.39 @@ -188,7 +188,7 @@ static int device_virtdisk_matches(const
    3.40      return 1;
    3.41  }
    3.42  
    3.43 -int device_disk_dev_number(char *virtpath)
    3.44 +int libxl__device_disk_dev_number(char *virtpath)
    3.45  {
    3.46      int disk, partition;
    3.47      char *ep;
    3.48 @@ -281,7 +281,7 @@ static int wait_for_dev_destroy(libxl_ct
    3.49              if (!state || atoi(state) == 6) {
    3.50                  xs_unwatch(ctx->xsh, l1[0], l1[1]);
    3.51                  xs_rm(ctx->xsh, XBT_NULL, l1[XS_WATCH_TOKEN]);
    3.52 -                XL_LOG(ctx, XL_LOG_DEBUG, "Destroyed device backend at %s", l1[XS_WATCH_TOKEN]);
    3.53 +                LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Destroyed device backend at %s", l1[XS_WATCH_TOKEN]);
    3.54                  rc = 0;
    3.55              }
    3.56              free(l1);
    3.57 @@ -304,7 +304,7 @@ int libxl__devices_destroy(libxl_ctx *ct
    3.58      path = libxl__sprintf(&gc, "/local/domain/%d/device", domid);
    3.59      l1 = libxl__xs_directory(&gc, XBT_NULL, path, &num1);
    3.60      if (!l1) {
    3.61 -        XL_LOG(ctx, XL_LOG_ERROR, "%s is empty", path);
    3.62 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "%s is empty", path);
    3.63          goto out;
    3.64      }
    3.65      for (i = 0; i < num1; i++) {
    3.66 @@ -445,7 +445,7 @@ again:
    3.67      }
    3.68      xs_unwatch(xsh, path, path);
    3.69      xs_daemon_close(xsh);
    3.70 -    XL_LOG(ctx, XL_LOG_ERROR, "Device Model not ready");
    3.71 +    LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model not ready");
    3.72      libxl__free_all(&gc);
    3.73      return -1;
    3.74  }
    3.75 @@ -463,10 +463,10 @@ int libxl__wait_for_backend(libxl_ctx *c
    3.76          p = xs_read(ctx->xsh, XBT_NULL, path, &len);
    3.77          if (p == NULL) {
    3.78              if (errno == ENOENT) {
    3.79 -                XL_LOG(ctx, XL_LOG_ERROR, "Backend %s does not exist",
    3.80 +                LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Backend %s does not exist",
    3.81                         be_path);
    3.82              } else {
    3.83 -                XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Failed to access backend %s",
    3.84 +                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Failed to access backend %s",
    3.85                         be_path);
    3.86              }
    3.87              goto out;
    3.88 @@ -480,7 +480,7 @@ int libxl__wait_for_backend(libxl_ctx *c
    3.89              }
    3.90          }
    3.91      }
    3.92 -    XL_LOG(ctx, XL_LOG_ERROR, "Backend %s not ready", be_path);
    3.93 +    LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Backend %s not ready", be_path);
    3.94  out:
    3.95      libxl__free_all(&gc);
    3.96      return rc;
     4.1 --- a/tools/libxl/libxl_dom.c	Wed Sep 08 16:44:24 2010 +0100
     4.2 +++ b/tools/libxl/libxl_dom.c	Wed Sep 08 16:46:27 2010 +0100
     4.3 @@ -31,7 +31,7 @@
     4.4  #include "libxl.h"
     4.5  #include "libxl_internal.h"
     4.6  
     4.7 -int is_hvm(libxl_ctx *ctx, uint32_t domid)
     4.8 +int libxl__domain_is_hvm(libxl_ctx *ctx, uint32_t domid)
     4.9  {
    4.10      xc_domaininfo_t info;
    4.11      int ret;
    4.12 @@ -44,7 +44,7 @@ int is_hvm(libxl_ctx *ctx, uint32_t domi
    4.13      return !!(info.flags & XEN_DOMINF_hvm_guest);
    4.14  }
    4.15  
    4.16 -int get_shutdown_reason(libxl_ctx *ctx, uint32_t domid)
    4.17 +int libxl__domain_shutdown_reason(libxl_ctx *ctx, uint32_t domid)
    4.18  {
    4.19      xc_domaininfo_t info;
    4.20      int ret;
    4.21 @@ -56,10 +56,11 @@ int get_shutdown_reason(libxl_ctx *ctx, 
    4.22          return -1;
    4.23      if (!(info.flags & XEN_DOMINF_shutdown))
    4.24          return -1;
    4.25 -    return dominfo_get_shutdown_reason(&info);
    4.26 +
    4.27 +    return (info.flags >> XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask;
    4.28  }
    4.29  
    4.30 -int build_pre(libxl_ctx *ctx, uint32_t domid,
    4.31 +int libxl__build_pre(libxl_ctx *ctx, uint32_t domid,
    4.32                libxl_domain_build_info *info, libxl_domain_build_state *state)
    4.33  {
    4.34      xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
    4.35 @@ -82,7 +83,7 @@ int build_pre(libxl_ctx *ctx, uint32_t d
    4.36      return 0;
    4.37  }
    4.38  
    4.39 -int build_post(libxl_ctx *ctx, uint32_t domid,
    4.40 +int libxl__build_post(libxl_ctx *ctx, uint32_t domid,
    4.41                 libxl_domain_build_info *info, libxl_domain_build_state *state,
    4.42                 char **vms_ents, char **local_ents)
    4.43  {
    4.44 @@ -136,7 +137,7 @@ retry_transaction:
    4.45      return 0;
    4.46  }
    4.47  
    4.48 -int build_pv(libxl_ctx *ctx, uint32_t domid,
    4.49 +int libxl__build_pv(libxl_ctx *ctx, uint32_t domid,
    4.50               libxl_domain_build_info *info, libxl_domain_build_state *state)
    4.51  {
    4.52      struct xc_dom_image *dom;
    4.53 @@ -147,18 +148,18 @@ int build_pv(libxl_ctx *ctx, uint32_t do
    4.54  
    4.55      dom = xc_dom_allocate(ctx->xch, info->u.pv.cmdline, info->u.pv.features);
    4.56      if (!dom) {
    4.57 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_allocate failed");
    4.58 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_allocate failed");
    4.59          return ERROR_FAIL;
    4.60      }
    4.61  
    4.62      if (info->kernel.mapped) {
    4.63          if ( (ret = xc_dom_kernel_mem(dom, info->kernel.data, info->kernel.size)) != 0) {
    4.64 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_kernel_mem failed");
    4.65 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_kernel_mem failed");
    4.66              goto out;
    4.67          }
    4.68      } else {
    4.69          if ( (ret = xc_dom_kernel_file(dom, info->kernel.path)) != 0) {
    4.70 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_kernel_file failed");
    4.71 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_kernel_file failed");
    4.72              goto out;
    4.73          }
    4.74      }
    4.75 @@ -166,12 +167,12 @@ int build_pv(libxl_ctx *ctx, uint32_t do
    4.76      if ( info->u.pv.ramdisk.path && strlen(info->u.pv.ramdisk.path) ) {
    4.77          if (info->u.pv.ramdisk.mapped) {
    4.78              if ( (ret = xc_dom_ramdisk_mem(dom, info->u.pv.ramdisk.data, info->u.pv.ramdisk.size)) != 0 ) {
    4.79 -                XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_ramdisk_mem failed");
    4.80 +                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_ramdisk_mem failed");
    4.81                  goto out;
    4.82              }
    4.83          } else {
    4.84              if ( (ret = xc_dom_ramdisk_file(dom, info->u.pv.ramdisk.path)) != 0 ) {
    4.85 -                XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_ramdisk_file failed");
    4.86 +                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_ramdisk_file failed");
    4.87                  goto out;
    4.88              }
    4.89          }
    4.90 @@ -182,27 +183,27 @@ int build_pv(libxl_ctx *ctx, uint32_t do
    4.91      dom->xenstore_evtchn = state->store_port;
    4.92  
    4.93      if ( (ret = xc_dom_boot_xen_init(dom, ctx->xch, domid)) != 0 ) {
    4.94 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_boot_xen_init failed");
    4.95 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_boot_xen_init failed");
    4.96          goto out;
    4.97      }
    4.98      if ( (ret = xc_dom_parse_image(dom)) != 0 ) {
    4.99 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_parse_image failed");
   4.100 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_parse_image failed");
   4.101          goto out;
   4.102      }
   4.103      if ( (ret = xc_dom_mem_init(dom, info->target_memkb / 1024)) != 0 ) {
   4.104 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_mem_init failed");
   4.105 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_mem_init failed");
   4.106          goto out;
   4.107      }
   4.108      if ( (ret = xc_dom_boot_mem_init(dom)) != 0 ) {
   4.109 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_boot_mem_init failed");
   4.110 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_boot_mem_init failed");
   4.111          goto out;
   4.112      }
   4.113      if ( (ret = xc_dom_build_image(dom)) != 0 ) {
   4.114 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_build_image failed");
   4.115 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_build_image failed");
   4.116          goto out;
   4.117      }
   4.118      if ( (ret = xc_dom_boot_image(dom)) != 0 ) {
   4.119 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_boot_image failed");
   4.120 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_boot_image failed");
   4.121          goto out;
   4.122      }
   4.123  
   4.124 @@ -215,14 +216,14 @@ out:
   4.125      return ret == 0 ? 0 : ERROR_FAIL;
   4.126  }
   4.127  
   4.128 -int build_hvm(libxl_ctx *ctx, uint32_t domid,
   4.129 +int libxl__build_hvm(libxl_ctx *ctx, uint32_t domid,
   4.130                libxl_domain_build_info *info, libxl_domain_build_state *state)
   4.131  {
   4.132      libxl_gc gc = LIBXL_INIT_GC(ctx);
   4.133      int ret, rc = ERROR_INVAL;
   4.134  
   4.135      if (info->kernel.mapped) {
   4.136 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "build_hvm kernel cannot be mmapped");
   4.137 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "libxl__build_hvm kernel cannot be mmapped");
   4.138          goto out;
   4.139      }
   4.140  
   4.141 @@ -235,13 +236,13 @@ int build_hvm(libxl_ctx *ctx, uint32_t d
   4.142          libxl__abs_path(&gc, (char *)info->kernel.path,
   4.143                         libxl_xenfirmwaredir_path()));
   4.144      if (ret) {
   4.145 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "hvm building failed");
   4.146 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "hvm building failed");
   4.147          goto out;
   4.148      }
   4.149      ret = hvm_build_set_params(ctx->xch, domid, info, state->store_port,
   4.150                                 &state->store_mfn, state->console_port, &state->console_mfn);
   4.151      if (ret) {
   4.152 -        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "hvm build set params failed");
   4.153 +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "hvm build set params failed");
   4.154          goto out;
   4.155      }
   4.156      rc = 0;
   4.157 @@ -250,7 +251,7 @@ out:
   4.158      return 0;
   4.159  }
   4.160  
   4.161 -int restore_common(libxl_ctx *ctx, uint32_t domid,
   4.162 +int libxl__domain_restore_common(libxl_ctx *ctx, uint32_t domid,
   4.163                     libxl_domain_build_info *info, libxl_domain_build_state *state,
   4.164                     int fd)
   4.165  {
   4.166 @@ -261,7 +262,7 @@ int restore_common(libxl_ctx *ctx, uint3
   4.167                               state->console_port, &state->console_mfn,
   4.168                               info->hvm, info->u.hvm.pae, 0);
   4.169      if ( rc ) {
   4.170 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "restoring domain");
   4.171 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "restoring domain");
   4.172          return ERROR_FAIL;
   4.173      }
   4.174      return 0;
   4.175 @@ -276,7 +277,7 @@ struct suspendinfo {
   4.176      unsigned int flags;
   4.177  };
   4.178  
   4.179 -static void core_suspend_switch_qemu_logdirty(int domid, unsigned int enable)
   4.180 +static void libxl__domain_suspend_common_switch_qemu_logdirty(int domid, unsigned int enable)
   4.181  {
   4.182      struct xs_handle *xsh;
   4.183      char path[64];
   4.184 @@ -293,7 +294,7 @@ static void core_suspend_switch_qemu_log
   4.185      xs_daemon_close(xsh);
   4.186  }
   4.187  
   4.188 -static int core_suspend_callback(void *data)
   4.189 +static int libxl__domain_suspend_common_callback(void *data)
   4.190  {
   4.191      struct suspendinfo *si = data;
   4.192      unsigned long s_state = 0;
   4.193 @@ -307,12 +308,12 @@ static int core_suspend_callback(void *d
   4.194      if ((s_state == 0) && (si->suspend_eventchn >= 0)) {
   4.195          ret = xc_evtchn_notify(si->xce, si->suspend_eventchn);
   4.196          if (ret < 0) {
   4.197 -            XL_LOG(ctx, XL_LOG_ERROR, "xc_evtchn_notify failed ret=%d", ret);
   4.198 +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "xc_evtchn_notify failed ret=%d", ret);
   4.199              return 0;
   4.200          }
   4.201          ret = xc_await_suspend(ctx->xch, si->xce, si->suspend_eventchn);
   4.202          if (ret < 0) {
   4.203 -            XL_LOG(ctx, XL_LOG_ERROR, "xc_await_suspend failed ret=%d", ret);
   4.204 +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "xc_await_suspend failed ret=%d", ret);
   4.205              return 0;
   4.206          }
   4.207          return 1;
   4.208 @@ -324,11 +325,11 @@ static int core_suspend_callback(void *d
   4.209          xc_get_hvm_param(ctx->xch, si->domid, HVM_PARAM_CALLBACK_IRQ, &hvm_pvdrv);
   4.210          xc_get_hvm_param(ctx->xch, si->domid, HVM_PARAM_ACPI_S_STATE, &hvm_s_state);
   4.211          if (!hvm_pvdrv || hvm_s_state) {
   4.212 -            XL_LOG(ctx, XL_LOG_DEBUG, "Calling xc_domain_shutdown on the domain");
   4.213 +            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Calling xc_domain_shutdown on the domain");
   4.214              xc_domain_shutdown(ctx->xch, si->domid, SHUTDOWN_suspend);
   4.215          }
   4.216      }
   4.217 -    XL_LOG(ctx, XL_LOG_DEBUG, "wait for the guest to suspend");
   4.218 +    LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "wait for the guest to suspend");
   4.219      while (!strcmp(state, "suspend") && watchdog > 0) {
   4.220          xc_domaininfo_t info;
   4.221  
   4.222 @@ -345,13 +346,13 @@ static int core_suspend_callback(void *d
   4.223          watchdog--;
   4.224      }
   4.225      if (!strcmp(state, "suspend")) {
   4.226 -        XL_LOG(ctx, XL_LOG_ERROR, "guest didn't suspend in time");
   4.227 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "guest didn't suspend in time");
   4.228          libxl__xs_write(si->gc, XBT_NULL, path, "");
   4.229      }
   4.230      return 1;
   4.231  }
   4.232  
   4.233 -int core_suspend(libxl_ctx *ctx, uint32_t domid, int fd,
   4.234 +int libxl__domain_suspend_common(libxl_ctx *ctx, uint32_t domid, int fd,
   4.235  		int hvm, int live, int debug)
   4.236  {
   4.237      libxl_gc gc = LIBXL_INIT_GC(ctx);
   4.238 @@ -382,17 +383,17 @@ int core_suspend(libxl_ctx *ctx, uint32_
   4.239              si.suspend_eventchn = xc_suspend_evtchn_init(ctx->xch, si.xce, si.domid, port);
   4.240  
   4.241              if (si.suspend_eventchn < 0)
   4.242 -                XL_LOG(ctx, XL_LOG_WARNING, "Suspend event channel initialization failed");
   4.243 +                LIBXL__LOG(ctx, LIBXL__LOG_WARNING, "Suspend event channel initialization failed");
   4.244          }
   4.245      }
   4.246  
   4.247      memset(&callbacks, 0, sizeof(callbacks));
   4.248 -    callbacks.suspend = core_suspend_callback;
   4.249 +    callbacks.suspend = libxl__domain_suspend_common_callback;
   4.250      callbacks.data = &si;
   4.251  
   4.252      xc_domain_save(ctx->xch, fd, domid, 0, 0, flags,
   4.253                     &callbacks, hvm,
   4.254 -                   &core_suspend_switch_qemu_logdirty);
   4.255 +                   &libxl__domain_suspend_common_switch_qemu_logdirty);
   4.256  
   4.257      if (si.suspend_eventchn > 0)
   4.258          xc_suspend_evtchn_release(ctx->xch, si.xce, domid, si.suspend_eventchn);
   4.259 @@ -404,14 +405,14 @@ out:
   4.260      return rc;
   4.261  }
   4.262  
   4.263 -int save_device_model(libxl_ctx *ctx, uint32_t domid, int fd)
   4.264 +int libxl__domain_save_device_model(libxl_ctx *ctx, uint32_t domid, int fd)
   4.265  {
   4.266      libxl_gc gc = LIBXL_INIT_GC(ctx);
   4.267      int fd2, c;
   4.268      char buf[1024];
   4.269      char *filename = libxl__sprintf(&gc, "/var/lib/xen/qemu-save.%d", domid);
   4.270  
   4.271 -    XL_LOG(ctx, XL_LOG_DEBUG, "Saving device model state to %s", filename);
   4.272 +    LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Saving device model state to %s", filename);
   4.273      libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "/local/domain/0/device-model/%d/command", domid), "save");
   4.274      libxl__wait_for_device_model(ctx, domid, "paused", NULL, NULL);
   4.275  
   4.276 @@ -444,7 +445,7 @@ char *libxl__uuid2string(libxl_gc *gc, c
   4.277  {
   4.278      char *s = libxl__sprintf(gc, LIBXL_UUID_FMT, LIBXL_UUID_BYTES(uuid));
   4.279      if (!s)
   4.280 -        XL_LOG(libxl_gc_owner(gc), XL_LOG_ERROR, "cannot allocate for uuid");
   4.281 +        LIBXL__LOG(libxl_gc_owner(gc), LIBXL__LOG_ERROR, "cannot allocate for uuid");
   4.282      return s;
   4.283  }
   4.284  
   4.285 @@ -459,7 +460,7 @@ static const char *userdata_path(libxl_g
   4.286  
   4.287      rc = libxl_domain_info(ctx, &info, domid);
   4.288      if (rc) {
   4.289 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unable to find domain info"
   4.290 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unable to find domain info"
   4.291                       " for domain %"PRIu32, domid);
   4.292          return NULL;
   4.293      }
   4.294 @@ -469,7 +470,7 @@ static const char *userdata_path(libxl_g
   4.295                           "userdata-%s.%u.%s.%s",
   4.296                           wh, domid, uuid_string, userdata_userid);
   4.297      if (!path)
   4.298 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "unable to allocate for"
   4.299 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unable to allocate for"
   4.300                       " userdata path");
   4.301      return path;
   4.302  }
   4.303 @@ -478,7 +479,7 @@ static int userdata_delete(libxl_ctx *ct
   4.304      int r;
   4.305      r = unlink(path);
   4.306      if (r) {
   4.307 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "remove failed for %s", path);
   4.308 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "remove failed for %s", path);
   4.309          return errno;
   4.310      }
   4.311      return 0;
   4.312 @@ -502,7 +503,7 @@ void libxl__userdata_destroyall(libxl_ct
   4.313      if (r == GLOB_NOMATCH)
   4.314          goto out;
   4.315      if (r)
   4.316 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "glob failed for %s", pattern);
   4.317 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "glob failed for %s", pattern);
   4.318  
   4.319      for (i=0; i<gl.gl_pathc; i++) {
   4.320          userdata_delete(ctx, gl.gl_pathv[i]);
   4.321 @@ -574,7 +575,7 @@ err:
   4.322  
   4.323      errno = e;
   4.324      if ( rc )
   4.325 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "cannot write %s for %s",
   4.326 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "cannot write %s for %s",
   4.327                   newfilename, filename);
   4.328  out:
   4.329      libxl__free_all(&gc);
   4.330 @@ -600,7 +601,7 @@ int libxl_userdata_retrieve(libxl_ctx *c
   4.331      e = libxl_read_file_contents(ctx, filename, data_r ? &data : 0, &datalen);
   4.332  
   4.333      if (!e && !datalen) {
   4.334 -        XL_LOG(ctx, XL_LOG_ERROR, "userdata file %s is empty", filename);
   4.335 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "userdata file %s is empty", filename);
   4.336          if (data_r) assert(!*data_r);
   4.337          rc = ERROR_FAIL;
   4.338          goto out;
     5.1 --- a/tools/libxl/libxl_exec.c	Wed Sep 08 16:44:24 2010 +0100
     5.2 +++ b/tools/libxl/libxl_exec.c	Wed Sep 08 16:46:27 2010 +0100
     5.3 @@ -65,25 +65,25 @@ void libxl_report_child_exitstatus(libxl
     5.4      if (WIFEXITED(status)) {
     5.5          int st = WEXITSTATUS(status);
     5.6          if (st)
     5.7 -            XL_LOG(ctx, level, "%s [%ld] exited"
     5.8 +            LIBXL__LOG(ctx, level, "%s [%ld] exited"
     5.9                     " with error status %d", what, (unsigned long)pid, st);
    5.10          else
    5.11 -            XL_LOG(ctx, level, "%s [%ld] unexpectedly"
    5.12 +            LIBXL__LOG(ctx, level, "%s [%ld] unexpectedly"
    5.13                     " exited status zero", what, (unsigned long)pid);
    5.14      } else if (WIFSIGNALED(status)) {
    5.15          int sig = WTERMSIG(status);
    5.16          const char *str = strsignal(sig);
    5.17          const char *coredump = WCOREDUMP(status) ? " (core dumped)" : "";
    5.18          if (str)
    5.19 -            XL_LOG(ctx, level, "%s [%ld] died due to"
    5.20 +            LIBXL__LOG(ctx, level, "%s [%ld] died due to"
    5.21                     " fatal signal %s%s", what, (unsigned long)pid,
    5.22                     str, coredump);
    5.23          else
    5.24 -            XL_LOG(ctx, level, "%s [%ld] died due to unknown"
    5.25 +            LIBXL__LOG(ctx, level, "%s [%ld] died due to unknown"
    5.26                     " fatal signal number %d%s", what, (unsigned long)pid,
    5.27                     sig, coredump);
    5.28      } else {
    5.29 -        XL_LOG(ctx, level, "%s [%ld] gave unknown"
    5.30 +        LIBXL__LOG(ctx, level, "%s [%ld] gave unknown"
    5.31                 " wait status 0x%x", what, (unsigned long)pid, status);
    5.32      }
    5.33  }
    5.34 @@ -146,7 +146,7 @@ static void report_spawn_intermediate_st
    5.35                   "%s intermediate process (startup monitor)",
    5.36                   for_spawn->what) < 0 )
    5.37              intermediate_what = "intermediate process (startup monitor)";
    5.38 -        libxl_report_child_exitstatus(ctx, XL_LOG_ERROR, intermediate_what,
    5.39 +        libxl_report_child_exitstatus(ctx, LIBXL__LOG_ERROR, intermediate_what,
    5.40                                        for_spawn->intermediate, status);
    5.41      }
    5.42  }
    5.43 @@ -163,7 +163,7 @@ int libxl__spawn_detach(libxl_ctx *ctx,
    5.44      if (for_spawn->intermediate) {
    5.45          r = kill(for_spawn->intermediate, SIGKILL);
    5.46          if (r) {
    5.47 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
    5.48 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
    5.49                           "could not kill %s intermediate process [%ld]",
    5.50                           for_spawn->what,
    5.51                           (unsigned long)for_spawn->intermediate);
     6.1 --- a/tools/libxl/libxl_internal.c	Wed Sep 08 16:44:24 2010 +0100
     6.2 +++ b/tools/libxl/libxl_internal.c	Wed Sep 08 16:46:27 2010 +0100
     6.3 @@ -147,7 +147,7 @@ char *libxl__dirname(libxl_gc *gc, const
     6.4      return ptr;
     6.5  }
     6.6  
     6.7 -void xl_logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
     6.8 +void libxl__logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
     6.9               const char *file, int line, const char *func,
    6.10               char *fmt, va_list ap)
    6.11  {
    6.12 @@ -174,13 +174,13 @@ void xl_logv(libxl_ctx *ctx, xentoollog_
    6.13      errno = esave;
    6.14  }
    6.15  
    6.16 -void xl_log(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
    6.17 +void libxl__log(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
    6.18              const char *file, int line, const char *func,
    6.19              char *fmt, ...)
    6.20  {
    6.21      va_list ap;
    6.22      va_start(ap, fmt);
    6.23 -    xl_logv(ctx, msglevel, errnoval, file, line, func, fmt, ap);
    6.24 +    libxl__logv(ctx, msglevel, errnoval, file, line, func, fmt, ap);
    6.25      va_end(ap);
    6.26  }
    6.27  
     7.1 --- a/tools/libxl/libxl_internal.h	Wed Sep 08 16:44:24 2010 +0100
     7.2 +++ b/tools/libxl/libxl_internal.h	Wed Sep 08 16:46:27 2010 +0100
     7.3 @@ -45,27 +45,27 @@
     7.4  
     7.5  #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
     7.6  
     7.7 -#define XL_LOGGING_ENABLED
     7.8 +#define LIBXL__LOGGING_ENABLED
     7.9  
    7.10 -#ifdef XL_LOGGING_ENABLED
    7.11 -#define XL_LOG(ctx, loglevel, _f, _a...)   xl_log(ctx, loglevel, -1, __FILE__, __LINE__, __func__, _f, ##_a)
    7.12 -#define XL_LOG_ERRNO(ctx, loglevel, _f, _a...)   xl_log(ctx, loglevel, errno, __FILE__, __LINE__, __func__, _f, ##_a)
    7.13 -#define XL_LOG_ERRNOVAL(ctx, loglevel, errnoval, _f, _a...)   xl_log(ctx, loglevel, errnoval, __FILE__, __LINE__, __func__, _f, ##_a)
    7.14 +#ifdef LIBXL__LOGGING_ENABLED
    7.15 +#define LIBXL__LOG(ctx, loglevel, _f, _a...)   libxl__log(ctx, loglevel, -1, __FILE__, __LINE__, __func__, _f, ##_a)
    7.16 +#define LIBXL__LOG_ERRNO(ctx, loglevel, _f, _a...)   libxl__log(ctx, loglevel, errno, __FILE__, __LINE__, __func__, _f, ##_a)
    7.17 +#define LIBXL__LOG_ERRNOVAL(ctx, loglevel, errnoval, _f, _a...)   libxl__log(ctx, loglevel, errnoval, __FILE__, __LINE__, __func__, _f, ##_a)
    7.18  #else
    7.19 -#define XL_LOG(ctx, loglevel, _f, _a...)
    7.20 -#define XL_LOG_ERRNO(ctx, loglevel, _f, _a...)
    7.21 -#define XL_LOG_ERRNOVAL(ctx, loglevel, errnoval, _f, _a...)
    7.22 +#define LIBXL__LOG(ctx, loglevel, _f, _a...)
    7.23 +#define LIBXL__LOG_ERRNO(ctx, loglevel, _f, _a...)
    7.24 +#define LIBXL__LOG_ERRNOVAL(ctx, loglevel, errnoval, _f, _a...)
    7.25  #endif
    7.26    /* all of these macros preserve errno (saving and restoring) */
    7.27  
    7.28  /* logging */
    7.29 -_hidden void xl_logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
    7.30 +_hidden void libxl__logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
    7.31               const char *file /* may be 0 */, int line /* ignored if !file */,
    7.32               const char *func /* may be 0 */,
    7.33               char *fmt, va_list al)
    7.34       __attribute__((format(printf,7,0)));
    7.35  
    7.36 -_hidden void xl_log(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
    7.37 +_hidden void libxl__log(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
    7.38              const char *file /* may be 0 */, int line /* ignored if !file */,
    7.39              const char *func /* may be 0 */,
    7.40              char *fmt, ...)
    7.41 @@ -140,33 +140,32 @@ static inline libxl_ctx *libxl_gc_owner(
    7.42  _hidden char **libxl__xs_directory(libxl_gc *gc, xs_transaction_t t, char *path, unsigned int *nb);
    7.43  
    7.44  /* from xl_dom */
    7.45 -_hidden int is_hvm(libxl_ctx *ctx, uint32_t domid);
    7.46 -_hidden int get_shutdown_reason(libxl_ctx *ctx, uint32_t domid);
    7.47 -#define dominfo_get_shutdown_reason(info) (((info)->flags >> XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask)
    7.48 +_hidden int libxl__domain_is_hvm(libxl_ctx *ctx, uint32_t domid);
    7.49 +_hidden int libxl__domain_shutdown_reason(libxl_ctx *ctx, uint32_t domid);
    7.50  
    7.51 -_hidden int build_pre(libxl_ctx *ctx, uint32_t domid,
    7.52 +_hidden int libxl__build_pre(libxl_ctx *ctx, uint32_t domid,
    7.53                libxl_domain_build_info *info, libxl_domain_build_state *state);
    7.54 -_hidden int build_post(libxl_ctx *ctx, uint32_t domid,
    7.55 +_hidden int libxl__build_post(libxl_ctx *ctx, uint32_t domid,
    7.56                 libxl_domain_build_info *info, libxl_domain_build_state *state,
    7.57                 char **vms_ents, char **local_ents);
    7.58  
    7.59 -_hidden int build_pv(libxl_ctx *ctx, uint32_t domid,
    7.60 +_hidden int libxl__build_pv(libxl_ctx *ctx, uint32_t domid,
    7.61               libxl_domain_build_info *info, libxl_domain_build_state *state);
    7.62 -_hidden int build_hvm(libxl_ctx *ctx, uint32_t domid,
    7.63 +_hidden int libxl__build_hvm(libxl_ctx *ctx, uint32_t domid,
    7.64                libxl_domain_build_info *info, libxl_domain_build_state *state);
    7.65  
    7.66 -_hidden int restore_common(libxl_ctx *ctx, uint32_t domid,
    7.67 +_hidden int libxl__domain_restore_common(libxl_ctx *ctx, uint32_t domid,
    7.68                     libxl_domain_build_info *info, libxl_domain_build_state *state, int fd);
    7.69 -_hidden int core_suspend(libxl_ctx *ctx, uint32_t domid, int fd, int hvm, int live, int debug);
    7.70 -_hidden int save_device_model(libxl_ctx *ctx, uint32_t domid, int fd);
    7.71 +_hidden int libxl__domain_suspend_common(libxl_ctx *ctx, uint32_t domid, int fd, int hvm, int live, int debug);
    7.72 +_hidden int libxl__domain_save_device_model(libxl_ctx *ctx, uint32_t domid, int fd);
    7.73  _hidden void libxl__userdata_destroyall(libxl_ctx *ctx, uint32_t domid);
    7.74  
    7.75  /* from xl_device */
    7.76 -_hidden char *device_disk_backend_type_of_phystype(libxl_disk_phystype phystype);
    7.77 -_hidden char *device_disk_string_of_phystype(libxl_disk_phystype phystype);
    7.78 +_hidden char *libxl__device_disk_backend_type_of_phystype(libxl_disk_phystype phystype);
    7.79 +_hidden char *libxl__device_disk_string_of_phystype(libxl_disk_phystype phystype);
    7.80  
    7.81 -_hidden int device_physdisk_major_minor(const char *physpath, int *major, int *minor);
    7.82 -_hidden int device_disk_dev_number(char *virtpath);
    7.83 +_hidden int libxl__device_physdisk_major_minor(const char *physpath, int *major, int *minor);
    7.84 +_hidden int libxl__device_disk_dev_number(char *virtpath);
    7.85  
    7.86  _hidden int libxl__device_generic_add(libxl_ctx *ctx, libxl_device *device,
    7.87                               char **bents, char **fents);
    7.88 @@ -234,10 +233,10 @@ struct libxl__device_model_starting {
    7.89  
    7.90  _hidden char *libxl__abs_path(libxl_gc *gc, char *s, const char *path);
    7.91  
    7.92 -#define XL_LOG_DEBUG   XTL_DEBUG
    7.93 -#define XL_LOG_INFO    XTL_INFO
    7.94 -#define XL_LOG_WARNING XTL_WARN
    7.95 -#define XL_LOG_ERROR   XTL_ERROR
    7.96 +#define LIBXL__LOG_DEBUG   XTL_DEBUG
    7.97 +#define LIBXL__LOG_INFO    XTL_INFO
    7.98 +#define LIBXL__LOG_WARNING XTL_WARN
    7.99 +#define LIBXL__LOG_ERROR   XTL_ERROR
   7.100  
   7.101  _hidden char *libxl__domid_to_name(libxl_gc *gc, uint32_t domid);
   7.102  _hidden char *libxl__poolid_to_name(libxl_gc *gc, uint32_t poolid);
   7.103 @@ -246,18 +245,18 @@ struct libxl__device_model_starting {
   7.104   * blktap2 support
   7.105   */
   7.106  
   7.107 -/* libxl_blktap_enabled:
   7.108 +/* libxl__blktap_enabled:
   7.109   *    return true if blktap/blktap2 support is available.
   7.110   */
   7.111 -int libxl_blktap_enabled(libxl_gc *gc);
   7.112 +_hidden int libxl__blktap_enabled(libxl_gc *gc);
   7.113  
   7.114 -/* libxl_blktap_devpath:
   7.115 +/* libxl__blktap_devpath:
   7.116   *    Argument: path and disk image as specified in config file.
   7.117   *      The type specifies whether this is aio, qcow, qcow2, etc.
   7.118   *    returns device path xenstore wants to have. returns NULL
   7.119   *      if no device corresponds to the disk.
   7.120   */
   7.121 -const char *libxl_blktap_devpath(libxl_gc *gc,
   7.122 +_hidden const char *libxl__blktap_devpath(libxl_gc *gc,
   7.123                                   const char *disk,
   7.124                                   libxl_disk_phystype phystype);
   7.125  
     8.1 --- a/tools/libxl/libxl_noblktap2.c	Wed Sep 08 16:44:24 2010 +0100
     8.2 +++ b/tools/libxl/libxl_noblktap2.c	Wed Sep 08 16:46:27 2010 +0100
     8.3 @@ -16,12 +16,12 @@
     8.4  #include "libxl_osdeps.h"
     8.5  #include "libxl_internal.h"
     8.6  
     8.7 -int libxl_blktap_enabled(libxl_gc *gc)
     8.8 +int libxl__blktap_enabled(libxl_gc *gc)
     8.9  {
    8.10      return 0;
    8.11  }
    8.12  
    8.13 -const char *libxl_blktap_devpath(libxl_gc *gc,
    8.14 +const char *libxl__blktap_devpath(libxl_gc *gc,
    8.15                                   const char *disk,
    8.16                                   libxl_disk_phystype phystype)
    8.17  {
     9.1 --- a/tools/libxl/libxl_pci.c	Wed Sep 08 16:44:24 2010 +0100
     9.2 +++ b/tools/libxl/libxl_pci.c	Wed Sep 08 16:46:27 2010 +0100
     9.3 @@ -173,7 +173,7 @@ int libxl_device_pci_parse_bdf(libxl_ctx
     9.4                  }else if ( !strcmp(optkey, "power_mgmt") ) {
     9.5                      pcidev->power_mgmt = atoi(tok);
     9.6                  }else{
     9.7 -                    XL_LOG(ctx, XL_LOG_WARNING,
     9.8 +                    LIBXL__LOG(ctx, LIBXL__LOG_WARNING,
     9.9                             "Unknown PCI BDF option: %s", optkey);
    9.10                  }
    9.11                  tok = ptr + 1;
    9.12 @@ -213,7 +213,7 @@ static int libxl_create_pci_backend(libx
    9.13      if (!back)
    9.14          return ERROR_NOMEM;
    9.15  
    9.16 -    XL_LOG(ctx, XL_LOG_DEBUG, "Creating pci backend");
    9.17 +    LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Creating pci backend");
    9.18  
    9.19      /* add pci device */
    9.20      device.backend_devid = 0;
    9.21 @@ -276,7 +276,7 @@ static int libxl_device_pci_add_xenstore
    9.22      if (!num_devs)
    9.23          return libxl_create_pci_backend(gc, domid, pcidev, 1);
    9.24  
    9.25 -    if (!is_hvm(ctx, domid)) {
    9.26 +    if (!libxl__domain_is_hvm(ctx, domid)) {
    9.27          if (libxl__wait_for_backend(ctx, be_path, "4") < 0)
    9.28              return ERROR_FAIL;
    9.29      }
    9.30 @@ -285,7 +285,7 @@ static int libxl_device_pci_add_xenstore
    9.31      if (!back)
    9.32          return ERROR_NOMEM;
    9.33  
    9.34 -    XL_LOG(ctx, XL_LOG_DEBUG, "Adding new pci device to xenstore");
    9.35 +    LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Adding new pci device to xenstore");
    9.36      num = atoi(num_devs);
    9.37      flexarray_set(back, boffset++, libxl__sprintf(gc, "key-%d", num));
    9.38      flexarray_set(back, boffset++, libxl__sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func));
    9.39 @@ -331,9 +331,9 @@ static int libxl_device_pci_remove_xenst
    9.40          return ERROR_INVAL;
    9.41      num = atoi(num_devs);
    9.42  
    9.43 -    if (!is_hvm(ctx, domid)) {
    9.44 +    if (!libxl__domain_is_hvm(ctx, domid)) {
    9.45          if (libxl__wait_for_backend(ctx, be_path, "4") < 0) {
    9.46 -            XL_LOG(ctx, XL_LOG_DEBUG, "pci backend at %s is not ready", be_path);
    9.47 +            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "pci backend at %s is not ready", be_path);
    9.48              return ERROR_FAIL;
    9.49          }
    9.50      }
    9.51 @@ -347,7 +347,7 @@ static int libxl_device_pci_remove_xenst
    9.52          }
    9.53      }
    9.54      if (i == num) {
    9.55 -        XL_LOG(ctx, XL_LOG_ERROR, "Couldn't find the device on xenstore");
    9.56 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Couldn't find the device on xenstore");
    9.57          return ERROR_INVAL;
    9.58      }
    9.59  
    9.60 @@ -359,9 +359,9 @@ retry_transaction:
    9.61          if (errno == EAGAIN)
    9.62              goto retry_transaction;
    9.63  
    9.64 -    if (!is_hvm(ctx, domid)) {
    9.65 +    if (!libxl__domain_is_hvm(ctx, domid)) {
    9.66          if (libxl__wait_for_backend(ctx, be_path, "4") < 0) {
    9.67 -            XL_LOG(ctx, XL_LOG_DEBUG, "pci backend at %s is not ready", be_path);
    9.68 +            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "pci backend at %s is not ready", be_path);
    9.69              return ERROR_FAIL;
    9.70          }
    9.71      }
    9.72 @@ -506,9 +506,9 @@ int libxl_device_pci_list_assignable(lib
    9.73      dir = opendir(SYSFS_PCIBACK_DRIVER);
    9.74      if ( NULL == dir ) {
    9.75          if ( errno == ENOENT ) {
    9.76 -            XL_LOG(ctx, XL_LOG_ERROR, "Looks like pciback driver not loaded");
    9.77 +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Looks like pciback driver not loaded");
    9.78          }else{
    9.79 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", SYSFS_PCIBACK_DRIVER);
    9.80 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s", SYSFS_PCIBACK_DRIVER);
    9.81          }
    9.82          libxl__free_all(&gc);
    9.83          return ERROR_FAIL;
    9.84 @@ -555,7 +555,7 @@ static int pci_multifunction_check(libxl
    9.85  
    9.86      dir = opendir(SYSFS_PCI_DEV);
    9.87      if ( NULL == dir ) {
    9.88 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", SYSFS_PCI_DEV);
    9.89 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s", SYSFS_PCI_DEV);
    9.90          return -1;
    9.91      }
    9.92  
    9.93 @@ -576,10 +576,10 @@ static int pci_multifunction_check(libxl
    9.94          path = libxl__sprintf(gc, "%s/" PCI_BDF, SYSFS_PCIBACK_DRIVER, dom, bus, dev, func);
    9.95          if ( lstat(path, &st) ) {
    9.96              if ( errno == ENOENT )
    9.97 -                XL_LOG(ctx, XL_LOG_ERROR, PCI_BDF " is not assigned to pciback driver",
    9.98 +                LIBXL__LOG(ctx, LIBXL__LOG_ERROR, PCI_BDF " is not assigned to pciback driver",
    9.99                         dom, bus, dev, func);
   9.100              else
   9.101 -                XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't lstat %s", path);
   9.102 +                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't lstat %s", path);
   9.103              closedir(dir);
   9.104              return -1;
   9.105          }
   9.106 @@ -611,7 +611,7 @@ static int do_pci_add(libxl_gc *gc, uint
   9.107      char *state, *vdevfn;
   9.108      int rc, hvm;
   9.109  
   9.110 -    hvm = is_hvm(ctx, domid);
   9.111 +    hvm = libxl__domain_is_hvm(ctx, domid);
   9.112      if (hvm) {
   9.113          if (libxl__wait_for_device_model(ctx, domid, "running", NULL, NULL) < 0) {
   9.114              return ERROR_FAIL;
   9.115 @@ -632,7 +632,7 @@ static int do_pci_add(libxl_gc *gc, uint
   9.116          vdevfn = libxl__xs_read(gc, XBT_NULL, path);
   9.117          path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
   9.118          if ( rc < 0 )
   9.119 -            XL_LOG(ctx, XL_LOG_ERROR, "qemu refused to add device: %s", vdevfn);
   9.120 +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "qemu refused to add device: %s", vdevfn);
   9.121          else if ( sscanf(vdevfn, "0x%x", &pcidev->vdevfn) != 1 )
   9.122              rc = -1;
   9.123          xs_write(ctx->xsh, XBT_NULL, path, state, strlen(state));
   9.124 @@ -647,7 +647,7 @@ static int do_pci_add(libxl_gc *gc, uint
   9.125          int i;
   9.126  
   9.127          if (f == NULL) {
   9.128 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", sysfs_path);
   9.129 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s", sysfs_path);
   9.130              return ERROR_FAIL;
   9.131          }
   9.132          for (i = 0; i < PROC_PCI_NUM_RESOURCES; i++) {
   9.133 @@ -658,7 +658,7 @@ static int do_pci_add(libxl_gc *gc, uint
   9.134                  if (flags & PCI_BAR_IO) {
   9.135                      rc = xc_domain_ioport_permission(ctx->xch, domid, start, size, 1);
   9.136                      if (rc < 0) {
   9.137 -                        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "Error: xc_domain_ioport_permission error 0x%llx/0x%llx", start, size);
   9.138 +                        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "Error: xc_domain_ioport_permission error 0x%llx/0x%llx", start, size);
   9.139                          fclose(f);
   9.140                          return ERROR_FAIL;
   9.141                      }
   9.142 @@ -666,7 +666,7 @@ static int do_pci_add(libxl_gc *gc, uint
   9.143                      rc = xc_domain_iomem_permission(ctx->xch, domid, start>>XC_PAGE_SHIFT,
   9.144                                                      (size+(XC_PAGE_SIZE-1))>>XC_PAGE_SHIFT, 1);
   9.145                      if (rc < 0) {
   9.146 -                        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "Error: xc_domain_iomem_permission error 0x%llx/0x%llx", start, size);
   9.147 +                        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "Error: xc_domain_iomem_permission error 0x%llx/0x%llx", start, size);
   9.148                          fclose(f);
   9.149                          return ERROR_FAIL;
   9.150                      }
   9.151 @@ -678,19 +678,19 @@ static int do_pci_add(libxl_gc *gc, uint
   9.152                                     pcidev->bus, pcidev->dev, pcidev->func);
   9.153          f = fopen(sysfs_path, "r");
   9.154          if (f == NULL) {
   9.155 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", sysfs_path);
   9.156 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s", sysfs_path);
   9.157              goto out;
   9.158          }
   9.159          if ((fscanf(f, "%u", &irq) == 1) && irq) {
   9.160              rc = xc_physdev_map_pirq(ctx->xch, domid, irq, &irq);
   9.161              if (rc < 0) {
   9.162 -                XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "Error: xc_physdev_map_pirq irq=%d", irq);
   9.163 +                LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "Error: xc_physdev_map_pirq irq=%d", irq);
   9.164                  fclose(f);
   9.165                  return ERROR_FAIL;
   9.166              }
   9.167              rc = xc_domain_irq_permission(ctx->xch, domid, irq, 1);
   9.168              if (rc < 0) {
   9.169 -                XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "Error: xc_domain_irq_permission irq=%d", irq);
   9.170 +                LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "Error: xc_domain_irq_permission irq=%d", irq);
   9.171                  fclose(f);
   9.172                  return ERROR_FAIL;
   9.173              }
   9.174 @@ -701,7 +701,7 @@ out:
   9.175      if (!libxl_is_stubdom(ctx, domid, NULL)) {
   9.176          rc = xc_assign_device(ctx->xch, domid, pcidev->value);
   9.177          if (rc < 0 && (hvm || errno != ENOSYS)) {
   9.178 -            XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_assign_device failed");
   9.179 +            LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_assign_device failed");
   9.180              return ERROR_FAIL;
   9.181          }
   9.182      }
   9.183 @@ -723,25 +723,25 @@ static int libxl_device_pci_reset(libxl_
   9.184          char *buf = libxl__sprintf(gc, PCI_BDF, domain, bus, dev, func);
   9.185          rc = write(fd, buf, strlen(buf));
   9.186          if (rc < 0)
   9.187 -            XL_LOG(ctx, XL_LOG_ERROR, "write to %s returned %d", reset, rc);
   9.188 +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "write to %s returned %d", reset, rc);
   9.189          close(fd);
   9.190          return rc < 0 ? rc : 0;
   9.191      }
   9.192      if (errno != ENOENT)
   9.193 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Failed to access pciback path %s", reset);
   9.194 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Failed to access pciback path %s", reset);
   9.195      reset = libxl__sprintf(gc, "%s/"PCI_BDF"/reset", SYSFS_PCI_DEV, domain, bus, dev, func);
   9.196      fd = open(reset, O_WRONLY);
   9.197      if (fd > 0) {
   9.198          rc = write(fd, "1", 1);
   9.199          if (rc < 0)
   9.200 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "write to %s returned %d", reset, rc);
   9.201 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "write to %s returned %d", reset, rc);
   9.202          close(fd);
   9.203          return rc < 0 ? rc : 0;
   9.204      }
   9.205      if (errno == ENOENT) {
   9.206 -        XL_LOG(ctx, XL_LOG_ERROR, "The kernel doesn't support PCI device reset from sysfs");
   9.207 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "The kernel doesn't support PCI device reset from sysfs");
   9.208      } else {
   9.209 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Failed to access reset path %s", reset);
   9.210 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Failed to access reset path %s", reset);
   9.211      }
   9.212      return -1;
   9.213  }
   9.214 @@ -756,12 +756,12 @@ int libxl_device_pci_add(libxl_ctx *ctx,
   9.215  
   9.216      rc = get_all_assigned_devices(&gc, &assigned, &num_assigned);
   9.217      if ( rc ) {
   9.218 -        XL_LOG(ctx, XL_LOG_ERROR, "cannot determine if device is assigned, refusing to continue");
   9.219 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot determine if device is assigned, refusing to continue");
   9.220          goto out;
   9.221      }
   9.222      if ( is_assigned(assigned, num_assigned, pcidev->domain,
   9.223                       pcidev->bus, pcidev->dev, pcidev->func) ) {
   9.224 -        XL_LOG(ctx, XL_LOG_ERROR, "PCI device already attached to a domain");
   9.225 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "PCI device already attached to a domain");
   9.226          rc = ERROR_FAIL;
   9.227          goto out;
   9.228      }
   9.229 @@ -780,7 +780,7 @@ int libxl_device_pci_add(libxl_ctx *ctx,
   9.230  
   9.231      if ( pcidev->vfunc_mask == LIBXL_PCI_FUNC_ALL ) {
   9.232          if ( !(pcidev->vdevfn >> 3) ) {
   9.233 -            XL_LOG(ctx, XL_LOG_ERROR, "Must specify a v-slot for multi-function devices");
   9.234 +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Must specify a v-slot for multi-function devices");
   9.235              rc = ERROR_INVAL;
   9.236              goto out;
   9.237          }
   9.238 @@ -828,14 +828,14 @@ static int do_pci_remove(libxl_gc *gc, u
   9.239      if ( !libxl_device_pci_list_assigned(ctx, &assigned, domid, &num) ) {
   9.240          if ( !is_assigned(assigned, num, pcidev->domain,
   9.241                           pcidev->bus, pcidev->dev, pcidev->func) ) {
   9.242 -            XL_LOG(ctx, XL_LOG_ERROR, "PCI device not attached to this domain");
   9.243 +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "PCI device not attached to this domain");
   9.244              return ERROR_INVAL;
   9.245          }
   9.246      }
   9.247  
   9.248      libxl_device_pci_remove_xenstore(gc, domid, pcidev);
   9.249  
   9.250 -    hvm = is_hvm(ctx, domid);
   9.251 +    hvm = libxl__domain_is_hvm(ctx, domid);
   9.252      if (hvm) {
   9.253          if (libxl__wait_for_device_model(ctx, domid, "running", NULL, NULL) < 0) {
   9.254              return ERROR_FAIL;
   9.255 @@ -852,7 +852,7 @@ static int do_pci_remove(libxl_gc *gc, u
   9.256          if ( (pcidev->vdevfn & 0x7) == 0 ) {
   9.257              xs_write(ctx->xsh, XBT_NULL, path, "pci-rem", strlen("pci-rem"));
   9.258              if (libxl__wait_for_device_model(ctx, domid, "pci-removed", NULL, NULL) < 0) {
   9.259 -                XL_LOG(ctx, XL_LOG_ERROR, "Device Model didn't respond in time");
   9.260 +                LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model didn't respond in time");
   9.261                  return ERROR_FAIL;
   9.262              }
   9.263          }
   9.264 @@ -867,7 +867,7 @@ static int do_pci_remove(libxl_gc *gc, u
   9.265          int i;
   9.266  
   9.267          if (f == NULL) {
   9.268 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", sysfs_path);
   9.269 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s", sysfs_path);
   9.270              goto skip1;
   9.271          }
   9.272          for (i = 0; i < PROC_PCI_NUM_RESOURCES; i++) {
   9.273 @@ -878,12 +878,12 @@ static int do_pci_remove(libxl_gc *gc, u
   9.274                  if (flags & PCI_BAR_IO) {
   9.275                      rc = xc_domain_ioport_permission(ctx->xch, domid, start, size, 0);
   9.276                      if (rc < 0)
   9.277 -                        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_ioport_permission error 0x%x/0x%x", start, size);
   9.278 +                        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_ioport_permission error 0x%x/0x%x", start, size);
   9.279                  } else {
   9.280                      rc = xc_domain_iomem_permission(ctx->xch, domid, start>>XC_PAGE_SHIFT,
   9.281                                                      (size+(XC_PAGE_SIZE-1))>>XC_PAGE_SHIFT, 0);
   9.282                      if (rc < 0)
   9.283 -                        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_iomem_permission error 0x%x/0x%x", start, size);
   9.284 +                        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_iomem_permission error 0x%x/0x%x", start, size);
   9.285                  }
   9.286              }
   9.287          }
   9.288 @@ -893,17 +893,17 @@ skip1:
   9.289                                     pcidev->bus, pcidev->dev, pcidev->func);
   9.290          f = fopen(sysfs_path, "r");
   9.291          if (f == NULL) {
   9.292 -            XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Couldn't open %s", sysfs_path);
   9.293 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s", sysfs_path);
   9.294              goto out;
   9.295          }
   9.296          if ((fscanf(f, "%u", &irq) == 1) && irq) {
   9.297              rc = xc_physdev_unmap_pirq(ctx->xch, domid, irq);
   9.298              if (rc < 0) {
   9.299 -                XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_physdev_map_pirq irq=%d", irq);
   9.300 +                LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_physdev_map_pirq irq=%d", irq);
   9.301              }
   9.302              rc = xc_domain_irq_permission(ctx->xch, domid, irq, 0);
   9.303              if (rc < 0) {
   9.304 -                XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_irq_permission irq=%d", irq);
   9.305 +                LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_irq_permission irq=%d", irq);
   9.306              }
   9.307          }
   9.308          fclose(f);
   9.309 @@ -917,7 +917,7 @@ out:
   9.310      if (!libxl_is_stubdom(ctx, domid, NULL)) {
   9.311          rc = xc_deassign_device(ctx->xch, domid, pcidev->value);
   9.312          if (rc < 0 && (hvm || errno != ENOSYS))
   9.313 -            XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_deassign_device failed");
   9.314 +            LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_deassign_device failed");
   9.315      }
   9.316  
   9.317      stubdomid = libxl_get_stubdom_id(ctx, domid);
    10.1 --- a/tools/libxl/libxl_utils.c	Wed Sep 08 16:44:24 2010 +0100
    10.2 +++ b/tools/libxl/libxl_utils.c	Wed Sep 08 16:46:27 2010 +0100
    10.3 @@ -184,7 +184,7 @@ static int logrename(libxl_ctx *ctx, con
    10.4      if (r) {
    10.5          if (errno == ENOENT) return 0; /* ok */
    10.6  
    10.7 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to rotate logfile - could not"
    10.8 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to rotate logfile - could not"
    10.9                       " rename %s to %s", old, new);
   10.10          return ERROR_FAIL;
   10.11      }
   10.12 @@ -218,7 +218,7 @@ int libxl_create_logfile(libxl_ctx *ctx,
   10.13              goto out;
   10.14      } else {
   10.15          if (errno != ENOENT)
   10.16 -            XL_LOG_ERRNO(ctx, XL_LOG_WARNING, "problem checking existence of"
   10.17 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_WARNING, "problem checking existence of"
   10.18                           " logfile %s, which might have needed to be rotated",
   10.19                           name);
   10.20      }
   10.21 @@ -271,23 +271,23 @@ int libxl_read_file_contents(libxl_ctx *
   10.22      f = fopen(filename, "r");
   10.23      if (!f) {
   10.24          if (errno == ENOENT) return ENOENT;
   10.25 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to open %s", filename);
   10.26 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to open %s", filename);
   10.27          goto xe;
   10.28      }
   10.29  
   10.30      if (fstat(fileno(f), &stab)) {
   10.31 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to fstat %s", filename);
   10.32 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to fstat %s", filename);
   10.33          goto xe;
   10.34      }
   10.35  
   10.36      if (!S_ISREG(stab.st_mode)) {
   10.37 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "%s is not a plain file", filename);
   10.38 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "%s is not a plain file", filename);
   10.39          errno = ENOTTY;
   10.40          goto xe;
   10.41      }
   10.42  
   10.43      if (stab.st_size > INT_MAX) {
   10.44 -        XL_LOG(ctx, XL_LOG_ERROR, "file %s is far too large", filename);
   10.45 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "file %s is far too large", filename);
   10.46          errno = EFBIG;
   10.47          goto xe;
   10.48      }
   10.49 @@ -301,9 +301,9 @@ int libxl_read_file_contents(libxl_ctx *
   10.50          rs = fread(data, 1, datalen, f);
   10.51          if (rs != datalen) {
   10.52              if (ferror(f))
   10.53 -                XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to read %s", filename);
   10.54 +                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to read %s", filename);
   10.55              else if (feof(f))
   10.56 -                XL_LOG(ctx, XL_LOG_ERROR, "%s changed size while we"
   10.57 +                LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "%s changed size while we"
   10.58                         " were reading it", filename);
   10.59              else
   10.60                  abort();
   10.61 @@ -313,7 +313,7 @@ int libxl_read_file_contents(libxl_ctx *
   10.62  
   10.63      if (fclose(f)) {
   10.64          f = 0;
   10.65 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to close %s", filename);
   10.66 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to close %s", filename);
   10.67          goto xe;
   10.68      }
   10.69  
   10.70 @@ -342,13 +342,13 @@ int libxl_read_file_contents(libxl_ctx *
   10.71            if (got == -1) {                                                \
   10.72                if (errno == EINTR) continue;                               \
   10.73                if (!ctx) return errno;                                     \
   10.74 -              XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to " #rw " %s%s%s", \
   10.75 +              LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to " #rw " %s%s%s", \
   10.76                             what?what:"", what?" from ":"", filename);     \
   10.77                return errno;                                               \
   10.78            }                                                               \
   10.79            if (got == 0) {                                                 \
   10.80                if (!ctx) return EPROTO;                                    \
   10.81 -              XL_LOG(ctx, XL_LOG_ERROR,                                   \
   10.82 +              LIBXL__LOG(ctx, LIBXL__LOG_ERROR,                                   \
   10.83                       zero_is_eof                                          \
   10.84                       ? "file/stream truncated reading %s%s%s"             \
   10.85                       : "file/stream write returned 0! writing %s%s%s",    \
   10.86 @@ -378,7 +378,7 @@ pid_t libxl_fork(libxl_ctx *ctx)
   10.87  
   10.88      pid = fork();
   10.89      if (pid == -1) {
   10.90 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "fork failed");
   10.91 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "fork failed");
   10.92          return -1;
   10.93      }
   10.94  
   10.95 @@ -396,7 +396,7 @@ pid_t libxl_fork(libxl_ctx *ctx)
   10.96  int libxl_pipe(libxl_ctx *ctx, int pipes[2])
   10.97  {
   10.98      if (pipe(pipes) < 0) {
   10.99 -        XL_LOG(ctx, XL_LOG_ERROR, "Failed to create a pipe");
  10.100 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to create a pipe");
  10.101          return -1;
  10.102      }
  10.103      return 0;
    11.1 --- a/tools/libxl/libxl_xshelp.c	Wed Sep 08 16:44:24 2010 +0100
    11.2 +++ b/tools/libxl/libxl_xshelp.c	Wed Sep 08 16:46:27 2010 +0100
    11.3 @@ -125,7 +125,7 @@ char *libxl__xs_get_dompath(libxl_gc *gc
    11.4      libxl_ctx *ctx = libxl_gc_owner(gc);
    11.5      char *s = xs_get_domain_path(ctx->xsh, domid);
    11.6      if (!s) {
    11.7 -        XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "failed to get dompath for %" PRIu32,
    11.8 +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to get dompath for %" PRIu32,
    11.9                       domid);
   11.10          return NULL;
   11.11      }