WARNING - OLD ARCHIVES

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

xen-devel

[Xen-devel] [PATCH 1 of 4] xl: idl: Abolish keyed union types

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 1 of 4] xl: idl: Abolish keyed union types
From: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Date: Wed, 5 Jan 2011 13:41:53 +0000
Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Wed, 05 Jan 2011 05:49:50 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1294234912@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1294234912@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.3
 tools/libxl/gentypes.py        |  10 +----
 tools/libxl/libxl.c            |  44 +++++++++++-----------
 tools/libxl/libxl.idl          |  42 ++++++++++-----------
 tools/libxl/libxl_bootloader.c |  30 +++++++-------
 tools/libxl/libxl_dom.c        |  32 ++++++++--------
 tools/libxl/libxltypes.py      |  15 -------
 tools/libxl/xl_cmdimpl.c       |  80 +++++++++++++++++++++---------------------
 tools/ocaml/libs/xl/xl_stubs.c |  26 ++++++------
 8 files changed, 127 insertions(+), 152 deletions(-)


# HG changeset patch
# User Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
# Date 1294231757 0
# Node ID 5a8c843ab94a38df32e5f9dc042619a439c6f124
# Parent  39194f457534e07e5d5cc54376c4df28e0acb63c
xl: idl: Abolish keyed union types

Since the IDL file has become useful for generating language bindings it has
become apparent that the KeyedUnion type has no straightforward translation to
scripting languages which have no notion of unions.

Turns out this is only used in domain_build_info which is hardly a memory
criticial structure.

This patch simply abolishes the notion replacing it in domain_build_info with
hvm and pv structures and renaming the key to 'is_hvm'.

Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>

diff -r 39194f457534 -r 5a8c843ab94a tools/libxl/gentypes.py
--- a/tools/libxl/gentypes.py   Wed Jan 05 09:57:15 2011 +0000
+++ b/tools/libxl/gentypes.py   Wed Jan 05 12:49:17 2011 +0000
@@ -71,15 +71,7 @@ def libxl_C_type_destroy(ty, v, referenc
         makeref = ""
 
     s = ""
-    if isinstance(ty, libxltypes.KeyedUnion):
-        if parent is None:
-            raise Exception("KeyedUnion type must have a parent")
-        for f in ty.fields:
-            keyvar_expr = f.keyvar_expr % (parent + ty.keyvar_name)
-            s += "if (" + keyvar_expr + ") {\n"
-            s += libxl_C_type_destroy(f.type, deref + f.name, False, indent + 
"    ", deref)
-            s += "}\n"
-    elif isinstance(ty, libxltypes.Reference):
+    if isinstance(ty, libxltypes.Reference):
         s += libxl_C_type_destroy(ty.ref_type, v, True, indent, v)
         if ty.destructor_fn is not None:
             s += "%s(%s);\n" % (ty.destructor_fn, makeref + v)
diff -r 39194f457534 -r 5a8c843ab94a tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed Jan 05 09:57:15 2011 +0000
+++ b/tools/libxl/libxl.c       Wed Jan 05 12:49:17 2011 +0000
@@ -306,14 +306,14 @@ int libxl_domain_build(libxl_ctx *ctx, l
 
     gettimeofday(&start_time, NULL);
 
-    if (info->hvm) {
+    if (info->is_hvm) {
         ret = libxl__build_hvm(ctx, domid, info, state);
         if (ret)
             goto out;
 
         vments = libxl__calloc(&gc, 7, sizeof(char *));
         vments[0] = "rtc/timeoffset";
-        vments[1] = (info->u.hvm.timeoffset) ? info->u.hvm.timeoffset : "";
+        vments[1] = (info->hvm.timeoffset) ? info->hvm.timeoffset : "";
         vments[2] = "image/ostype";
         vments[3] = "hvm";
         vments[4] = "start_time";
@@ -331,20 +331,20 @@ int libxl_domain_build(libxl_ctx *ctx, l
         vments[i++] = (char*) info->kernel.path;
         vments[i++] = "start_time";
         vments[i++] = libxl__sprintf(&gc, "%lu.%02d", 
start_time.tv_sec,(int)start_time.tv_usec/10000);
-        if (info->u.pv.ramdisk.path) {
+        if (info->pv.ramdisk.path) {
             vments[i++] = "image/ramdisk";
-            vments[i++] = (char*) info->u.pv.ramdisk.path;
+            vments[i++] = (char*) info->pv.ramdisk.path;
         }
-        if (info->u.pv.cmdline) {
+        if (info->pv.cmdline) {
             vments[i++] = "image/cmdline";
-            vments[i++] = (char*) info->u.pv.cmdline;
+            vments[i++] = (char*) info->pv.cmdline;
         }
     }
     ret = libxl__build_post(ctx, domid, info, state, vments, localents);
 out:
     libxl__file_reference_unmap(&info->kernel);
-    if (!info->hvm)
-           libxl__file_reference_unmap(&info->u.pv.ramdisk);
+    if (!info->is_hvm)
+           libxl__file_reference_unmap(&info->pv.ramdisk);
 
     libxl__free_all(&gc);
     return ret;
@@ -369,10 +369,10 @@ int libxl_domain_restore(libxl_ctx *ctx,
 
     gettimeofday(&start_time, NULL);
 
-    if (info->hvm) {
+    if (info->is_hvm) {
         vments = libxl__calloc(&gc, 7, sizeof(char *));
         vments[0] = "rtc/timeoffset";
-        vments[1] = (info->u.hvm.timeoffset) ? info->u.hvm.timeoffset : "";
+        vments[1] = (info->hvm.timeoffset) ? info->hvm.timeoffset : "";
         vments[2] = "image/ostype";
         vments[3] = "hvm";
         vments[4] = "start_time";
@@ -386,13 +386,13 @@ int libxl_domain_restore(libxl_ctx *ctx,
         vments[i++] = (char*) info->kernel.path;
         vments[i++] = "start_time";
         vments[i++] = libxl__sprintf(&gc, "%lu.%02d", 
start_time.tv_sec,(int)start_time.tv_usec/10000);
-        if (info->u.pv.ramdisk.path) {
+        if (info->pv.ramdisk.path) {
             vments[i++] = "image/ramdisk";
-            vments[i++] = (char*) info->u.pv.ramdisk.path;
+            vments[i++] = (char*) info->pv.ramdisk.path;
         }
-        if (info->u.pv.cmdline) {
+        if (info->pv.cmdline) {
             vments[i++] = "image/cmdline";
-            vments[i++] = (char*) info->u.pv.cmdline;
+            vments[i++] = (char*) info->pv.cmdline;
         }
     }
     ret = libxl__build_post(ctx, domid, info, state, vments, localents);
@@ -400,7 +400,7 @@ int libxl_domain_restore(libxl_ctx *ctx,
         goto out;
 
     dm_info->saved_state = NULL;
-    if (info->hvm) {
+    if (info->is_hvm) {
         ret = asprintf(&dm_info->saved_state,
                        "/var/lib/xen/qemu-save.%d", domid);
         ret = (ret < 0) ? ERROR_FAIL : 0;
@@ -408,8 +408,8 @@ int libxl_domain_restore(libxl_ctx *ctx,
 
 out:
     libxl__file_reference_unmap(&info->kernel);
-    if (!info->hvm)
-           libxl__file_reference_unmap(&info->u.pv.ramdisk);
+    if (!info->is_hvm)
+           libxl__file_reference_unmap(&info->pv.ramdisk);
 
     esave = errno;
 
@@ -1560,10 +1560,10 @@ static int libxl_create_stubdom(libxl_ct
     b_info.max_memkb = 32 * 1024;
     b_info.target_memkb = b_info.max_memkb;
     b_info.kernel.path = libxl__abs_path(&gc, "ioemu-stubdom.gz", 
libxl_xenfirmwaredir_path());
-    b_info.u.pv.cmdline = libxl__sprintf(&gc, " -d %d", info->domid);
-    b_info.u.pv.ramdisk.path = "";
-    b_info.u.pv.features = "";
-    b_info.hvm = 0;
+    b_info.pv.cmdline = libxl__sprintf(&gc, " -d %d", info->domid);
+    b_info.pv.ramdisk.path = "";
+    b_info.pv.features = "";
+    b_info.is_hvm = 0;
 
     ret = libxl_domain_make(ctx, &c_info, &domid);
     if (ret)
@@ -3088,7 +3088,7 @@ int libxl_domain_need_memory(libxl_ctx *
         libxl_device_model_info *dm_info, uint32_t *need_memkb)
 {
     *need_memkb = b_info->target_memkb;
-    if (b_info->hvm) {
+    if (b_info->is_hvm) {
         *need_memkb += b_info->shadow_memkb + LIBXL_HVM_EXTRA_MEMORY;
         if (strstr(dm_info->device_model, "stubdom-dm"))
             *need_memkb += 32 * 1024;
diff -r 39194f457534 -r 5a8c843ab94a tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl     Wed Jan 05 09:57:15 2011 +0000
+++ b/tools/libxl/libxl.idl     Wed Jan 05 12:49:17 2011 +0000
@@ -96,28 +96,26 @@ libxl_domain_build_info = Struct("domain
     ("disable_migrate", bool),
     ("kernel",          libxl_file_reference),
     ("cpuid",           libxl_cpuid_policy_list),
-    ("hvm",             integer),
-    ("u", KeyedUnion(None, "hvm",
-                [("hvm", "%s", Struct(None,
-                                       [("pae", bool),
-                                        ("apic", bool),
-                                        ("acpi", bool),
-                                        ("nx", bool),
-                                        ("viridian", bool),
-                                        ("timeoffset", string),
-                                        ("hpet", bool),
-                                        ("vpt_align", bool),
-                                        ("timer_mode", integer),
-                                        ])),
-                 ("pv", "!%s", Struct(None,
-                                       [("slack_memkb", uint32),
-                                        ("bootloader", string),
-                                        ("bootloader_args", string),
-                                        ("cmdline", string),
-                                        ("ramdisk", libxl_file_reference),
-                                        ("features", string, True),
-                                        ])),
-                 ])),
+    ("is_hvm",          bool),
+    ("hvm", Struct(None,
+                           [("pae", bool),
+                            ("apic", bool),
+                            ("acpi", bool),
+                            ("nx", bool),
+                            ("viridian", bool),
+                            ("timeoffset", string),
+                            ("hpet", bool),
+                            ("vpt_align", bool),
+                            ("timer_mode", integer),
+                            ])),
+     ("pv", Struct(None,
+                           [("slack_memkb", uint32),
+                            ("bootloader", string),
+                            ("bootloader_args", string),
+                            ("cmdline", string),
+                            ("ramdisk", libxl_file_reference),
+                            ("features", string, True),
+                            ])),
     ],
     comment =
 """Instances of libxl_file_reference contained in this struct which
diff -r 39194f457534 -r 5a8c843ab94a tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c    Wed Jan 05 09:57:15 2011 +0000
+++ b/tools/libxl/libxl_bootloader.c    Wed Jan 05 12:49:17 2011 +0000
@@ -42,23 +42,23 @@ static char **make_bootloader_args(libxl
     if (!args)
         return NULL;
 
-    flexarray_set(args, nr++, (char *)info->u.pv.bootloader);
+    flexarray_set(args, nr++, (char *)info->pv.bootloader);
 
     if (info->kernel.path)
         flexarray_set(args, nr++, libxl__sprintf(gc, "--kernel=%s", 
info->kernel.path));
-    if (info->u.pv.ramdisk.path)
-        flexarray_set(args, nr++, libxl__sprintf(gc, "--ramdisk=%s", 
info->u.pv.ramdisk.path));
-    if (info->u.pv.cmdline && *info->u.pv.cmdline != '\0')
-        flexarray_set(args, nr++, libxl__sprintf(gc, "--args=%s", 
info->u.pv.cmdline));
+    if (info->pv.ramdisk.path)
+        flexarray_set(args, nr++, libxl__sprintf(gc, "--ramdisk=%s", 
info->pv.ramdisk.path));
+    if (info->pv.cmdline && *info->pv.cmdline != '\0')
+        flexarray_set(args, nr++, libxl__sprintf(gc, "--args=%s", 
info->pv.cmdline));
 
     flexarray_set(args, nr++, libxl__sprintf(gc, "--output=%s", fifo));
     flexarray_set(args, nr++, "--output-format=simple0");
     flexarray_set(args, nr++, libxl__sprintf(gc, "--output-directory=%s", 
"/var/run/libxl/"));
 
-    if (info->u.pv.bootloader_args) {
+    if (info->pv.bootloader_args) {
         char *saveptr;
         /* Operate on a duplicate since strtok modifes the argument */
-        char *dup = libxl__strdup(gc, info->u.pv.bootloader_args);
+        char *dup = libxl__strdup(gc, info->pv.bootloader_args);
         char *t = strtok_r(dup, " \t\n", &saveptr);
         do {
             flexarray_set(args, nr++, t);
@@ -282,13 +282,13 @@ static void parse_bootloader_result(libx
             libxl__file_reference_map(&info->kernel);
             unlink(info->kernel.path);
         } else if (strncmp("ramdisk ", o, strlen("ramdisk ")) == 0) {
-            free(info->u.pv.ramdisk.path);
-            info->u.pv.ramdisk.path = strdup(o + strlen("ramdisk "));
-            libxl__file_reference_map(&info->u.pv.ramdisk);
-            unlink(info->u.pv.ramdisk.path);
+            free(info->pv.ramdisk.path);
+            info->pv.ramdisk.path = strdup(o + strlen("ramdisk "));
+            libxl__file_reference_map(&info->pv.ramdisk);
+            unlink(info->pv.ramdisk.path);
         } else if (strncmp("args ", o, strlen("args ")) == 0) {
-            free(info->u.pv.cmdline);
-            info->u.pv.cmdline = strdup(o + strlen("args "));
+            free(info->pv.cmdline);
+            info->pv.cmdline = strdup(o + strlen("args "));
         }
 
         o = o + strlen(o) + 1;
@@ -321,7 +321,7 @@ int libxl_run_bootloader(libxl_ctx *ctx,
 
     struct stat st_buf;
 
-    if (info->hvm || !info->u.pv.bootloader)
+    if (info->is_hvm || !info->pv.bootloader)
         goto out;
 
     rc = ERROR_INVAL;
@@ -386,7 +386,7 @@ int libxl_run_bootloader(libxl_ctx *ctx,
     dom_console_xs_path = libxl__sprintf(&gc, "%s/console/tty", 
libxl__xs_get_dompath(&gc, domid));
     libxl__xs_write(&gc, XBT_NULL, dom_console_xs_path, "%s", 
dom_console_slave_tty_path);
 
-    pid = fork_exec_bootloader(&bootloader_fd, info->u.pv.bootloader, args);
+    pid = fork_exec_bootloader(&bootloader_fd, info->pv.bootloader, args);
     if (pid < 0) {
         goto out_close;
     }
diff -r 39194f457534 -r 5a8c843ab94a tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Wed Jan 05 09:57:15 2011 +0000
+++ b/tools/libxl/libxl_dom.c   Wed Jan 05 12:49:17 2011 +0000
@@ -70,13 +70,13 @@ int libxl__build_pre(libxl_ctx *ctx, uin
     xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
     xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + 
LIBXL_MAXMEM_CONSTANT);
     xc_domain_set_memmap_limit(ctx->xch, domid, 
-            (info->hvm) ? info->max_memkb : 
-            (info->max_memkb + info->u.pv.slack_memkb));
+            (info->is_hvm) ? info->max_memkb : 
+            (info->max_memkb + info->pv.slack_memkb));
     xc_domain_set_tsc_info(ctx->xch, domid, info->tsc_mode, 0, 0, 0);
     if ( info->disable_migrate )
         xc_domain_disable_migrate(ctx->xch, domid);
 
-    if (info->hvm) {
+    if (info->is_hvm) {
         unsigned long shadow;
         shadow = (info->shadow_memkb + 1023) / 1024;
         xc_shadow_control(ctx->xch, domid, 
XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION, NULL, 0, &shadow, 0, NULL);
@@ -152,7 +152,7 @@ int libxl__build_pv(libxl_ctx *ctx, uint
 
     xc_dom_loginit(ctx->xch);
 
-    dom = xc_dom_allocate(ctx->xch, info->u.pv.cmdline, info->u.pv.features);
+    dom = xc_dom_allocate(ctx->xch, info->pv.cmdline, info->pv.features);
     if (!dom) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_allocate failed");
         return ERROR_FAIL;
@@ -170,14 +170,14 @@ int libxl__build_pv(libxl_ctx *ctx, uint
         }
     }
 
-    if ( info->u.pv.ramdisk.path && strlen(info->u.pv.ramdisk.path) ) {
-        if (info->u.pv.ramdisk.mapped) {
-            if ( (ret = xc_dom_ramdisk_mem(dom, info->u.pv.ramdisk.data, 
info->u.pv.ramdisk.size)) != 0 ) {
+    if ( info->pv.ramdisk.path && strlen(info->pv.ramdisk.path) ) {
+        if (info->pv.ramdisk.mapped) {
+            if ( (ret = xc_dom_ramdisk_mem(dom, info->pv.ramdisk.data, 
info->pv.ramdisk.size)) != 0 ) {
                 LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_ramdisk_mem 
failed");
                 goto out;
             }
         } else {
-            if ( (ret = xc_dom_ramdisk_file(dom, info->u.pv.ramdisk.path)) != 
0 ) {
+            if ( (ret = xc_dom_ramdisk_file(dom, info->pv.ramdisk.path)) != 0 
) {
                 LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_dom_ramdisk_file 
failed");
                 goto out;
             }
@@ -238,8 +238,8 @@ static int hvm_build_set_params(xc_inter
         return -1;
 
     va_hvm = (struct hvm_info_table *)(va_map + HVM_INFO_OFFSET);
-    va_hvm->acpi_enabled = info->u.hvm.acpi;
-    va_hvm->apic_mode = info->u.hvm.apic;
+    va_hvm->acpi_enabled = info->hvm.acpi;
+    va_hvm->apic_mode = info->hvm.apic;
     va_hvm->nr_vcpus = info->max_vcpus;
     memcpy(va_hvm->vcpu_online, &info->cur_vcpus, sizeof(info->cur_vcpus));
     for (i = 0, sum = 0; i < va_hvm->length; i++)
@@ -249,13 +249,13 @@ static int hvm_build_set_params(xc_inter
 
     xc_get_hvm_param(handle, domid, HVM_PARAM_STORE_PFN, store_mfn);
     xc_get_hvm_param(handle, domid, HVM_PARAM_CONSOLE_PFN, console_mfn);
-    xc_set_hvm_param(handle, domid, HVM_PARAM_PAE_ENABLED, info->u.hvm.pae);
+    xc_set_hvm_param(handle, domid, HVM_PARAM_PAE_ENABLED, info->hvm.pae);
 #if defined(__i386__) || defined(__x86_64__)
-    xc_set_hvm_param(handle, domid, HVM_PARAM_VIRIDIAN, info->u.hvm.viridian);
-    xc_set_hvm_param(handle, domid, HVM_PARAM_HPET_ENABLED, (unsigned long) 
info->u.hvm.hpet);
+    xc_set_hvm_param(handle, domid, HVM_PARAM_VIRIDIAN, info->hvm.viridian);
+    xc_set_hvm_param(handle, domid, HVM_PARAM_HPET_ENABLED, (unsigned long) 
info->hvm.hpet);
 #endif
-    xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, (unsigned long) 
info->u.hvm.timer_mode);
-    xc_set_hvm_param(handle, domid, HVM_PARAM_VPT_ALIGN, (unsigned long) 
info->u.hvm.vpt_align);
+    xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, (unsigned long) 
info->hvm.timer_mode);
+    xc_set_hvm_param(handle, domid, HVM_PARAM_VPT_ALIGN, (unsigned long) 
info->hvm.vpt_align);
     xc_set_hvm_param(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn);
     xc_set_hvm_param(handle, domid, HVM_PARAM_CONSOLE_EVTCHN, console_evtchn);
     return 0;
@@ -305,7 +305,7 @@ int libxl__domain_restore_common(libxl_c
     rc = xc_domain_restore(ctx->xch, fd, domid,
                              state->store_port, &state->store_mfn,
                              state->console_port, &state->console_mfn,
-                             info->hvm, info->u.hvm.pae, 0);
+                             info->is_hvm, info->hvm.pae, 0);
     if ( rc ) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "restoring domain");
         return ERROR_FAIL;
diff -r 39194f457534 -r 5a8c843ab94a tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py Wed Jan 05 09:57:15 2011 +0000
+++ b/tools/libxl/libxltypes.py Wed Jan 05 12:49:17 2011 +0000
@@ -104,21 +104,6 @@ class Union(Aggregate):
         kwargs.setdefault('destructor_fn', None)
         Aggregate.__init__(self, "union", name, fields, **kwargs)
 
-class KeyedUnion(Aggregate):
-    """A union which is keyed of another variable in the parent structure"""
-    def __init__(self, name, keyvar_name, fields, **kwargs):
-        Aggregate.__init__(self, "union", name, [], **kwargs)
-
-        self.keyvar_name = keyvar_name
-
-        for f in fields:
-            # (name, keyvar_expr, type)
-
-            # keyvar_expr must contain exactly one %s which will be replaced 
with the keyvar_name
-
-            n, kve, ty = f
-            self.fields.append(Field(ty, n, keyvar_expr=kve))
-
 class Reference(Type):
     """A reference to another type"""
     def __init__(self, ty, **kwargs):
diff -r 39194f457534 -r 5a8c843ab94a tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Wed Jan 05 09:57:15 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Wed Jan 05 12:49:17 2011 +0000
@@ -336,17 +336,17 @@ static void init_build_info(libxl_domain
     if (c_info->hvm) {
         b_info->video_memkb = 8 * 1024;
         b_info->kernel.path = strdup("hvmloader");
-        b_info->hvm = 1;
-        b_info->u.hvm.pae = 1;
-        b_info->u.hvm.apic = 1;
-        b_info->u.hvm.acpi = 1;
-        b_info->u.hvm.nx = 1;
-        b_info->u.hvm.viridian = 0;
-        b_info->u.hvm.hpet = 1;
-        b_info->u.hvm.vpt_align = 1;
-        b_info->u.hvm.timer_mode = 1;
+        b_info->is_hvm = 1;
+        b_info->hvm.pae = 1;
+        b_info->hvm.apic = 1;
+        b_info->hvm.acpi = 1;
+        b_info->hvm.nx = 1;
+        b_info->hvm.viridian = 0;
+        b_info->hvm.hpet = 1;
+        b_info->hvm.vpt_align = 1;
+        b_info->hvm.timer_mode = 1;
     } else {
-        b_info->u.pv.slack_memkb = 8 * 1024;
+        b_info->pv.slack_memkb = 8 * 1024;
     }
 }
 
@@ -360,7 +360,7 @@ static void init_dm_info(libxl_device_mo
     dm_info->dom_name = strdup(c_info->name);
     dm_info->device_model = strdup("qemu-dm");
     dm_info->videoram = b_info->video_memkb / 1024;
-    dm_info->apic = b_info->u.hvm.apic;
+    dm_info->apic = b_info->hvm.apic;
     dm_info->vcpus = b_info->max_vcpus;
     dm_info->vcpu_avail = b_info->cur_vcpus;
 
@@ -512,10 +512,10 @@ static void printf_info(int domid,
     printf("\t(target_memkb %d)\n", b_info->target_memkb);
     printf("\t(nomigrate %d)\n", b_info->disable_migrate);
 
-    if (!c_info->hvm && b_info->u.pv.bootloader) {
-        printf("\t(bootloader %s)\n", b_info->u.pv.bootloader);
-        if (b_info->u.pv.bootloader_args)
-            printf("\t(bootloader_args %s)\n", b_info->u.pv.bootloader_args);
+    if (!c_info->hvm && b_info->pv.bootloader) {
+        printf("\t(bootloader %s)\n", b_info->pv.bootloader);
+        if (b_info->pv.bootloader_args)
+            printf("\t(bootloader_args %s)\n", b_info->pv.bootloader_args);
     }
 
     printf("\t(image\n");
@@ -524,14 +524,14 @@ static void printf_info(int domid,
         printf("\t\t\t(loader %s)\n", b_info->kernel.path);
         printf("\t\t\t(video_memkb %d)\n", b_info->video_memkb);
         printf("\t\t\t(shadow_memkb %d)\n", b_info->shadow_memkb);
-        printf("\t\t\t(pae %d)\n", b_info->u.hvm.pae);
-        printf("\t\t\t(apic %d)\n", b_info->u.hvm.apic);
-        printf("\t\t\t(acpi %d)\n", b_info->u.hvm.acpi);
-        printf("\t\t\t(nx %d)\n", b_info->u.hvm.nx);
-        printf("\t\t\t(viridian %d)\n", b_info->u.hvm.viridian);
-        printf("\t\t\t(hpet %d)\n", b_info->u.hvm.hpet);
-        printf("\t\t\t(vpt_align %d)\n", b_info->u.hvm.vpt_align);
-        printf("\t\t\t(timer_mode %d)\n", b_info->u.hvm.timer_mode);
+        printf("\t\t\t(pae %d)\n", b_info->hvm.pae);
+        printf("\t\t\t(apic %d)\n", b_info->hvm.apic);
+        printf("\t\t\t(acpi %d)\n", b_info->hvm.acpi);
+        printf("\t\t\t(nx %d)\n", b_info->hvm.nx);
+        printf("\t\t\t(viridian %d)\n", b_info->hvm.viridian);
+        printf("\t\t\t(hpet %d)\n", b_info->hvm.hpet);
+        printf("\t\t\t(vpt_align %d)\n", b_info->hvm.vpt_align);
+        printf("\t\t\t(timer_mode %d)\n", b_info->hvm.timer_mode);
 
         printf("\t\t\t(device_model %s)\n", dm_info->device_model);
         printf("\t\t\t(videoram %d)\n", dm_info->videoram);
@@ -551,10 +551,10 @@ static void printf_info(int domid,
         printf("\t\t\t(apic %d)\n", dm_info->apic);
         printf("\t\t)\n");
     } else {
-        printf("\t\t(linux %d)\n", b_info->hvm);
+        printf("\t\t(linux %d)\n", b_info->is_hvm);
         printf("\t\t\t(kernel %s)\n", b_info->kernel.path);
-        printf("\t\t\t(cmdline %s)\n", b_info->u.pv.cmdline);
-        printf("\t\t\t(ramdisk %s)\n", b_info->u.pv.ramdisk.path);
+        printf("\t\t\t(cmdline %s)\n", b_info->pv.cmdline);
+        printf("\t\t\t(ramdisk %s)\n", b_info->pv.ramdisk.path);
         printf("\t\t)\n");
     }
     printf("\t)\n");
@@ -774,21 +774,21 @@ static void parse_config_data(const char
 
     if (c_info->hvm == 1) {
         if (!xlu_cfg_get_long (config, "pae", &l))
-            b_info->u.hvm.pae = l;
+            b_info->hvm.pae = l;
         if (!xlu_cfg_get_long (config, "apic", &l))
-            b_info->u.hvm.apic = l;
+            b_info->hvm.apic = l;
         if (!xlu_cfg_get_long (config, "acpi", &l))
-            b_info->u.hvm.acpi = l;
+            b_info->hvm.acpi = l;
         if (!xlu_cfg_get_long (config, "nx", &l))
-            b_info->u.hvm.nx = l;
+            b_info->hvm.nx = l;
         if (!xlu_cfg_get_long (config, "viridian", &l))
-            b_info->u.hvm.viridian = l;
+            b_info->hvm.viridian = l;
         if (!xlu_cfg_get_long (config, "hpet", &l))
-            b_info->u.hvm.hpet = l;
+            b_info->hvm.hpet = l;
         if (!xlu_cfg_get_long (config, "vpt_align", &l))
-            b_info->u.hvm.vpt_align = l;
+            b_info->hvm.vpt_align = l;
         if (!xlu_cfg_get_long (config, "timer_mode", &l))
-            b_info->u.hvm.timer_mode = l;
+            b_info->hvm.timer_mode = l;
     } else {
         char *cmdline = NULL;
         const char *root = NULL, *extra = "";
@@ -808,16 +808,16 @@ static void parse_config_data(const char
             exit(1);
         }
 
-        xlu_cfg_replace_string (config, "bootloader", 
&b_info->u.pv.bootloader);
-        xlu_cfg_replace_string (config, "bootloader_args", 
&b_info->u.pv.bootloader_args);
-
-        if (!b_info->u.pv.bootloader && !b_info->kernel.path) {
+        xlu_cfg_replace_string (config, "bootloader", &b_info->pv.bootloader);
+        xlu_cfg_replace_string (config, "bootloader_args", 
&b_info->pv.bootloader_args);
+
+        if (!b_info->pv.bootloader && !b_info->kernel.path) {
             fprintf(stderr, "Neither kernel nor bootloader specified\n");
             exit(1);
         }
 
-        b_info->u.pv.cmdline = cmdline;
-        xlu_cfg_replace_string (config, "ramdisk", &b_info->u.pv.ramdisk.path);
+        b_info->pv.cmdline = cmdline;
+        xlu_cfg_replace_string (config, "ramdisk", &b_info->pv.ramdisk.path);
     }
 
     if (!xlu_cfg_get_list (config, "disk", &vbds, 0, 0)) {
diff -r 39194f457534 -r 5a8c843ab94a tools/ocaml/libs/xl/xl_stubs.c
--- a/tools/ocaml/libs/xl/xl_stubs.c    Wed Jan 05 09:57:15 2011 +0000
+++ b/tools/ocaml/libs/xl/xl_stubs.c    Wed Jan 05 12:49:17 2011 +0000
@@ -166,20 +166,20 @@ static int domain_build_info_val (caml_g
        c_val->hvm = Tag_val(Field(v, 7)) == 0;
        infopriv = Field(Field(v, 7), 0);
        if (c_val->hvm) {
-               c_val->u.hvm.pae = Bool_val(Field(infopriv, 0));
-               c_val->u.hvm.apic = Bool_val(Field(infopriv, 1));
-               c_val->u.hvm.acpi = Bool_val(Field(infopriv, 2));
-               c_val->u.hvm.nx = Bool_val(Field(infopriv, 3));
-               c_val->u.hvm.viridian = Bool_val(Field(infopriv, 4));
-               c_val->u.hvm.timeoffset = dup_String_val(gc, Field(infopriv, 
5));
-               c_val->u.hvm.timer_mode = Int_val(Field(infopriv, 6));
-               c_val->u.hvm.hpet = Int_val(Field(infopriv, 7));
-               c_val->u.hvm.vpt_align = Int_val(Field(infopriv, 8));
+               c_val->hvm.pae = Bool_val(Field(infopriv, 0));
+               c_val->hvm.apic = Bool_val(Field(infopriv, 1));
+               c_val->hvm.acpi = Bool_val(Field(infopriv, 2));
+               c_val->hvm.nx = Bool_val(Field(infopriv, 3));
+               c_val->hvm.viridian = Bool_val(Field(infopriv, 4));
+               c_val->hvm.timeoffset = dup_String_val(gc, Field(infopriv, 5));
+               c_val->hvm.timer_mode = Int_val(Field(infopriv, 6));
+               c_val->hvm.hpet = Int_val(Field(infopriv, 7));
+               c_val->hvm.vpt_align = Int_val(Field(infopriv, 8));
        } else {
-               c_val->u.pv.slack_memkb = Int64_val(Field(infopriv, 0));
-               c_val->u.pv.cmdline = dup_String_val(gc, Field(infopriv, 1));
-               c_val->u.pv.ramdisk.path = dup_String_val(gc, Field(infopriv, 
2));
-               c_val->u.pv.features = dup_String_val(gc, Field(infopriv, 3));
+               c_val->pv.slack_memkb = Int64_val(Field(infopriv, 0));
+               c_val->pv.cmdline = dup_String_val(gc, Field(infopriv, 1));
+               c_val->pv.ramdisk.path = dup_String_val(gc, Field(infopriv, 2));
+               c_val->pv.features = dup_String_val(gc, Field(infopriv, 3));
        }
 
        CAMLreturn(0);

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