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

[Xen-changelog] [xen-unstable] libxl: remove libxl_device_model_info.



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1328027678 0
# Node ID 05310d1a73ed310e3c0c18f9829a4356a40f8cb6
# Parent  9356938a851d93571fc16c5922f5db8242d7daf7
libxl: remove libxl_device_model_info.

All that is left here is the target domain's domid which we can pass around as
a parameter.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---


diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl.c       Tue Jan 31 16:34:38 2012 +0000
@@ -2621,7 +2621,7 @@
 }
 
 int libxl_domain_need_memory(libxl_ctx *ctx, libxl_domain_build_info *b_info,
-        libxl_device_model_info *dm_info, uint32_t *need_memkb)
+                             uint32_t *need_memkb)
 {
     GC_INIT(ctx);
     int rc = ERROR_INVAL;
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl.h       Tue Jan 31 16:34:38 2012 +0000
@@ -295,7 +295,6 @@
 typedef struct {
     libxl_domain_create_info c_info;
     libxl_domain_build_info b_info;
-    libxl_device_model_info dm_info;
 
     int num_disks, num_vifs, num_pcidevs, num_vfbs, num_vkbs;
 
@@ -323,10 +322,6 @@
 int libxl_init_build_info(libxl_ctx *ctx,
                           libxl_domain_build_info *b_info,
                           libxl_domain_create_info *c_info);
-int libxl_init_dm_info(libxl_ctx *ctx,
-                       libxl_device_model_info *dm_info,
-                       libxl_domain_create_info *c_info,
-                       libxl_domain_build_info *b_info);
 typedef int (*libxl_console_ready)(libxl_ctx *ctx, uint32_t domid, void *priv);
 int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config, 
libxl_console_ready cb, void *priv, uint32_t *domid);
 int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config, 
libxl_console_ready cb, void *priv, uint32_t *domid, int restore_fd);
@@ -379,7 +374,7 @@
 int libxl_get_memory_target(libxl_ctx *ctx, uint32_t domid, uint32_t 
*out_target);
 /* how much free memory in the system a domain needs to be built */
 int libxl_domain_need_memory(libxl_ctx *ctx, libxl_domain_build_info *b_info,
-        libxl_device_model_info *dm_info, uint32_t *need_memkb);
+                             uint32_t *need_memkb);
 /* how much free memory is available in the system */
 int libxl_get_free_memory(libxl_ctx *ctx, uint32_t *memkb);
 /* wait for a given amount of memory to be free in the system */
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_create.c        Tue Jan 31 16:34:38 2012 +0000
@@ -48,7 +48,6 @@
 
     libxl_domain_create_info_dispose(&d_config->c_info);
     libxl_domain_build_info_dispose(&d_config->b_info);
-    libxl_device_model_info_dispose(&d_config->dm_info);
 }
 
 int libxl_init_create_info(libxl_ctx *ctx, libxl_domain_create_info *c_info)
@@ -130,17 +129,6 @@
     return 0;
 }
 
-int libxl_init_dm_info(libxl_ctx *ctx,
-                       libxl_device_model_info *dm_info,
-                       libxl_domain_create_info *c_info,
-                       libxl_domain_build_info *b_info)
-{
-    memset(dm_info, '\0', sizeof(*dm_info));
-
-
-    return 0;
-}
-
 static int init_console_info(libxl_device_console *console, int dev_num)
 {
     memset(console, 0x00, sizeof(libxl_device_console));
@@ -154,7 +142,6 @@
 
 int libxl__domain_build(libxl__gc *gc,
                         libxl_domain_build_info *info,
-                        libxl_device_model_info *dm_info,
                         uint32_t domid,
                         libxl__domain_build_state *state)
 {
@@ -170,7 +157,7 @@
 
     switch (info->type) {
     case LIBXL_DOMAIN_TYPE_HVM:
-        ret = libxl__build_hvm(gc, domid, info, dm_info, state);
+        ret = libxl__build_hvm(gc, domid, info, state);
         if (ret)
             goto out;
 
@@ -224,8 +211,7 @@
 
 static int domain_restore(libxl__gc *gc, libxl_domain_build_info *info,
                           uint32_t domid, int fd,
-                          libxl__domain_build_state *state,
-                          libxl_device_model_info *dm_info)
+                          libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char **vments = NULL, **localents = NULL;
@@ -477,7 +463,6 @@
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     libxl__spawner_starting *dm_starting = 0;
-    libxl_device_model_info *dm_info = &d_config->dm_info;
     libxl__domain_build_state state;
     uint32_t domid;
     int i, ret;
@@ -514,9 +499,9 @@
     memset(&state, 0, sizeof(state));
 
     if ( restore_fd >= 0 ) {
-        ret = domain_restore(gc, &d_config->b_info, domid, restore_fd, &state, 
dm_info);
+        ret = domain_restore(gc, &d_config->b_info, domid, restore_fd, &state);
     } else {
-        ret = libxl__domain_build(gc, &d_config->b_info, dm_info, domid, 
&state);
+        ret = libxl__domain_build(gc, &d_config->b_info, domid, &state);
     }
 
     if (ret) {
@@ -563,8 +548,7 @@
         libxl_device_vkb_add(ctx, domid, &vkb);
         libxl_device_vkb_dispose(&vkb);
 
-        dm_info->domid = domid;
-        ret = libxl__create_device_model(gc, d_config, dm_info,
+        ret = libxl__create_device_model(gc, domid, d_config,
                                          &state, &dm_starting);
         if (ret < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
@@ -577,7 +561,6 @@
     {
         int need_qemu = 0;
         libxl_device_console console;
-        libxl_device_model_info xenpv_dm_info;
 
         for (i = 0; i < d_config->num_vfbs; i++) {
             libxl_device_vfb_add(ctx, domid, &d_config->vfbs[i]);
@@ -599,11 +582,7 @@
         libxl_device_console_dispose(&console);
 
         if (need_qemu) {
-            /* only copy those useful configs */
-            memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
-
-            libxl__create_xenpv_qemu(gc, domid, d_config,
-                                     &xenpv_dm_info, &state, &dm_starting);
+            libxl__create_xenpv_qemu(gc, domid, d_config, &state, 
&dm_starting);
         }
         break;
     }
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_dm.c    Tue Jan 31 16:34:38 2012 +0000
@@ -73,8 +73,7 @@
     }
 }
 
-static const libxl_vnc_info *dm_vnc(const libxl_domain_config *guest_config,
-                                    const libxl_device_model_info *info)
+static const libxl_vnc_info *dm_vnc(const libxl_domain_config *guest_config)
 {
     const libxl_vnc_info *vnc = NULL;
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
@@ -85,8 +84,7 @@
     return vnc && vnc->enable ? vnc : NULL;
 }
 
-static const libxl_sdl_info *dm_sdl(const libxl_domain_config *guest_config,
-                                    const libxl_device_model_info *info)
+static const libxl_sdl_info *dm_sdl(const libxl_domain_config *guest_config)
 {
     const libxl_sdl_info *sdl = NULL;
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
@@ -97,8 +95,7 @@
     return sdl && sdl->enable ? sdl : NULL;
 }
 
-static const char *dm_keymap(const libxl_domain_config *guest_config,
-                             const libxl_device_model_info *info)
+static const char *dm_keymap(const libxl_domain_config *guest_config)
 {
     if (guest_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
         return guest_config->b_info.u.hvm.keymap;
@@ -109,18 +106,17 @@
 }
 
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
-                                        const char *dm,
+                                        const char *dm, int domid,
                                         const libxl_domain_config 
*guest_config,
-                                        const libxl_device_model_info *info,
                                         const libxl__domain_build_state *state)
 {
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
     const libxl_device_nic *vifs = guest_config->vifs;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
-    const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_sdl_info *sdl = dm_sdl(guest_config);
     const int num_vifs = guest_config->num_vifs;
-    const char *keymap = dm_keymap(guest_config, info);
+    const char *keymap = dm_keymap(guest_config);
     int i;
     flexarray_t *dm_args;
     dm_args = flexarray_make(16, 1);
@@ -129,7 +125,7 @@
         return NULL;
 
     flexarray_vappend(dm_args, dm,
-                      "-d", libxl__sprintf(gc, "%d", info->domid), NULL);
+                      "-d", libxl__sprintf(gc, "%d", domid), NULL);
 
     if (c_info->name)
         flexarray_vappend(dm_args, "-domain-name", c_info->name, NULL);
@@ -225,7 +221,8 @@
                                    LIBXL_MAC_FMT, 
LIBXL_MAC_BYTES(vifs[i].mac));
                 char *ifname;
                 if (!vifs[i].ifname)
-                    ifname = libxl__sprintf(gc, "tap%d.%d", info->domid, 
vifs[i].devid);
+                    ifname = libxl__sprintf(gc,
+                                            "tap%d.%d", domid, vifs[i].devid);
                 else
                     ifname = vifs[i].ifname;
                 flexarray_vappend(dm_args,
@@ -320,9 +317,8 @@
 }
 
 static char ** libxl__build_device_model_args_new(libxl__gc *gc,
-                                        const char *dm,
+                                        const char *dm, int guest_domid,
                                         const libxl_domain_config 
*guest_config,
-                                        const libxl_device_model_info *info,
                                         const libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -332,9 +328,9 @@
     const libxl_device_nic *vifs = guest_config->vifs;
     const int num_disks = guest_config->num_disks;
     const int num_vifs = guest_config->num_vifs;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
-    const libxl_sdl_info *sdl = dm_sdl(guest_config, info);
-    const char *keymap = dm_keymap(guest_config, info);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config);
+    const libxl_sdl_info *sdl = dm_sdl(guest_config);
+    const char *keymap = dm_keymap(guest_config);
     flexarray_t *dm_args;
     int i;
 
@@ -343,14 +339,14 @@
         return NULL;
 
     flexarray_vappend(dm_args, dm,
-                      "-xen-domid", libxl__sprintf(gc, "%d", info->domid), 
NULL);
+                      "-xen-domid",
+                      libxl__sprintf(gc, "%d", guest_domid), NULL);
 
     flexarray_append(dm_args, "-chardev");
     flexarray_append(dm_args,
                      libxl__sprintf(gc, "socket,id=libxl-cmd,"
                                     "path=%s/qmp-libxl-%d,server,nowait",
-                                    libxl_run_dir_path(),
-                                    info->domid));
+                                    libxl_run_dir_path(), guest_domid));
 
     flexarray_append(dm_args, "-mon");
     flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
@@ -460,7 +456,8 @@
                                 LIBXL_MAC_FMT, LIBXL_MAC_BYTES(vifs[i].mac));
                 char *ifname;
                 if (!vifs[i].ifname) {
-                    ifname = libxl__sprintf(gc, "tap%d.%d", info->domid, 
vifs[i].devid);
+                    ifname = libxl__sprintf(gc, "tap%d.%d",
+                                            guest_domid, vifs[i].devid);
                 } else {
                     ifname = vifs[i].ifname;
                 }
@@ -581,18 +578,21 @@
 }
 
 static char ** libxl__build_device_model_args(libxl__gc *gc,
-                                        const char *dm,
+                                        const char *dm, int guest_domid,
                                         const libxl_domain_config 
*guest_config,
-                                        const libxl_device_model_info *info,
                                         const libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
 
     switch (guest_config->b_info.device_model_version) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-        return libxl__build_device_model_args_old(gc, dm, guest_config, info, 
state);
+        return libxl__build_device_model_args_old(gc, dm,
+                                                  guest_domid, guest_config,
+                                                  state);
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-        return libxl__build_device_model_args_new(gc, dm, guest_config, info, 
state);
+        return libxl__build_device_model_args_new(gc, dm,
+                                                  guest_domid, guest_config,
+                                                  state);
     default:
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unknown device model version 
%d",
                          guest_config->b_info.device_model_version);
@@ -624,7 +624,9 @@
     return 0;
 }
 
-static int libxl__write_dmargs(libxl__gc *gc, int domid, int guest_domid, char 
**args)
+static int libxl__write_stub_dmargs(libxl__gc *gc,
+                                    int dm_domid, int guest_domid,
+                                    char **args)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int i;
@@ -636,7 +638,7 @@
 
     roperm[0].id = 0;
     roperm[0].perms = XS_PERM_NONE;
-    roperm[1].id = domid;
+    roperm[1].id = dm_domid;
     roperm[1].perms = XS_PERM_READ;
 
     vm_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, 
"/local/domain/%d/vm", guest_domid));
@@ -673,8 +675,8 @@
 }
 
 static int libxl__create_stubdom(libxl__gc *gc,
+                                 int guest_domid,
                                  libxl_domain_config *guest_config,
-                                 libxl_device_model_info *info,
                                  libxl__domain_build_state *d_state,
                                  libxl__spawner_starting **starting_r)
 {
@@ -685,12 +687,11 @@
     libxl_device_vfb vfb;
     libxl_device_vkb vkb;
     libxl__domain_build_state stubdom_state;
-    uint32_t domid;
+    uint32_t dm_domid;
     char **args;
     struct xs_permissions perm[2];
     xs_transaction_t t;
     libxl__spawner_starting *dm_starting = 0;
-    libxl_device_model_info xenpv_dm_info;
 
     if (guest_config->b_info.device_model_version !=
         LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) {
@@ -700,7 +701,8 @@
 
     memset(&dm_config.c_info, 0x00, sizeof(libxl_domain_create_info));
     dm_config.c_info.type = LIBXL_DOMAIN_TYPE_PV;
-    dm_config.c_info.name = libxl__sprintf(gc, "%s-dm", 
libxl__domid_to_name(gc, info->domid));
+    dm_config.c_info.name = libxl__sprintf(gc, "%s-dm",
+                                    libxl__domid_to_name(gc, guest_domid));
 
     libxl_uuid_generate(&dm_config.c_info.uuid);
 
@@ -713,7 +715,7 @@
     dm_config.b_info.type = LIBXL_DOMAIN_TYPE_PV;
     dm_config.b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
                                               libxl_xenfirmwaredir_path());
-    dm_config.b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", info->domid);
+    dm_config.b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", guest_domid);
     dm_config.b_info.u.pv.ramdisk.path = "";
     dm_config.b_info.u.pv.features = "";
 
@@ -738,62 +740,69 @@
     dm_config.num_vkbs = 1;
 
     /* fixme: this function can leak the stubdom if it fails */
-    domid = 0;
-    ret = libxl__domain_make(gc, &dm_config.c_info, &domid);
+    dm_domid = 0;
+    ret = libxl__domain_make(gc, &dm_config.c_info, &dm_domid);
     if (ret)
         goto out;
-    ret = libxl__domain_build(gc, &dm_config.b_info, info, domid, 
&stubdom_state);
+    ret = libxl__domain_build(gc, &dm_config.b_info, dm_domid, &stubdom_state);
     if (ret)
         goto out;
 
-    args = libxl__build_device_model_args(gc, "stubdom-dm",
-                                          guest_config, info, d_state);
+    args = libxl__build_device_model_args(gc, "stubdom-dm", guest_domid,
+                                          guest_config, d_state);
     if (!args) {
         ret = ERROR_FAIL;
         goto out;
     }
 
-    libxl__write_dmargs(gc, domid, info->domid, args);
+    libxl__write_stub_dmargs(gc, dm_domid, guest_domid, args);
     libxl__xs_write(gc, XBT_NULL,
-                   libxl__sprintf(gc, "%s/image/device-model-domid", 
libxl__xs_get_dompath(gc, info->domid)),
-                   "%d", domid);
+                   libxl__sprintf(gc, "%s/image/device-model-domid",
+                                  libxl__xs_get_dompath(gc, guest_domid)),
+                   "%d", dm_domid);
     libxl__xs_write(gc, XBT_NULL,
-                   libxl__sprintf(gc, "%s/target", libxl__xs_get_dompath(gc, 
domid)),
-                   "%d", info->domid);
-    ret = xc_domain_set_target(ctx->xch, domid, info->domid);
+                   libxl__sprintf(gc, "%s/target",
+                                  libxl__xs_get_dompath(gc, dm_domid)),
+                   "%d", guest_domid);
+    ret = xc_domain_set_target(ctx->xch, dm_domid, guest_domid);
     if (ret<0) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting target domain %d -> 
%d", domid, info->domid);
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                         "setting target domain %d -> %d",
+                         dm_domid, guest_domid);
         ret = ERROR_FAIL;
         goto out_free;
     }
-    xs_set_target(ctx->xsh, domid, info->domid);
+    xs_set_target(ctx->xsh, dm_domid, guest_domid);
 
-    perm[0].id = domid;
+    perm[0].id = dm_domid;
     perm[0].perms = XS_PERM_NONE;
-    perm[1].id = info->domid;
+    perm[1].id = guest_domid;
     perm[1].perms = XS_PERM_READ;
 retry_transaction:
     t = xs_transaction_start(ctx->xsh);
-    xs_mkdir(ctx->xsh, t, libxl__sprintf(gc, 
"/local/domain/0/device-model/%d", info->domid));
-    xs_set_permissions(ctx->xsh, t, libxl__sprintf(gc, 
"/local/domain/0/device-model/%d", info->domid), perm, ARRAY_SIZE(perm));
+    xs_mkdir(ctx->xsh, t,
+        libxl__sprintf(gc, "/local/domain/0/device-model/%d", guest_domid));
+    xs_set_permissions(ctx->xsh, t,
+        libxl__sprintf(gc, "/local/domain/0/device-model/%d", guest_domid),
+                       perm, ARRAY_SIZE(perm));
     if (!xs_transaction_end(ctx->xsh, t, 0))
         if (errno == EAGAIN)
             goto retry_transaction;
 
     for (i = 0; i < dm_config.num_disks; i++) {
-        ret = libxl_device_disk_add(ctx, domid, &dm_config.disks[i]);
+        ret = libxl_device_disk_add(ctx, dm_domid, &dm_config.disks[i]);
         if (ret)
             goto out_free;
     }
     for (i = 0; i < dm_config.num_vifs; i++) {
-        ret = libxl_device_nic_add(ctx, domid, &dm_config.vifs[i]);
+        ret = libxl_device_nic_add(ctx, dm_domid, &dm_config.vifs[i]);
         if (ret)
             goto out_free;
     }
-    ret = libxl_device_vfb_add(ctx, domid, &dm_config.vfbs[0]);
+    ret = libxl_device_vfb_add(ctx, dm_domid, &dm_config.vfbs[0]);
     if (ret)
         goto out_free;
-    ret = libxl_device_vkb_add(ctx, domid, &dm_config.vkbs[0]);
+    ret = libxl_device_vkb_add(ctx, dm_domid, &dm_config.vkbs[0]);
     if (ret)
         goto out_free;
 
@@ -818,14 +827,14 @@
             char *name;
             case STUBDOM_CONSOLE_LOGGING:
                 name = libxl__sprintf(gc, "qemu-dm-%s",
-                                      libxl_domid_to_name(ctx, info->domid));
+                                      libxl_domid_to_name(ctx, guest_domid));
                 libxl_create_logfile(ctx, name, &filename);
                 console[i].output = libxl__sprintf(gc, "file:%s", filename);
                 free(filename);
                 break;
             case STUBDOM_CONSOLE_SAVE:
                 console[i].output = libxl__sprintf(gc, "file:%s",
-                                libxl__device_model_savefile(gc, info->domid));
+                                libxl__device_model_savefile(gc, guest_domid));
                 break;
             case STUBDOM_CONSOLE_RESTORE:
                 if (d_state->saved_state)
@@ -836,17 +845,14 @@
                 console[i].output = "pty";
                 break;
         }
-        ret = libxl__device_console_add(gc, domid, &console[i],
+        ret = libxl__device_console_add(gc, dm_domid, &console[i],
                         i == STUBDOM_CONSOLE_LOGGING ? &stubdom_state : NULL);
         if (ret)
             goto out_free;
     }
 
-    memset((void*)&xenpv_dm_info, 0, sizeof(libxl_device_model_info));
-
-    if (libxl__create_xenpv_qemu(gc, domid,
+    if (libxl__create_xenpv_qemu(gc, dm_domid,
                                  &dm_config,
-                                 &xenpv_dm_info,
                                  &stubdom_state,
                                  &dm_starting) < 0) {
         ret = ERROR_FAIL;
@@ -857,12 +863,12 @@
         goto out_free;
     }
 
-    libxl_domain_unpause(ctx, domid);
+    libxl_domain_unpause(ctx, dm_domid);
 
     if (starting_r) {
         *starting_r = calloc(1, sizeof(libxl__spawner_starting));
-        (*starting_r)->domid = info->domid;
-        (*starting_r)->dom_path = libxl__xs_get_dompath(gc, info->domid);
+        (*starting_r)->domid = guest_domid;
+        (*starting_r)->dom_path = libxl__xs_get_dompath(gc, guest_domid);
         (*starting_r)->for_spawn = NULL;
     }
 
@@ -875,15 +881,15 @@
 }
 
 int libxl__create_device_model(libxl__gc *gc,
+                              int domid,
                               libxl_domain_config *guest_config,
-                              libxl_device_model_info *info,
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
-    const libxl_vnc_info *vnc = dm_vnc(guest_config, info);
+    const libxl_vnc_info *vnc = dm_vnc(guest_config);
     char *path, *logfile;
     int logfile_w, null;
     int rc;
@@ -895,7 +901,7 @@
     const char *dm;
 
     if (b_info->device_model_stubdomain) {
-        rc = libxl__create_stubdom(gc, guest_config, info, state, starting_r);
+        rc = libxl__create_stubdom(gc, domid, guest_config, state, starting_r);
         goto out;
     }
 
@@ -910,18 +916,18 @@
         rc = ERROR_FAIL;
         goto out;
     }
-    args = libxl__build_device_model_args(gc, dm, guest_config, info, state);
+    args = libxl__build_device_model_args(gc, dm, domid, guest_config, state);
     if (!args) {
         rc = ERROR_FAIL;
         goto out;
     }
 
-    path = xs_get_domain_path(ctx->xsh, info->domid);
+    path = xs_get_domain_path(ctx->xsh, domid);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/hvmloader/bios", 
path),
                     "%s", libxl__domain_bios(gc, b_info));
     free(path);
 
-    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid);
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", domid);
     xs_mkdir(ctx->xsh, XBT_NULL, path);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path),
                     "%d", !b_info->u.hvm.xen_platform_pci);
@@ -945,8 +951,8 @@
         p->for_spawn = NULL;
     }
 
-    p->domid = info->domid;
-    p->dom_path = libxl__xs_get_dompath(gc, info->domid);
+    p->domid = domid;
+    p->dom_path = libxl__xs_get_dompath(gc, domid);
     p->pid_path = "image/device-model-pid";
     if (!p->dom_path) {
         rc = ERROR_FAIL;
@@ -1068,14 +1074,6 @@
     return ret;
 }
 
-static int libxl__build_xenpv_qemu_args(libxl__gc *gc,
-                                        uint32_t domid,
-                                        libxl_device_model_info *info)
-{
-    info->domid = domid;
-    return 0;
-}
-
 int libxl__need_xenpv_qemu(libxl__gc *gc,
         int nr_consoles, libxl_device_console *consoles,
         int nr_vfbs, libxl_device_vfb *vfbs,
@@ -1115,12 +1113,10 @@
 
 int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                              libxl_domain_config *guest_config,
-                             libxl_device_model_info *info,
                              libxl__domain_build_state *state,
                              libxl__spawner_starting **starting_r)
 {
-    libxl__build_xenpv_qemu_args(gc, domid, info);
-    libxl__create_device_model(gc, guest_config, info, state, starting_r);
+    libxl__create_device_model(gc, domid, guest_config, state, starting_r);
     return 0;
 }
 
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_dom.c   Tue Jan 31 16:34:38 2012 +0000
@@ -291,8 +291,7 @@
 }
 
 static const char *libxl__domain_firmware(libxl__gc *gc,
-                                          libxl_domain_build_info *info,
-                                          libxl_device_model_info *dm_info)
+                                          libxl_domain_build_info *info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const char *firmware;
@@ -320,12 +319,11 @@
 
 int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
               libxl_domain_build_info *info,
-              libxl_device_model_info *dm_info,
               libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int ret, rc = ERROR_FAIL;
-    const char *firmware = libxl__domain_firmware(gc, info, dm_info);
+    const char *firmware = libxl__domain_firmware(gc, info);
 
     if (!firmware)
         goto out;
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_internal.h      Tue Jan 31 16:34:38 2012 +0000
@@ -615,7 +615,6 @@
              libxl_domain_build_info *info, libxl__domain_build_state *state);
 _hidden int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
               libxl_domain_build_info *info,
-              libxl_device_model_info *dm_info,
               libxl__domain_build_state *state);
 
 _hidden int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
@@ -858,10 +857,11 @@
                const char *arg0, char **args); // logs errors, never returns
 
 /* from xl_create */
-_hidden int libxl__domain_make(libxl__gc *gc, libxl_domain_create_info *info, 
uint32_t *domid);
+_hidden int libxl__domain_make(libxl__gc *gc,
+                               libxl_domain_create_info *info,
+                               uint32_t *domid);
 _hidden int libxl__domain_build(libxl__gc *gc,
                                 libxl_domain_build_info *info,
-                                libxl_device_model_info *dm_info,
                                 uint32_t domid,
                                 libxl__domain_build_state *state);
 
@@ -869,13 +869,12 @@
 _hidden const char *libxl__domain_device_model(libxl__gc *gc,
                                         const libxl_domain_build_info *info);
 _hidden int libxl__create_device_model(libxl__gc *gc,
+                              int domid,
                               libxl_domain_config *guest_config,
-                              libxl_device_model_info *info,
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                               libxl_domain_config *guest_config,
-                              libxl_device_model_info *dm_info,
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__need_xenpv_qemu(libxl__gc *gc,
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl       Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/libxl_types.idl       Tue Jan 31 16:34:38 2012 +0000
@@ -262,12 +262,6 @@
     ],
 )
 
-# Device Model Information
-libxl_device_model_info = Struct("device_model_info",[
-    ("domid",            libxl_domid),
-    ],
-)
-
 libxl_device_vfb = Struct("device_vfb", [
     ("backend_domid", libxl_domid),
     ("devid",         integer),
diff -r 9356938a851d -r 05310d1a73ed tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Tue Jan 31 16:34:38 2012 +0000
@@ -290,8 +290,7 @@
 }
 
 static void printf_info(int domid,
-                        libxl_domain_config *d_config,
-                        libxl_device_model_info *dm_info)
+                        libxl_domain_config *d_config)
 {
     int i;
     libxl_dominfo info;
@@ -631,8 +630,7 @@
 static void parse_config_data(const char *configfile_filename_report,
                               const char *configfile_data,
                               int configfile_len,
-                              libxl_domain_config *d_config,
-                              libxl_device_model_info *dm_info)
+                              libxl_domain_config *d_config)
 {
     const char *buf;
     long l;
@@ -1194,9 +1192,6 @@
         break;
     }
 
-    /* init dm from c and b */
-    if (libxl_init_dm_info(ctx, dm_info, c_info, b_info))
-        exit(1);
     /* parse device model arguments, this works for pv, hvm and stubdom */
     if (!xlu_cfg_get_string (config, "device_model", &buf, 0)) {
         fprintf(stderr,
@@ -1452,7 +1447,7 @@
     int no_incr_generationid;
 };
 
-static int freemem(libxl_domain_build_info *b_info, libxl_device_model_info 
*dm_info)
+static int freemem(libxl_domain_build_info *b_info)
 {
     int rc, retries = 3;
     uint32_t need_memkb, free_memkb;
@@ -1460,7 +1455,7 @@
     if (!autoballoon)
         return 0;
 
-    rc = libxl_domain_need_memory(ctx, b_info, dm_info, &need_memkb);
+    rc = libxl_domain_need_memory(ctx, b_info, &need_memkb);
     if (rc < 0)
         return rc;
 
@@ -1679,7 +1674,7 @@
     if (!dom_info->quiet)
         printf("Parsing config file %s\n", config_file);
 
-    parse_config_data(config_file, config_data, config_len, &d_config, 
&d_config.dm_info);
+    parse_config_data(config_file, config_data, config_len, &d_config);
 
     if (migrate_fd >= 0) {
         if (d_config.c_info.name) {
@@ -1704,7 +1699,7 @@
             dom_info->no_incr_generationid;
 
     if (debug || dom_info->dryrun)
-        printf_info(-1, &d_config, &d_config.dm_info);
+        printf_info(-1, &d_config);
 
     ret = 0;
     if (dom_info->dryrun)
@@ -1717,7 +1712,7 @@
     if (rc < 0)
         goto error_out;
 
-    ret = freemem(&d_config.b_info, &d_config.dm_info);
+    ret = freemem(&d_config.b_info);
     if (ret < 0) {
         fprintf(stderr, "failed to free memory for the domain\n");
         ret = ERROR_FAIL;
@@ -2484,7 +2479,6 @@
     char *config_file;
     uint8_t *data;
     int i, len, rc;
-    libxl_device_model_info dm_info;
 
     for (i = 0; i < nb_domain; i++) {
         /* no detailed info available on dom0 */
@@ -2495,8 +2489,8 @@
             continue;
         CHK_ERRNO(asprintf(&config_file, "<domid %d data>", info[i].domid));
         memset(&d_config, 0x00, sizeof(d_config));
-        parse_config_data(config_file, (char *)data, len, &d_config, &dm_info);
-        printf_info(info[i].domid, &d_config, &dm_info);
+        parse_config_data(config_file, (char *)data, len, &d_config);
+        printf_info(info[i].domid, &d_config);
         libxl_domain_config_dispose(&d_config);
         free(data);
         free(config_file);
diff -r 9356938a851d -r 05310d1a73ed tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py    Tue Jan 31 16:34:38 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py    Tue Jan 31 16:34:38 2012 +0000
@@ -266,7 +266,6 @@
         "cpupoolinfo",
         "domain_create_info",
         "domain_build_info",
-        "device_model_info",
         "vcpuinfo",
         "topologyinfo",
         "event",

_______________________________________________
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®.