WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxl: Ensure all _hidden functions use l

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: Ensure all _hidden functions use libxl__ prefix (manual part)
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 10 Sep 2010 14:40:33 -0700
Delivery-date: Fri, 10 Sep 2010 14:47:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1283960787 -3600
# Node ID d6663c62524a375b3b88daab7df641b1f35df07e
# Parent  23112038074f30a14ce38a15ee8a0b25d4672892
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@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c           |  216 +++++++++++++++++++++---------------------
 tools/libxl/libxl_blktap2.c   |    6 -
 tools/libxl/libxl_device.c    |   32 +++---
 tools/libxl/libxl_dom.c       |   91 ++++++++---------
 tools/libxl/libxl_exec.c      |   14 +-
 tools/libxl/libxl_internal.c  |    6 -
 tools/libxl/libxl_internal.h  |   71 ++++++-------
 tools/libxl/libxl_noblktap2.c |    4 
 tools/libxl/libxl_pci.c       |   82 +++++++--------
 tools/libxl/libxl_utils.c     |   26 ++---
 tools/libxl/libxl_xshelp.c    |    2 
 11 files changed, 275 insertions(+), 275 deletions(-)

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

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: Ensure all _hidden functions use libxl__ prefix (manual part), Xen patchbot-unstable <=