[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Merge with xen-ia64-unstable.hg



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1177447163 -3600
# Node ID 605aa81d7341f812a3c7a25ee2d0f4a60e4b0ddc
# Parent  9313d0ce09f85e0d883bc5378d1fc9ca7a55a932
# Parent  c1d3f4fbfacf7ea8eab9549823787f13efa2d976
Merge with xen-ia64-unstable.hg
---
 tools/libxen/include/xen_common.h                        |  204 ---
 tools/libxen/include/xen_console.h                       |  247 ----
 tools/libxen/include/xen_console_decl.h                  |   30 
 tools/libxen/include/xen_console_protocol.h              |   82 -
 tools/libxen/include/xen_crashdump.h                     |  199 ---
 tools/libxen/include/xen_crashdump_decl.h                |   30 
 tools/libxen/include/xen_event.h                         |  102 -
 tools/libxen/include/xen_event_decl.h                    |   25 
 tools/libxen/include/xen_event_operation.h               |   82 -
 tools/libxen/include/xen_host.h                          |  497 --------
 tools/libxen/include/xen_host_cpu.h                      |  247 ----
 tools/libxen/include/xen_host_cpu_decl.h                 |   30 
 tools/libxen/include/xen_host_decl.h                     |   30 
 tools/libxen/include/xen_host_metrics.h                  |  199 ---
 tools/libxen/include/xen_host_metrics_decl.h             |   30 
 tools/libxen/include/xen_int_float_map.h                 |   53 
 tools/libxen/include/xen_int_int_map.h                   |   53 
 tools/libxen/include/xen_int_string_set_map.h            |   53 
 tools/libxen/include/xen_network.h                       |  276 ----
 tools/libxen/include/xen_network_decl.h                  |   30 
 tools/libxen/include/xen_on_crash_behaviour.h            |   97 -
 tools/libxen/include/xen_on_normal_exit.h                |   77 -
 tools/libxen/include/xen_pbd.h                           |  223 ---
 tools/libxen/include/xen_pbd_decl.h                      |   30 
 tools/libxen/include/xen_pif.h                           |  277 ----
 tools/libxen/include/xen_pif_decl.h                      |   30 
 tools/libxen/include/xen_pif_metrics.h                   |  198 ---
 tools/libxen/include/xen_pif_metrics_decl.h              |   30 
 tools/libxen/include/xen_sr.h                            |  277 ----
 tools/libxen/include/xen_sr_decl.h                       |   30 
 tools/libxen/include/xen_string_set.h                    |   47 
 tools/libxen/include/xen_string_string_map.h             |   53 
 tools/libxen/include/xen_user.h                          |  204 ---
 tools/libxen/include/xen_user_decl.h                     |   30 
 tools/libxen/include/xen_vbd.h                           |  390 ------
 tools/libxen/include/xen_vbd_decl.h                      |   30 
 tools/libxen/include/xen_vbd_metrics.h                   |  198 ---
 tools/libxen/include/xen_vbd_metrics_decl.h              |   30 
 tools/libxen/include/xen_vbd_mode.h                      |   77 -
 tools/libxen/include/xen_vbd_type.h                      |   77 -
 tools/libxen/include/xen_vdi.h                           |  347 -----
 tools/libxen/include/xen_vdi_decl.h                      |   30 
 tools/libxen/include/xen_vdi_type.h                      |   92 -
 tools/libxen/include/xen_vif.h                           |  365 ------
 tools/libxen/include/xen_vif_decl.h                      |   30 
 tools/libxen/include/xen_vif_metrics.h                   |  198 ---
 tools/libxen/include/xen_vif_metrics_decl.h              |   30 
 tools/libxen/include/xen_vm.h                            |  894 ---------------
 tools/libxen/include/xen_vm_decl.h                       |   30 
 tools/libxen/include/xen_vm_guest_metrics.h              |  234 ---
 tools/libxen/include/xen_vm_guest_metrics_decl.h         |   30 
 tools/libxen/include/xen_vm_metrics.h                    |  251 ----
 tools/libxen/include/xen_vm_metrics_decl.h               |   30 
 tools/libxen/include/xen_vm_power_state.h                |   92 -
 tools/libxen/include/xen_vtpm.h                          |  198 ---
 tools/libxen/include/xen_vtpm_decl.h                     |   31 
 tools/libxen/test/test_hvm_bindings.c                    |  445 -------
 .hgignore                                                |    1 
 docs/xen-api/xenapi-coversheet.tex                       |    4 
 linux-2.6-xen-sparse/drivers/xen/netback/netback.c       |   10 
 tools/blktap/drivers/blktapctrl.c                        |   19 
 tools/blktap/lib/blktaplib.h                             |    2 
 tools/firmware/hvmloader/util.c                          |    6 
 tools/firmware/rombios/32bit/util.c                      |   64 -
 tools/firmware/rombios/rombios.c                         |    9 
 tools/ioemu/block.c                                      |    4 
 tools/ioemu/hw/cirrus_vga.c                              |    3 
 tools/ioemu/hw/cirrus_vga_rop.h                          |   35 
 tools/ioemu/hw/cirrus_vga_rop2.h                         |  132 +-
 tools/ioemu/hw/dma.c                                     |    2 
 tools/ioemu/hw/lsi53c895a.c                              |    5 
 tools/libxen/Makefile                                    |   22 
 tools/libxen/Makefile.dist                               |  115 +
 tools/libxen/include/xen/api/xen_all.h                   |   39 
 tools/libxen/include/xen/api/xen_common.h                |  211 +++
 tools/libxen/include/xen/api/xen_console.h               |  247 ++++
 tools/libxen/include/xen/api/xen_console_decl.h          |   30 
 tools/libxen/include/xen/api/xen_console_protocol.h      |   82 +
 tools/libxen/include/xen/api/xen_crashdump.h             |  199 +++
 tools/libxen/include/xen/api/xen_crashdump_decl.h        |   30 
 tools/libxen/include/xen/api/xen_event.h                 |  102 +
 tools/libxen/include/xen/api/xen_event_decl.h            |   25 
 tools/libxen/include/xen/api/xen_event_operation.h       |   82 +
 tools/libxen/include/xen/api/xen_host.h                  |  497 ++++++++
 tools/libxen/include/xen/api/xen_host_cpu.h              |  247 ++++
 tools/libxen/include/xen/api/xen_host_cpu_decl.h         |   30 
 tools/libxen/include/xen/api/xen_host_decl.h             |   30 
 tools/libxen/include/xen/api/xen_host_metrics.h          |  199 +++
 tools/libxen/include/xen/api/xen_host_metrics_decl.h     |   30 
 tools/libxen/include/xen/api/xen_int_float_map.h         |   53 
 tools/libxen/include/xen/api/xen_int_int_map.h           |   53 
 tools/libxen/include/xen/api/xen_int_string_set_map.h    |   53 
 tools/libxen/include/xen/api/xen_network.h               |  276 ++++
 tools/libxen/include/xen/api/xen_network_decl.h          |   30 
 tools/libxen/include/xen/api/xen_on_crash_behaviour.h    |   97 +
 tools/libxen/include/xen/api/xen_on_normal_exit.h        |   77 +
 tools/libxen/include/xen/api/xen_pbd.h                   |  223 +++
 tools/libxen/include/xen/api/xen_pbd_decl.h              |   30 
 tools/libxen/include/xen/api/xen_pif.h                   |  277 ++++
 tools/libxen/include/xen/api/xen_pif_decl.h              |   30 
 tools/libxen/include/xen/api/xen_pif_metrics.h           |  198 +++
 tools/libxen/include/xen/api/xen_pif_metrics_decl.h      |   30 
 tools/libxen/include/xen/api/xen_sr.h                    |  277 ++++
 tools/libxen/include/xen/api/xen_sr_decl.h               |   30 
 tools/libxen/include/xen/api/xen_string_set.h            |   47 
 tools/libxen/include/xen/api/xen_string_string_map.h     |   53 
 tools/libxen/include/xen/api/xen_user.h                  |  204 +++
 tools/libxen/include/xen/api/xen_user_decl.h             |   30 
 tools/libxen/include/xen/api/xen_vbd.h                   |  390 ++++++
 tools/libxen/include/xen/api/xen_vbd_decl.h              |   30 
 tools/libxen/include/xen/api/xen_vbd_metrics.h           |  198 +++
 tools/libxen/include/xen/api/xen_vbd_metrics_decl.h      |   30 
 tools/libxen/include/xen/api/xen_vbd_mode.h              |   77 +
 tools/libxen/include/xen/api/xen_vbd_type.h              |   77 +
 tools/libxen/include/xen/api/xen_vdi.h                   |  347 +++++
 tools/libxen/include/xen/api/xen_vdi_decl.h              |   30 
 tools/libxen/include/xen/api/xen_vdi_type.h              |   92 +
 tools/libxen/include/xen/api/xen_vif.h                   |  365 ++++++
 tools/libxen/include/xen/api/xen_vif_decl.h              |   30 
 tools/libxen/include/xen/api/xen_vif_metrics.h           |  198 +++
 tools/libxen/include/xen/api/xen_vif_metrics_decl.h      |   30 
 tools/libxen/include/xen/api/xen_vm.h                    |  894 +++++++++++++++
 tools/libxen/include/xen/api/xen_vm_decl.h               |   30 
 tools/libxen/include/xen/api/xen_vm_guest_metrics.h      |  234 +++
 tools/libxen/include/xen/api/xen_vm_guest_metrics_decl.h |   30 
 tools/libxen/include/xen/api/xen_vm_metrics.h            |  251 ++++
 tools/libxen/include/xen/api/xen_vm_metrics_decl.h       |   30 
 tools/libxen/include/xen/api/xen_vm_power_state.h        |   92 +
 tools/libxen/include/xen/api/xen_vtpm.h                  |  199 +++
 tools/libxen/include/xen/api/xen_vtpm_decl.h             |   31 
 tools/libxen/include/xen_console_protocol_internal.h     |    2 
 tools/libxen/include/xen_internal.h                      |   57 
 tools/libxen/include/xen_on_crash_behaviour_internal.h   |    2 
 tools/libxen/include/xen_on_normal_exit_internal.h       |    2 
 tools/libxen/include/xen_vbd_mode_internal.h             |    2 
 tools/libxen/include/xen_vdi_type_internal.h             |    2 
 tools/libxen/include/xen_vm_power_state_internal.h       |    2 
 tools/libxen/src/xen_common.c                            |   29 
 tools/libxen/src/xen_console.c                           |    8 
 tools/libxen/src/xen_console_protocol.c                  |    4 
 tools/libxen/src/xen_crashdump.c                         |    8 
 tools/libxen/src/xen_event.c                             |    4 
 tools/libxen/src/xen_event_operation.c                   |    2 
 tools/libxen/src/xen_host.c                              |   18 
 tools/libxen/src/xen_host_cpu.c                          |    6 
 tools/libxen/src/xen_host_metrics.c                      |    4 
 tools/libxen/src/xen_int_float_map.c                     |    6 
 tools/libxen/src/xen_int_int_map.c                       |    4 
 tools/libxen/src/xen_int_string_set_map.c                |    6 
 tools/libxen/src/xen_network.c                           |   10 
 tools/libxen/src/xen_on_crash_behaviour.c                |    4 
 tools/libxen/src/xen_on_normal_exit.c                    |    4 
 tools/libxen/src/xen_pbd.c                               |   10 
 tools/libxen/src/xen_pif.c                               |   10 
 tools/libxen/src/xen_pif_metrics.c                       |    4 
 tools/libxen/src/xen_sr.c                                |    8 
 tools/libxen/src/xen_string_set.c                        |    2 
 tools/libxen/src/xen_string_string_map.c                 |    6 
 tools/libxen/src/xen_user.c                              |    4 
 tools/libxen/src/xen_vbd.c                               |   12 
 tools/libxen/src/xen_vbd_metrics.c                       |    4 
 tools/libxen/src/xen_vbd_mode.c                          |    4 
 tools/libxen/src/xen_vbd_type.c                          |    2 
 tools/libxen/src/xen_vdi.c                               |   12 
 tools/libxen/src/xen_vdi_type.c                          |    4 
 tools/libxen/src/xen_vif.c                               |   12 
 tools/libxen/src/xen_vif_metrics.c                       |    4 
 tools/libxen/src/xen_vm.c                                |   24 
 tools/libxen/src/xen_vm_guest_metrics.c                  |    6 
 tools/libxen/src/xen_vm_metrics.c                        |   12 
 tools/libxen/src/xen_vm_power_state.c                    |    4 
 tools/libxen/src/xen_vtpm.c                              |    8 
 tools/libxen/test/test_bindings.c                        |    9 
 tools/libxen/test/test_event_handling.c                  |    3 
 tools/python/xen/xm/create.py                            |    2 
 tools/xm-test/lib/XmTestLib/XenAPIDomain.py              |    2 
 xen/acm/acm_chinesewall_hooks.c                          |  108 -
 xen/acm/acm_null_hooks.c                                 |    6 
 xen/acm/acm_simple_type_enforcement_hooks.c              |   17 
 xen/arch/ia64/xen/xensetup.c                             |    4 
 xen/arch/powerpc/setup.c                                 |    7 
 xen/arch/x86/mm/hap/hap.c                                |   10 
 xen/arch/x86/setup.c                                     |    7 
 xen/common/domain.c                                      |   21 
 xen/common/domctl.c                                      |   15 
 xen/common/kexec.c                                       |   27 
 xen/common/perfc.c                                       |    8 
 xen/include/acm/acm_hooks.h                              |  222 +--
 xen/include/public/hvm/ioreq.h                           |    9 
 xen/include/public/io/tpmif.h                            |    2 
 xen/include/xen/sched.h                                  |    4 
 191 files changed, 8485 insertions(+), 8833 deletions(-)

diff -r 9313d0ce09f8 -r 605aa81d7341 .hgignore
--- a/.hgignore Tue Apr 24 09:26:32 2007 -0600
+++ b/.hgignore Tue Apr 24 21:39:23 2007 +0100
@@ -126,6 +126,7 @@
 ^tools/ioemu/qemu\.1$
 ^tools/ioemu/qemu\.pod$
 ^tools/libxc/xen/.*$
+^tools/libxen/libxenapi-
 ^tools/libxen/test/test_bindings$
 ^tools/libxen/test/test_event_handling$
 ^tools/libaio/src/.*\.ol$
diff -r 9313d0ce09f8 -r 605aa81d7341 docs/xen-api/xenapi-coversheet.tex
--- a/docs/xen-api/xenapi-coversheet.tex        Tue Apr 24 09:26:32 2007 -0600
+++ b/docs/xen-api/xenapi-coversheet.tex        Tue Apr 24 21:39:23 2007 +0100
@@ -17,12 +17,12 @@
 \newcommand{\coversheetlogo}{xen.eps}
 
 %% Document date
-\newcommand{\datestring}{5th April 2007}
+\newcommand{\datestring}{21st April 2007}
 
 \newcommand{\releasestatement}{Candidate for Release\\Comments are welcome!}
 
 %% Document revision
-\newcommand{\revstring}{API Revision 0.9.0}
+\newcommand{\revstring}{API Revision 0.9.1}
 
 %% Document authors
 \newcommand{\docauthors}{
diff -r 9313d0ce09f8 -r 605aa81d7341 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Tue Apr 24 
09:26:32 2007 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Tue Apr 24 
21:39:23 2007 +0100
@@ -252,8 +252,11 @@ int netif_be_start_xmit(struct sk_buff *
        /*
         * Copy the packet here if it's destined for a flipping interface
         * but isn't flippable (e.g. extra references to data).
+        * XXX For now we also copy skbuffs whose head crosses a page
+        * boundary, because netbk_gop_skb can't handle them.
         */
-       if (!netif->copying_receiver) {
+       if (!netif->copying_receiver ||
+           ((skb_headlen(skb) + offset_in_page(skb->data)) >= PAGE_SIZE)) {
                struct sk_buff *nskb = netbk_copy_skb(skb);
                if ( unlikely(nskb == NULL) )
                        goto drop;
@@ -425,8 +428,9 @@ static void netbk_gop_skb(struct sk_buff
        }
 
        /*
-        * This must occur at the end to ensure that we don't trash
-        * skb_shinfo until we're done.
+        * This must occur at the end to ensure that we don't trash skb_shinfo
+        * until we're done. We know that the head doesn't cross a page
+        * boundary because such packets get copied in netif_be_start_xmit.
         */
        head_meta->id = netbk_gop_frag(netif, head_meta, 0, npo,
                                       virt_to_page(skb->data),
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/blktap/drivers/blktapctrl.c
--- a/tools/blktap/drivers/blktapctrl.c Tue Apr 24 09:26:32 2007 -0600
+++ b/tools/blktap/drivers/blktapctrl.c Tue Apr 24 21:39:23 2007 +0100
@@ -177,14 +177,14 @@ static int get_tapdisk_pid(blkif_t *blki
  *   return 0 on success, -1 on error.
  */
 
-static int test_path(char *path, char **dev, int *type, blkif_t *blkif)
+static int test_path(char *path, char **dev, int *type, blkif_t **blkif)
 {
        char *ptr, handle[10];
        int i, size, found = 0;
 
        size = sizeof(dtypes)/sizeof(disk_info_t *);
        *type = MAX_DISK_TYPES + 1;
-        blkif = NULL;
+        *blkif = NULL;
 
        if ( (ptr = strstr(path, ":"))!=NULL) {
                memcpy(handle, path, (ptr - path));
@@ -207,9 +207,9 @@ static int test_path(char *path, char **
                                 /* Check whether tapdisk process 
                                    already exists */
                                 if (active_disks[dtypes[i]->idnum] == NULL) 
-                                        blkif = NULL;
+                                        *blkif = NULL;
                                 else 
-                                        blkif = active_disks[dtypes[i]
+                                        *blkif = active_disks[dtypes[i]
                                                              ->idnum]->blkif;
                         }
                         return 0;
@@ -478,27 +478,30 @@ int blktapctrl_new_blkif(blkif_t *blkif)
        char *rdctldev, *wrctldev, *cmd, *ptr;
        image_t *image;
        blkif_t *exist = NULL;
+       static uint16_t next_cookie = 0;
 
        DPRINTF("Received a poll for a new vbd\n");
        if ( ((blk=blkif->info) != NULL) && (blk->params != NULL) ) {
                if (get_new_dev(&major, &minor, blkif)<0)
                        return -1;
 
-               if (test_path(blk->params, &ptr, &type, exist) != 0) {
+               if (test_path(blk->params, &ptr, &type, &exist) != 0) {
                         DPRINTF("Error in blktap device string(%s).\n",
                                 blk->params);
                         return -1;
                 }
                blkif->drivertype = type;
-               blkif->cookie = lrand48() % MAX_RAND_VAL;
+               blkif->cookie = next_cookie++;
 
                if (!exist) {
                        DPRINTF("Process does not exist:\n");
-                       asprintf(&rdctldev, "/dev/xen/tapctrlread%d", minor);
+                       asprintf(&rdctldev, 
+                                "%s/tapctrlread%d", BLKTAP_DEV_DIR, minor);
                        blkif->fds[READ] = open_ctrl_socket(rdctldev);
 
 
-                       asprintf(&wrctldev, "/dev/xen/tapctrlwrite%d", minor);
+                       asprintf(&wrctldev, 
+                                "%s/tapctrlwrite%d", BLKTAP_DEV_DIR, minor);
                        blkif->fds[WRITE] = open_ctrl_socket(wrctldev);
                        
                        if (blkif->fds[READ] == -1 || blkif->fds[WRITE] == -1) 
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/blktap/lib/blktaplib.h
--- a/tools/blktap/lib/blktaplib.h      Tue Apr 24 09:26:32 2007 -0600
+++ b/tools/blktap/lib/blktaplib.h      Tue Apr 24 21:39:23 2007 +0100
@@ -78,7 +78,7 @@ static inline int BLKTAP_MODE_VALID(unsi
 
 #define BLKTAP_IOCTL_KICK 1
 #define MAX_PENDING_REQS       BLK_RING_SIZE
-#define BLKTAP_DEV_DIR   "/dev/xen"
+#define BLKTAP_DEV_DIR   "/var/run/tap"
 #define BLKTAP_DEV_NAME  "blktap"
 #define BLKTAP_DEV_MINOR 0
 
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/firmware/hvmloader/util.c
--- a/tools/firmware/hvmloader/util.c   Tue Apr 24 09:26:32 2007 -0600
+++ b/tools/firmware/hvmloader/util.c   Tue Apr 24 21:39:23 2007 +0100
@@ -295,7 +295,7 @@ static void e820_collapse(void)
              ((ent[i].addr + ent[i].size) == ent[i+1].addr) )
         {
             ent[i].size += ent[i+1].size;
-            memcpy(&ent[i+1], &ent[i+2], *E820_MAP_NR - i - 2);
+            memcpy(&ent[i+1], &ent[i+2], (*E820_MAP_NR-i-2) * sizeof(*ent));
             (*E820_MAP_NR)--;
         }
         else
@@ -322,10 +322,10 @@ uint32_t e820_malloc(uint32_t size)
              (addr != ent[i].addr) ||     /* starts above 4gb? */
              ((addr + size) < addr) )     /* ends above 4gb? */
             continue;
-        
+
         if ( ent[i].size != size )
         {
-            memmove(&ent[i+1], &ent[i], (*E820_MAP_NR - i) * sizeof(*ent));
+            memmove(&ent[i+1], &ent[i], (*E820_MAP_NR-i) * sizeof(*ent));
             (*E820_MAP_NR)++;
             ent[i].size -= size;
             addr += ent[i].size;
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/firmware/rombios/32bit/util.c
--- a/tools/firmware/rombios/32bit/util.c       Tue Apr 24 09:26:32 2007 -0600
+++ b/tools/firmware/rombios/32bit/util.c       Tue Apr 24 21:39:23 2007 +0100
@@ -394,57 +394,17 @@ int vprintf(const char *fmt, va_list ap)
     return 0;
 }
 
-
-/*
- * sleep by synchronizing with the PIT on channel 2
- * http://bochs.sourceforge.net/techspec/intel-82c54-timer.pdf.gz
- */
-#define PIT_CTR2       0x80
-#define PIT_CTR1       0x40
-#define PIT_CTR0       0x00
-
-#define PIT_RW_LSB     0x10
-
-#define PIT_MODE0      0x0
-
-#define PIT_CTR_16BIT  0x0
-
-#define PIT_CMD_LATCH  0x0
-
-#define PORT_PIT_CMD     0x43
-#define PORT_PIT_CTR2    0x42
-#define PORT_PIT_CTR1    0x41
-#define PORT_PIT_CTR0    0x40
-
-#define PIT_FREQ         1193182 /* Hz */
-
-#define PORT_PPI         0x61
-
 void mssleep(uint32_t waittime)
 {
-       long int timeout = 0;
-       uint8_t last = 0x0;
-       uint8_t old_ppi = inb(PORT_PPI);
-
-       /* use ctr2; ctr0 is used by the Bochs BIOS */
-       /* ctr2 drives speaker -- turn it off */
-       outb(PORT_PPI, old_ppi & 0xfc);
-
-       outb(PORT_PIT_CMD, PIT_CTR2 | PIT_RW_LSB | PIT_MODE0 | PIT_CTR_16BIT);
-       outb(PORT_PIT_CTR2, last);         /* start countdown */
-
-       while (timeout < (waittime * PIT_FREQ / 1000)) {
-               uint8_t cur, delta;
-               outb(PORT_PIT_CMD, PIT_CTR2 | PIT_CMD_LATCH);
-               cur = inb(PORT_PIT_CTR2);
-               delta = last - cur;
-               timeout += delta;
-               last = cur;
-       }
-       /* turn ctr2 off */
-       outb(PORT_PIT_CMD, PIT_CTR2 | PIT_RW_LSB | PIT_MODE0 | PIT_CTR_16BIT);
-       outb(PORT_PIT_CTR2, 0xff); /* start countdown */
-       outb(PORT_PIT_CTR2, 0x0);  /* stop */
-
-       outb(PORT_PPI, old_ppi);
-}
+    uint32_t i;
+    uint8_t  x, y = inb(0x61) & 0x10;
+
+    /* Poll the DRAM refresh timer: I/O port 61h, bit 4 toggles every 15us. */
+    waittime *= 67; /* Convert milliseconds to multiples of 15us. */
+    for ( i = 0; i < waittime; i++ )
+    {
+        while ( (x = inb(0x61) & 0x10) == y )
+            continue;
+        y = x;
+    }
+}
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/firmware/rombios/rombios.c
--- a/tools/firmware/rombios/rombios.c  Tue Apr 24 09:26:32 2007 -0600
+++ b/tools/firmware/rombios/rombios.c  Tue Apr 24 21:39:23 2007 +0100
@@ -4157,15 +4157,10 @@ BX_DEBUG_INT15("int15 AX=%04x\n",regs.u.
       DX = regs.u.r16.dx;
 
 ASM_START
-      sti
-
       ;; Get the count in eax
-      mov  bx, sp
-      SEG SS
-        mov  ax, _int15_function.CX [bx]
+      mov  ax, .int15_function32.CX [bp]
       shl  eax, #16
-      SEG SS
-        mov  ax, _int15_function.DX [bx]
+      mov  ax, .int15_function32.DX [bp]
 
       ;; convert to numbers of 15usec ticks
       mov ebx, #15
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/ioemu/block.c
--- a/tools/ioemu/block.c       Tue Apr 24 09:26:32 2007 -0600
+++ b/tools/ioemu/block.c       Tue Apr 24 21:39:23 2007 +0100
@@ -420,6 +420,8 @@ int bdrv_read(BlockDriverState *bs, int6
 
     if (!bs->inserted)
         return -1;
+    if (sector_num < 0)
+       return -1;
 
     while (nb_sectors > 0) {
         if (sector_num == 0 && bs->boot_sector_enabled) {
@@ -458,6 +460,8 @@ int bdrv_write(BlockDriverState *bs, int
         return -1;
     if (bs->read_only)
         return -1;
+    if (sector_num < 0)
+       return -1;
     if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
         memcpy(bs->boot_sector_data, buf, 512);   
     }
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/ioemu/hw/cirrus_vga.c
--- a/tools/ioemu/hw/cirrus_vga.c       Tue Apr 24 09:26:32 2007 -0600
+++ b/tools/ioemu/hw/cirrus_vga.c       Tue Apr 24 21:39:23 2007 +0100
@@ -601,7 +601,8 @@ static void cirrus_invalidate_region(Cir
        off_cur_end = off_cur + bytesperline;
        off_cur &= TARGET_PAGE_MASK;
        while (off_cur < off_cur_end) {
-           cpu_physical_memory_set_dirty(s->vram_offset + off_cur);
+           cpu_physical_memory_set_dirty(s->vram_offset +
+                                         (off_cur & s->cirrus_addr_mask));
            off_cur += TARGET_PAGE_SIZE;
        }
        off_begin += off_pitch;
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/ioemu/hw/cirrus_vga_rop.h
--- a/tools/ioemu/hw/cirrus_vga_rop.h   Tue Apr 24 09:26:32 2007 -0600
+++ b/tools/ioemu/hw/cirrus_vga_rop.h   Tue Apr 24 21:39:23 2007 +0100
@@ -22,18 +22,36 @@
  * THE SOFTWARE.
  */
 
+#define get_base(p, s, b) do { \
+    if ((p) >= (s)->vram_ptr && (p) < (s)->vram_ptr + (s)->vram_size) \
+       (b) = (s)->vram_ptr; \
+    else if ((p) >= &(s)->cirrus_bltbuf[0] && \
+            (p) < &(s)->cirrus_bltbuf[CIRRUS_BLTBUFSIZE]) \
+       (b) = &(s)->cirrus_bltbuf[0]; \
+    else \
+       return; \
+} while(0)
+
+#define m(x) ((x) & s->cirrus_addr_mask)
+
 static void
 glue(cirrus_bitblt_rop_fwd_, ROP_NAME)(CirrusVGAState *s,
-                             uint8_t *dst,const uint8_t *src,
+                             uint8_t *dst_,const uint8_t *src_,
                              int dstpitch,int srcpitch,
                              int bltwidth,int bltheight)
 {
     int x,y;
+    uint32_t dst, src;
+    uint8_t *dst_base, *src_base;
+    get_base(dst_, s, dst_base);
+    get_base(src_, s, src_base);
+    dst = dst_ - dst_base;
+    src = src_ - src_base;
     dstpitch -= bltwidth;
     srcpitch -= bltwidth;
     for (y = 0; y < bltheight; y++) {
         for (x = 0; x < bltwidth; x++) {
-            ROP_OP(*dst, *src);
+            ROP_OP(*(dst_base + m(dst)), *(src_base + m(src)));
             dst++;
             src++;
         }
@@ -44,16 +62,22 @@ glue(cirrus_bitblt_rop_fwd_, ROP_NAME)(C
 
 static void
 glue(cirrus_bitblt_rop_bkwd_, ROP_NAME)(CirrusVGAState *s,
-                                        uint8_t *dst,const uint8_t *src,
+                                        uint8_t *dst_,const uint8_t *src_,
                                         int dstpitch,int srcpitch,
                                         int bltwidth,int bltheight)
 {
     int x,y;
+    uint32_t dst, src;
+    uint8_t *dst_base, *src_base;
+    get_base(dst_, s, dst_base);
+    get_base(src_, s, src_base);
+    dst = dst_ - dst_base;
+    src = src_ - src_base;
     dstpitch += bltwidth;
     srcpitch += bltwidth;
     for (y = 0; y < bltheight; y++) {
         for (x = 0; x < bltwidth; x++) {
-            ROP_OP(*dst, *src);
+            ROP_OP(*(dst_base + m(dst)), *(src_base + m(src)));
             dst--;
             src--;
         }
@@ -76,3 +100,6 @@ glue(cirrus_bitblt_rop_bkwd_, ROP_NAME)(
 
 #undef ROP_NAME
 #undef ROP_OP
+
+#undef get_base
+#undef m
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/ioemu/hw/cirrus_vga_rop2.h
--- a/tools/ioemu/hw/cirrus_vga_rop2.h  Tue Apr 24 09:26:32 2007 -0600
+++ b/tools/ioemu/hw/cirrus_vga_rop2.h  Tue Apr 24 21:39:23 2007 +0100
@@ -23,36 +23,42 @@
  */
 
 #if DEPTH == 8
-#define PUTPIXEL()    ROP_OP(d[0], col)
+#define PUTPIXEL()    ROP_OP((dst_base + m(d))[0], col)
 #elif DEPTH == 16
-#define PUTPIXEL()    ROP_OP(((uint16_t *)d)[0], col);
+#define PUTPIXEL()    ROP_OP(((uint16_t *)(dst_base + m(d)))[0], col);
 #elif DEPTH == 24
-#define PUTPIXEL()    ROP_OP(d[0], col); \
-                      ROP_OP(d[1], (col >> 8)); \
-                      ROP_OP(d[2], (col >> 16))
+#define PUTPIXEL()    ROP_OP((dst_base + m(d))[0], col); \
+                      ROP_OP((dst_base + m(d))[1], (col >> 8)); \
+                      ROP_OP((dst_base + m(d))[2], (col >> 16))
 #elif DEPTH == 32
-#define PUTPIXEL()    ROP_OP(((uint32_t *)d)[0], col)
+#define PUTPIXEL()    ROP_OP(((uint32_t *)(dst_base + m(d)))[0], col)
 #else
 #error unsupported DEPTH
 #endif                
 
 static void
 glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)
-     (CirrusVGAState * s, uint8_t * dst,
-      const uint8_t * src, 
-      int dstpitch, int srcpitch, 
-      int bltwidth, int bltheight)
-{
-    uint8_t *d;
+     (CirrusVGAState * s, uint8_t * dst_,
+      const uint8_t * src_, 
+      int dstpitch, int srcpitch, 
+      int bltwidth, int bltheight)
+{
+    uint8_t *dst_base, *src_base;
+    uint32_t src, dst;
+    uint32_t d;
     int x, y, pattern_y, pattern_pitch, pattern_x;
     unsigned int col;
-    const uint8_t *src1;
+    uint32_t src1;
 #if DEPTH == 24
     int skipleft = s->gr[0x2f] & 0x1f;
 #else
     int skipleft = (s->gr[0x2f] & 0x07) * (DEPTH / 8);
 #endif
 
+    get_base(dst_, s, dst_base);
+    get_base(src_, s, src_base);
+    dst = dst_ - dst_base;
+    src = src_ - src_base;
 #if DEPTH == 8
     pattern_pitch = 8;
 #elif DEPTH == 16
@@ -67,19 +73,19 @@ glue(glue(glue(cirrus_patternfill_, ROP_
         src1 = src + pattern_y * pattern_pitch;
         for (x = skipleft; x < bltwidth; x += (DEPTH / 8)) {
 #if DEPTH == 8
-            col = src1[pattern_x];
+            col = *(src_base + m(src1 + pattern_x));
             pattern_x = (pattern_x + 1) & 7;
 #elif DEPTH == 16
-            col = ((uint16_t *)(src1 + pattern_x))[0];
+            col = *(uint16_t *)(src_base + m(src1 + pattern_x));
             pattern_x = (pattern_x + 2) & 15;
 #elif DEPTH == 24
             {
-                const uint8_t *src2 = src1 + pattern_x * 3;
+                const uint8_t *src2 = src_base + m(src1 + pattern_x * 3);
                 col = src2[0] | (src2[1] << 8) | (src2[2] << 16);
                 pattern_x = (pattern_x + 1) & 7;
             }
 #else
-            col = ((uint32_t *)(src1 + pattern_x))[0];
+            col = *(uint32_t *)(src_base + m(src1 + pattern_x));
             pattern_x = (pattern_x + 4) & 31;
 #endif
             PUTPIXEL();
@@ -93,12 +99,14 @@ glue(glue(glue(cirrus_patternfill_, ROP_
 /* NOTE: srcpitch is ignored */
 static void
 glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH)
-     (CirrusVGAState * s, uint8_t * dst,
-      const uint8_t * src, 
-      int dstpitch, int srcpitch, 
-      int bltwidth, int bltheight)
-{
-    uint8_t *d;
+     (CirrusVGAState * s, uint8_t * dst_,
+      const uint8_t * src_, 
+      int dstpitch, int srcpitch, 
+      int bltwidth, int bltheight)
+{
+    uint8_t *dst_base, *src_base;
+    uint32_t src, dst;
+    uint32_t d;
     int x, y;
     unsigned bits, bits_xor;
     unsigned int col;
@@ -112,6 +120,10 @@ glue(glue(glue(cirrus_colorexpand_transp
     int dstskipleft = srcskipleft * (DEPTH / 8);
 #endif
 
+    get_base(dst_, s, dst_base);
+    get_base(src_, s, src_base);
+    dst = dst_ - dst_base;
+    src = src_ - src_base;
     if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) {
         bits_xor = 0xff;
         col = s->cirrus_blt_bgcol;
@@ -122,12 +134,12 @@ glue(glue(glue(cirrus_colorexpand_transp
 
     for(y = 0; y < bltheight; y++) {
         bitmask = 0x80 >> srcskipleft;
-        bits = *src++ ^ bits_xor;
+        bits = *(src_base + m(src++)) ^ bits_xor;
         d = dst + dstskipleft;
         for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
             if ((bitmask & 0xff) == 0) {
                 bitmask = 0x80;
-                bits = *src++ ^ bits_xor;
+                bits = *(src_base + m(src++)) ^ bits_xor;
             }
             index = (bits & bitmask);
             if (index) {
@@ -142,13 +154,15 @@ glue(glue(glue(cirrus_colorexpand_transp
 
 static void
 glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH)
-     (CirrusVGAState * s, uint8_t * dst,
-      const uint8_t * src, 
-      int dstpitch, int srcpitch, 
-      int bltwidth, int bltheight)
-{
+     (CirrusVGAState * s, uint8_t * dst_,
+      const uint8_t * src_, 
+      int dstpitch, int srcpitch, 
+      int bltwidth, int bltheight)
+{
+    uint8_t *dst_base, *src_base;
+    uint32_t src, dst;
     uint32_t colors[2];
-    uint8_t *d;
+    uint32_t d;
     int x, y;
     unsigned bits;
     unsigned int col;
@@ -156,16 +170,20 @@ glue(glue(glue(cirrus_colorexpand_, ROP_
     int srcskipleft = s->gr[0x2f] & 0x07;
     int dstskipleft = srcskipleft * (DEPTH / 8);
 
+    get_base(dst_, s, dst_base);
+    get_base(src_, s, src_base);
+    dst = dst_ - dst_base;
+    src = src_ - src_base;
     colors[0] = s->cirrus_blt_bgcol;
     colors[1] = s->cirrus_blt_fgcol;
     for(y = 0; y < bltheight; y++) {
         bitmask = 0x80 >> srcskipleft;
-        bits = *src++;
+        bits = *(src_base + m(src++));
         d = dst + dstskipleft;
         for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
             if ((bitmask & 0xff) == 0) {
                 bitmask = 0x80;
-                bits = *src++;
+                bits = *(src_base + m(src++));
             }
             col = colors[!!(bits & bitmask)];
             PUTPIXEL();
@@ -178,12 +196,14 @@ glue(glue(glue(cirrus_colorexpand_, ROP_
 
 static void
 glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH)
-     (CirrusVGAState * s, uint8_t * dst,
-      const uint8_t * src, 
-      int dstpitch, int srcpitch, 
-      int bltwidth, int bltheight)
-{
-    uint8_t *d;
+     (CirrusVGAState * s, uint8_t * dst_,
+      const uint8_t * src_, 
+      int dstpitch, int srcpitch, 
+      int bltwidth, int bltheight)
+{
+    uint8_t *dst_base, *src_base;
+    uint32_t src, dst;
+    uint32_t d;
     int x, y, bitpos, pattern_y;
     unsigned int bits, bits_xor;
     unsigned int col;
@@ -195,6 +215,10 @@ glue(glue(glue(cirrus_colorexpand_patter
     int dstskipleft = srcskipleft * (DEPTH / 8);
 #endif
 
+    get_base(dst_, s, dst_base);
+    get_base(src_, s, src_base);
+    dst = dst_ - dst_base;
+    src = src_ - src_base;
     if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) {
         bits_xor = 0xff;
         col = s->cirrus_blt_bgcol;
@@ -205,7 +229,7 @@ glue(glue(glue(cirrus_colorexpand_patter
     pattern_y = s->cirrus_blt_srcaddr & 7;
 
     for(y = 0; y < bltheight; y++) {
-        bits = src[pattern_y] ^ bits_xor;
+        bits = *(src_base + m(src + pattern_y)) ^ bits_xor;
         bitpos = 7 - srcskipleft;
         d = dst + dstskipleft;
         for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
@@ -222,25 +246,31 @@ glue(glue(glue(cirrus_colorexpand_patter
 
 static void
 glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH)
-     (CirrusVGAState * s, uint8_t * dst,
-      const uint8_t * src, 
-      int dstpitch, int srcpitch, 
-      int bltwidth, int bltheight)
-{
+     (CirrusVGAState * s, uint8_t * dst_,
+      const uint8_t * src_, 
+      int dstpitch, int srcpitch, 
+      int bltwidth, int bltheight)
+{
+    uint8_t *dst_base, *src_base;
+    uint32_t src, dst;
     uint32_t colors[2];
-    uint8_t *d;
+    uint32_t d;
     int x, y, bitpos, pattern_y;
     unsigned int bits;
     unsigned int col;
     int srcskipleft = s->gr[0x2f] & 0x07;
     int dstskipleft = srcskipleft * (DEPTH / 8);
 
+    get_base(dst_, s, dst_base);
+    get_base(src_, s, src_base);
+    dst = dst_ - dst_base;
+    src = src_ - src_base;
     colors[0] = s->cirrus_blt_bgcol;
     colors[1] = s->cirrus_blt_fgcol;
     pattern_y = s->cirrus_blt_srcaddr & 7;
 
     for(y = 0; y < bltheight; y++) {
-        bits = src[pattern_y];
+        bits = *(src_base + m(src + pattern_y));
         bitpos = 7 - srcskipleft;
         d = dst + dstskipleft;
         for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
@@ -257,13 +287,17 @@ static void
 static void 
 glue(glue(glue(cirrus_fill_, ROP_NAME), _),DEPTH)
      (CirrusVGAState *s,
-      uint8_t *dst, int dst_pitch, 
+      uint8_t *dst_, int dst_pitch, 
       int width, int height)
 {
-    uint8_t *d, *d1;
+    uint8_t *dst_base;
+    uint32_t dst;
+    uint32_t d, d1;
     uint32_t col;
     int x, y;
 
+    get_base(dst_, s, dst_base);
+    dst = dst_ - dst_base;
     col = s->cirrus_blt_fgcol;
 
     d1 = dst;
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/ioemu/hw/dma.c
--- a/tools/ioemu/hw/dma.c      Tue Apr 24 09:26:32 2007 -0600
+++ b/tools/ioemu/hw/dma.c      Tue Apr 24 21:39:23 2007 +0100
@@ -340,6 +340,8 @@ static void channel_run (int ncont, int 
 #endif
 
     r = dma_controllers[ncont].regs + ichan;
+    if (r->transfer_handler == NULL)
+       return;
     n = r->transfer_handler (r->opaque, ichan + (ncont << 2),
                              r->now[COUNT], (r->base[COUNT] + 1) << ncont);
     r->now[COUNT] = n;
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/ioemu/hw/lsi53c895a.c
--- a/tools/ioemu/hw/lsi53c895a.c       Tue Apr 24 09:26:32 2007 -0600
+++ b/tools/ioemu/hw/lsi53c895a.c       Tue Apr 24 21:39:23 2007 +0100
@@ -1071,8 +1071,13 @@ static uint8_t lsi_reg_readb(LSIState *s
         shift = (offset & 3) * 8;
         return (s->scratch[n] >> shift) & 0xff;
     }
+#ifndef CONFIG_DM
     BADF("readb 0x%x\n", offset);
     exit(1);
+#else
+    /* XEN: This path can be triggered (e.g. ASPI8DOS.SYS reads 0x8). */
+    return 0;
+#endif
 #undef CASE_GET_REG32
 }
 
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/Makefile
--- a/tools/libxen/Makefile     Tue Apr 24 09:26:32 2007 -0600
+++ b/tools/libxen/Makefile     Tue Apr 24 21:39:23 2007 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, XenSource Inc.
+# Copyright (c) 2006-2007, XenSource Inc.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -18,20 +18,21 @@ XEN_ROOT=../..
 XEN_ROOT=../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-MAJOR = 0.1
-MINOR = 0
+MAJOR = 0.9
+MINOR = 1
 
 CFLAGS = -Iinclude                     \
-        $(shell xml2-config --cflags) \
+         $(shell xml2-config --cflags) \
          $(shell curl-config --cflags) \
          -W -Wall -Wmissing-prototypes -Werror -std=c99 -O2 -fPIC
 
 LDFLAGS = $(shell xml2-config --libs) \
           $(shell curl-config --libs)
 
-LIBXENAPI_HDRS = $(wildcard include/*.h)
+LIBXENAPI_HDRS = $(wildcard include/xen/api/*.h) include/xen/api/xen_all.h
 LIBXENAPI_OBJS = $(patsubst %.c, %.o, $(wildcard src/*.c))
 
+TEST_PROGRAMS = test/test_bindings test/test_event_handling
 
 .PHONY: all
 all: libxenapi.so libxenapi.a
@@ -48,13 +49,7 @@ libxenapi.a: $(LIBXENAPI_OBJS)
 libxenapi.a: $(LIBXENAPI_OBJS)
        $(AR) rcs libxenapi.a $^
 
-test/test_bindings: test/test_bindings.o libxenapi.so
-       $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi
-
-test/test_event_handling: test/test_event_handling.o libxenapi.so
-       $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi
-
-test/test_hvm_bindings: test/test_hvm_bindings.o libxenapi.so
+$(TEST_PROGRAMS): test/%: test/%.o libxenapi.so
        $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi
 
 
@@ -70,9 +65,10 @@ install: all
            $(INSTALL_DATA) $$i $(DESTDIR)/usr/include/xen/api; \
        done
 
+
 .PHONY: clean
 clean:
        rm -f `find -name *.o`
        rm -f libxenapi.so*
        rm -f libxenapi.a
-       rm -f test/test_bindings
+       rm -f $(TEST_PROGRAMS)
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/Makefile.dist
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/Makefile.dist        Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,115 @@
+#
+# Copyright (c) 2006-2007, XenSource Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+#
+
+MAJOR = 0.9
+MINOR = 1
+
+CFLAGS = -Iinclude                     \
+         $(shell xml2-config --cflags) \
+         $(shell curl-config --cflags) \
+         -W -Wall -Wmissing-prototypes -Werror -std=c99 -O2 -fPIC
+
+LDFLAGS = $(shell xml2-config --libs) \
+          $(shell curl-config --libs)
+
+# -h for Solaris
+SONAME_LDFLAG ?= -soname
+# -R /usr/sfw/$(LIBDIR) -shared for Solaris
+SHLIB_CFLAGS ?= -shared
+
+# ginstall for Solaris
+INSTALL      = install
+INSTALL_DIR  = $(INSTALL) -d -m0755 -p
+INSTALL_DATA = $(INSTALL) -m0644 -p
+
+LIBXENAPI_HDRS = $(wildcard include/*.h)
+LIBXENAPI_OBJS = $(patsubst %.c, %.o, $(wildcard src/*.c))
+
+TEST_PROGRAMS = test/test_bindings test/test_event_handling
+
+TARBALL_DEST = libxenapi-$(MAJOR).$(MINOR)
+
+.PHONY: all
+all: $(TEST_PROGRAMS)
+
+libxenapi.so: libxenapi.so.$(MAJOR)
+       ln -sf $< $@
+
+libxenapi.so.$(MAJOR): libxenapi.so.$(MAJOR).$(MINOR)
+       ln -sf $< $@
+
+libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS)
+       $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) 
-Wl,libxenapi.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
+
+libxenapi.a: $(LIBXENAPI_OBJS)
+       $(AR) rcs libxenapi.a $^
+
+$(TEST_PROGRAMS): test/%: test/%.o libxenapi.so
+       $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi
+
+
+.PHONY: install
+install: all
+       $(INSTALL_DIR) $(DESTDIR)/usr/include/xen/api
+       $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
+       $(INSTALL_PROG) libxenapi.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
+       ln -sf libxenapi.so.$(MAJOR).$(MINOR) 
$(DESTDIR)/usr/$(LIBDIR)/libxenapi.so.$(MAJOR)
+       ln -sf libxenapi.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenapi.so
+       $(INSTALL_DATA) libxenapi.a $(DESTDIR)/usr/$(LIBDIR)
+       for i in $(LIBXENAPI_HDRS); do \
+           $(INSTALL_DATA) $$i $(DESTDIR)/usr/include/xen/api; \
+       done
+
+
+.PHONY: tarball
+tarball: $(TARBALL_DEST).tar.bz2
+
+$(TARBALL_DEST).tar.bz2: all
+       rm -Rf $(TARBALL_DEST)
+       mkdir -p $(TARBALL_DEST)/include/xen/api
+       mkdir -p $(TARBALL_DEST)/src
+       mkdir -p $(TARBALL_DEST)/test
+       cp COPYING $(TARBALL_DEST)
+       cp Makefile.dist $(TARBALL_DEST)/Makefile
+       cp Makefile.dist $(TARBALL_DEST)/Makefile.dist
+       cp README $(TARBALL_DEST)
+       cp include/*.h $(TARBALL_DEST)/include
+       cp include/xen/api/*.h $(TARBALL_DEST)/include/xen/api
+       cp src/*.c $(TARBALL_DEST)/src
+       cp test/*.c $(TARBALL_DEST)/test
+       fakeroot chown root:root -R $(TARBALL_DEST)
+       fakeroot tar cjf $(TARBALL_DEST).tar.bz2 $(TARBALL_DEST)
+
+
+.PHONY: clean
+clean:
+       rm -f `find -name *.o`
+       rm -f libxenapi.so*
+       rm -f libxenapi.a
+       rm -f $(TEST_PROGRAMS)
+
+
+.PHONY: uberheader
+uberheader: include/xen/api/xen_all.h
+include/xen/api/xen_all.h::
+       echo "/* This file is autogenerated */" >$@
+       echo "#ifndef XEN_API_XEN_ALL_H" >>$@
+       echo "#define XEN_API_XEN_ALL_H" >>$@
+       ls include/xen/api/*.h | grep -v xen_all.h | grep -v _decl.h | \
+          sed 's,^include/\(.*\)$$,#include <\1>,g' >>$@
+       echo "#endif" >>$@
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_all.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_all.h    Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,39 @@
+/* This file is autogenerated */
+#ifndef XEN_API_XEN_ALL_H
+#define XEN_API_XEN_ALL_H
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_console.h>
+#include <xen/api/xen_console_protocol.h>
+#include <xen/api/xen_crashdump.h>
+#include <xen/api/xen_event.h>
+#include <xen/api/xen_event_operation.h>
+#include <xen/api/xen_host_cpu.h>
+#include <xen/api/xen_host.h>
+#include <xen/api/xen_host_metrics.h>
+#include <xen/api/xen_int_float_map.h>
+#include <xen/api/xen_int_int_map.h>
+#include <xen/api/xen_int_string_set_map.h>
+#include <xen/api/xen_network.h>
+#include <xen/api/xen_on_crash_behaviour.h>
+#include <xen/api/xen_on_normal_exit.h>
+#include <xen/api/xen_pbd.h>
+#include <xen/api/xen_pif.h>
+#include <xen/api/xen_pif_metrics.h>
+#include <xen/api/xen_sr.h>
+#include <xen/api/xen_string_set.h>
+#include <xen/api/xen_string_string_map.h>
+#include <xen/api/xen_user.h>
+#include <xen/api/xen_vbd.h>
+#include <xen/api/xen_vbd_metrics.h>
+#include <xen/api/xen_vbd_mode.h>
+#include <xen/api/xen_vbd_type.h>
+#include <xen/api/xen_vdi.h>
+#include <xen/api/xen_vdi_type.h>
+#include <xen/api/xen_vif.h>
+#include <xen/api/xen_vif_metrics.h>
+#include <xen/api/xen_vm_guest_metrics.h>
+#include <xen/api/xen_vm.h>
+#include <xen/api/xen_vm_metrics.h>
+#include <xen/api/xen_vm_power_state.h>
+#include <xen/api/xen_vtpm.h>
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_common.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_common.h Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2006 XenSource, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_COMMON_H
+#define XEN_COMMON_H
+
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <time.h>
+
+#include "xen/api/xen_host_decl.h"
+
+
+typedef bool (*xen_result_func)(const void *data, size_t len,
+                                void *result_handle);
+
+
+/**
+ * len does not include a terminating \0.
+ */
+typedef int (*xen_call_func)(const void *, size_t len, void *user_handle,
+                             void *result_handle,
+                             xen_result_func result_func);
+
+
+typedef struct
+{
+    xen_call_func call_func;
+    void *handle;
+    const char *session_id;
+    bool ok;
+    char **error_description;
+    int error_description_count;
+} xen_session;
+
+
+typedef struct xen_session_record
+{
+    char *uuid;
+    struct xen_host_record_opt *this_host;
+    char *this_user;
+    time_t last_active;
+} xen_session_record;
+
+
+/**
+ * Allocate a xen_session_record.
+ */
+extern xen_session_record *
+xen_session_record_alloc(void);
+
+
+/**
+ * Free the given xen_session_record, and all referenced values.  The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_session_record_free(xen_session_record *record);
+
+
+struct xen_task_;
+typedef struct xen_task_ * xen_task_id;
+
+
+typedef struct
+{
+    int progress;
+    long eta;
+    /* !!! RESULT */
+}  xen_task_status;
+
+
+typedef struct
+{
+    int major;
+    int minor;
+    int patch;
+    char *extraversion;
+} xen_version;
+
+
+/**
+ * Free the given xen_version, and all referenced values.
+ */
+extern void xen_version_free(xen_version *version);
+
+
+/**
+ * Return the version of this client-side library.  This will be the major,
+ * minor, and extraversion of the Xen release with which it was released,
+ * plus the library's own version as the patch.
+ */
+extern xen_version *xen_get_client_side_version();
+
+
+extern bool
+xen_uuid_string_to_bytes(char *uuid, char **bytes);
+
+
+extern bool
+xen_uuid_bytes_to_string(char *bytes, char **uuid);
+
+
+extern void
+xen_uuid_free(char *uuid);
+
+
+extern void
+xen_uuid_bytes_free(char *bytes);
+
+
+/**
+ * Initialise this library.  Call this before starting to use this library.
+ * Note that since this library depends upon libxml2, you should also call
+ * xmlInitParser as appropriate for your program.
+ */
+extern
+void xen_init(void);
+
+
+/**
+ * Clear up this library.  Call when you have finished using this library.
+ * Note that since this library depends upon libxml2, you should also call
+ * xmlCleanupParser as appropriate for your program.
+ */
+extern
+void xen_fini(void);
+
+
+/**
+ * Log in at the server, and allocate a xen_session to represent this session.
+ */
+extern xen_session *
+xen_session_login_with_password(xen_call_func call_func, void *handle,
+                                const char *uname, const char *pwd);
+
+
+/**
+ * Log out at the server, and free the xen_session.
+ */
+extern void
+xen_session_logout(xen_session *session);
+
+
+/**
+ * Clear any error condition recorded on this session.
+ */
+void
+xen_session_clear_error(xen_session *session);
+
+
+/**
+ * Get the UUID of the second given session.  Set *result to point at a
+ * string, yours to free.
+ */
+extern bool
+xen_session_get_uuid(xen_session *session, char **result,
+                     xen_session *self_session);
+
+
+/**
+ * Get the this_host field of the second given session.  Set *result to be a
+ * handle to that host.
+ */
+extern bool
+xen_session_get_this_host(xen_session *session, xen_host *result,
+                          xen_session *self_session);
+
+
+/**
+ * Get the this_user field of the second given session.  Set *result to point
+ * at a string, yours to free.
+ */
+extern bool
+xen_session_get_this_user(xen_session *session, char **result,
+                          xen_session *self_session);
+
+
+/**
+ * Get the last_active field of the given session, and place it in *result.
+ */
+extern bool
+xen_session_get_last_active(xen_session *session, time_t *result,
+                            xen_session *self_session);
+
+/**
+ * Get a record containing the current state of the second given session.
+ */
+extern bool
+xen_session_get_record(xen_session *session, xen_session_record **result,
+                       xen_session *self_session);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_console.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_console.h        Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_CONSOLE_H
+#define XEN_CONSOLE_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_console_decl.h>
+#include <xen/api/xen_console_protocol.h>
+#include <xen/api/xen_string_string_map.h>
+#include <xen/api/xen_vm_decl.h>
+
+
+/*
+ * The console class.
+ * 
+ * A console.
+ */
+
+
+/**
+ * Free the given xen_console.  The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_console_free(xen_console console);
+
+
+typedef struct xen_console_set
+{
+    size_t size;
+    xen_console *contents[];
+} xen_console_set;
+
+/**
+ * Allocate a xen_console_set of the given size.
+ */
+extern xen_console_set *
+xen_console_set_alloc(size_t size);
+
+/**
+ * Free the given xen_console_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_console_set_free(xen_console_set *set);
+
+
+typedef struct xen_console_record
+{
+    xen_console handle;
+    char *uuid;
+    enum xen_console_protocol protocol;
+    char *location;
+    struct xen_vm_record_opt *vm;
+    xen_string_string_map *other_config;
+} xen_console_record;
+
+/**
+ * Allocate a xen_console_record.
+ */
+extern xen_console_record *
+xen_console_record_alloc(void);
+
+/**
+ * Free the given xen_console_record, and all referenced values.  The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_console_record_free(xen_console_record *record);
+
+
+typedef struct xen_console_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_console handle;
+        xen_console_record *record;
+    } u;
+} xen_console_record_opt;
+
+/**
+ * Allocate a xen_console_record_opt.
+ */
+extern xen_console_record_opt *
+xen_console_record_opt_alloc(void);
+
+/**
+ * Free the given xen_console_record_opt, and all referenced values. 
+ * The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_console_record_opt_free(xen_console_record_opt *record_opt);
+
+
+typedef struct xen_console_record_set
+{
+    size_t size;
+    xen_console_record *contents[];
+} xen_console_record_set;
+
+/**
+ * Allocate a xen_console_record_set of the given size.
+ */
+extern xen_console_record_set *
+xen_console_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_console_record_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_console_record_set_free(xen_console_record_set *set);
+
+
+
+typedef struct xen_console_record_opt_set
+{
+    size_t size;
+    xen_console_record_opt *contents[];
+} xen_console_record_opt_set;
+
+/**
+ * Allocate a xen_console_record_opt_set of the given size.
+ */
+extern xen_console_record_opt_set *
+xen_console_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_console_record_opt_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_console_record_opt_set_free(xen_console_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given console.
+ */
+extern bool
+xen_console_get_record(xen_session *session, xen_console_record **result, 
xen_console console);
+
+
+/**
+ * Get a reference to the console instance with the specified UUID.
+ */
+extern bool
+xen_console_get_by_uuid(xen_session *session, xen_console *result, char *uuid);
+
+
+/**
+ * Create a new console instance, and return its handle.
+ */
+extern bool
+xen_console_create(xen_session *session, xen_console *result, 
xen_console_record *record);
+
+
+/**
+ * Destroy the specified console instance.
+ */
+extern bool
+xen_console_destroy(xen_session *session, xen_console console);
+
+
+/**
+ * Get the uuid field of the given console.
+ */
+extern bool
+xen_console_get_uuid(xen_session *session, char **result, xen_console console);
+
+
+/**
+ * Get the protocol field of the given console.
+ */
+extern bool
+xen_console_get_protocol(xen_session *session, enum xen_console_protocol 
*result, xen_console console);
+
+
+/**
+ * Get the location field of the given console.
+ */
+extern bool
+xen_console_get_location(xen_session *session, char **result, xen_console 
console);
+
+
+/**
+ * Get the VM field of the given console.
+ */
+extern bool
+xen_console_get_vm(xen_session *session, xen_vm *result, xen_console console);
+
+
+/**
+ * Get the other_config field of the given console.
+ */
+extern bool
+xen_console_get_other_config(xen_session *session, xen_string_string_map 
**result, xen_console console);
+
+
+/**
+ * Set the other_config field of the given console.
+ */
+extern bool
+xen_console_set_other_config(xen_session *session, xen_console console, 
xen_string_string_map *other_config);
+
+
+/**
+ * Add the given key-value pair to the other_config field of the given
+ * console.
+ */
+extern bool
+xen_console_add_to_other_config(xen_session *session, xen_console console, 
char *key, char *value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * other_config field of the given console.  If the key is not in that Map,
+ * then do nothing.
+ */
+extern bool
+xen_console_remove_from_other_config(xen_session *session, xen_console 
console, char *key);
+
+
+/**
+ * Return a list of all the consoles known to the system.
+ */
+extern bool
+xen_console_get_all(xen_session *session, struct xen_console_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_console_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_console_decl.h   Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_CONSOLE_DECL_H
+#define XEN_CONSOLE_DECL_H
+
+typedef void *xen_console;
+
+struct xen_console_set;
+struct xen_console_record;
+struct xen_console_record_set;
+struct xen_console_record_opt;
+struct xen_console_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_console_protocol.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_console_protocol.h       Tue Apr 24 
21:39:23 2007 +0100
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_CONSOLE_PROTOCOL_H
+#define XEN_CONSOLE_PROTOCOL_H
+
+
+#include <xen/api/xen_common.h>
+
+
+enum xen_console_protocol
+{
+    /**
+     * VT100 terminal
+     */
+    XEN_CONSOLE_PROTOCOL_VT100,
+
+    /**
+     * Remote FrameBuffer protocol (as used in VNC)
+     */
+    XEN_CONSOLE_PROTOCOL_RFB,
+
+    /**
+     * Remote Desktop Protocol
+     */
+    XEN_CONSOLE_PROTOCOL_RDP
+};
+
+
+typedef struct xen_console_protocol_set
+{
+    size_t size;
+    enum xen_console_protocol contents[];
+} xen_console_protocol_set;
+
+/**
+ * Allocate a xen_console_protocol_set of the given size.
+ */
+extern xen_console_protocol_set *
+xen_console_protocol_set_alloc(size_t size);
+
+/**
+ * Free the given xen_console_protocol_set.  The given set must have
+ * been allocated by this library.
+ */
+extern void
+xen_console_protocol_set_free(xen_console_protocol_set *set);
+
+
+/**
+ * Return the name corresponding to the given code.  This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_console_protocol_to_string(enum xen_console_protocol val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_console_protocol
+xen_console_protocol_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_crashdump.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_crashdump.h      Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_CRASHDUMP_H
+#define XEN_CRASHDUMP_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_crashdump_decl.h>
+#include <xen/api/xen_vdi_decl.h>
+#include <xen/api/xen_vm_decl.h>
+
+
+/*
+ * The crashdump class.
+ * 
+ * A VM crashdump.
+ */
+
+
+/**
+ * Free the given xen_crashdump.  The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_crashdump_free(xen_crashdump crashdump);
+
+
+typedef struct xen_crashdump_set
+{
+    size_t size;
+    xen_crashdump *contents[];
+} xen_crashdump_set;
+
+/**
+ * Allocate a xen_crashdump_set of the given size.
+ */
+extern xen_crashdump_set *
+xen_crashdump_set_alloc(size_t size);
+
+/**
+ * Free the given xen_crashdump_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_crashdump_set_free(xen_crashdump_set *set);
+
+
+typedef struct xen_crashdump_record
+{
+    xen_crashdump handle;
+    char *uuid;
+    struct xen_vm_record_opt *vm;
+    struct xen_vdi_record_opt *vdi;
+} xen_crashdump_record;
+
+/**
+ * Allocate a xen_crashdump_record.
+ */
+extern xen_crashdump_record *
+xen_crashdump_record_alloc(void);
+
+/**
+ * Free the given xen_crashdump_record, and all referenced values.  The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_crashdump_record_free(xen_crashdump_record *record);
+
+
+typedef struct xen_crashdump_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_crashdump handle;
+        xen_crashdump_record *record;
+    } u;
+} xen_crashdump_record_opt;
+
+/**
+ * Allocate a xen_crashdump_record_opt.
+ */
+extern xen_crashdump_record_opt *
+xen_crashdump_record_opt_alloc(void);
+
+/**
+ * Free the given xen_crashdump_record_opt, and all referenced values. 
+ * The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_crashdump_record_opt_free(xen_crashdump_record_opt *record_opt);
+
+
+typedef struct xen_crashdump_record_set
+{
+    size_t size;
+    xen_crashdump_record *contents[];
+} xen_crashdump_record_set;
+
+/**
+ * Allocate a xen_crashdump_record_set of the given size.
+ */
+extern xen_crashdump_record_set *
+xen_crashdump_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_crashdump_record_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_crashdump_record_set_free(xen_crashdump_record_set *set);
+
+
+
+typedef struct xen_crashdump_record_opt_set
+{
+    size_t size;
+    xen_crashdump_record_opt *contents[];
+} xen_crashdump_record_opt_set;
+
+/**
+ * Allocate a xen_crashdump_record_opt_set of the given size.
+ */
+extern xen_crashdump_record_opt_set *
+xen_crashdump_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_crashdump_record_opt_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_crashdump_record_opt_set_free(xen_crashdump_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given crashdump.
+ */
+extern bool
+xen_crashdump_get_record(xen_session *session, xen_crashdump_record **result, 
xen_crashdump crashdump);
+
+
+/**
+ * Get a reference to the crashdump instance with the specified UUID.
+ */
+extern bool
+xen_crashdump_get_by_uuid(xen_session *session, xen_crashdump *result, char 
*uuid);
+
+
+/**
+ * Get the uuid field of the given crashdump.
+ */
+extern bool
+xen_crashdump_get_uuid(xen_session *session, char **result, xen_crashdump 
crashdump);
+
+
+/**
+ * Get the VM field of the given crashdump.
+ */
+extern bool
+xen_crashdump_get_vm(xen_session *session, xen_vm *result, xen_crashdump 
crashdump);
+
+
+/**
+ * Get the VDI field of the given crashdump.
+ */
+extern bool
+xen_crashdump_get_vdi(xen_session *session, xen_vdi *result, xen_crashdump 
crashdump);
+
+
+/**
+ * Destroy the specified crashdump.
+ */
+extern bool
+xen_crashdump_destroy(xen_session *session, xen_crashdump self);
+
+
+/**
+ * Return a list of all the crashdumps known to the system.
+ */
+extern bool
+xen_crashdump_get_all(xen_session *session, struct xen_crashdump_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_crashdump_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_crashdump_decl.h Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_CRASHDUMP_DECL_H
+#define XEN_CRASHDUMP_DECL_H
+
+typedef void *xen_crashdump;
+
+struct xen_crashdump_set;
+struct xen_crashdump_record;
+struct xen_crashdump_record_set;
+struct xen_crashdump_record_opt;
+struct xen_crashdump_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_event.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_event.h  Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_EVENT_H
+#define XEN_EVENT_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_event_decl.h>
+#include <xen/api/xen_event_operation.h>
+#include <xen/api/xen_string_set.h>
+
+
+/*
+ * The event class.
+ * 
+ * Asynchronous event registration and handling.
+ */
+
+
+
+typedef struct xen_event_record
+{
+    int64_t id;
+    time_t timestamp;
+    char *class;
+    enum xen_event_operation operation;
+    char *ref;
+    char *obj_uuid;
+} xen_event_record;
+
+/**
+ * Allocate a xen_event_record.
+ */
+extern xen_event_record *
+xen_event_record_alloc(void);
+
+/**
+ * Free the given xen_event_record, and all referenced values.  The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_event_record_free(xen_event_record *record);
+
+
+typedef struct xen_event_record_set
+{
+    size_t size;
+    xen_event_record *contents[];
+} xen_event_record_set;
+
+/**
+ * Allocate a xen_event_record_set of the given size.
+ */
+extern xen_event_record_set *
+xen_event_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_event_record_set, and all referenced values.  The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_event_record_set_free(xen_event_record_set *set);
+
+
+/**
+ * Registers this session with the event system.  Specifying the empty
+ * list will register for all classes.
+ */
+extern bool
+xen_event_register(xen_session *session, struct xen_string_set *classes);
+
+
+/**
+ * Unregisters this session with the event system.
+ */
+extern bool
+xen_event_unregister(xen_session *session, struct xen_string_set *classes);
+
+
+/**
+ * Blocking call which returns a (possibly empty) batch of events.
+ */
+extern bool
+xen_event_next(xen_session *session, struct xen_event_record_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_event_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_event_decl.h     Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_EVENT_DECL_H
+#define XEN_EVENT_DECL_H
+
+struct xen_event_record;
+struct xen_event_record_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_event_operation.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_event_operation.h        Tue Apr 24 
21:39:23 2007 +0100
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_EVENT_OPERATION_H
+#define XEN_EVENT_OPERATION_H
+
+
+#include <xen/api/xen_common.h>
+
+
+enum xen_event_operation
+{
+    /**
+     * An object has been created
+     */
+    XEN_EVENT_OPERATION_ADD,
+
+    /**
+     * An object has been deleted
+     */
+    XEN_EVENT_OPERATION_DEL,
+
+    /**
+     * An object has been modified
+     */
+    XEN_EVENT_OPERATION_MOD
+};
+
+
+typedef struct xen_event_operation_set
+{
+    size_t size;
+    enum xen_event_operation contents[];
+} xen_event_operation_set;
+
+/**
+ * Allocate a xen_event_operation_set of the given size.
+ */
+extern xen_event_operation_set *
+xen_event_operation_set_alloc(size_t size);
+
+/**
+ * Free the given xen_event_operation_set.  The given set must have
+ * been allocated by this library.
+ */
+extern void
+xen_event_operation_set_free(xen_event_operation_set *set);
+
+
+/**
+ * Return the name corresponding to the given code.  This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_event_operation_to_string(enum xen_event_operation val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_event_operation
+xen_event_operation_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_host.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_host.h   Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,497 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_HOST_H
+#define XEN_HOST_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_host_cpu_decl.h>
+#include <xen/api/xen_host_decl.h>
+#include <xen/api/xen_host_metrics_decl.h>
+#include <xen/api/xen_pbd_decl.h>
+#include <xen/api/xen_pif_decl.h>
+#include <xen/api/xen_sr_decl.h>
+#include <xen/api/xen_string_set.h>
+#include <xen/api/xen_string_string_map.h>
+#include <xen/api/xen_vm_decl.h>
+
+
+/*
+ * The host class.
+ * 
+ * A physical host.
+ */
+
+
+/**
+ * Free the given xen_host.  The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_host_free(xen_host host);
+
+
+typedef struct xen_host_set
+{
+    size_t size;
+    xen_host *contents[];
+} xen_host_set;
+
+/**
+ * Allocate a xen_host_set of the given size.
+ */
+extern xen_host_set *
+xen_host_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_set.  The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_host_set_free(xen_host_set *set);
+
+
+typedef struct xen_host_record
+{
+    xen_host handle;
+    char *uuid;
+    char *name_label;
+    char *name_description;
+    int64_t api_version_major;
+    int64_t api_version_minor;
+    char *api_version_vendor;
+    xen_string_string_map *api_version_vendor_implementation;
+    bool enabled;
+    xen_string_string_map *software_version;
+    xen_string_string_map *other_config;
+    struct xen_string_set *capabilities;
+    xen_string_string_map *cpu_configuration;
+    char *sched_policy;
+    struct xen_string_set *supported_bootloaders;
+    struct xen_vm_record_opt_set *resident_vms;
+    xen_string_string_map *logging;
+    struct xen_pif_record_opt_set *pifs;
+    struct xen_sr_record_opt *suspend_image_sr;
+    struct xen_sr_record_opt *crash_dump_sr;
+    struct xen_pbd_record_opt_set *pbds;
+    struct xen_host_cpu_record_opt_set *host_cpus;
+    struct xen_host_metrics_record_opt *metrics;
+} xen_host_record;
+
+/**
+ * Allocate a xen_host_record.
+ */
+extern xen_host_record *
+xen_host_record_alloc(void);
+
+/**
+ * Free the given xen_host_record, and all referenced values.  The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_host_record_free(xen_host_record *record);
+
+
+typedef struct xen_host_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_host handle;
+        xen_host_record *record;
+    } u;
+} xen_host_record_opt;
+
+/**
+ * Allocate a xen_host_record_opt.
+ */
+extern xen_host_record_opt *
+xen_host_record_opt_alloc(void);
+
+/**
+ * Free the given xen_host_record_opt, and all referenced values.  The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_host_record_opt_free(xen_host_record_opt *record_opt);
+
+
+typedef struct xen_host_record_set
+{
+    size_t size;
+    xen_host_record *contents[];
+} xen_host_record_set;
+
+/**
+ * Allocate a xen_host_record_set of the given size.
+ */
+extern xen_host_record_set *
+xen_host_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_record_set, and all referenced values.  The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_host_record_set_free(xen_host_record_set *set);
+
+
+
+typedef struct xen_host_record_opt_set
+{
+    size_t size;
+    xen_host_record_opt *contents[];
+} xen_host_record_opt_set;
+
+/**
+ * Allocate a xen_host_record_opt_set of the given size.
+ */
+extern xen_host_record_opt_set *
+xen_host_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_record_opt_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_host_record_opt_set_free(xen_host_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given host.
+ */
+extern bool
+xen_host_get_record(xen_session *session, xen_host_record **result, xen_host 
host);
+
+
+/**
+ * Get a reference to the host instance with the specified UUID.
+ */
+extern bool
+xen_host_get_by_uuid(xen_session *session, xen_host *result, char *uuid);
+
+
+/**
+ * Get all the host instances with the given label.
+ */
+extern bool
+xen_host_get_by_name_label(xen_session *session, struct xen_host_set **result, 
char *label);
+
+
+/**
+ * Get the uuid field of the given host.
+ */
+extern bool
+xen_host_get_uuid(xen_session *session, char **result, xen_host host);
+
+
+/**
+ * Get the name/label field of the given host.
+ */
+extern bool
+xen_host_get_name_label(xen_session *session, char **result, xen_host host);
+
+
+/**
+ * Get the name/description field of the given host.
+ */
+extern bool
+xen_host_get_name_description(xen_session *session, char **result, xen_host 
host);
+
+
+/**
+ * Get the API_version/major field of the given host.
+ */
+extern bool
+xen_host_get_api_version_major(xen_session *session, int64_t *result, xen_host 
host);
+
+
+/**
+ * Get the API_version/minor field of the given host.
+ */
+extern bool
+xen_host_get_api_version_minor(xen_session *session, int64_t *result, xen_host 
host);
+
+
+/**
+ * Get the API_version/vendor field of the given host.
+ */
+extern bool
+xen_host_get_api_version_vendor(xen_session *session, char **result, xen_host 
host);
+
+
+/**
+ * Get the API_version/vendor_implementation field of the given host.
+ */
+extern bool
+xen_host_get_api_version_vendor_implementation(xen_session *session, 
xen_string_string_map **result, xen_host host);
+
+
+/**
+ * Get the enabled field of the given host.
+ */
+extern bool
+xen_host_get_enabled(xen_session *session, bool *result, xen_host host);
+
+
+/**
+ * Get the software_version field of the given host.
+ */
+extern bool
+xen_host_get_software_version(xen_session *session, xen_string_string_map 
**result, xen_host host);
+
+
+/**
+ * Get the other_config field of the given host.
+ */
+extern bool
+xen_host_get_other_config(xen_session *session, xen_string_string_map 
**result, xen_host host);
+
+
+/**
+ * Get the capabilities field of the given host.
+ */
+extern bool
+xen_host_get_capabilities(xen_session *session, struct xen_string_set 
**result, xen_host host);
+
+
+/**
+ * Get the cpu_configuration field of the given host.
+ */
+extern bool
+xen_host_get_cpu_configuration(xen_session *session, xen_string_string_map 
**result, xen_host host);
+
+
+/**
+ * Get the sched_policy field of the given host.
+ */
+extern bool
+xen_host_get_sched_policy(xen_session *session, char **result, xen_host host);
+
+
+/**
+ * Get the supported_bootloaders field of the given host.
+ */
+extern bool
+xen_host_get_supported_bootloaders(xen_session *session, struct xen_string_set 
**result, xen_host host);
+
+
+/**
+ * Get the resident_VMs field of the given host.
+ */
+extern bool
+xen_host_get_resident_vms(xen_session *session, struct xen_vm_set **result, 
xen_host host);
+
+
+/**
+ * Get the logging field of the given host.
+ */
+extern bool
+xen_host_get_logging(xen_session *session, xen_string_string_map **result, 
xen_host host);
+
+
+/**
+ * Get the PIFs field of the given host.
+ */
+extern bool
+xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host 
host);
+
+
+/**
+ * Get the suspend_image_sr field of the given host.
+ */
+extern bool
+xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host 
host);
+
+
+/**
+ * Get the crash_dump_sr field of the given host.
+ */
+extern bool
+xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host 
host);
+
+
+/**
+ * Get the PBDs field of the given host.
+ */
+extern bool
+xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host 
host);
+
+
+/**
+ * Get the host_CPUs field of the given host.
+ */
+extern bool
+xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result, 
xen_host host);
+
+
+/**
+ * Get the metrics field of the given host.
+ */
+extern bool
+xen_host_get_metrics(xen_session *session, xen_host_metrics *result, xen_host 
host);
+
+
+/**
+ * Set the name/label field of the given host.
+ */
+extern bool
+xen_host_set_name_label(xen_session *session, xen_host host, char *label);
+
+
+/**
+ * Set the name/description field of the given host.
+ */
+extern bool
+xen_host_set_name_description(xen_session *session, xen_host host, char 
*description);
+
+
+/**
+ * Set the other_config field of the given host.
+ */
+extern bool
+xen_host_set_other_config(xen_session *session, xen_host host, 
xen_string_string_map *other_config);
+
+
+/**
+ * Add the given key-value pair to the other_config field of the given
+ * host.
+ */
+extern bool
+xen_host_add_to_other_config(xen_session *session, xen_host host, char *key, 
char *value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * other_config field of the given host.  If the key is not in that Map, then
+ * do nothing.
+ */
+extern bool
+xen_host_remove_from_other_config(xen_session *session, xen_host host, char 
*key);
+
+
+/**
+ * Set the logging field of the given host.
+ */
+extern bool
+xen_host_set_logging(xen_session *session, xen_host host, 
xen_string_string_map *logging);
+
+
+/**
+ * Add the given key-value pair to the logging field of the given host.
+ */
+extern bool
+xen_host_add_to_logging(xen_session *session, xen_host host, char *key, char 
*value);
+
+
+/**
+ * Remove the given key and its corresponding value from the logging
+ * field of the given host.  If the key is not in that Map, then do nothing.
+ */
+extern bool
+xen_host_remove_from_logging(xen_session *session, xen_host host, char *key);
+
+
+/**
+ * Set the suspend_image_sr field of the given host.
+ */
+extern bool
+xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr 
suspend_image_sr);
+
+
+/**
+ * Set the crash_dump_sr field of the given host.
+ */
+extern bool
+xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr 
crash_dump_sr);
+
+
+/**
+ * Puts the host into a state in which no new VMs can be started.
+ * Currently active VMs on the host continue to execute.
+ */
+extern bool
+xen_host_disable(xen_session *session, xen_host host);
+
+
+/**
+ * Puts the host into a state in which new VMs can be started.
+ */
+extern bool
+xen_host_enable(xen_session *session, xen_host host);
+
+
+/**
+ * Shutdown the host. (This function can only be called if there are no
+ * currently running VMs on the host and it is disabled.).
+ */
+extern bool
+xen_host_shutdown(xen_session *session, xen_host host);
+
+
+/**
+ * Reboot the host. (This function can only be called if there are no
+ * currently running VMs on the host and it is disabled.).
+ */
+extern bool
+xen_host_reboot(xen_session *session, xen_host host);
+
+
+/**
+ * Get the host xen dmesg.
+ */
+extern bool
+xen_host_dmesg(xen_session *session, char **result, xen_host host);
+
+
+/**
+ * Get the host xen dmesg, and clear the buffer.
+ */
+extern bool
+xen_host_dmesg_clear(xen_session *session, char **result, xen_host host);
+
+
+/**
+ * Get the host's log file.
+ */
+extern bool
+xen_host_get_log(xen_session *session, char **result, xen_host host);
+
+
+/**
+ * Inject the given string as debugging keys into Xen.
+ */
+extern bool
+xen_host_send_debug_keys(xen_session *session, xen_host host, char *keys);
+
+
+/**
+ * List all supported methods.
+ */
+extern bool
+xen_host_list_methods(xen_session *session, struct xen_string_set **result);
+
+
+/**
+ * Return a list of all the hosts known to the system.
+ */
+extern bool
+xen_host_get_all(xen_session *session, struct xen_host_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_host_cpu.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_host_cpu.h       Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_HOST_CPU_H
+#define XEN_HOST_CPU_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_host_cpu_decl.h>
+#include <xen/api/xen_host_decl.h>
+
+
+/*
+ * The host_cpu class.
+ * 
+ * A physical CPU.
+ */
+
+
+/**
+ * Free the given xen_host_cpu.  The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_host_cpu_free(xen_host_cpu host_cpu);
+
+
+typedef struct xen_host_cpu_set
+{
+    size_t size;
+    xen_host_cpu *contents[];
+} xen_host_cpu_set;
+
+/**
+ * Allocate a xen_host_cpu_set of the given size.
+ */
+extern xen_host_cpu_set *
+xen_host_cpu_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_cpu_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_host_cpu_set_free(xen_host_cpu_set *set);
+
+
+typedef struct xen_host_cpu_record
+{
+    xen_host_cpu handle;
+    char *uuid;
+    struct xen_host_record_opt *host;
+    int64_t number;
+    char *vendor;
+    int64_t speed;
+    char *modelname;
+    char *stepping;
+    char *flags;
+    char *features;
+    double utilisation;
+} xen_host_cpu_record;
+
+/**
+ * Allocate a xen_host_cpu_record.
+ */
+extern xen_host_cpu_record *
+xen_host_cpu_record_alloc(void);
+
+/**
+ * Free the given xen_host_cpu_record, and all referenced values.  The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_host_cpu_record_free(xen_host_cpu_record *record);
+
+
+typedef struct xen_host_cpu_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_host_cpu handle;
+        xen_host_cpu_record *record;
+    } u;
+} xen_host_cpu_record_opt;
+
+/**
+ * Allocate a xen_host_cpu_record_opt.
+ */
+extern xen_host_cpu_record_opt *
+xen_host_cpu_record_opt_alloc(void);
+
+/**
+ * Free the given xen_host_cpu_record_opt, and all referenced values. 
+ * The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_host_cpu_record_opt_free(xen_host_cpu_record_opt *record_opt);
+
+
+typedef struct xen_host_cpu_record_set
+{
+    size_t size;
+    xen_host_cpu_record *contents[];
+} xen_host_cpu_record_set;
+
+/**
+ * Allocate a xen_host_cpu_record_set of the given size.
+ */
+extern xen_host_cpu_record_set *
+xen_host_cpu_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_cpu_record_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_host_cpu_record_set_free(xen_host_cpu_record_set *set);
+
+
+
+typedef struct xen_host_cpu_record_opt_set
+{
+    size_t size;
+    xen_host_cpu_record_opt *contents[];
+} xen_host_cpu_record_opt_set;
+
+/**
+ * Allocate a xen_host_cpu_record_opt_set of the given size.
+ */
+extern xen_host_cpu_record_opt_set *
+xen_host_cpu_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_cpu_record_opt_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_host_cpu_record_opt_set_free(xen_host_cpu_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_record(xen_session *session, xen_host_cpu_record **result, 
xen_host_cpu host_cpu);
+
+
+/**
+ * Get a reference to the host_cpu instance with the specified UUID.
+ */
+extern bool
+xen_host_cpu_get_by_uuid(xen_session *session, xen_host_cpu *result, char 
*uuid);
+
+
+/**
+ * Get the uuid field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_uuid(xen_session *session, char **result, xen_host_cpu 
host_cpu);
+
+
+/**
+ * Get the host field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu 
host_cpu);
+
+
+/**
+ * Get the number field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_number(xen_session *session, int64_t *result, xen_host_cpu 
host_cpu);
+
+
+/**
+ * Get the vendor field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_vendor(xen_session *session, char **result, xen_host_cpu 
host_cpu);
+
+
+/**
+ * Get the speed field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_speed(xen_session *session, int64_t *result, xen_host_cpu 
host_cpu);
+
+
+/**
+ * Get the modelname field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu 
host_cpu);
+
+
+/**
+ * Get the stepping field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_stepping(xen_session *session, char **result, xen_host_cpu 
host_cpu);
+
+
+/**
+ * Get the flags field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_flags(xen_session *session, char **result, xen_host_cpu 
host_cpu);
+
+
+/**
+ * Get the features field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_features(xen_session *session, char **result, xen_host_cpu 
host_cpu);
+
+
+/**
+ * Get the utilisation field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_utilisation(xen_session *session, double *result, 
xen_host_cpu host_cpu);
+
+
+/**
+ * Return a list of all the host_cpus known to the system.
+ */
+extern bool
+xen_host_cpu_get_all(xen_session *session, struct xen_host_cpu_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_host_cpu_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_host_cpu_decl.h  Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_HOST_CPU_DECL_H
+#define XEN_HOST_CPU_DECL_H
+
+typedef void *xen_host_cpu;
+
+struct xen_host_cpu_set;
+struct xen_host_cpu_record;
+struct xen_host_cpu_record_set;
+struct xen_host_cpu_record_opt;
+struct xen_host_cpu_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_host_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_host_decl.h      Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_HOST_DECL_H
+#define XEN_HOST_DECL_H
+
+typedef void *xen_host;
+
+struct xen_host_set;
+struct xen_host_record;
+struct xen_host_record_set;
+struct xen_host_record_opt;
+struct xen_host_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_host_metrics.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_host_metrics.h   Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_HOST_METRICS_H
+#define XEN_HOST_METRICS_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_host_metrics_decl.h>
+
+
+/*
+ * The host_metrics class.
+ * 
+ * The metrics associated with a host.
+ */
+
+
+/**
+ * Free the given xen_host_metrics.  The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_host_metrics_free(xen_host_metrics host_metrics);
+
+
+typedef struct xen_host_metrics_set
+{
+    size_t size;
+    xen_host_metrics *contents[];
+} xen_host_metrics_set;
+
+/**
+ * Allocate a xen_host_metrics_set of the given size.
+ */
+extern xen_host_metrics_set *
+xen_host_metrics_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_metrics_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_host_metrics_set_free(xen_host_metrics_set *set);
+
+
+typedef struct xen_host_metrics_record
+{
+    xen_host_metrics handle;
+    char *uuid;
+    int64_t memory_total;
+    int64_t memory_free;
+    time_t last_updated;
+} xen_host_metrics_record;
+
+/**
+ * Allocate a xen_host_metrics_record.
+ */
+extern xen_host_metrics_record *
+xen_host_metrics_record_alloc(void);
+
+/**
+ * Free the given xen_host_metrics_record, and all referenced values. 
+ * The given record must have been allocated by this library.
+ */
+extern void
+xen_host_metrics_record_free(xen_host_metrics_record *record);
+
+
+typedef struct xen_host_metrics_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_host_metrics handle;
+        xen_host_metrics_record *record;
+    } u;
+} xen_host_metrics_record_opt;
+
+/**
+ * Allocate a xen_host_metrics_record_opt.
+ */
+extern xen_host_metrics_record_opt *
+xen_host_metrics_record_opt_alloc(void);
+
+/**
+ * Free the given xen_host_metrics_record_opt, and all referenced
+ * values.  The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_host_metrics_record_opt_free(xen_host_metrics_record_opt *record_opt);
+
+
+typedef struct xen_host_metrics_record_set
+{
+    size_t size;
+    xen_host_metrics_record *contents[];
+} xen_host_metrics_record_set;
+
+/**
+ * Allocate a xen_host_metrics_record_set of the given size.
+ */
+extern xen_host_metrics_record_set *
+xen_host_metrics_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_metrics_record_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_host_metrics_record_set_free(xen_host_metrics_record_set *set);
+
+
+
+typedef struct xen_host_metrics_record_opt_set
+{
+    size_t size;
+    xen_host_metrics_record_opt *contents[];
+} xen_host_metrics_record_opt_set;
+
+/**
+ * Allocate a xen_host_metrics_record_opt_set of the given size.
+ */
+extern xen_host_metrics_record_opt_set *
+xen_host_metrics_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_metrics_record_opt_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_host_metrics_record_opt_set_free(xen_host_metrics_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given host_metrics.
+ */
+extern bool
+xen_host_metrics_get_record(xen_session *session, xen_host_metrics_record 
**result, xen_host_metrics host_metrics);
+
+
+/**
+ * Get a reference to the host_metrics instance with the specified
+ * UUID.
+ */
+extern bool
+xen_host_metrics_get_by_uuid(xen_session *session, xen_host_metrics *result, 
char *uuid);
+
+
+/**
+ * Get the uuid field of the given host_metrics.
+ */
+extern bool
+xen_host_metrics_get_uuid(xen_session *session, char **result, 
xen_host_metrics host_metrics);
+
+
+/**
+ * Get the memory/total field of the given host_metrics.
+ */
+extern bool
+xen_host_metrics_get_memory_total(xen_session *session, int64_t *result, 
xen_host_metrics host_metrics);
+
+
+/**
+ * Get the memory/free field of the given host_metrics.
+ */
+extern bool
+xen_host_metrics_get_memory_free(xen_session *session, int64_t *result, 
xen_host_metrics host_metrics);
+
+
+/**
+ * Get the last_updated field of the given host_metrics.
+ */
+extern bool
+xen_host_metrics_get_last_updated(xen_session *session, time_t *result, 
xen_host_metrics host_metrics);
+
+
+/**
+ * Return a list of all the host_metrics instances known to the system.
+ */
+extern bool
+xen_host_metrics_get_all(xen_session *session, struct xen_host_metrics_set 
**result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_host_metrics_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_host_metrics_decl.h      Tue Apr 24 
21:39:23 2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_HOST_METRICS_DECL_H
+#define XEN_HOST_METRICS_DECL_H
+
+typedef void *xen_host_metrics;
+
+struct xen_host_metrics_set;
+struct xen_host_metrics_record;
+struct xen_host_metrics_record_set;
+struct xen_host_metrics_record_opt;
+struct xen_host_metrics_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_int_float_map.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_int_float_map.h  Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_INT_FLOAT_MAP_H
+#define XEN_INT_FLOAT_MAP_H
+
+
+#include <xen/api/xen_common.h>
+
+
+typedef struct xen_int_float_map_contents
+{
+  int64_t key;
+  double val;
+} xen_int_float_map_contents;
+
+
+typedef struct xen_int_float_map
+{
+    size_t size;
+    xen_int_float_map_contents contents[];
+} xen_int_float_map;
+
+/**
+ * Allocate a xen_int_float_map of the given size.
+ */
+extern xen_int_float_map *
+xen_int_float_map_alloc(size_t size);
+
+/**
+ * Free the given xen_int_float_map, and all referenced values.  The
+ * given map must have been allocated by this library.
+ */
+extern void
+xen_int_float_map_free(xen_int_float_map *map);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_int_int_map.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_int_int_map.h    Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_INT_INT_MAP_H
+#define XEN_INT_INT_MAP_H
+
+
+#include <xen/api/xen_common.h>
+
+
+typedef struct xen_int_int_map_contents
+{
+  int64_t key;
+  int64_t val;
+} xen_int_int_map_contents;
+
+
+typedef struct xen_int_int_map
+{
+    size_t size;
+    xen_int_int_map_contents contents[];
+} xen_int_int_map;
+
+/**
+ * Allocate a xen_int_int_map of the given size.
+ */
+extern xen_int_int_map *
+xen_int_int_map_alloc(size_t size);
+
+/**
+ * Free the given xen_int_int_map, and all referenced values.  The
+ * given map must have been allocated by this library.
+ */
+extern void
+xen_int_int_map_free(xen_int_int_map *map);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_int_string_set_map.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_int_string_set_map.h     Tue Apr 24 
21:39:23 2007 +0100
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_INT_STRING_SET_MAP_H
+#define XEN_INT_STRING_SET_MAP_H
+
+
+#include <xen/api/xen_common.h>
+
+
+typedef struct xen_int_string_set_map_contents
+{
+  int64_t key;
+  struct xen_string_set *val;
+} xen_int_string_set_map_contents;
+
+
+typedef struct xen_int_string_set_map
+{
+    size_t size;
+    xen_int_string_set_map_contents contents[];
+} xen_int_string_set_map;
+
+/**
+ * Allocate a xen_int_string_set_map of the given size.
+ */
+extern xen_int_string_set_map *
+xen_int_string_set_map_alloc(size_t size);
+
+/**
+ * Free the given xen_int_string_set_map, and all referenced values. 
+ * The given map must have been allocated by this library.
+ */
+extern void
+xen_int_string_set_map_free(xen_int_string_set_map *map);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_network.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_network.h        Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_NETWORK_H
+#define XEN_NETWORK_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_network_decl.h>
+#include <xen/api/xen_pif_decl.h>
+#include <xen/api/xen_string_string_map.h>
+#include <xen/api/xen_vif_decl.h>
+
+
+/*
+ * The network class.
+ * 
+ * A virtual network.
+ */
+
+
+/**
+ * Free the given xen_network.  The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_network_free(xen_network network);
+
+
+typedef struct xen_network_set
+{
+    size_t size;
+    xen_network *contents[];
+} xen_network_set;
+
+/**
+ * Allocate a xen_network_set of the given size.
+ */
+extern xen_network_set *
+xen_network_set_alloc(size_t size);
+
+/**
+ * Free the given xen_network_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_network_set_free(xen_network_set *set);
+
+
+typedef struct xen_network_record
+{
+    xen_network handle;
+    char *uuid;
+    char *name_label;
+    char *name_description;
+    struct xen_vif_record_opt_set *vifs;
+    struct xen_pif_record_opt_set *pifs;
+    xen_string_string_map *other_config;
+} xen_network_record;
+
+/**
+ * Allocate a xen_network_record.
+ */
+extern xen_network_record *
+xen_network_record_alloc(void);
+
+/**
+ * Free the given xen_network_record, and all referenced values.  The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_network_record_free(xen_network_record *record);
+
+
+typedef struct xen_network_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_network handle;
+        xen_network_record *record;
+    } u;
+} xen_network_record_opt;
+
+/**
+ * Allocate a xen_network_record_opt.
+ */
+extern xen_network_record_opt *
+xen_network_record_opt_alloc(void);
+
+/**
+ * Free the given xen_network_record_opt, and all referenced values. 
+ * The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_network_record_opt_free(xen_network_record_opt *record_opt);
+
+
+typedef struct xen_network_record_set
+{
+    size_t size;
+    xen_network_record *contents[];
+} xen_network_record_set;
+
+/**
+ * Allocate a xen_network_record_set of the given size.
+ */
+extern xen_network_record_set *
+xen_network_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_network_record_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_network_record_set_free(xen_network_record_set *set);
+
+
+
+typedef struct xen_network_record_opt_set
+{
+    size_t size;
+    xen_network_record_opt *contents[];
+} xen_network_record_opt_set;
+
+/**
+ * Allocate a xen_network_record_opt_set of the given size.
+ */
+extern xen_network_record_opt_set *
+xen_network_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_network_record_opt_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_network_record_opt_set_free(xen_network_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given network.
+ */
+extern bool
+xen_network_get_record(xen_session *session, xen_network_record **result, 
xen_network network);
+
+
+/**
+ * Get a reference to the network instance with the specified UUID.
+ */
+extern bool
+xen_network_get_by_uuid(xen_session *session, xen_network *result, char *uuid);
+
+
+/**
+ * Create a new network instance, and return its handle.
+ */
+extern bool
+xen_network_create(xen_session *session, xen_network *result, 
xen_network_record *record);
+
+
+/**
+ * Destroy the specified network instance.
+ */
+extern bool
+xen_network_destroy(xen_session *session, xen_network network);
+
+
+/**
+ * Get all the network instances with the given label.
+ */
+extern bool
+xen_network_get_by_name_label(xen_session *session, struct xen_network_set 
**result, char *label);
+
+
+/**
+ * Get the uuid field of the given network.
+ */
+extern bool
+xen_network_get_uuid(xen_session *session, char **result, xen_network network);
+
+
+/**
+ * Get the name/label field of the given network.
+ */
+extern bool
+xen_network_get_name_label(xen_session *session, char **result, xen_network 
network);
+
+
+/**
+ * Get the name/description field of the given network.
+ */
+extern bool
+xen_network_get_name_description(xen_session *session, char **result, 
xen_network network);
+
+
+/**
+ * Get the VIFs field of the given network.
+ */
+extern bool
+xen_network_get_vifs(xen_session *session, struct xen_vif_set **result, 
xen_network network);
+
+
+/**
+ * Get the PIFs field of the given network.
+ */
+extern bool
+xen_network_get_pifs(xen_session *session, struct xen_pif_set **result, 
xen_network network);
+
+
+/**
+ * Get the other_config field of the given network.
+ */
+extern bool
+xen_network_get_other_config(xen_session *session, xen_string_string_map 
**result, xen_network network);
+
+
+/**
+ * Set the name/label field of the given network.
+ */
+extern bool
+xen_network_set_name_label(xen_session *session, xen_network network, char 
*label);
+
+
+/**
+ * Set the name/description field of the given network.
+ */
+extern bool
+xen_network_set_name_description(xen_session *session, xen_network network, 
char *description);
+
+
+/**
+ * Set the other_config field of the given network.
+ */
+extern bool
+xen_network_set_other_config(xen_session *session, xen_network network, 
xen_string_string_map *other_config);
+
+
+/**
+ * Add the given key-value pair to the other_config field of the given
+ * network.
+ */
+extern bool
+xen_network_add_to_other_config(xen_session *session, xen_network network, 
char *key, char *value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * other_config field of the given network.  If the key is not in that Map,
+ * then do nothing.
+ */
+extern bool
+xen_network_remove_from_other_config(xen_session *session, xen_network 
network, char *key);
+
+
+/**
+ * Return a list of all the networks known to the system.
+ */
+extern bool
+xen_network_get_all(xen_session *session, struct xen_network_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_network_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_network_decl.h   Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_NETWORK_DECL_H
+#define XEN_NETWORK_DECL_H
+
+typedef void *xen_network;
+
+struct xen_network_set;
+struct xen_network_record;
+struct xen_network_record_set;
+struct xen_network_record_opt;
+struct xen_network_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_on_crash_behaviour.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_on_crash_behaviour.h     Tue Apr 24 
21:39:23 2007 +0100
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_ON_CRASH_BEHAVIOUR_H
+#define XEN_ON_CRASH_BEHAVIOUR_H
+
+
+#include <xen/api/xen_common.h>
+
+
+enum xen_on_crash_behaviour
+{
+    /**
+     * destroy the VM state
+     */
+    XEN_ON_CRASH_BEHAVIOUR_DESTROY,
+
+    /**
+     * record a coredump and then destroy the VM state
+     */
+    XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_DESTROY,
+
+    /**
+     * restart the VM
+     */
+    XEN_ON_CRASH_BEHAVIOUR_RESTART,
+
+    /**
+     * record a coredump and then restart the VM
+     */
+    XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_RESTART,
+
+    /**
+     * leave the crashed VM as-is
+     */
+    XEN_ON_CRASH_BEHAVIOUR_PRESERVE,
+
+    /**
+     * rename the crashed VM and start a new copy
+     */
+    XEN_ON_CRASH_BEHAVIOUR_RENAME_RESTART
+};
+
+
+typedef struct xen_on_crash_behaviour_set
+{
+    size_t size;
+    enum xen_on_crash_behaviour contents[];
+} xen_on_crash_behaviour_set;
+
+/**
+ * Allocate a xen_on_crash_behaviour_set of the given size.
+ */
+extern xen_on_crash_behaviour_set *
+xen_on_crash_behaviour_set_alloc(size_t size);
+
+/**
+ * Free the given xen_on_crash_behaviour_set.  The given set must have
+ * been allocated by this library.
+ */
+extern void
+xen_on_crash_behaviour_set_free(xen_on_crash_behaviour_set *set);
+
+
+/**
+ * Return the name corresponding to the given code.  This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_on_crash_behaviour_to_string(enum xen_on_crash_behaviour val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_on_crash_behaviour
+xen_on_crash_behaviour_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_on_normal_exit.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_on_normal_exit.h Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_ON_NORMAL_EXIT_H
+#define XEN_ON_NORMAL_EXIT_H
+
+
+#include <xen/api/xen_common.h>
+
+
+enum xen_on_normal_exit
+{
+    /**
+     * destroy the VM state
+     */
+    XEN_ON_NORMAL_EXIT_DESTROY,
+
+    /**
+     * restart the VM
+     */
+    XEN_ON_NORMAL_EXIT_RESTART
+};
+
+
+typedef struct xen_on_normal_exit_set
+{
+    size_t size;
+    enum xen_on_normal_exit contents[];
+} xen_on_normal_exit_set;
+
+/**
+ * Allocate a xen_on_normal_exit_set of the given size.
+ */
+extern xen_on_normal_exit_set *
+xen_on_normal_exit_set_alloc(size_t size);
+
+/**
+ * Free the given xen_on_normal_exit_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_on_normal_exit_set_free(xen_on_normal_exit_set *set);
+
+
+/**
+ * Return the name corresponding to the given code.  This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_on_normal_exit_to_string(enum xen_on_normal_exit val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_on_normal_exit
+xen_on_normal_exit_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_pbd.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_pbd.h    Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,223 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_PBD_H
+#define XEN_PBD_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_host_decl.h>
+#include <xen/api/xen_pbd_decl.h>
+#include <xen/api/xen_sr_decl.h>
+#include <xen/api/xen_string_string_map.h>
+
+
+/*
+ * The PBD class.
+ * 
+ * The physical block devices through which hosts access SRs.
+ */
+
+
+/**
+ * Free the given xen_pbd.  The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_pbd_free(xen_pbd pbd);
+
+
+typedef struct xen_pbd_set
+{
+    size_t size;
+    xen_pbd *contents[];
+} xen_pbd_set;
+
+/**
+ * Allocate a xen_pbd_set of the given size.
+ */
+extern xen_pbd_set *
+xen_pbd_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pbd_set.  The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_pbd_set_free(xen_pbd_set *set);
+
+
+typedef struct xen_pbd_record
+{
+    xen_pbd handle;
+    char *uuid;
+    struct xen_host_record_opt *host;
+    struct xen_sr_record_opt *sr;
+    xen_string_string_map *device_config;
+    bool currently_attached;
+} xen_pbd_record;
+
+/**
+ * Allocate a xen_pbd_record.
+ */
+extern xen_pbd_record *
+xen_pbd_record_alloc(void);
+
+/**
+ * Free the given xen_pbd_record, and all referenced values.  The given
+ * record must have been allocated by this library.
+ */
+extern void
+xen_pbd_record_free(xen_pbd_record *record);
+
+
+typedef struct xen_pbd_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_pbd handle;
+        xen_pbd_record *record;
+    } u;
+} xen_pbd_record_opt;
+
+/**
+ * Allocate a xen_pbd_record_opt.
+ */
+extern xen_pbd_record_opt *
+xen_pbd_record_opt_alloc(void);
+
+/**
+ * Free the given xen_pbd_record_opt, and all referenced values.  The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_pbd_record_opt_free(xen_pbd_record_opt *record_opt);
+
+
+typedef struct xen_pbd_record_set
+{
+    size_t size;
+    xen_pbd_record *contents[];
+} xen_pbd_record_set;
+
+/**
+ * Allocate a xen_pbd_record_set of the given size.
+ */
+extern xen_pbd_record_set *
+xen_pbd_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pbd_record_set, and all referenced values.  The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_pbd_record_set_free(xen_pbd_record_set *set);
+
+
+
+typedef struct xen_pbd_record_opt_set
+{
+    size_t size;
+    xen_pbd_record_opt *contents[];
+} xen_pbd_record_opt_set;
+
+/**
+ * Allocate a xen_pbd_record_opt_set of the given size.
+ */
+extern xen_pbd_record_opt_set *
+xen_pbd_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pbd_record_opt_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_pbd_record_opt_set_free(xen_pbd_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given PBD.
+ */
+extern bool
+xen_pbd_get_record(xen_session *session, xen_pbd_record **result, xen_pbd pbd);
+
+
+/**
+ * Get a reference to the PBD instance with the specified UUID.
+ */
+extern bool
+xen_pbd_get_by_uuid(xen_session *session, xen_pbd *result, char *uuid);
+
+
+/**
+ * Create a new PBD instance, and return its handle.
+ */
+extern bool
+xen_pbd_create(xen_session *session, xen_pbd *result, xen_pbd_record *record);
+
+
+/**
+ * Destroy the specified PBD instance.
+ */
+extern bool
+xen_pbd_destroy(xen_session *session, xen_pbd pbd);
+
+
+/**
+ * Get the uuid field of the given PBD.
+ */
+extern bool
+xen_pbd_get_uuid(xen_session *session, char **result, xen_pbd pbd);
+
+
+/**
+ * Get the host field of the given PBD.
+ */
+extern bool
+xen_pbd_get_host(xen_session *session, xen_host *result, xen_pbd pbd);
+
+
+/**
+ * Get the SR field of the given PBD.
+ */
+extern bool
+xen_pbd_get_sr(xen_session *session, xen_sr *result, xen_pbd pbd);
+
+
+/**
+ * Get the device_config field of the given PBD.
+ */
+extern bool
+xen_pbd_get_device_config(xen_session *session, xen_string_string_map 
**result, xen_pbd pbd);
+
+
+/**
+ * Get the currently_attached field of the given PBD.
+ */
+extern bool
+xen_pbd_get_currently_attached(xen_session *session, bool *result, xen_pbd 
pbd);
+
+
+/**
+ * Return a list of all the PBDs known to the system.
+ */
+extern bool
+xen_pbd_get_all(xen_session *session, struct xen_pbd_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_pbd_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_pbd_decl.h       Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_PBD_DECL_H
+#define XEN_PBD_DECL_H
+
+typedef void *xen_pbd;
+
+struct xen_pbd_set;
+struct xen_pbd_record;
+struct xen_pbd_record_set;
+struct xen_pbd_record_opt;
+struct xen_pbd_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_pif.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_pif.h    Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,277 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_PIF_H
+#define XEN_PIF_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_host_decl.h>
+#include <xen/api/xen_network_decl.h>
+#include <xen/api/xen_pif_decl.h>
+#include <xen/api/xen_pif_metrics_decl.h>
+
+
+/*
+ * The PIF class.
+ * 
+ * A physical network interface (note separate VLANs are represented as
+ * several PIFs).
+ */
+
+
+/**
+ * Free the given xen_pif.  The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_pif_free(xen_pif pif);
+
+
+typedef struct xen_pif_set
+{
+    size_t size;
+    xen_pif *contents[];
+} xen_pif_set;
+
+/**
+ * Allocate a xen_pif_set of the given size.
+ */
+extern xen_pif_set *
+xen_pif_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pif_set.  The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_pif_set_free(xen_pif_set *set);
+
+
+typedef struct xen_pif_record
+{
+    xen_pif handle;
+    char *uuid;
+    char *device;
+    struct xen_network_record_opt *network;
+    struct xen_host_record_opt *host;
+    char *mac;
+    int64_t mtu;
+    int64_t vlan;
+    struct xen_pif_metrics_record_opt *metrics;
+} xen_pif_record;
+
+/**
+ * Allocate a xen_pif_record.
+ */
+extern xen_pif_record *
+xen_pif_record_alloc(void);
+
+/**
+ * Free the given xen_pif_record, and all referenced values.  The given
+ * record must have been allocated by this library.
+ */
+extern void
+xen_pif_record_free(xen_pif_record *record);
+
+
+typedef struct xen_pif_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_pif handle;
+        xen_pif_record *record;
+    } u;
+} xen_pif_record_opt;
+
+/**
+ * Allocate a xen_pif_record_opt.
+ */
+extern xen_pif_record_opt *
+xen_pif_record_opt_alloc(void);
+
+/**
+ * Free the given xen_pif_record_opt, and all referenced values.  The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_pif_record_opt_free(xen_pif_record_opt *record_opt);
+
+
+typedef struct xen_pif_record_set
+{
+    size_t size;
+    xen_pif_record *contents[];
+} xen_pif_record_set;
+
+/**
+ * Allocate a xen_pif_record_set of the given size.
+ */
+extern xen_pif_record_set *
+xen_pif_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pif_record_set, and all referenced values.  The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_pif_record_set_free(xen_pif_record_set *set);
+
+
+
+typedef struct xen_pif_record_opt_set
+{
+    size_t size;
+    xen_pif_record_opt *contents[];
+} xen_pif_record_opt_set;
+
+/**
+ * Allocate a xen_pif_record_opt_set of the given size.
+ */
+extern xen_pif_record_opt_set *
+xen_pif_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pif_record_opt_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_pif_record_opt_set_free(xen_pif_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given PIF.
+ */
+extern bool
+xen_pif_get_record(xen_session *session, xen_pif_record **result, xen_pif pif);
+
+
+/**
+ * Get a reference to the PIF instance with the specified UUID.
+ */
+extern bool
+xen_pif_get_by_uuid(xen_session *session, xen_pif *result, char *uuid);
+
+
+/**
+ * Get the uuid field of the given PIF.
+ */
+extern bool
+xen_pif_get_uuid(xen_session *session, char **result, xen_pif pif);
+
+
+/**
+ * Get the device field of the given PIF.
+ */
+extern bool
+xen_pif_get_device(xen_session *session, char **result, xen_pif pif);
+
+
+/**
+ * Get the network field of the given PIF.
+ */
+extern bool
+xen_pif_get_network(xen_session *session, xen_network *result, xen_pif pif);
+
+
+/**
+ * Get the host field of the given PIF.
+ */
+extern bool
+xen_pif_get_host(xen_session *session, xen_host *result, xen_pif pif);
+
+
+/**
+ * Get the MAC field of the given PIF.
+ */
+extern bool
+xen_pif_get_mac(xen_session *session, char **result, xen_pif pif);
+
+
+/**
+ * Get the MTU field of the given PIF.
+ */
+extern bool
+xen_pif_get_mtu(xen_session *session, int64_t *result, xen_pif pif);
+
+
+/**
+ * Get the VLAN field of the given PIF.
+ */
+extern bool
+xen_pif_get_vlan(xen_session *session, int64_t *result, xen_pif pif);
+
+
+/**
+ * Get the metrics field of the given PIF.
+ */
+extern bool
+xen_pif_get_metrics(xen_session *session, xen_pif_metrics *result, xen_pif 
pif);
+
+
+/**
+ * Set the device field of the given PIF.
+ */
+extern bool
+xen_pif_set_device(xen_session *session, xen_pif pif, char *device);
+
+
+/**
+ * Set the MAC field of the given PIF.
+ */
+extern bool
+xen_pif_set_mac(xen_session *session, xen_pif pif, char *mac);
+
+
+/**
+ * Set the MTU field of the given PIF.
+ */
+extern bool
+xen_pif_set_mtu(xen_session *session, xen_pif pif, int64_t mtu);
+
+
+/**
+ * Set the VLAN field of the given PIF.
+ */
+extern bool
+xen_pif_set_vlan(xen_session *session, xen_pif pif, int64_t vlan);
+
+
+/**
+ * Create a VLAN interface from an existing physical interface.
+ */
+extern bool
+xen_pif_create_vlan(xen_session *session, xen_pif *result, char *device, 
xen_network network, xen_host host, int64_t vlan);
+
+
+/**
+ * Destroy the interface (provided it is a synthetic interface like a
+ * VLAN; fail if it is a physical interface).
+ */
+extern bool
+xen_pif_destroy(xen_session *session, xen_pif self);
+
+
+/**
+ * Return a list of all the PIFs known to the system.
+ */
+extern bool
+xen_pif_get_all(xen_session *session, struct xen_pif_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_pif_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_pif_decl.h       Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_PIF_DECL_H
+#define XEN_PIF_DECL_H
+
+typedef void *xen_pif;
+
+struct xen_pif_set;
+struct xen_pif_record;
+struct xen_pif_record_set;
+struct xen_pif_record_opt;
+struct xen_pif_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_pif_metrics.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_pif_metrics.h    Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_PIF_METRICS_H
+#define XEN_PIF_METRICS_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_pif_metrics_decl.h>
+
+
+/*
+ * The PIF_metrics class.
+ * 
+ * The metrics associated with a physical network interface.
+ */
+
+
+/**
+ * Free the given xen_pif_metrics.  The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_pif_metrics_free(xen_pif_metrics pif_metrics);
+
+
+typedef struct xen_pif_metrics_set
+{
+    size_t size;
+    xen_pif_metrics *contents[];
+} xen_pif_metrics_set;
+
+/**
+ * Allocate a xen_pif_metrics_set of the given size.
+ */
+extern xen_pif_metrics_set *
+xen_pif_metrics_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pif_metrics_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_pif_metrics_set_free(xen_pif_metrics_set *set);
+
+
+typedef struct xen_pif_metrics_record
+{
+    xen_pif_metrics handle;
+    char *uuid;
+    double io_read_kbs;
+    double io_write_kbs;
+    time_t last_updated;
+} xen_pif_metrics_record;
+
+/**
+ * Allocate a xen_pif_metrics_record.
+ */
+extern xen_pif_metrics_record *
+xen_pif_metrics_record_alloc(void);
+
+/**
+ * Free the given xen_pif_metrics_record, and all referenced values. 
+ * The given record must have been allocated by this library.
+ */
+extern void
+xen_pif_metrics_record_free(xen_pif_metrics_record *record);
+
+
+typedef struct xen_pif_metrics_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_pif_metrics handle;
+        xen_pif_metrics_record *record;
+    } u;
+} xen_pif_metrics_record_opt;
+
+/**
+ * Allocate a xen_pif_metrics_record_opt.
+ */
+extern xen_pif_metrics_record_opt *
+xen_pif_metrics_record_opt_alloc(void);
+
+/**
+ * Free the given xen_pif_metrics_record_opt, and all referenced
+ * values.  The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_pif_metrics_record_opt_free(xen_pif_metrics_record_opt *record_opt);
+
+
+typedef struct xen_pif_metrics_record_set
+{
+    size_t size;
+    xen_pif_metrics_record *contents[];
+} xen_pif_metrics_record_set;
+
+/**
+ * Allocate a xen_pif_metrics_record_set of the given size.
+ */
+extern xen_pif_metrics_record_set *
+xen_pif_metrics_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pif_metrics_record_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_pif_metrics_record_set_free(xen_pif_metrics_record_set *set);
+
+
+
+typedef struct xen_pif_metrics_record_opt_set
+{
+    size_t size;
+    xen_pif_metrics_record_opt *contents[];
+} xen_pif_metrics_record_opt_set;
+
+/**
+ * Allocate a xen_pif_metrics_record_opt_set of the given size.
+ */
+extern xen_pif_metrics_record_opt_set *
+xen_pif_metrics_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_pif_metrics_record_opt_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_pif_metrics_record_opt_set_free(xen_pif_metrics_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given PIF_metrics.
+ */
+extern bool
+xen_pif_metrics_get_record(xen_session *session, xen_pif_metrics_record 
**result, xen_pif_metrics pif_metrics);
+
+
+/**
+ * Get a reference to the PIF_metrics instance with the specified UUID.
+ */
+extern bool
+xen_pif_metrics_get_by_uuid(xen_session *session, xen_pif_metrics *result, 
char *uuid);
+
+
+/**
+ * Get the uuid field of the given PIF_metrics.
+ */
+extern bool
+xen_pif_metrics_get_uuid(xen_session *session, char **result, xen_pif_metrics 
pif_metrics);
+
+
+/**
+ * Get the io/read_kbs field of the given PIF_metrics.
+ */
+extern bool
+xen_pif_metrics_get_io_read_kbs(xen_session *session, double *result, 
xen_pif_metrics pif_metrics);
+
+
+/**
+ * Get the io/write_kbs field of the given PIF_metrics.
+ */
+extern bool
+xen_pif_metrics_get_io_write_kbs(xen_session *session, double *result, 
xen_pif_metrics pif_metrics);
+
+
+/**
+ * Get the last_updated field of the given PIF_metrics.
+ */
+extern bool
+xen_pif_metrics_get_last_updated(xen_session *session, time_t *result, 
xen_pif_metrics pif_metrics);
+
+
+/**
+ * Return a list of all the PIF_metrics instances known to the system.
+ */
+extern bool
+xen_pif_metrics_get_all(xen_session *session, struct xen_pif_metrics_set 
**result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_pif_metrics_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_pif_metrics_decl.h       Tue Apr 24 
21:39:23 2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_PIF_METRICS_DECL_H
+#define XEN_PIF_METRICS_DECL_H
+
+typedef void *xen_pif_metrics;
+
+struct xen_pif_metrics_set;
+struct xen_pif_metrics_record;
+struct xen_pif_metrics_record_set;
+struct xen_pif_metrics_record_opt;
+struct xen_pif_metrics_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_sr.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_sr.h     Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,277 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_SR_H
+#define XEN_SR_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_pbd_decl.h>
+#include <xen/api/xen_sr_decl.h>
+#include <xen/api/xen_string_set.h>
+#include <xen/api/xen_vdi_decl.h>
+
+
+/*
+ * The SR class.
+ * 
+ * A storage repository.
+ */
+
+
+/**
+ * Free the given xen_sr.  The given handle must have been allocated by
+ * this library.
+ */
+extern void
+xen_sr_free(xen_sr sr);
+
+
+typedef struct xen_sr_set
+{
+    size_t size;
+    xen_sr *contents[];
+} xen_sr_set;
+
+/**
+ * Allocate a xen_sr_set of the given size.
+ */
+extern xen_sr_set *
+xen_sr_set_alloc(size_t size);
+
+/**
+ * Free the given xen_sr_set.  The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_sr_set_free(xen_sr_set *set);
+
+
+typedef struct xen_sr_record
+{
+    xen_sr handle;
+    char *uuid;
+    char *name_label;
+    char *name_description;
+    struct xen_vdi_record_opt_set *vdis;
+    struct xen_pbd_record_opt_set *pbds;
+    int64_t virtual_allocation;
+    int64_t physical_utilisation;
+    int64_t physical_size;
+    char *type;
+    char *content_type;
+} xen_sr_record;
+
+/**
+ * Allocate a xen_sr_record.
+ */
+extern xen_sr_record *
+xen_sr_record_alloc(void);
+
+/**
+ * Free the given xen_sr_record, and all referenced values.  The given
+ * record must have been allocated by this library.
+ */
+extern void
+xen_sr_record_free(xen_sr_record *record);
+
+
+typedef struct xen_sr_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_sr handle;
+        xen_sr_record *record;
+    } u;
+} xen_sr_record_opt;
+
+/**
+ * Allocate a xen_sr_record_opt.
+ */
+extern xen_sr_record_opt *
+xen_sr_record_opt_alloc(void);
+
+/**
+ * Free the given xen_sr_record_opt, and all referenced values.  The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_sr_record_opt_free(xen_sr_record_opt *record_opt);
+
+
+typedef struct xen_sr_record_set
+{
+    size_t size;
+    xen_sr_record *contents[];
+} xen_sr_record_set;
+
+/**
+ * Allocate a xen_sr_record_set of the given size.
+ */
+extern xen_sr_record_set *
+xen_sr_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_sr_record_set, and all referenced values.  The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_sr_record_set_free(xen_sr_record_set *set);
+
+
+
+typedef struct xen_sr_record_opt_set
+{
+    size_t size;
+    xen_sr_record_opt *contents[];
+} xen_sr_record_opt_set;
+
+/**
+ * Allocate a xen_sr_record_opt_set of the given size.
+ */
+extern xen_sr_record_opt_set *
+xen_sr_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_sr_record_opt_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_sr_record_opt_set_free(xen_sr_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given SR.
+ */
+extern bool
+xen_sr_get_record(xen_session *session, xen_sr_record **result, xen_sr sr);
+
+
+/**
+ * Get a reference to the SR instance with the specified UUID.
+ */
+extern bool
+xen_sr_get_by_uuid(xen_session *session, xen_sr *result, char *uuid);
+
+
+/**
+ * Get all the SR instances with the given label.
+ */
+extern bool
+xen_sr_get_by_name_label(xen_session *session, struct xen_sr_set **result, 
char *label);
+
+
+/**
+ * Get the uuid field of the given SR.
+ */
+extern bool
+xen_sr_get_uuid(xen_session *session, char **result, xen_sr sr);
+
+
+/**
+ * Get the name/label field of the given SR.
+ */
+extern bool
+xen_sr_get_name_label(xen_session *session, char **result, xen_sr sr);
+
+
+/**
+ * Get the name/description field of the given SR.
+ */
+extern bool
+xen_sr_get_name_description(xen_session *session, char **result, xen_sr sr);
+
+
+/**
+ * Get the VDIs field of the given SR.
+ */
+extern bool
+xen_sr_get_vdis(xen_session *session, struct xen_vdi_set **result, xen_sr sr);
+
+
+/**
+ * Get the PBDs field of the given SR.
+ */
+extern bool
+xen_sr_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_sr sr);
+
+
+/**
+ * Get the virtual_allocation field of the given SR.
+ */
+extern bool
+xen_sr_get_virtual_allocation(xen_session *session, int64_t *result, xen_sr 
sr);
+
+
+/**
+ * Get the physical_utilisation field of the given SR.
+ */
+extern bool
+xen_sr_get_physical_utilisation(xen_session *session, int64_t *result, xen_sr 
sr);
+
+
+/**
+ * Get the physical_size field of the given SR.
+ */
+extern bool
+xen_sr_get_physical_size(xen_session *session, int64_t *result, xen_sr sr);
+
+
+/**
+ * Get the type field of the given SR.
+ */
+extern bool
+xen_sr_get_type(xen_session *session, char **result, xen_sr sr);
+
+
+/**
+ * Get the content_type field of the given SR.
+ */
+extern bool
+xen_sr_get_content_type(xen_session *session, char **result, xen_sr sr);
+
+
+/**
+ * Set the name/label field of the given SR.
+ */
+extern bool
+xen_sr_set_name_label(xen_session *session, xen_sr sr, char *label);
+
+
+/**
+ * Set the name/description field of the given SR.
+ */
+extern bool
+xen_sr_set_name_description(xen_session *session, xen_sr sr, char 
*description);
+
+
+/**
+ * Return a set of all the SR types supported by the system.
+ */
+extern bool
+xen_sr_get_supported_types(xen_session *session, struct xen_string_set 
**result);
+
+
+/**
+ * Return a list of all the SRs known to the system.
+ */
+extern bool
+xen_sr_get_all(xen_session *session, struct xen_sr_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_sr_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_sr_decl.h        Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_SR_DECL_H
+#define XEN_SR_DECL_H
+
+typedef void *xen_sr;
+
+struct xen_sr_set;
+struct xen_sr_record;
+struct xen_sr_record_set;
+struct xen_sr_record_opt;
+struct xen_sr_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_string_set.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_string_set.h     Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_STRING_SET_H
+#define XEN_STRING_SET_H
+
+
+#include "xen_common.h"
+
+
+typedef struct xen_string_set
+{
+    size_t size;
+    char *contents[];
+} xen_string_set;
+
+
+/**
+ * Allocate a xen_string_set of the given size.
+ */
+extern xen_string_set *
+xen_string_set_alloc(size_t size);
+
+/**
+ * Free the given xen_string_set.  The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_string_set_free(xen_string_set *set);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_string_string_map.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_string_string_map.h      Tue Apr 24 
21:39:23 2007 +0100
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_STRING_STRING_MAP_H
+#define XEN_STRING_STRING_MAP_H
+
+
+#include <xen/api/xen_common.h>
+
+
+typedef struct xen_string_string_map_contents
+{
+  char *key;
+  char *val;
+} xen_string_string_map_contents;
+
+
+typedef struct xen_string_string_map
+{
+    size_t size;
+    xen_string_string_map_contents contents[];
+} xen_string_string_map;
+
+/**
+ * Allocate a xen_string_string_map of the given size.
+ */
+extern xen_string_string_map *
+xen_string_string_map_alloc(size_t size);
+
+/**
+ * Free the given xen_string_string_map, and all referenced values. 
+ * The given map must have been allocated by this library.
+ */
+extern void
+xen_string_string_map_free(xen_string_string_map *map);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_user.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_user.h   Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_USER_H
+#define XEN_USER_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_user_decl.h>
+
+
+/*
+ * The user class.
+ * 
+ * A user of the system.
+ */
+
+
+/**
+ * Free the given xen_user.  The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_user_free(xen_user user);
+
+
+typedef struct xen_user_set
+{
+    size_t size;
+    xen_user *contents[];
+} xen_user_set;
+
+/**
+ * Allocate a xen_user_set of the given size.
+ */
+extern xen_user_set *
+xen_user_set_alloc(size_t size);
+
+/**
+ * Free the given xen_user_set.  The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_user_set_free(xen_user_set *set);
+
+
+typedef struct xen_user_record
+{
+    xen_user handle;
+    char *uuid;
+    char *short_name;
+    char *fullname;
+} xen_user_record;
+
+/**
+ * Allocate a xen_user_record.
+ */
+extern xen_user_record *
+xen_user_record_alloc(void);
+
+/**
+ * Free the given xen_user_record, and all referenced values.  The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_user_record_free(xen_user_record *record);
+
+
+typedef struct xen_user_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_user handle;
+        xen_user_record *record;
+    } u;
+} xen_user_record_opt;
+
+/**
+ * Allocate a xen_user_record_opt.
+ */
+extern xen_user_record_opt *
+xen_user_record_opt_alloc(void);
+
+/**
+ * Free the given xen_user_record_opt, and all referenced values.  The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_user_record_opt_free(xen_user_record_opt *record_opt);
+
+
+typedef struct xen_user_record_set
+{
+    size_t size;
+    xen_user_record *contents[];
+} xen_user_record_set;
+
+/**
+ * Allocate a xen_user_record_set of the given size.
+ */
+extern xen_user_record_set *
+xen_user_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_user_record_set, and all referenced values.  The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_user_record_set_free(xen_user_record_set *set);
+
+
+
+typedef struct xen_user_record_opt_set
+{
+    size_t size;
+    xen_user_record_opt *contents[];
+} xen_user_record_opt_set;
+
+/**
+ * Allocate a xen_user_record_opt_set of the given size.
+ */
+extern xen_user_record_opt_set *
+xen_user_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_user_record_opt_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_user_record_opt_set_free(xen_user_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given user.
+ */
+extern bool
+xen_user_get_record(xen_session *session, xen_user_record **result, xen_user 
user);
+
+
+/**
+ * Get a reference to the user instance with the specified UUID.
+ */
+extern bool
+xen_user_get_by_uuid(xen_session *session, xen_user *result, char *uuid);
+
+
+/**
+ * Create a new user instance, and return its handle.
+ */
+extern bool
+xen_user_create(xen_session *session, xen_user *result, xen_user_record 
*record);
+
+
+/**
+ * Destroy the specified user instance.
+ */
+extern bool
+xen_user_destroy(xen_session *session, xen_user user);
+
+
+/**
+ * Get the uuid field of the given user.
+ */
+extern bool
+xen_user_get_uuid(xen_session *session, char **result, xen_user user);
+
+
+/**
+ * Get the short_name field of the given user.
+ */
+extern bool
+xen_user_get_short_name(xen_session *session, char **result, xen_user user);
+
+
+/**
+ * Get the fullname field of the given user.
+ */
+extern bool
+xen_user_get_fullname(xen_session *session, char **result, xen_user user);
+
+
+/**
+ * Set the fullname field of the given user.
+ */
+extern bool
+xen_user_set_fullname(xen_session *session, xen_user user, char *fullname);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_user_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_user_decl.h      Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_USER_DECL_H
+#define XEN_USER_DECL_H
+
+typedef void *xen_user;
+
+struct xen_user_set;
+struct xen_user_record;
+struct xen_user_record_set;
+struct xen_user_record_opt;
+struct xen_user_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_vbd.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vbd.h    Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,390 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VBD_H
+#define XEN_VBD_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_string_set.h>
+#include <xen/api/xen_string_string_map.h>
+#include <xen/api/xen_vbd_decl.h>
+#include <xen/api/xen_vbd_metrics_decl.h>
+#include <xen/api/xen_vbd_mode.h>
+#include <xen/api/xen_vbd_type.h>
+#include <xen/api/xen_vdi_decl.h>
+#include <xen/api/xen_vm_decl.h>
+
+
+/*
+ * The VBD class.
+ * 
+ * A virtual block device.
+ */
+
+
+/**
+ * Free the given xen_vbd.  The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_vbd_free(xen_vbd vbd);
+
+
+typedef struct xen_vbd_set
+{
+    size_t size;
+    xen_vbd *contents[];
+} xen_vbd_set;
+
+/**
+ * Allocate a xen_vbd_set of the given size.
+ */
+extern xen_vbd_set *
+xen_vbd_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vbd_set.  The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_vbd_set_free(xen_vbd_set *set);
+
+
+typedef struct xen_vbd_record
+{
+    xen_vbd handle;
+    char *uuid;
+    struct xen_vm_record_opt *vm;
+    struct xen_vdi_record_opt *vdi;
+    char *device;
+    bool bootable;
+    enum xen_vbd_mode mode;
+    enum xen_vbd_type type;
+    bool currently_attached;
+    int64_t status_code;
+    char *status_detail;
+    xen_string_string_map *runtime_properties;
+    char *qos_algorithm_type;
+    xen_string_string_map *qos_algorithm_params;
+    struct xen_string_set *qos_supported_algorithms;
+    struct xen_vbd_metrics_record_opt *metrics;
+} xen_vbd_record;
+
+/**
+ * Allocate a xen_vbd_record.
+ */
+extern xen_vbd_record *
+xen_vbd_record_alloc(void);
+
+/**
+ * Free the given xen_vbd_record, and all referenced values.  The given
+ * record must have been allocated by this library.
+ */
+extern void
+xen_vbd_record_free(xen_vbd_record *record);
+
+
+typedef struct xen_vbd_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_vbd handle;
+        xen_vbd_record *record;
+    } u;
+} xen_vbd_record_opt;
+
+/**
+ * Allocate a xen_vbd_record_opt.
+ */
+extern xen_vbd_record_opt *
+xen_vbd_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vbd_record_opt, and all referenced values.  The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vbd_record_opt_free(xen_vbd_record_opt *record_opt);
+
+
+typedef struct xen_vbd_record_set
+{
+    size_t size;
+    xen_vbd_record *contents[];
+} xen_vbd_record_set;
+
+/**
+ * Allocate a xen_vbd_record_set of the given size.
+ */
+extern xen_vbd_record_set *
+xen_vbd_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vbd_record_set, and all referenced values.  The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_vbd_record_set_free(xen_vbd_record_set *set);
+
+
+
+typedef struct xen_vbd_record_opt_set
+{
+    size_t size;
+    xen_vbd_record_opt *contents[];
+} xen_vbd_record_opt_set;
+
+/**
+ * Allocate a xen_vbd_record_opt_set of the given size.
+ */
+extern xen_vbd_record_opt_set *
+xen_vbd_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vbd_record_opt_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_vbd_record_opt_set_free(xen_vbd_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given VBD.
+ */
+extern bool
+xen_vbd_get_record(xen_session *session, xen_vbd_record **result, xen_vbd vbd);
+
+
+/**
+ * Get a reference to the VBD instance with the specified UUID.
+ */
+extern bool
+xen_vbd_get_by_uuid(xen_session *session, xen_vbd *result, char *uuid);
+
+
+/**
+ * Create a new VBD instance, and return its handle.
+ */
+extern bool
+xen_vbd_create(xen_session *session, xen_vbd *result, xen_vbd_record *record);
+
+
+/**
+ * Destroy the specified VBD instance.
+ */
+extern bool
+xen_vbd_destroy(xen_session *session, xen_vbd vbd);
+
+
+/**
+ * Get the uuid field of the given VBD.
+ */
+extern bool
+xen_vbd_get_uuid(xen_session *session, char **result, xen_vbd vbd);
+
+
+/**
+ * Get the VM field of the given VBD.
+ */
+extern bool
+xen_vbd_get_vm(xen_session *session, xen_vm *result, xen_vbd vbd);
+
+
+/**
+ * Get the VDI field of the given VBD.
+ */
+extern bool
+xen_vbd_get_vdi(xen_session *session, xen_vdi *result, xen_vbd vbd);
+
+
+/**
+ * Get the device field of the given VBD.
+ */
+extern bool
+xen_vbd_get_device(xen_session *session, char **result, xen_vbd vbd);
+
+
+/**
+ * Get the bootable field of the given VBD.
+ */
+extern bool
+xen_vbd_get_bootable(xen_session *session, bool *result, xen_vbd vbd);
+
+
+/**
+ * Get the mode field of the given VBD.
+ */
+extern bool
+xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd);
+
+
+/**
+ * Get the type field of the given VBD.
+ */
+extern bool
+xen_vbd_get_type(xen_session *session, enum xen_vbd_type *result, xen_vbd vbd);
+
+
+/**
+ * Get the currently_attached field of the given VBD.
+ */
+extern bool
+xen_vbd_get_currently_attached(xen_session *session, bool *result, xen_vbd 
vbd);
+
+
+/**
+ * Get the status_code field of the given VBD.
+ */
+extern bool
+xen_vbd_get_status_code(xen_session *session, int64_t *result, xen_vbd vbd);
+
+
+/**
+ * Get the status_detail field of the given VBD.
+ */
+extern bool
+xen_vbd_get_status_detail(xen_session *session, char **result, xen_vbd vbd);
+
+
+/**
+ * Get the runtime_properties field of the given VBD.
+ */
+extern bool
+xen_vbd_get_runtime_properties(xen_session *session, xen_string_string_map 
**result, xen_vbd vbd);
+
+
+/**
+ * Get the qos/algorithm_type field of the given VBD.
+ */
+extern bool
+xen_vbd_get_qos_algorithm_type(xen_session *session, char **result, xen_vbd 
vbd);
+
+
+/**
+ * Get the qos/algorithm_params field of the given VBD.
+ */
+extern bool
+xen_vbd_get_qos_algorithm_params(xen_session *session, xen_string_string_map 
**result, xen_vbd vbd);
+
+
+/**
+ * Get the qos/supported_algorithms field of the given VBD.
+ */
+extern bool
+xen_vbd_get_qos_supported_algorithms(xen_session *session, struct 
xen_string_set **result, xen_vbd vbd);
+
+
+/**
+ * Get the metrics field of the given VBD.
+ */
+extern bool
+xen_vbd_get_metrics(xen_session *session, xen_vbd_metrics *result, xen_vbd 
vbd);
+
+
+/**
+ * Set the device field of the given VBD.
+ */
+extern bool
+xen_vbd_set_device(xen_session *session, xen_vbd vbd, char *device);
+
+
+/**
+ * Set the bootable field of the given VBD.
+ */
+extern bool
+xen_vbd_set_bootable(xen_session *session, xen_vbd vbd, bool bootable);
+
+
+/**
+ * Set the mode field of the given VBD.
+ */
+extern bool
+xen_vbd_set_mode(xen_session *session, xen_vbd vbd, enum xen_vbd_mode mode);
+
+
+/**
+ * Set the type field of the given VBD.
+ */
+extern bool
+xen_vbd_set_type(xen_session *session, xen_vbd vbd, enum xen_vbd_type type);
+
+
+/**
+ * Set the qos/algorithm_type field of the given VBD.
+ */
+extern bool
+xen_vbd_set_qos_algorithm_type(xen_session *session, xen_vbd vbd, char 
*algorithm_type);
+
+
+/**
+ * Set the qos/algorithm_params field of the given VBD.
+ */
+extern bool
+xen_vbd_set_qos_algorithm_params(xen_session *session, xen_vbd vbd, 
xen_string_string_map *algorithm_params);
+
+
+/**
+ * Add the given key-value pair to the qos/algorithm_params field of
+ * the given VBD.
+ */
+extern bool
+xen_vbd_add_to_qos_algorithm_params(xen_session *session, xen_vbd vbd, char 
*key, char *value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * qos/algorithm_params field of the given VBD.  If the key is not in that
+ * Map, then do nothing.
+ */
+extern bool
+xen_vbd_remove_from_qos_algorithm_params(xen_session *session, xen_vbd vbd, 
char *key);
+
+
+/**
+ * Change the media in the device for CDROM-like devices only. For
+ * other devices, detach the VBD and attach a new one.
+ */
+extern bool
+xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi);
+
+
+/**
+ * Hotplug the specified VBD, dynamically attaching it to the running
+ * VM.
+ */
+extern bool
+xen_vbd_plug(xen_session *session, xen_vbd self);
+
+
+/**
+ * Hot-unplug the specified VBD, dynamically unattaching it from the
+ * running VM.
+ */
+extern bool
+xen_vbd_unplug(xen_session *session, xen_vbd self);
+
+
+/**
+ * Return a list of all the VBDs known to the system.
+ */
+extern bool
+xen_vbd_get_all(xen_session *session, struct xen_vbd_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_vbd_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vbd_decl.h       Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VBD_DECL_H
+#define XEN_VBD_DECL_H
+
+typedef void *xen_vbd;
+
+struct xen_vbd_set;
+struct xen_vbd_record;
+struct xen_vbd_record_set;
+struct xen_vbd_record_opt;
+struct xen_vbd_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_vbd_metrics.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vbd_metrics.h    Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VBD_METRICS_H
+#define XEN_VBD_METRICS_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_vbd_metrics_decl.h>
+
+
+/*
+ * The VBD_metrics class.
+ * 
+ * The metrics associated with a virtual block device.
+ */
+
+
+/**
+ * Free the given xen_vbd_metrics.  The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_vbd_metrics_free(xen_vbd_metrics vbd_metrics);
+
+
+typedef struct xen_vbd_metrics_set
+{
+    size_t size;
+    xen_vbd_metrics *contents[];
+} xen_vbd_metrics_set;
+
+/**
+ * Allocate a xen_vbd_metrics_set of the given size.
+ */
+extern xen_vbd_metrics_set *
+xen_vbd_metrics_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vbd_metrics_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_vbd_metrics_set_free(xen_vbd_metrics_set *set);
+
+
+typedef struct xen_vbd_metrics_record
+{
+    xen_vbd_metrics handle;
+    char *uuid;
+    double io_read_kbs;
+    double io_write_kbs;
+    time_t last_updated;
+} xen_vbd_metrics_record;
+
+/**
+ * Allocate a xen_vbd_metrics_record.
+ */
+extern xen_vbd_metrics_record *
+xen_vbd_metrics_record_alloc(void);
+
+/**
+ * Free the given xen_vbd_metrics_record, and all referenced values. 
+ * The given record must have been allocated by this library.
+ */
+extern void
+xen_vbd_metrics_record_free(xen_vbd_metrics_record *record);
+
+
+typedef struct xen_vbd_metrics_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_vbd_metrics handle;
+        xen_vbd_metrics_record *record;
+    } u;
+} xen_vbd_metrics_record_opt;
+
+/**
+ * Allocate a xen_vbd_metrics_record_opt.
+ */
+extern xen_vbd_metrics_record_opt *
+xen_vbd_metrics_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vbd_metrics_record_opt, and all referenced
+ * values.  The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vbd_metrics_record_opt_free(xen_vbd_metrics_record_opt *record_opt);
+
+
+typedef struct xen_vbd_metrics_record_set
+{
+    size_t size;
+    xen_vbd_metrics_record *contents[];
+} xen_vbd_metrics_record_set;
+
+/**
+ * Allocate a xen_vbd_metrics_record_set of the given size.
+ */
+extern xen_vbd_metrics_record_set *
+xen_vbd_metrics_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vbd_metrics_record_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_vbd_metrics_record_set_free(xen_vbd_metrics_record_set *set);
+
+
+
+typedef struct xen_vbd_metrics_record_opt_set
+{
+    size_t size;
+    xen_vbd_metrics_record_opt *contents[];
+} xen_vbd_metrics_record_opt_set;
+
+/**
+ * Allocate a xen_vbd_metrics_record_opt_set of the given size.
+ */
+extern xen_vbd_metrics_record_opt_set *
+xen_vbd_metrics_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vbd_metrics_record_opt_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_vbd_metrics_record_opt_set_free(xen_vbd_metrics_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given VBD_metrics.
+ */
+extern bool
+xen_vbd_metrics_get_record(xen_session *session, xen_vbd_metrics_record 
**result, xen_vbd_metrics vbd_metrics);
+
+
+/**
+ * Get a reference to the VBD_metrics instance with the specified UUID.
+ */
+extern bool
+xen_vbd_metrics_get_by_uuid(xen_session *session, xen_vbd_metrics *result, 
char *uuid);
+
+
+/**
+ * Get the uuid field of the given VBD_metrics.
+ */
+extern bool
+xen_vbd_metrics_get_uuid(xen_session *session, char **result, xen_vbd_metrics 
vbd_metrics);
+
+
+/**
+ * Get the io/read_kbs field of the given VBD_metrics.
+ */
+extern bool
+xen_vbd_metrics_get_io_read_kbs(xen_session *session, double *result, 
xen_vbd_metrics vbd_metrics);
+
+
+/**
+ * Get the io/write_kbs field of the given VBD_metrics.
+ */
+extern bool
+xen_vbd_metrics_get_io_write_kbs(xen_session *session, double *result, 
xen_vbd_metrics vbd_metrics);
+
+
+/**
+ * Get the last_updated field of the given VBD_metrics.
+ */
+extern bool
+xen_vbd_metrics_get_last_updated(xen_session *session, time_t *result, 
xen_vbd_metrics vbd_metrics);
+
+
+/**
+ * Return a list of all the VBD_metrics instances known to the system.
+ */
+extern bool
+xen_vbd_metrics_get_all(xen_session *session, struct xen_vbd_metrics_set 
**result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_vbd_metrics_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vbd_metrics_decl.h       Tue Apr 24 
21:39:23 2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VBD_METRICS_DECL_H
+#define XEN_VBD_METRICS_DECL_H
+
+typedef void *xen_vbd_metrics;
+
+struct xen_vbd_metrics_set;
+struct xen_vbd_metrics_record;
+struct xen_vbd_metrics_record_set;
+struct xen_vbd_metrics_record_opt;
+struct xen_vbd_metrics_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_vbd_mode.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vbd_mode.h       Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VBD_MODE_H
+#define XEN_VBD_MODE_H
+
+
+#include <xen/api/xen_common.h>
+
+
+enum xen_vbd_mode
+{
+    /**
+     * disk is mounted read-only
+     */
+    XEN_VBD_MODE_RO,
+
+    /**
+     * disk is mounted read-write
+     */
+    XEN_VBD_MODE_RW
+};
+
+
+typedef struct xen_vbd_mode_set
+{
+    size_t size;
+    enum xen_vbd_mode contents[];
+} xen_vbd_mode_set;
+
+/**
+ * Allocate a xen_vbd_mode_set of the given size.
+ */
+extern xen_vbd_mode_set *
+xen_vbd_mode_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vbd_mode_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_vbd_mode_set_free(xen_vbd_mode_set *set);
+
+
+/**
+ * Return the name corresponding to the given code.  This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_vbd_mode_to_string(enum xen_vbd_mode val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_vbd_mode
+xen_vbd_mode_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_vbd_type.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vbd_type.h       Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VBD_TYPE_H
+#define XEN_VBD_TYPE_H
+
+
+#include <xen/api/xen_common.h>
+
+
+enum xen_vbd_type
+{
+    /**
+     * VBD will appear to guest as CD
+     */
+    XEN_VBD_TYPE_CD,
+
+    /**
+     * VBD will appear to guest as disk
+     */
+    XEN_VBD_TYPE_DISK
+};
+
+
+typedef struct xen_vbd_type_set
+{
+    size_t size;
+    enum xen_vbd_type contents[];
+} xen_vbd_type_set;
+
+/**
+ * Allocate a xen_vbd_type_set of the given size.
+ */
+extern xen_vbd_type_set *
+xen_vbd_type_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vbd_type_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_vbd_type_set_free(xen_vbd_type_set *set);
+
+
+/**
+ * Return the name corresponding to the given code.  This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_vbd_type_to_string(enum xen_vbd_type val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_vbd_type
+xen_vbd_type_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_vdi.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vdi.h    Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,347 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VDI_H
+#define XEN_VDI_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_crashdump_decl.h>
+#include <xen/api/xen_sr_decl.h>
+#include <xen/api/xen_string_string_map.h>
+#include <xen/api/xen_vbd_decl.h>
+#include <xen/api/xen_vdi_decl.h>
+#include <xen/api/xen_vdi_type.h>
+
+
+/*
+ * The VDI class.
+ * 
+ * A virtual disk image.
+ */
+
+
+/**
+ * Free the given xen_vdi.  The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_vdi_free(xen_vdi vdi);
+
+
+typedef struct xen_vdi_set
+{
+    size_t size;
+    xen_vdi *contents[];
+} xen_vdi_set;
+
+/**
+ * Allocate a xen_vdi_set of the given size.
+ */
+extern xen_vdi_set *
+xen_vdi_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vdi_set.  The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_vdi_set_free(xen_vdi_set *set);
+
+
+typedef struct xen_vdi_record
+{
+    xen_vdi handle;
+    char *uuid;
+    char *name_label;
+    char *name_description;
+    struct xen_sr_record_opt *sr;
+    struct xen_vbd_record_opt_set *vbds;
+    struct xen_crashdump_record_opt_set *crash_dumps;
+    int64_t virtual_size;
+    int64_t physical_utilisation;
+    enum xen_vdi_type type;
+    bool sharable;
+    bool read_only;
+    xen_string_string_map *other_config;
+} xen_vdi_record;
+
+/**
+ * Allocate a xen_vdi_record.
+ */
+extern xen_vdi_record *
+xen_vdi_record_alloc(void);
+
+/**
+ * Free the given xen_vdi_record, and all referenced values.  The given
+ * record must have been allocated by this library.
+ */
+extern void
+xen_vdi_record_free(xen_vdi_record *record);
+
+
+typedef struct xen_vdi_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_vdi handle;
+        xen_vdi_record *record;
+    } u;
+} xen_vdi_record_opt;
+
+/**
+ * Allocate a xen_vdi_record_opt.
+ */
+extern xen_vdi_record_opt *
+xen_vdi_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vdi_record_opt, and all referenced values.  The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vdi_record_opt_free(xen_vdi_record_opt *record_opt);
+
+
+typedef struct xen_vdi_record_set
+{
+    size_t size;
+    xen_vdi_record *contents[];
+} xen_vdi_record_set;
+
+/**
+ * Allocate a xen_vdi_record_set of the given size.
+ */
+extern xen_vdi_record_set *
+xen_vdi_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vdi_record_set, and all referenced values.  The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_vdi_record_set_free(xen_vdi_record_set *set);
+
+
+
+typedef struct xen_vdi_record_opt_set
+{
+    size_t size;
+    xen_vdi_record_opt *contents[];
+} xen_vdi_record_opt_set;
+
+/**
+ * Allocate a xen_vdi_record_opt_set of the given size.
+ */
+extern xen_vdi_record_opt_set *
+xen_vdi_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vdi_record_opt_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_vdi_record_opt_set_free(xen_vdi_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given VDI.
+ */
+extern bool
+xen_vdi_get_record(xen_session *session, xen_vdi_record **result, xen_vdi vdi);
+
+
+/**
+ * Get a reference to the VDI instance with the specified UUID.
+ */
+extern bool
+xen_vdi_get_by_uuid(xen_session *session, xen_vdi *result, char *uuid);
+
+
+/**
+ * Create a new VDI instance, and return its handle.
+ */
+extern bool
+xen_vdi_create(xen_session *session, xen_vdi *result, xen_vdi_record *record);
+
+
+/**
+ * Destroy the specified VDI instance.
+ */
+extern bool
+xen_vdi_destroy(xen_session *session, xen_vdi vdi);
+
+
+/**
+ * Get all the VDI instances with the given label.
+ */
+extern bool
+xen_vdi_get_by_name_label(xen_session *session, struct xen_vdi_set **result, 
char *label);
+
+
+/**
+ * Get the uuid field of the given VDI.
+ */
+extern bool
+xen_vdi_get_uuid(xen_session *session, char **result, xen_vdi vdi);
+
+
+/**
+ * Get the name/label field of the given VDI.
+ */
+extern bool
+xen_vdi_get_name_label(xen_session *session, char **result, xen_vdi vdi);
+
+
+/**
+ * Get the name/description field of the given VDI.
+ */
+extern bool
+xen_vdi_get_name_description(xen_session *session, char **result, xen_vdi vdi);
+
+
+/**
+ * Get the SR field of the given VDI.
+ */
+extern bool
+xen_vdi_get_sr(xen_session *session, xen_sr *result, xen_vdi vdi);
+
+
+/**
+ * Get the VBDs field of the given VDI.
+ */
+extern bool
+xen_vdi_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vdi 
vdi);
+
+
+/**
+ * Get the crash_dumps field of the given VDI.
+ */
+extern bool
+xen_vdi_get_crash_dumps(xen_session *session, struct xen_crashdump_set 
**result, xen_vdi vdi);
+
+
+/**
+ * Get the virtual_size field of the given VDI.
+ */
+extern bool
+xen_vdi_get_virtual_size(xen_session *session, int64_t *result, xen_vdi vdi);
+
+
+/**
+ * Get the physical_utilisation field of the given VDI.
+ */
+extern bool
+xen_vdi_get_physical_utilisation(xen_session *session, int64_t *result, 
xen_vdi vdi);
+
+
+/**
+ * Get the type field of the given VDI.
+ */
+extern bool
+xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi);
+
+
+/**
+ * Get the sharable field of the given VDI.
+ */
+extern bool
+xen_vdi_get_sharable(xen_session *session, bool *result, xen_vdi vdi);
+
+
+/**
+ * Get the read_only field of the given VDI.
+ */
+extern bool
+xen_vdi_get_read_only(xen_session *session, bool *result, xen_vdi vdi);
+
+
+/**
+ * Get the other_config field of the given VDI.
+ */
+extern bool
+xen_vdi_get_other_config(xen_session *session, xen_string_string_map **result, 
xen_vdi vdi);
+
+
+/**
+ * Set the name/label field of the given VDI.
+ */
+extern bool
+xen_vdi_set_name_label(xen_session *session, xen_vdi vdi, char *label);
+
+
+/**
+ * Set the name/description field of the given VDI.
+ */
+extern bool
+xen_vdi_set_name_description(xen_session *session, xen_vdi vdi, char 
*description);
+
+
+/**
+ * Set the virtual_size field of the given VDI.
+ */
+extern bool
+xen_vdi_set_virtual_size(xen_session *session, xen_vdi vdi, int64_t 
virtual_size);
+
+
+/**
+ * Set the sharable field of the given VDI.
+ */
+extern bool
+xen_vdi_set_sharable(xen_session *session, xen_vdi vdi, bool sharable);
+
+
+/**
+ * Set the read_only field of the given VDI.
+ */
+extern bool
+xen_vdi_set_read_only(xen_session *session, xen_vdi vdi, bool read_only);
+
+
+/**
+ * Set the other_config field of the given VDI.
+ */
+extern bool
+xen_vdi_set_other_config(xen_session *session, xen_vdi vdi, 
xen_string_string_map *other_config);
+
+
+/**
+ * Add the given key-value pair to the other_config field of the given
+ * VDI.
+ */
+extern bool
+xen_vdi_add_to_other_config(xen_session *session, xen_vdi vdi, char *key, char 
*value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * other_config field of the given VDI.  If the key is not in that Map, then
+ * do nothing.
+ */
+extern bool
+xen_vdi_remove_from_other_config(xen_session *session, xen_vdi vdi, char *key);
+
+
+/**
+ * Return a list of all the VDIs known to the system.
+ */
+extern bool
+xen_vdi_get_all(xen_session *session, struct xen_vdi_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_vdi_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vdi_decl.h       Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VDI_DECL_H
+#define XEN_VDI_DECL_H
+
+typedef void *xen_vdi;
+
+struct xen_vdi_set;
+struct xen_vdi_record;
+struct xen_vdi_record_set;
+struct xen_vdi_record_opt;
+struct xen_vdi_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_vdi_type.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vdi_type.h       Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VDI_TYPE_H
+#define XEN_VDI_TYPE_H
+
+
+#include <xen/api/xen_common.h>
+
+
+enum xen_vdi_type
+{
+    /**
+     * a disk that may be replaced on upgrade
+     */
+    XEN_VDI_TYPE_SYSTEM,
+
+    /**
+     * a disk that is always preserved on upgrade
+     */
+    XEN_VDI_TYPE_USER,
+
+    /**
+     * a disk that may be reformatted on upgrade
+     */
+    XEN_VDI_TYPE_EPHEMERAL,
+
+    /**
+     * a disk that stores a suspend image
+     */
+    XEN_VDI_TYPE_SUSPEND,
+
+    /**
+     * a disk that stores VM crashdump information
+     */
+    XEN_VDI_TYPE_CRASHDUMP
+};
+
+
+typedef struct xen_vdi_type_set
+{
+    size_t size;
+    enum xen_vdi_type contents[];
+} xen_vdi_type_set;
+
+/**
+ * Allocate a xen_vdi_type_set of the given size.
+ */
+extern xen_vdi_type_set *
+xen_vdi_type_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vdi_type_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_vdi_type_set_free(xen_vdi_type_set *set);
+
+
+/**
+ * Return the name corresponding to the given code.  This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_vdi_type_to_string(enum xen_vdi_type val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_vdi_type
+xen_vdi_type_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_vif.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vif.h    Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,365 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VIF_H
+#define XEN_VIF_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_network_decl.h>
+#include <xen/api/xen_string_set.h>
+#include <xen/api/xen_string_string_map.h>
+#include <xen/api/xen_vif_decl.h>
+#include <xen/api/xen_vif_metrics_decl.h>
+#include <xen/api/xen_vm_decl.h>
+
+
+/*
+ * The VIF class.
+ * 
+ * A virtual network interface.
+ */
+
+
+/**
+ * Free the given xen_vif.  The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_vif_free(xen_vif vif);
+
+
+typedef struct xen_vif_set
+{
+    size_t size;
+    xen_vif *contents[];
+} xen_vif_set;
+
+/**
+ * Allocate a xen_vif_set of the given size.
+ */
+extern xen_vif_set *
+xen_vif_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vif_set.  The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_vif_set_free(xen_vif_set *set);
+
+
+typedef struct xen_vif_record
+{
+    xen_vif handle;
+    char *uuid;
+    char *device;
+    struct xen_network_record_opt *network;
+    struct xen_vm_record_opt *vm;
+    char *mac;
+    int64_t mtu;
+    bool currently_attached;
+    int64_t status_code;
+    char *status_detail;
+    xen_string_string_map *runtime_properties;
+    char *qos_algorithm_type;
+    xen_string_string_map *qos_algorithm_params;
+    struct xen_string_set *qos_supported_algorithms;
+    struct xen_vif_metrics_record_opt *metrics;
+} xen_vif_record;
+
+/**
+ * Allocate a xen_vif_record.
+ */
+extern xen_vif_record *
+xen_vif_record_alloc(void);
+
+/**
+ * Free the given xen_vif_record, and all referenced values.  The given
+ * record must have been allocated by this library.
+ */
+extern void
+xen_vif_record_free(xen_vif_record *record);
+
+
+typedef struct xen_vif_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_vif handle;
+        xen_vif_record *record;
+    } u;
+} xen_vif_record_opt;
+
+/**
+ * Allocate a xen_vif_record_opt.
+ */
+extern xen_vif_record_opt *
+xen_vif_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vif_record_opt, and all referenced values.  The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vif_record_opt_free(xen_vif_record_opt *record_opt);
+
+
+typedef struct xen_vif_record_set
+{
+    size_t size;
+    xen_vif_record *contents[];
+} xen_vif_record_set;
+
+/**
+ * Allocate a xen_vif_record_set of the given size.
+ */
+extern xen_vif_record_set *
+xen_vif_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vif_record_set, and all referenced values.  The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_vif_record_set_free(xen_vif_record_set *set);
+
+
+
+typedef struct xen_vif_record_opt_set
+{
+    size_t size;
+    xen_vif_record_opt *contents[];
+} xen_vif_record_opt_set;
+
+/**
+ * Allocate a xen_vif_record_opt_set of the given size.
+ */
+extern xen_vif_record_opt_set *
+xen_vif_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vif_record_opt_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_vif_record_opt_set_free(xen_vif_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given VIF.
+ */
+extern bool
+xen_vif_get_record(xen_session *session, xen_vif_record **result, xen_vif vif);
+
+
+/**
+ * Get a reference to the VIF instance with the specified UUID.
+ */
+extern bool
+xen_vif_get_by_uuid(xen_session *session, xen_vif *result, char *uuid);
+
+
+/**
+ * Create a new VIF instance, and return its handle.
+ */
+extern bool
+xen_vif_create(xen_session *session, xen_vif *result, xen_vif_record *record);
+
+
+/**
+ * Destroy the specified VIF instance.
+ */
+extern bool
+xen_vif_destroy(xen_session *session, xen_vif vif);
+
+
+/**
+ * Get the uuid field of the given VIF.
+ */
+extern bool
+xen_vif_get_uuid(xen_session *session, char **result, xen_vif vif);
+
+
+/**
+ * Get the device field of the given VIF.
+ */
+extern bool
+xen_vif_get_device(xen_session *session, char **result, xen_vif vif);
+
+
+/**
+ * Get the network field of the given VIF.
+ */
+extern bool
+xen_vif_get_network(xen_session *session, xen_network *result, xen_vif vif);
+
+
+/**
+ * Get the VM field of the given VIF.
+ */
+extern bool
+xen_vif_get_vm(xen_session *session, xen_vm *result, xen_vif vif);
+
+
+/**
+ * Get the MAC field of the given VIF.
+ */
+extern bool
+xen_vif_get_mac(xen_session *session, char **result, xen_vif vif);
+
+
+/**
+ * Get the MTU field of the given VIF.
+ */
+extern bool
+xen_vif_get_mtu(xen_session *session, int64_t *result, xen_vif vif);
+
+
+/**
+ * Get the currently_attached field of the given VIF.
+ */
+extern bool
+xen_vif_get_currently_attached(xen_session *session, bool *result, xen_vif 
vif);
+
+
+/**
+ * Get the status_code field of the given VIF.
+ */
+extern bool
+xen_vif_get_status_code(xen_session *session, int64_t *result, xen_vif vif);
+
+
+/**
+ * Get the status_detail field of the given VIF.
+ */
+extern bool
+xen_vif_get_status_detail(xen_session *session, char **result, xen_vif vif);
+
+
+/**
+ * Get the runtime_properties field of the given VIF.
+ */
+extern bool
+xen_vif_get_runtime_properties(xen_session *session, xen_string_string_map 
**result, xen_vif vif);
+
+
+/**
+ * Get the qos/algorithm_type field of the given VIF.
+ */
+extern bool
+xen_vif_get_qos_algorithm_type(xen_session *session, char **result, xen_vif 
vif);
+
+
+/**
+ * Get the qos/algorithm_params field of the given VIF.
+ */
+extern bool
+xen_vif_get_qos_algorithm_params(xen_session *session, xen_string_string_map 
**result, xen_vif vif);
+
+
+/**
+ * Get the qos/supported_algorithms field of the given VIF.
+ */
+extern bool
+xen_vif_get_qos_supported_algorithms(xen_session *session, struct 
xen_string_set **result, xen_vif vif);
+
+
+/**
+ * Get the metrics field of the given VIF.
+ */
+extern bool
+xen_vif_get_metrics(xen_session *session, xen_vif_metrics *result, xen_vif 
vif);
+
+
+/**
+ * Set the device field of the given VIF.
+ */
+extern bool
+xen_vif_set_device(xen_session *session, xen_vif vif, char *device);
+
+
+/**
+ * Set the MAC field of the given VIF.
+ */
+extern bool
+xen_vif_set_mac(xen_session *session, xen_vif vif, char *mac);
+
+
+/**
+ * Set the MTU field of the given VIF.
+ */
+extern bool
+xen_vif_set_mtu(xen_session *session, xen_vif vif, int64_t mtu);
+
+
+/**
+ * Set the qos/algorithm_type field of the given VIF.
+ */
+extern bool
+xen_vif_set_qos_algorithm_type(xen_session *session, xen_vif vif, char 
*algorithm_type);
+
+
+/**
+ * Set the qos/algorithm_params field of the given VIF.
+ */
+extern bool
+xen_vif_set_qos_algorithm_params(xen_session *session, xen_vif vif, 
xen_string_string_map *algorithm_params);
+
+
+/**
+ * Add the given key-value pair to the qos/algorithm_params field of
+ * the given VIF.
+ */
+extern bool
+xen_vif_add_to_qos_algorithm_params(xen_session *session, xen_vif vif, char 
*key, char *value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * qos/algorithm_params field of the given VIF.  If the key is not in that
+ * Map, then do nothing.
+ */
+extern bool
+xen_vif_remove_from_qos_algorithm_params(xen_session *session, xen_vif vif, 
char *key);
+
+
+/**
+ * Hotplug the specified VIF, dynamically attaching it to the running
+ * VM.
+ */
+extern bool
+xen_vif_plug(xen_session *session, xen_vif self);
+
+
+/**
+ * Hot-unplug the specified VIF, dynamically unattaching it from the
+ * running VM.
+ */
+extern bool
+xen_vif_unplug(xen_session *session, xen_vif self);
+
+
+/**
+ * Return a list of all the VIFs known to the system.
+ */
+extern bool
+xen_vif_get_all(xen_session *session, struct xen_vif_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_vif_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vif_decl.h       Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VIF_DECL_H
+#define XEN_VIF_DECL_H
+
+typedef void *xen_vif;
+
+struct xen_vif_set;
+struct xen_vif_record;
+struct xen_vif_record_set;
+struct xen_vif_record_opt;
+struct xen_vif_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_vif_metrics.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vif_metrics.h    Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VIF_METRICS_H
+#define XEN_VIF_METRICS_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_vif_metrics_decl.h>
+
+
+/*
+ * The VIF_metrics class.
+ * 
+ * The metrics associated with a virtual network device.
+ */
+
+
+/**
+ * Free the given xen_vif_metrics.  The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_vif_metrics_free(xen_vif_metrics vif_metrics);
+
+
+typedef struct xen_vif_metrics_set
+{
+    size_t size;
+    xen_vif_metrics *contents[];
+} xen_vif_metrics_set;
+
+/**
+ * Allocate a xen_vif_metrics_set of the given size.
+ */
+extern xen_vif_metrics_set *
+xen_vif_metrics_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vif_metrics_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_vif_metrics_set_free(xen_vif_metrics_set *set);
+
+
+typedef struct xen_vif_metrics_record
+{
+    xen_vif_metrics handle;
+    char *uuid;
+    double io_read_kbs;
+    double io_write_kbs;
+    time_t last_updated;
+} xen_vif_metrics_record;
+
+/**
+ * Allocate a xen_vif_metrics_record.
+ */
+extern xen_vif_metrics_record *
+xen_vif_metrics_record_alloc(void);
+
+/**
+ * Free the given xen_vif_metrics_record, and all referenced values. 
+ * The given record must have been allocated by this library.
+ */
+extern void
+xen_vif_metrics_record_free(xen_vif_metrics_record *record);
+
+
+typedef struct xen_vif_metrics_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_vif_metrics handle;
+        xen_vif_metrics_record *record;
+    } u;
+} xen_vif_metrics_record_opt;
+
+/**
+ * Allocate a xen_vif_metrics_record_opt.
+ */
+extern xen_vif_metrics_record_opt *
+xen_vif_metrics_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vif_metrics_record_opt, and all referenced
+ * values.  The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vif_metrics_record_opt_free(xen_vif_metrics_record_opt *record_opt);
+
+
+typedef struct xen_vif_metrics_record_set
+{
+    size_t size;
+    xen_vif_metrics_record *contents[];
+} xen_vif_metrics_record_set;
+
+/**
+ * Allocate a xen_vif_metrics_record_set of the given size.
+ */
+extern xen_vif_metrics_record_set *
+xen_vif_metrics_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vif_metrics_record_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_vif_metrics_record_set_free(xen_vif_metrics_record_set *set);
+
+
+
+typedef struct xen_vif_metrics_record_opt_set
+{
+    size_t size;
+    xen_vif_metrics_record_opt *contents[];
+} xen_vif_metrics_record_opt_set;
+
+/**
+ * Allocate a xen_vif_metrics_record_opt_set of the given size.
+ */
+extern xen_vif_metrics_record_opt_set *
+xen_vif_metrics_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vif_metrics_record_opt_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_vif_metrics_record_opt_set_free(xen_vif_metrics_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given VIF_metrics.
+ */
+extern bool
+xen_vif_metrics_get_record(xen_session *session, xen_vif_metrics_record 
**result, xen_vif_metrics vif_metrics);
+
+
+/**
+ * Get a reference to the VIF_metrics instance with the specified UUID.
+ */
+extern bool
+xen_vif_metrics_get_by_uuid(xen_session *session, xen_vif_metrics *result, 
char *uuid);
+
+
+/**
+ * Get the uuid field of the given VIF_metrics.
+ */
+extern bool
+xen_vif_metrics_get_uuid(xen_session *session, char **result, xen_vif_metrics 
vif_metrics);
+
+
+/**
+ * Get the io/read_kbs field of the given VIF_metrics.
+ */
+extern bool
+xen_vif_metrics_get_io_read_kbs(xen_session *session, double *result, 
xen_vif_metrics vif_metrics);
+
+
+/**
+ * Get the io/write_kbs field of the given VIF_metrics.
+ */
+extern bool
+xen_vif_metrics_get_io_write_kbs(xen_session *session, double *result, 
xen_vif_metrics vif_metrics);
+
+
+/**
+ * Get the last_updated field of the given VIF_metrics.
+ */
+extern bool
+xen_vif_metrics_get_last_updated(xen_session *session, time_t *result, 
xen_vif_metrics vif_metrics);
+
+
+/**
+ * Return a list of all the VIF_metrics instances known to the system.
+ */
+extern bool
+xen_vif_metrics_get_all(xen_session *session, struct xen_vif_metrics_set 
**result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_vif_metrics_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vif_metrics_decl.h       Tue Apr 24 
21:39:23 2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VIF_METRICS_DECL_H
+#define XEN_VIF_METRICS_DECL_H
+
+typedef void *xen_vif_metrics;
+
+struct xen_vif_metrics_set;
+struct xen_vif_metrics_record;
+struct xen_vif_metrics_record_set;
+struct xen_vif_metrics_record_opt;
+struct xen_vif_metrics_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_vm.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vm.h     Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,894 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VM_H
+#define XEN_VM_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_console_decl.h>
+#include <xen/api/xen_crashdump_decl.h>
+#include <xen/api/xen_host_decl.h>
+#include <xen/api/xen_on_crash_behaviour.h>
+#include <xen/api/xen_on_normal_exit.h>
+#include <xen/api/xen_string_string_map.h>
+#include <xen/api/xen_vbd_decl.h>
+#include <xen/api/xen_vdi_decl.h>
+#include <xen/api/xen_vif_decl.h>
+#include <xen/api/xen_vm_decl.h>
+#include <xen/api/xen_vm_guest_metrics_decl.h>
+#include <xen/api/xen_vm_metrics_decl.h>
+#include <xen/api/xen_vm_power_state.h>
+#include <xen/api/xen_vtpm_decl.h>
+
+
+/*
+ * The VM class.
+ * 
+ * A virtual machine (or 'guest').
+ */
+
+
+/**
+ * Free the given xen_vm.  The given handle must have been allocated by
+ * this library.
+ */
+extern void
+xen_vm_free(xen_vm vm);
+
+
+typedef struct xen_vm_set
+{
+    size_t size;
+    xen_vm *contents[];
+} xen_vm_set;
+
+/**
+ * Allocate a xen_vm_set of the given size.
+ */
+extern xen_vm_set *
+xen_vm_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_set.  The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_vm_set_free(xen_vm_set *set);
+
+
+typedef struct xen_vm_record
+{
+    xen_vm handle;
+    char *uuid;
+    enum xen_vm_power_state power_state;
+    char *name_label;
+    char *name_description;
+    int64_t user_version;
+    bool is_a_template;
+    bool auto_power_on;
+    struct xen_vdi_record_opt *suspend_vdi;
+    struct xen_host_record_opt *resident_on;
+    int64_t memory_static_max;
+    int64_t memory_dynamic_max;
+    int64_t memory_dynamic_min;
+    int64_t memory_static_min;
+    xen_string_string_map *vcpus_params;
+    int64_t vcpus_max;
+    int64_t vcpus_at_startup;
+    enum xen_on_normal_exit actions_after_shutdown;
+    enum xen_on_normal_exit actions_after_reboot;
+    enum xen_on_crash_behaviour actions_after_crash;
+    struct xen_console_record_opt_set *consoles;
+    struct xen_vif_record_opt_set *vifs;
+    struct xen_vbd_record_opt_set *vbds;
+    struct xen_crashdump_record_opt_set *crash_dumps;
+    struct xen_vtpm_record_opt_set *vtpms;
+    char *pv_bootloader;
+    char *pv_kernel;
+    char *pv_ramdisk;
+    char *pv_args;
+    char *pv_bootloader_args;
+    char *hvm_boot_policy;
+    xen_string_string_map *hvm_boot_params;
+    xen_string_string_map *platform;
+    char *pci_bus;
+    xen_string_string_map *other_config;
+    int64_t domid;
+    bool is_control_domain;
+    struct xen_vm_metrics_record_opt *metrics;
+    struct xen_vm_guest_metrics_record_opt *guest_metrics;
+} xen_vm_record;
+
+/**
+ * Allocate a xen_vm_record.
+ */
+extern xen_vm_record *
+xen_vm_record_alloc(void);
+
+/**
+ * Free the given xen_vm_record, and all referenced values.  The given
+ * record must have been allocated by this library.
+ */
+extern void
+xen_vm_record_free(xen_vm_record *record);
+
+
+typedef struct xen_vm_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_vm handle;
+        xen_vm_record *record;
+    } u;
+} xen_vm_record_opt;
+
+/**
+ * Allocate a xen_vm_record_opt.
+ */
+extern xen_vm_record_opt *
+xen_vm_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vm_record_opt, and all referenced values.  The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vm_record_opt_free(xen_vm_record_opt *record_opt);
+
+
+typedef struct xen_vm_record_set
+{
+    size_t size;
+    xen_vm_record *contents[];
+} xen_vm_record_set;
+
+/**
+ * Allocate a xen_vm_record_set of the given size.
+ */
+extern xen_vm_record_set *
+xen_vm_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_record_set, and all referenced values.  The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_vm_record_set_free(xen_vm_record_set *set);
+
+
+
+typedef struct xen_vm_record_opt_set
+{
+    size_t size;
+    xen_vm_record_opt *contents[];
+} xen_vm_record_opt_set;
+
+/**
+ * Allocate a xen_vm_record_opt_set of the given size.
+ */
+extern xen_vm_record_opt_set *
+xen_vm_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_record_opt_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_vm_record_opt_set_free(xen_vm_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given VM.
+ */
+extern bool
+xen_vm_get_record(xen_session *session, xen_vm_record **result, xen_vm vm);
+
+
+/**
+ * Get a reference to the VM instance with the specified UUID.
+ */
+extern bool
+xen_vm_get_by_uuid(xen_session *session, xen_vm *result, char *uuid);
+
+
+/**
+ * Create a new VM instance, and return its handle.
+ */
+extern bool
+xen_vm_create(xen_session *session, xen_vm *result, xen_vm_record *record);
+
+
+/**
+ * Destroy the specified VM.  The VM is completely removed from the
+ * system.  This function can only be called when the VM is in the Halted
+ * State.
+ */
+extern bool
+xen_vm_destroy(xen_session *session, xen_vm vm);
+
+
+/**
+ * Get all the VM instances with the given label.
+ */
+extern bool
+xen_vm_get_by_name_label(xen_session *session, struct xen_vm_set **result, 
char *label);
+
+
+/**
+ * Get the uuid field of the given VM.
+ */
+extern bool
+xen_vm_get_uuid(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the power_state field of the given VM.
+ */
+extern bool
+xen_vm_get_power_state(xen_session *session, enum xen_vm_power_state *result, 
xen_vm vm);
+
+
+/**
+ * Get the name/label field of the given VM.
+ */
+extern bool
+xen_vm_get_name_label(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the name/description field of the given VM.
+ */
+extern bool
+xen_vm_get_name_description(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the user_version field of the given VM.
+ */
+extern bool
+xen_vm_get_user_version(xen_session *session, int64_t *result, xen_vm vm);
+
+
+/**
+ * Get the is_a_template field of the given VM.
+ */
+extern bool
+xen_vm_get_is_a_template(xen_session *session, bool *result, xen_vm vm);
+
+
+/**
+ * Get the auto_power_on field of the given VM.
+ */
+extern bool
+xen_vm_get_auto_power_on(xen_session *session, bool *result, xen_vm vm);
+
+
+/**
+ * Get the suspend_VDI field of the given VM.
+ */
+extern bool
+xen_vm_get_suspend_vdi(xen_session *session, xen_vdi *result, xen_vm vm);
+
+
+/**
+ * Get the resident_on field of the given VM.
+ */
+extern bool
+xen_vm_get_resident_on(xen_session *session, xen_host *result, xen_vm vm);
+
+
+/**
+ * Get the memory/static_max field of the given VM.
+ */
+extern bool
+xen_vm_get_memory_static_max(xen_session *session, int64_t *result, xen_vm vm);
+
+
+/**
+ * Get the memory/dynamic_max field of the given VM.
+ */
+extern bool
+xen_vm_get_memory_dynamic_max(xen_session *session, int64_t *result, xen_vm 
vm);
+
+
+/**
+ * Get the memory/dynamic_min field of the given VM.
+ */
+extern bool
+xen_vm_get_memory_dynamic_min(xen_session *session, int64_t *result, xen_vm 
vm);
+
+
+/**
+ * Get the memory/static_min field of the given VM.
+ */
+extern bool
+xen_vm_get_memory_static_min(xen_session *session, int64_t *result, xen_vm vm);
+
+
+/**
+ * Get the VCPUs/params field of the given VM.
+ */
+extern bool
+xen_vm_get_vcpus_params(xen_session *session, xen_string_string_map **result, 
xen_vm vm);
+
+
+/**
+ * Get the VCPUs/max field of the given VM.
+ */
+extern bool
+xen_vm_get_vcpus_max(xen_session *session, int64_t *result, xen_vm vm);
+
+
+/**
+ * Get the VCPUs/at_startup field of the given VM.
+ */
+extern bool
+xen_vm_get_vcpus_at_startup(xen_session *session, int64_t *result, xen_vm vm);
+
+
+/**
+ * Get the actions/after_shutdown field of the given VM.
+ */
+extern bool
+xen_vm_get_actions_after_shutdown(xen_session *session, enum 
xen_on_normal_exit *result, xen_vm vm);
+
+
+/**
+ * Get the actions/after_reboot field of the given VM.
+ */
+extern bool
+xen_vm_get_actions_after_reboot(xen_session *session, enum xen_on_normal_exit 
*result, xen_vm vm);
+
+
+/**
+ * Get the actions/after_crash field of the given VM.
+ */
+extern bool
+xen_vm_get_actions_after_crash(xen_session *session, enum 
xen_on_crash_behaviour *result, xen_vm vm);
+
+
+/**
+ * Get the consoles field of the given VM.
+ */
+extern bool
+xen_vm_get_consoles(xen_session *session, struct xen_console_set **result, 
xen_vm vm);
+
+
+/**
+ * Get the VIFs field of the given VM.
+ */
+extern bool
+xen_vm_get_vifs(xen_session *session, struct xen_vif_set **result, xen_vm vm);
+
+
+/**
+ * Get the VBDs field of the given VM.
+ */
+extern bool
+xen_vm_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vm vm);
+
+
+/**
+ * Get the crash_dumps field of the given VM.
+ */
+extern bool
+xen_vm_get_crash_dumps(xen_session *session, struct xen_crashdump_set 
**result, xen_vm vm);
+
+
+/**
+ * Get the VTPMs field of the given VM.
+ */
+extern bool
+xen_vm_get_vtpms(xen_session *session, struct xen_vtpm_set **result, xen_vm 
vm);
+
+
+/**
+ * Get the PV/bootloader field of the given VM.
+ */
+extern bool
+xen_vm_get_pv_bootloader(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the PV/kernel field of the given VM.
+ */
+extern bool
+xen_vm_get_pv_kernel(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the PV/ramdisk field of the given VM.
+ */
+extern bool
+xen_vm_get_pv_ramdisk(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the PV/args field of the given VM.
+ */
+extern bool
+xen_vm_get_pv_args(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the PV/bootloader_args field of the given VM.
+ */
+extern bool
+xen_vm_get_pv_bootloader_args(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the HVM/boot_policy field of the given VM.
+ */
+extern bool
+xen_vm_get_hvm_boot_policy(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the HVM/boot_params field of the given VM.
+ */
+extern bool
+xen_vm_get_hvm_boot_params(xen_session *session, xen_string_string_map 
**result, xen_vm vm);
+
+
+/**
+ * Get the platform field of the given VM.
+ */
+extern bool
+xen_vm_get_platform(xen_session *session, xen_string_string_map **result, 
xen_vm vm);
+
+
+/**
+ * Get the PCI_bus field of the given VM.
+ */
+extern bool
+xen_vm_get_pci_bus(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the other_config field of the given VM.
+ */
+extern bool
+xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, 
xen_vm vm);
+
+
+/**
+ * Get the domid field of the given VM.
+ */
+extern bool
+xen_vm_get_domid(xen_session *session, int64_t *result, xen_vm vm);
+
+
+/**
+ * Get the is_control_domain field of the given VM.
+ */
+extern bool
+xen_vm_get_is_control_domain(xen_session *session, bool *result, xen_vm vm);
+
+
+/**
+ * Get the metrics field of the given VM.
+ */
+extern bool
+xen_vm_get_metrics(xen_session *session, xen_vm_metrics *result, xen_vm vm);
+
+
+/**
+ * Get the guest_metrics field of the given VM.
+ */
+extern bool
+xen_vm_get_guest_metrics(xen_session *session, xen_vm_guest_metrics *result, 
xen_vm vm);
+
+
+/**
+ * Set the name/label field of the given VM.
+ */
+extern bool
+xen_vm_set_name_label(xen_session *session, xen_vm vm, char *label);
+
+
+/**
+ * Set the name/description field of the given VM.
+ */
+extern bool
+xen_vm_set_name_description(xen_session *session, xen_vm vm, char 
*description);
+
+
+/**
+ * Set the user_version field of the given VM.
+ */
+extern bool
+xen_vm_set_user_version(xen_session *session, xen_vm vm, int64_t user_version);
+
+
+/**
+ * Set the is_a_template field of the given VM.
+ */
+extern bool
+xen_vm_set_is_a_template(xen_session *session, xen_vm vm, bool is_a_template);
+
+
+/**
+ * Set the auto_power_on field of the given VM.
+ */
+extern bool
+xen_vm_set_auto_power_on(xen_session *session, xen_vm vm, bool auto_power_on);
+
+
+/**
+ * Set the memory/static_max field of the given VM.
+ */
+extern bool
+xen_vm_set_memory_static_max(xen_session *session, xen_vm vm, int64_t 
static_max);
+
+
+/**
+ * Set the memory/dynamic_max field of the given VM.
+ */
+extern bool
+xen_vm_set_memory_dynamic_max(xen_session *session, xen_vm vm, int64_t 
dynamic_max);
+
+
+/**
+ * Set the memory/dynamic_min field of the given VM.
+ */
+extern bool
+xen_vm_set_memory_dynamic_min(xen_session *session, xen_vm vm, int64_t 
dynamic_min);
+
+
+/**
+ * Set the memory/static_min field of the given VM.
+ */
+extern bool
+xen_vm_set_memory_static_min(xen_session *session, xen_vm vm, int64_t 
static_min);
+
+
+/**
+ * Set the VCPUs/params field of the given VM.
+ */
+extern bool
+xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, xen_string_string_map 
*params);
+
+
+/**
+ * Add the given key-value pair to the VCPUs/params field of the given
+ * VM.
+ */
+extern bool
+xen_vm_add_to_vcpus_params(xen_session *session, xen_vm vm, char *key, char 
*value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * VCPUs/params field of the given VM.  If the key is not in that Map, then do
+ * nothing.
+ */
+extern bool
+xen_vm_remove_from_vcpus_params(xen_session *session, xen_vm vm, char *key);
+
+
+/**
+ * Set the VCPUs/max field of the given VM.
+ */
+extern bool
+xen_vm_set_vcpus_max(xen_session *session, xen_vm vm, int64_t max);
+
+
+/**
+ * Set the VCPUs/at_startup field of the given VM.
+ */
+extern bool
+xen_vm_set_vcpus_at_startup(xen_session *session, xen_vm vm, int64_t 
at_startup);
+
+
+/**
+ * Set the actions/after_shutdown field of the given VM.
+ */
+extern bool
+xen_vm_set_actions_after_shutdown(xen_session *session, xen_vm vm, enum 
xen_on_normal_exit after_shutdown);
+
+
+/**
+ * Set the actions/after_reboot field of the given VM.
+ */
+extern bool
+xen_vm_set_actions_after_reboot(xen_session *session, xen_vm vm, enum 
xen_on_normal_exit after_reboot);
+
+
+/**
+ * Set the actions/after_crash field of the given VM.
+ */
+extern bool
+xen_vm_set_actions_after_crash(xen_session *session, xen_vm vm, enum 
xen_on_crash_behaviour after_crash);
+
+
+/**
+ * Set the PV/bootloader field of the given VM.
+ */
+extern bool
+xen_vm_set_pv_bootloader(xen_session *session, xen_vm vm, char *bootloader);
+
+
+/**
+ * Set the PV/kernel field of the given VM.
+ */
+extern bool
+xen_vm_set_pv_kernel(xen_session *session, xen_vm vm, char *kernel);
+
+
+/**
+ * Set the PV/ramdisk field of the given VM.
+ */
+extern bool
+xen_vm_set_pv_ramdisk(xen_session *session, xen_vm vm, char *ramdisk);
+
+
+/**
+ * Set the PV/args field of the given VM.
+ */
+extern bool
+xen_vm_set_pv_args(xen_session *session, xen_vm vm, char *args);
+
+
+/**
+ * Set the PV/bootloader_args field of the given VM.
+ */
+extern bool
+xen_vm_set_pv_bootloader_args(xen_session *session, xen_vm vm, char 
*bootloader_args);
+
+
+/**
+ * Set the HVM/boot_policy field of the given VM.
+ */
+extern bool
+xen_vm_set_hvm_boot_policy(xen_session *session, xen_vm vm, char *boot_policy);
+
+
+/**
+ * Set the HVM/boot_params field of the given VM.
+ */
+extern bool
+xen_vm_set_hvm_boot_params(xen_session *session, xen_vm vm, 
xen_string_string_map *boot_params);
+
+
+/**
+ * Add the given key-value pair to the HVM/boot_params field of the
+ * given VM.
+ */
+extern bool
+xen_vm_add_to_hvm_boot_params(xen_session *session, xen_vm vm, char *key, char 
*value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * HVM/boot_params field of the given VM.  If the key is not in that Map, then
+ * do nothing.
+ */
+extern bool
+xen_vm_remove_from_hvm_boot_params(xen_session *session, xen_vm vm, char *key);
+
+
+/**
+ * Set the platform field of the given VM.
+ */
+extern bool
+xen_vm_set_platform(xen_session *session, xen_vm vm, xen_string_string_map 
*platform);
+
+
+/**
+ * Add the given key-value pair to the platform field of the given VM.
+ */
+extern bool
+xen_vm_add_to_platform(xen_session *session, xen_vm vm, char *key, char 
*value);
+
+
+/**
+ * Remove the given key and its corresponding value from the platform
+ * field of the given VM.  If the key is not in that Map, then do nothing.
+ */
+extern bool
+xen_vm_remove_from_platform(xen_session *session, xen_vm vm, char *key);
+
+
+/**
+ * Set the PCI_bus field of the given VM.
+ */
+extern bool
+xen_vm_set_pci_bus(xen_session *session, xen_vm vm, char *pci_bus);
+
+
+/**
+ * Set the other_config field of the given VM.
+ */
+extern bool
+xen_vm_set_other_config(xen_session *session, xen_vm vm, xen_string_string_map 
*other_config);
+
+
+/**
+ * Add the given key-value pair to the other_config field of the given
+ * VM.
+ */
+extern bool
+xen_vm_add_to_other_config(xen_session *session, xen_vm vm, char *key, char 
*value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * other_config field of the given VM.  If the key is not in that Map, then do
+ * nothing.
+ */
+extern bool
+xen_vm_remove_from_other_config(xen_session *session, xen_vm vm, char *key);
+
+
+/**
+ * Clones the specified VM, making a new VM. Clone automatically
+ * exploits the capabilities of the underlying storage repository in which the
+ * VM's disk images are stored (e.g. Copy on Write).   This function can only
+ * be called when the VM is in the Halted State.
+ */
+extern bool
+xen_vm_clone(xen_session *session, xen_vm *result, xen_vm vm, char *new_name);
+
+
+/**
+ * Start the specified VM.  This function can only be called with the
+ * VM is in the Halted State.
+ */
+extern bool
+xen_vm_start(xen_session *session, xen_vm vm, bool start_paused);
+
+
+/**
+ * Pause the specified VM. This can only be called when the specified
+ * VM is in the Running state.
+ */
+extern bool
+xen_vm_pause(xen_session *session, xen_vm vm);
+
+
+/**
+ * Resume the specified VM. This can only be called when the specified
+ * VM is in the Paused state.
+ */
+extern bool
+xen_vm_unpause(xen_session *session, xen_vm vm);
+
+
+/**
+ * Attempt to cleanly shutdown the specified VM. (Note: this may not be
+ * supported---e.g. if a guest agent is not installed).
+ * 
+ * Once shutdown has been completed perform poweroff action specified in guest
+ * configuration.
+ * 
+ * This can only be called when the specified VM is in the Running state.
+ */
+extern bool
+xen_vm_clean_shutdown(xen_session *session, xen_vm vm);
+
+
+/**
+ * Attempt to cleanly shutdown the specified VM (Note: this may not be
+ * supported---e.g. if a guest agent is not installed).
+ * 
+ * Once shutdown has been completed perform reboot action specified in guest
+ * configuration.
+ * 
+ * This can only be called when the specified VM is in the Running state.
+ */
+extern bool
+xen_vm_clean_reboot(xen_session *session, xen_vm vm);
+
+
+/**
+ * Stop executing the specified VM without attempting a clean shutdown.
+ * Then perform poweroff action specified in VM configuration.
+ */
+extern bool
+xen_vm_hard_shutdown(xen_session *session, xen_vm vm);
+
+
+/**
+ * Stop executing the specified VM without attempting a clean shutdown.
+ * Then perform reboot action specified in VM configuration
+ */
+extern bool
+xen_vm_hard_reboot(xen_session *session, xen_vm vm);
+
+
+/**
+ * Suspend the specified VM to disk.  This can only be called when the
+ * specified VM is in the Running state.
+ */
+extern bool
+xen_vm_suspend(xen_session *session, xen_vm vm);
+
+
+/**
+ * Awaken the specified VM and resume it.  This can only be called when
+ * the specified VM is in the Suspended state.
+ */
+extern bool
+xen_vm_resume(xen_session *session, xen_vm vm, bool start_paused);
+
+
+/**
+ * Set this VM's VCPUs/at_startup value, and set the same value on the
+ * VM, if running
+ */
+extern bool
+xen_vm_set_vcpus_number_live(xen_session *session, xen_vm self, int64_t nvcpu);
+
+
+/**
+ * Add the given key-value pair to VM.VCPUs_params, and apply that
+ * value on the running VM.
+ */
+extern bool
+xen_vm_add_to_vcpus_params_live(xen_session *session, xen_vm self, char *key, 
char *value);
+
+
+/**
+ * Set memory_dynamic_max in database and on running VM.
+ */
+extern bool
+xen_vm_set_memory_dynamic_max_live(xen_session *session, xen_vm self, int64_t 
max);
+
+
+/**
+ * Set memory_dynamic_min in database and on running VM.
+ */
+extern bool
+xen_vm_set_memory_dynamic_min_live(xen_session *session, xen_vm self, int64_t 
min);
+
+
+/**
+ * Send the given key as a sysrq to this VM.  The key is specified as a
+ * single character (a String of length 1).  This can only be called when the
+ * specified VM is in the Running state.
+ */
+extern bool
+xen_vm_send_sysrq(xen_session *session, xen_vm vm, char *key);
+
+
+/**
+ * Send the named trigger to this VM.  This can only be called when the
+ * specified VM is in the Running state.
+ */
+extern bool
+xen_vm_send_trigger(xen_session *session, xen_vm vm, char *trigger);
+
+
+/**
+ * Migrate the VM to another host.  This can only be called when the
+ * specified VM is in the Running state.
+ */
+extern bool
+xen_vm_migrate(xen_session *session, xen_vm vm, char *dest, bool live, 
xen_string_string_map *options);
+
+
+/**
+ * Return a list of all the VMs known to the system.
+ */
+extern bool
+xen_vm_get_all(xen_session *session, struct xen_vm_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_vm_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vm_decl.h        Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VM_DECL_H
+#define XEN_VM_DECL_H
+
+typedef void *xen_vm;
+
+struct xen_vm_set;
+struct xen_vm_record;
+struct xen_vm_record_set;
+struct xen_vm_record_opt;
+struct xen_vm_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_vm_guest_metrics.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vm_guest_metrics.h       Tue Apr 24 
21:39:23 2007 +0100
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VM_GUEST_METRICS_H
+#define XEN_VM_GUEST_METRICS_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_string_string_map.h>
+#include <xen/api/xen_vm_guest_metrics_decl.h>
+
+
+/*
+ * The VM_guest_metrics class.
+ * 
+ * The metrics reported by the guest (as opposed to inferred from outside).
+ */
+
+
+/**
+ * Free the given xen_vm_guest_metrics.  The given handle must have
+ * been allocated by this library.
+ */
+extern void
+xen_vm_guest_metrics_free(xen_vm_guest_metrics vm_guest_metrics);
+
+
+typedef struct xen_vm_guest_metrics_set
+{
+    size_t size;
+    xen_vm_guest_metrics *contents[];
+} xen_vm_guest_metrics_set;
+
+/**
+ * Allocate a xen_vm_guest_metrics_set of the given size.
+ */
+extern xen_vm_guest_metrics_set *
+xen_vm_guest_metrics_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_guest_metrics_set.  The given set must have
+ * been allocated by this library.
+ */
+extern void
+xen_vm_guest_metrics_set_free(xen_vm_guest_metrics_set *set);
+
+
+typedef struct xen_vm_guest_metrics_record
+{
+    xen_vm_guest_metrics handle;
+    char *uuid;
+    xen_string_string_map *os_version;
+    xen_string_string_map *pv_drivers_version;
+    xen_string_string_map *memory;
+    xen_string_string_map *disks;
+    xen_string_string_map *networks;
+    xen_string_string_map *other;
+    time_t last_updated;
+} xen_vm_guest_metrics_record;
+
+/**
+ * Allocate a xen_vm_guest_metrics_record.
+ */
+extern xen_vm_guest_metrics_record *
+xen_vm_guest_metrics_record_alloc(void);
+
+/**
+ * Free the given xen_vm_guest_metrics_record, and all referenced
+ * values.  The given record must have been allocated by this library.
+ */
+extern void
+xen_vm_guest_metrics_record_free(xen_vm_guest_metrics_record *record);
+
+
+typedef struct xen_vm_guest_metrics_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_vm_guest_metrics handle;
+        xen_vm_guest_metrics_record *record;
+    } u;
+} xen_vm_guest_metrics_record_opt;
+
+/**
+ * Allocate a xen_vm_guest_metrics_record_opt.
+ */
+extern xen_vm_guest_metrics_record_opt *
+xen_vm_guest_metrics_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vm_guest_metrics_record_opt, and all referenced
+ * values.  The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vm_guest_metrics_record_opt_free(xen_vm_guest_metrics_record_opt 
*record_opt);
+
+
+typedef struct xen_vm_guest_metrics_record_set
+{
+    size_t size;
+    xen_vm_guest_metrics_record *contents[];
+} xen_vm_guest_metrics_record_set;
+
+/**
+ * Allocate a xen_vm_guest_metrics_record_set of the given size.
+ */
+extern xen_vm_guest_metrics_record_set *
+xen_vm_guest_metrics_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_guest_metrics_record_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_vm_guest_metrics_record_set_free(xen_vm_guest_metrics_record_set *set);
+
+
+
+typedef struct xen_vm_guest_metrics_record_opt_set
+{
+    size_t size;
+    xen_vm_guest_metrics_record_opt *contents[];
+} xen_vm_guest_metrics_record_opt_set;
+
+/**
+ * Allocate a xen_vm_guest_metrics_record_opt_set of the given size.
+ */
+extern xen_vm_guest_metrics_record_opt_set *
+xen_vm_guest_metrics_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_guest_metrics_record_opt_set, and all
+ * referenced values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_vm_guest_metrics_record_opt_set_free(xen_vm_guest_metrics_record_opt_set 
*set);
+
+
+/**
+ * Get a record containing the current state of the given
+ * VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_record(xen_session *session, 
xen_vm_guest_metrics_record **result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get a reference to the VM_guest_metrics instance with the specified
+ * UUID.
+ */
+extern bool
+xen_vm_guest_metrics_get_by_uuid(xen_session *session, xen_vm_guest_metrics 
*result, char *uuid);
+
+
+/**
+ * Get the uuid field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_uuid(xen_session *session, char **result, 
xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the os_version field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_os_version(xen_session *session, 
xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the PV_drivers_version field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_pv_drivers_version(xen_session *session, 
xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the memory field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_memory(xen_session *session, xen_string_string_map 
**result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the disks field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_disks(xen_session *session, xen_string_string_map 
**result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the networks field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_networks(xen_session *session, xen_string_string_map 
**result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the other field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_other(xen_session *session, xen_string_string_map 
**result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the last_updated field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_last_updated(xen_session *session, time_t *result, 
xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Return a list of all the VM_guest_metrics instances known to the
+ * system.
+ */
+extern bool
+xen_vm_guest_metrics_get_all(xen_session *session, struct 
xen_vm_guest_metrics_set **result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_vm_guest_metrics_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vm_guest_metrics_decl.h  Tue Apr 24 
21:39:23 2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VM_GUEST_METRICS_DECL_H
+#define XEN_VM_GUEST_METRICS_DECL_H
+
+typedef void *xen_vm_guest_metrics;
+
+struct xen_vm_guest_metrics_set;
+struct xen_vm_guest_metrics_record;
+struct xen_vm_guest_metrics_record_set;
+struct xen_vm_guest_metrics_record_opt;
+struct xen_vm_guest_metrics_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_vm_metrics.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vm_metrics.h     Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VM_METRICS_H
+#define XEN_VM_METRICS_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_int_float_map.h>
+#include <xen/api/xen_int_int_map.h>
+#include <xen/api/xen_int_string_set_map.h>
+#include <xen/api/xen_string_set.h>
+#include <xen/api/xen_string_string_map.h>
+#include <xen/api/xen_vm_metrics_decl.h>
+
+
+/*
+ * The VM_metrics class.
+ * 
+ * The metrics associated with a VM.
+ */
+
+
+/**
+ * Free the given xen_vm_metrics.  The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_vm_metrics_free(xen_vm_metrics vm_metrics);
+
+
+typedef struct xen_vm_metrics_set
+{
+    size_t size;
+    xen_vm_metrics *contents[];
+} xen_vm_metrics_set;
+
+/**
+ * Allocate a xen_vm_metrics_set of the given size.
+ */
+extern xen_vm_metrics_set *
+xen_vm_metrics_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_metrics_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_vm_metrics_set_free(xen_vm_metrics_set *set);
+
+
+typedef struct xen_vm_metrics_record
+{
+    xen_vm_metrics handle;
+    char *uuid;
+    int64_t memory_actual;
+    int64_t vcpus_number;
+    xen_int_float_map *vcpus_utilisation;
+    xen_int_int_map *vcpus_cpu;
+    xen_string_string_map *vcpus_params;
+    xen_int_string_set_map *vcpus_flags;
+    struct xen_string_set *state;
+    time_t start_time;
+    time_t last_updated;
+} xen_vm_metrics_record;
+
+/**
+ * Allocate a xen_vm_metrics_record.
+ */
+extern xen_vm_metrics_record *
+xen_vm_metrics_record_alloc(void);
+
+/**
+ * Free the given xen_vm_metrics_record, and all referenced values. 
+ * The given record must have been allocated by this library.
+ */
+extern void
+xen_vm_metrics_record_free(xen_vm_metrics_record *record);
+
+
+typedef struct xen_vm_metrics_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_vm_metrics handle;
+        xen_vm_metrics_record *record;
+    } u;
+} xen_vm_metrics_record_opt;
+
+/**
+ * Allocate a xen_vm_metrics_record_opt.
+ */
+extern xen_vm_metrics_record_opt *
+xen_vm_metrics_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vm_metrics_record_opt, and all referenced values.
+ *  The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vm_metrics_record_opt_free(xen_vm_metrics_record_opt *record_opt);
+
+
+typedef struct xen_vm_metrics_record_set
+{
+    size_t size;
+    xen_vm_metrics_record *contents[];
+} xen_vm_metrics_record_set;
+
+/**
+ * Allocate a xen_vm_metrics_record_set of the given size.
+ */
+extern xen_vm_metrics_record_set *
+xen_vm_metrics_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_metrics_record_set, and all referenced values.
+ *  The given set must have been allocated by this library.
+ */
+extern void
+xen_vm_metrics_record_set_free(xen_vm_metrics_record_set *set);
+
+
+
+typedef struct xen_vm_metrics_record_opt_set
+{
+    size_t size;
+    xen_vm_metrics_record_opt *contents[];
+} xen_vm_metrics_record_opt_set;
+
+/**
+ * Allocate a xen_vm_metrics_record_opt_set of the given size.
+ */
+extern xen_vm_metrics_record_opt_set *
+xen_vm_metrics_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_metrics_record_opt_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_vm_metrics_record_opt_set_free(xen_vm_metrics_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_record(xen_session *session, xen_vm_metrics_record 
**result, xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get a reference to the VM_metrics instance with the specified UUID.
+ */
+extern bool
+xen_vm_metrics_get_by_uuid(xen_session *session, xen_vm_metrics *result, char 
*uuid);
+
+
+/**
+ * Get the uuid field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_uuid(xen_session *session, char **result, xen_vm_metrics 
vm_metrics);
+
+
+/**
+ * Get the memory/actual field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_memory_actual(xen_session *session, int64_t *result, 
xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the VCPUs/number field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_vcpus_number(xen_session *session, int64_t *result, 
xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the VCPUs/utilisation field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_vcpus_utilisation(xen_session *session, xen_int_float_map 
**result, xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the VCPUs/CPU field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_vcpus_cpu(xen_session *session, xen_int_int_map **result, 
xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the VCPUs/params field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_vcpus_params(xen_session *session, xen_string_string_map 
**result, xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the VCPUs/flags field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_vcpus_flags(xen_session *session, xen_int_string_set_map 
**result, xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the state field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_state(xen_session *session, struct xen_string_set **result, 
xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the start_time field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_start_time(xen_session *session, time_t *result, 
xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the last_updated field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_last_updated(xen_session *session, time_t *result, 
xen_vm_metrics vm_metrics);
+
+
+/**
+ * Return a list of all the VM_metrics instances known to the system.
+ */
+extern bool
+xen_vm_metrics_get_all(xen_session *session, struct xen_vm_metrics_set 
**result);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_vm_metrics_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vm_metrics_decl.h        Tue Apr 24 
21:39:23 2007 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VM_METRICS_DECL_H
+#define XEN_VM_METRICS_DECL_H
+
+typedef void *xen_vm_metrics;
+
+struct xen_vm_metrics_set;
+struct xen_vm_metrics_record;
+struct xen_vm_metrics_record_set;
+struct xen_vm_metrics_record_opt;
+struct xen_vm_metrics_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_vm_power_state.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vm_power_state.h Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VM_POWER_STATE_H
+#define XEN_VM_POWER_STATE_H
+
+
+#include <xen/api/xen_common.h>
+
+
+enum xen_vm_power_state
+{
+    /**
+     * Halted
+     */
+    XEN_VM_POWER_STATE_HALTED,
+
+    /**
+     * Paused
+     */
+    XEN_VM_POWER_STATE_PAUSED,
+
+    /**
+     * Running
+     */
+    XEN_VM_POWER_STATE_RUNNING,
+
+    /**
+     * Suspended
+     */
+    XEN_VM_POWER_STATE_SUSPENDED,
+
+    /**
+     * Some other unknown state
+     */
+    XEN_VM_POWER_STATE_UNKNOWN
+};
+
+
+typedef struct xen_vm_power_state_set
+{
+    size_t size;
+    enum xen_vm_power_state contents[];
+} xen_vm_power_state_set;
+
+/**
+ * Allocate a xen_vm_power_state_set of the given size.
+ */
+extern xen_vm_power_state_set *
+xen_vm_power_state_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_power_state_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_vm_power_state_set_free(xen_vm_power_state_set *set);
+
+
+/**
+ * Return the name corresponding to the given code.  This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_vm_power_state_to_string(enum xen_vm_power_state val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_vm_power_state
+xen_vm_power_state_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen/api/xen_vtpm.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vtpm.h   Tue Apr 24 21:39:23 2007 +0100
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ * Copyright (c) 2006, IBM Corp.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VTPM_H
+#define XEN_VTPM_H
+
+#include <xen/api/xen_common.h>
+#include <xen/api/xen_vm_decl.h>
+#include <xen/api/xen_vtpm_decl.h>
+
+
+/*
+ * The VTPM class.
+ * 
+ * A virtual TPM device.
+ */
+
+
+/**
+ * Free the given xen_vtpm.  The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_vtpm_free(xen_vtpm vtpm);
+
+
+typedef struct xen_vtpm_set
+{
+    size_t size;
+    xen_vtpm *contents[];
+} xen_vtpm_set;
+
+/**
+ * Allocate a xen_vtpm_set of the given size.
+ */
+extern xen_vtpm_set *
+xen_vtpm_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vtpm_set.  The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_vtpm_set_free(xen_vtpm_set *set);
+
+
+typedef struct xen_vtpm_record
+{
+    xen_vtpm handle;
+    char *uuid;
+    struct xen_vm_record_opt *vm;
+    struct xen_vm_record_opt *backend;
+} xen_vtpm_record;
+
+/**
+ * Allocate a xen_vtpm_record.
+ */
+extern xen_vtpm_record *
+xen_vtpm_record_alloc(void);
+
+/**
+ * Free the given xen_vtpm_record, and all referenced values.  The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_vtpm_record_free(xen_vtpm_record *record);
+
+
+typedef struct xen_vtpm_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_vtpm handle;
+        xen_vtpm_record *record;
+    } u;
+} xen_vtpm_record_opt;
+
+/**
+ * Allocate a xen_vtpm_record_opt.
+ */
+extern xen_vtpm_record_opt *
+xen_vtpm_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vtpm_record_opt, and all referenced values.  The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vtpm_record_opt_free(xen_vtpm_record_opt *record_opt);
+
+
+typedef struct xen_vtpm_record_set
+{
+    size_t size;
+    xen_vtpm_record *contents[];
+} xen_vtpm_record_set;
+
+/**
+ * Allocate a xen_vtpm_record_set of the given size.
+ */
+extern xen_vtpm_record_set *
+xen_vtpm_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vtpm_record_set, and all referenced values.  The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_vtpm_record_set_free(xen_vtpm_record_set *set);
+
+
+
+typedef struct xen_vtpm_record_opt_set
+{
+    size_t size;
+    xen_vtpm_record_opt *contents[];
+} xen_vtpm_record_opt_set;
+
+/**
+ * Allocate a xen_vtpm_record_opt_set of the given size.
+ */
+extern xen_vtpm_record_opt_set *
+xen_vtpm_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vtpm_record_opt_set, and all referenced values. 
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_vtpm_record_opt_set_free(xen_vtpm_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given VTPM.
+ */
+extern bool
+xen_vtpm_get_record(xen_session *session, xen_vtpm_record **result, xen_vtpm 
vtpm);
+
+
+/**
+ * Get a reference to the VTPM instance with the specified UUID.
+ */
+extern bool
+xen_vtpm_get_by_uuid(xen_session *session, xen_vtpm *result, char *uuid);
+
+
+/**
+ * Create a new VTPM instance, and return its handle.
+ */
+extern bool
+xen_vtpm_create(xen_session *session, xen_vtpm *result, xen_vtpm_record 
*record);
+
+
+/**
+ * Destroy the specified VTPM instance.
+ */
+extern bool
+xen_vtpm_destroy(xen_session *session, xen_vtpm vtpm);
+
+
+/**
+ * Get the uuid field of the given VTPM.
+ */
+extern bool
+xen_vtpm_get_uuid(xen_session *session, char **result, xen_vtpm vtpm);
+
+
+/**
+ * Get the VM field of the given VTPM.
+ */
+extern bool
+xen_vtpm_get_vm(xen_session *session, xen_vm *result, xen_vtpm vtpm);
+
+
+/**
+ * Get the backend field of the given VTPM.
+ */
+extern bool
+xen_vtpm_get_backend(xen_session *session, xen_vm *result, xen_vtpm vtpm);
+
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen/api/xen_vtpm_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen/api/xen_vtpm_decl.h      Tue Apr 24 21:39:23 
2007 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ * Copyright (c) 2006, IBM Corp.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_VTPM_DECL_H
+#define XEN_VTPM_DECL_H
+
+typedef void *xen_vtpm;
+
+struct xen_vtpm_set;
+struct xen_vtpm_record;
+struct xen_vtpm_record_set;
+struct xen_vtpm_record_opt;
+struct xen_vtpm_record_opt_set;
+
+#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen_common.h
--- a/tools/libxen/include/xen_common.h Tue Apr 24 09:26:32 2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
- * Copyright (c) 2006 XenSource, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-#ifndef XEN_COMMON_H
-#define XEN_COMMON_H
-
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <time.h>
-
-#include "xen_host_decl.h"
-
-
-typedef bool (*xen_result_func)(const void *data, size_t len,
-                                void *result_handle);
-
-
-/**
- * len does not include a terminating \0.
- */
-typedef int (*xen_call_func)(const void *, size_t len, void *user_handle,
-                             void *result_handle,
-                             xen_result_func result_func);
-
-
-typedef struct
-{
-    xen_call_func call_func;
-    void *handle;
-    const char *session_id;
-    bool ok;
-    char **error_description;
-    int error_description_count;
-} xen_session;
-
-
-typedef struct xen_session_record
-{
-    char *uuid;
-    struct xen_host_record_opt *this_host;
-    char *this_user;
-    time_t last_active;
-} xen_session_record;
-
-
-/**
- * Allocate a xen_session_record.
- */
-extern xen_session_record *
-xen_session_record_alloc(void);
-
-
-/**
- * Free the given xen_session_record, and all referenced values.  The
- * given record must have been allocated by this library.
- */
-extern void
-xen_session_record_free(xen_session_record *record);
-
-
-struct xen_task_;
-typedef struct xen_task_ * xen_task_id;
-
-
-typedef struct
-{
-    int progress;
-    long eta;
-    /* !!! RESULT */
-}  xen_task_status;
-
-
-typedef struct
-{
-    int major;
-    int minor;
-    int patch;
-    char *extraversion;
-} xen_version;
-
-
-/**
- * Free the given xen_version, and all referenced values.
- */
-extern void xen_version_free(xen_version *version);
-
-
-/**
- * Return the version of this client-side library.  This will be the major,
- * minor, and extraversion of the Xen release with which it was released,
- * plus the library's own version as the patch.
- */
-extern xen_version *xen_get_client_side_version();
-
-
-extern bool
-xen_uuid_string_to_bytes(char *uuid, char **bytes);
-
-
-extern bool
-xen_uuid_bytes_to_string(char *bytes, char **uuid);
-
-
-extern void
-xen_uuid_free(char *uuid);
-
-
-extern void
-xen_uuid_bytes_free(char *bytes);
-
-
-/**
- * Initialise this library.  Call this before starting to use this library.
- * Note that since this library depends upon libxml2, you should also call
- * xmlInitParser as appropriate for your program.
- */
-extern
-void xen_init(void);
-
-
-/**
- * Clear up this library.  Call when you have finished using this library.
- * Note that since this library depends upon libxml2, you should also call
- * xmlCleanupParser as appropriate for your program.
- */
-extern
-void xen_fini(void);
-
-
-/**
- * Log in at the server, and allocate a xen_session to represent this session.
- */
-extern xen_session *
-xen_session_login_with_password(xen_call_func call_func, void *handle,
-                                const char *uname, const char *pwd);
-
-
-/**
- * Log out at the server, and free the xen_session.
- */
-extern void
-xen_session_logout(xen_session *session);
-
-
-/**
- * Get the UUID of the second given session.  Set *result to point at a
- * string, yours to free.
- */
-extern bool
-xen_session_get_uuid(xen_session *session, char **result,
-                     xen_session *self_session);
-
-
-/**
- * Get the this_host field of the second given session.  Set *result to be a
- * handle to that host.
- */
-extern bool
-xen_session_get_this_host(xen_session *session, xen_host *result,
-                          xen_session *self_session);
-
-
-/**
- * Get the this_user field of the second given session.  Set *result to point
- * at a string, yours to free.
- */
-extern bool
-xen_session_get_this_user(xen_session *session, char **result,
-                          xen_session *self_session);
-
-
-/**
- * Get the last_active field of the given session, and place it in *result.
- */
-extern bool
-xen_session_get_last_active(xen_session *session, time_t *result,
-                            xen_session *self_session);
-
-/**
- * Get a record containing the current state of the second given session.
- */
-extern bool
-xen_session_get_record(xen_session *session, xen_session_record **result,
-                       xen_session *self_session);
-
-
-#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen_console.h
--- a/tools/libxen/include/xen_console.h        Tue Apr 24 09:26:32 2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +0,0 @@
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-#ifndef XEN_CONSOLE_H
-#define XEN_CONSOLE_H
-
-#include "xen_common.h"
-#include "xen_console_decl.h"
-#include "xen_console_protocol.h"
-#include "xen_string_string_map.h"
-#include "xen_vm_decl.h"
-
-
-/*
- * The console class.
- * 
- * A console.
- */
-
-
-/**
- * Free the given xen_console.  The given handle must have been
- * allocated by this library.
- */
-extern void
-xen_console_free(xen_console console);
-
-
-typedef struct xen_console_set
-{
-    size_t size;
-    xen_console *contents[];
-} xen_console_set;
-
-/**
- * Allocate a xen_console_set of the given size.
- */
-extern xen_console_set *
-xen_console_set_alloc(size_t size);
-
-/**
- * Free the given xen_console_set.  The given set must have been
- * allocated by this library.
- */
-extern void
-xen_console_set_free(xen_console_set *set);
-
-
-typedef struct xen_console_record
-{
-    xen_console handle;
-    char *uuid;
-    enum xen_console_protocol protocol;
-    char *location;
-    struct xen_vm_record_opt *vm;
-    xen_string_string_map *other_config;
-} xen_console_record;
-
-/**
- * Allocate a xen_console_record.
- */
-extern xen_console_record *
-xen_console_record_alloc(void);
-
-/**
- * Free the given xen_console_record, and all referenced values.  The
- * given record must have been allocated by this library.
- */
-extern void
-xen_console_record_free(xen_console_record *record);
-
-
-typedef struct xen_console_record_opt
-{
-    bool is_record;
-    union
-    {
-        xen_console handle;
-        xen_console_record *record;
-    } u;
-} xen_console_record_opt;
-
-/**
- * Allocate a xen_console_record_opt.
- */
-extern xen_console_record_opt *
-xen_console_record_opt_alloc(void);
-
-/**
- * Free the given xen_console_record_opt, and all referenced values. 
- * The given record_opt must have been allocated by this library.
- */
-extern void
-xen_console_record_opt_free(xen_console_record_opt *record_opt);
-
-
-typedef struct xen_console_record_set
-{
-    size_t size;
-    xen_console_record *contents[];
-} xen_console_record_set;
-
-/**
- * Allocate a xen_console_record_set of the given size.
- */
-extern xen_console_record_set *
-xen_console_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_console_record_set, and all referenced values. 
- * The given set must have been allocated by this library.
- */
-extern void
-xen_console_record_set_free(xen_console_record_set *set);
-
-
-
-typedef struct xen_console_record_opt_set
-{
-    size_t size;
-    xen_console_record_opt *contents[];
-} xen_console_record_opt_set;
-
-/**
- * Allocate a xen_console_record_opt_set of the given size.
- */
-extern xen_console_record_opt_set *
-xen_console_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_console_record_opt_set, and all referenced
- * values.  The given set must have been allocated by this library.
- */
-extern void
-xen_console_record_opt_set_free(xen_console_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given console.
- */
-extern bool
-xen_console_get_record(xen_session *session, xen_console_record **result, 
xen_console console);
-
-
-/**
- * Get a reference to the console instance with the specified UUID.
- */
-extern bool
-xen_console_get_by_uuid(xen_session *session, xen_console *result, char *uuid);
-
-
-/**
- * Create a new console instance, and return its handle.
- */
-extern bool
-xen_console_create(xen_session *session, xen_console *result, 
xen_console_record *record);
-
-
-/**
- * Destroy the specified console instance.
- */
-extern bool
-xen_console_destroy(xen_session *session, xen_console console);
-
-
-/**
- * Get the uuid field of the given console.
- */
-extern bool
-xen_console_get_uuid(xen_session *session, char **result, xen_console console);
-
-
-/**
- * Get the protocol field of the given console.
- */
-extern bool
-xen_console_get_protocol(xen_session *session, enum xen_console_protocol 
*result, xen_console console);
-
-
-/**
- * Get the location field of the given console.
- */
-extern bool
-xen_console_get_location(xen_session *session, char **result, xen_console 
console);
-
-
-/**
- * Get the VM field of the given console.
- */
-extern bool
-xen_console_get_vm(xen_session *session, xen_vm *result, xen_console console);
-
-
-/**
- * Get the other_config field of the given console.
- */
-extern bool
-xen_console_get_other_config(xen_session *session, xen_string_string_map 
**result, xen_console console);
-
-
-/**
- * Set the other_config field of the given console.
- */
-extern bool
-xen_console_set_other_config(xen_session *session, xen_console console, 
xen_string_string_map *other_config);
-
-
-/**
- * Add the given key-value pair to the other_config field of the given
- * console.
- */
-extern bool
-xen_console_add_to_other_config(xen_session *session, xen_console console, 
char *key, char *value);
-
-
-/**
- * Remove the given key and its corresponding value from the
- * other_config field of the given console.  If the key is not in that Map,
- * then do nothing.
- */
-extern bool
-xen_console_remove_from_other_config(xen_session *session, xen_console 
console, char *key);
-
-
-/**
- * Return a list of all the consoles known to the system.
- */
-extern bool
-xen_console_get_all(xen_session *session, struct xen_console_set **result);
-
-
-#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen_console_decl.h
--- a/tools/libxen/include/xen_console_decl.h   Tue Apr 24 09:26:32 2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2006, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-#ifndef XEN_CONSOLE_DECL_H
-#define XEN_CONSOLE_DECL_H
-
-typedef void *xen_console;
-
-struct xen_console_set;
-struct xen_console_record;
-struct xen_console_record_set;
-struct xen_console_record_opt;
-struct xen_console_record_opt_set;
-
-#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen_console_protocol.h
--- a/tools/libxen/include/xen_console_protocol.h       Tue Apr 24 09:26:32 
2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2006, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-#ifndef XEN_CONSOLE_PROTOCOL_H
-#define XEN_CONSOLE_PROTOCOL_H
-
-
-#include "xen_common.h"
-
-
-enum xen_console_protocol
-{
-    /**
-     * VT100 terminal
-     */
-    XEN_CONSOLE_PROTOCOL_VT100,
-
-    /**
-     * Remote FrameBuffer protocol (as used in VNC)
-     */
-    XEN_CONSOLE_PROTOCOL_RFB,
-
-    /**
-     * Remote Desktop Protocol
-     */
-    XEN_CONSOLE_PROTOCOL_RDP
-};
-
-
-typedef struct xen_console_protocol_set
-{
-    size_t size;
-    enum xen_console_protocol contents[];
-} xen_console_protocol_set;
-
-/**
- * Allocate a xen_console_protocol_set of the given size.
- */
-extern xen_console_protocol_set *
-xen_console_protocol_set_alloc(size_t size);
-
-/**
- * Free the given xen_console_protocol_set.  The given set must have
- * been allocated by this library.
- */
-extern void
-xen_console_protocol_set_free(xen_console_protocol_set *set);
-
-
-/**
- * Return the name corresponding to the given code.  This string must
- * not be modified or freed.
- */
-extern const char *
-xen_console_protocol_to_string(enum xen_console_protocol val);
-
-
-/**
- * Return the correct code for the given string, or set the session
- * object to failure and return an undefined value if the given string does
- * not match a known code.
- */
-extern enum xen_console_protocol
-xen_console_protocol_from_string(xen_session *session, const char *str);
-
-
-#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 
tools/libxen/include/xen_console_protocol_internal.h
--- a/tools/libxen/include/xen_console_protocol_internal.h      Tue Apr 24 
09:26:32 2007 -0600
+++ b/tools/libxen/include/xen_console_protocol_internal.h      Tue Apr 24 
21:39:23 2007 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, XenSource Inc.
+ * Copyright (c) 2006-2007, XenSource Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen_crashdump.h
--- a/tools/libxen/include/xen_crashdump.h      Tue Apr 24 09:26:32 2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-#ifndef XEN_CRASHDUMP_H
-#define XEN_CRASHDUMP_H
-
-#include "xen_common.h"
-#include "xen_crashdump_decl.h"
-#include "xen_vdi_decl.h"
-#include "xen_vm_decl.h"
-
-
-/*
- * The crashdump class.
- * 
- * A VM crashdump.
- */
-
-
-/**
- * Free the given xen_crashdump.  The given handle must have been
- * allocated by this library.
- */
-extern void
-xen_crashdump_free(xen_crashdump crashdump);
-
-
-typedef struct xen_crashdump_set
-{
-    size_t size;
-    xen_crashdump *contents[];
-} xen_crashdump_set;
-
-/**
- * Allocate a xen_crashdump_set of the given size.
- */
-extern xen_crashdump_set *
-xen_crashdump_set_alloc(size_t size);
-
-/**
- * Free the given xen_crashdump_set.  The given set must have been
- * allocated by this library.
- */
-extern void
-xen_crashdump_set_free(xen_crashdump_set *set);
-
-
-typedef struct xen_crashdump_record
-{
-    xen_crashdump handle;
-    char *uuid;
-    struct xen_vm_record_opt *vm;
-    struct xen_vdi_record_opt *vdi;
-} xen_crashdump_record;
-
-/**
- * Allocate a xen_crashdump_record.
- */
-extern xen_crashdump_record *
-xen_crashdump_record_alloc(void);
-
-/**
- * Free the given xen_crashdump_record, and all referenced values.  The
- * given record must have been allocated by this library.
- */
-extern void
-xen_crashdump_record_free(xen_crashdump_record *record);
-
-
-typedef struct xen_crashdump_record_opt
-{
-    bool is_record;
-    union
-    {
-        xen_crashdump handle;
-        xen_crashdump_record *record;
-    } u;
-} xen_crashdump_record_opt;
-
-/**
- * Allocate a xen_crashdump_record_opt.
- */
-extern xen_crashdump_record_opt *
-xen_crashdump_record_opt_alloc(void);
-
-/**
- * Free the given xen_crashdump_record_opt, and all referenced values. 
- * The given record_opt must have been allocated by this library.
- */
-extern void
-xen_crashdump_record_opt_free(xen_crashdump_record_opt *record_opt);
-
-
-typedef struct xen_crashdump_record_set
-{
-    size_t size;
-    xen_crashdump_record *contents[];
-} xen_crashdump_record_set;
-
-/**
- * Allocate a xen_crashdump_record_set of the given size.
- */
-extern xen_crashdump_record_set *
-xen_crashdump_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_crashdump_record_set, and all referenced values. 
- * The given set must have been allocated by this library.
- */
-extern void
-xen_crashdump_record_set_free(xen_crashdump_record_set *set);
-
-
-
-typedef struct xen_crashdump_record_opt_set
-{
-    size_t size;
-    xen_crashdump_record_opt *contents[];
-} xen_crashdump_record_opt_set;
-
-/**
- * Allocate a xen_crashdump_record_opt_set of the given size.
- */
-extern xen_crashdump_record_opt_set *
-xen_crashdump_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_crashdump_record_opt_set, and all referenced
- * values.  The given set must have been allocated by this library.
- */
-extern void
-xen_crashdump_record_opt_set_free(xen_crashdump_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given crashdump.
- */
-extern bool
-xen_crashdump_get_record(xen_session *session, xen_crashdump_record **result, 
xen_crashdump crashdump);
-
-
-/**
- * Get a reference to the crashdump instance with the specified UUID.
- */
-extern bool
-xen_crashdump_get_by_uuid(xen_session *session, xen_crashdump *result, char 
*uuid);
-
-
-/**
- * Get the uuid field of the given crashdump.
- */
-extern bool
-xen_crashdump_get_uuid(xen_session *session, char **result, xen_crashdump 
crashdump);
-
-
-/**
- * Get the VM field of the given crashdump.
- */
-extern bool
-xen_crashdump_get_vm(xen_session *session, xen_vm *result, xen_crashdump 
crashdump);
-
-
-/**
- * Get the VDI field of the given crashdump.
- */
-extern bool
-xen_crashdump_get_vdi(xen_session *session, xen_vdi *result, xen_crashdump 
crashdump);
-
-
-/**
- * Destroy the specified crashdump
- */
-extern bool
-xen_crashdump_destroy(xen_session *session, xen_crashdump self);
-
-
-/**
- * Return a list of all the crashdumps known to the system.
- */
-extern bool
-xen_crashdump_get_all(xen_session *session, struct xen_crashdump_set **result);
-
-
-#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen_crashdump_decl.h
--- a/tools/libxen/include/xen_crashdump_decl.h Tue Apr 24 09:26:32 2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2006, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-#ifndef XEN_CRASHDUMP_DECL_H
-#define XEN_CRASHDUMP_DECL_H
-
-typedef void *xen_crashdump;
-
-struct xen_crashdump_set;
-struct xen_crashdump_record;
-struct xen_crashdump_record_set;
-struct xen_crashdump_record_opt;
-struct xen_crashdump_record_opt_set;
-
-#endif
diff -r 9313d0ce09f8 -r 605aa81d7341 tools/libxen/include/xen_event.h
--- a/tools/libxen/include/xen_event.h  Tue Apr 24 09:26:32 2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-#ifndef XEN_EVENT_H
-#define XEN_EVENT_H
-
-#include "xen_common.h"
-#include "xen_event_decl.h"
-#include "xen_event_operation.h"
-#include "xen_string_set.h"
-
-
-/*
- * The event class.
- * 
- * Asynchronous event registration and handling.
- */
-
-
-
-typedef struct xen_event_record
-{
-    int64_t id;
-    time_t timestamp;
-    char *class;
-    enum xen_event_operation operation;
-    char *ref;
-    char *obj_uuid;
-} xen_event_record;
-
-/**
- * Allocate a xen_event_record.
- */
-extern xen_event_record *
-xen_event_record_alloc(void);
-
-/**
- * Free the given xen_event_record, and all referenced values.  The

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.