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] libxl: drop domid field from libxl_device_*

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] libxl: drop domid field from libxl_device_*
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Thu, 24 Mar 2011 14:10:47 +0000
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Thu, 24 Mar 2011 07:15:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1300975785 0
# Node ID ca75b204dca4339dcdca4124bd010abe6604f616
# Parent  fff89897e9c20b78cd73ce544c93bbc44b528f25
libxl: drop domid field from libxl_device_*

All functions which add a device to a domain already take a domid
argument and the callers typically write the same value to the
structure right before making the call.

Functions which delete a device typically do not but adding this field
makes the interface more consistent anyway and all callers have the
domid to hand.

All functions which return a libxl device structure are given a domid
as a paramter and the caller therefore already knows which domain it
is dealing with.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r fff89897e9c2 -r ca75b204dca4 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Mar 24 14:09:43 2011 +0000
+++ b/tools/libxl/libxl.c       Thu Mar 24 14:09:45 2011 +0000
@@ -701,7 +701,6 @@ int libxl_event_get_disk_eject_info(libx
                disk->backend = LIBXL_DISK_BACKEND_UNKNOWN;
        } 
 
-    disk->domid = domid;
     disk->pdev_path = strdup("");
     disk->format = LIBXL_DISK_FORMAT_EMPTY;
     /* this value is returned to the user: do not free right away */
@@ -976,7 +975,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
     device.backend_devid = devid;
     device.backend_domid = disk->backend_domid;
     device.devid = devid;
-    device.domid = disk->domid;
+    device.domid = domid;
     device.kind = DEVICE_VBD;
 
     switch (disk->backend) {
@@ -1030,7 +1029,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
     }
 
     flexarray_append(back, "frontend-id");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", disk->domid));
+    flexarray_append(back, libxl__sprintf(&gc, "%d", domid));
     flexarray_append(back, "online");
     flexarray_append(back, "1");
     flexarray_append(back, "removable");
@@ -1074,7 +1073,7 @@ out:
     return rc;
 }
 
-int libxl_device_disk_del(libxl_ctx *ctx,
+int libxl_device_disk_del(libxl_ctx *ctx, uint32_t domid,
                           libxl_device_disk *disk, int wait)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
@@ -1086,7 +1085,7 @@ int libxl_device_disk_del(libxl_ctx *ctx
     device.backend_devid    = devid;
     device.backend_kind     =
         (disk->backend == LIBXL_DISK_BACKEND_PHY) ? DEVICE_VBD : DEVICE_TAP;
-    device.domid            = disk->domid;
+    device.domid            = domid;
     device.devid            = devid;
     device.kind             = DEVICE_VBD;
     rc = libxl__device_del(&gc, &device, wait);
@@ -1186,7 +1185,6 @@ int libxl_device_nic_init(libxl_device_n
     memset(nic_info, '\0', sizeof(*nic_info));
 
     nic_info->backend_domid = 0;
-    nic_info->domid = 0;
     nic_info->devid = devnum;
     nic_info->mtu = 1492;
     nic_info->model = strdup("rtl8139");
@@ -1243,11 +1241,11 @@ int libxl_device_nic_add(libxl_ctx *ctx,
     device.backend_domid = nic->backend_domid;
     device.backend_kind = DEVICE_VIF;
     device.devid = nic->devid;
-    device.domid = nic->domid;
+    device.domid = domid;
     device.kind = DEVICE_VIF;
 
     flexarray_append(back, "frontend-id");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", nic->domid));
+    flexarray_append(back, libxl__sprintf(&gc, "%d", domid));
     flexarray_append(back, "online");
     flexarray_append(back, "1");
     flexarray_append(back, "state");
@@ -1302,7 +1300,7 @@ out:
     return rc;
 }
 
-int libxl_device_nic_del(libxl_ctx *ctx,
+int libxl_device_nic_del(libxl_ctx *ctx, uint32_t domid,
                          libxl_device_nic *nic, int wait)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
@@ -1313,7 +1311,7 @@ int libxl_device_nic_del(libxl_ctx *ctx,
     device.backend_domid    = nic->backend_domid;
     device.backend_kind     = DEVICE_VIF;
     device.devid            = nic->devid;
-    device.domid            = nic->domid;
+    device.domid            = domid;
     device.kind             = DEVICE_VIF;
 
     rc = libxl__device_del(&gc, &device, wait);
@@ -1445,13 +1443,13 @@ int libxl_device_net2_add(libxl_ctx *ctx
     device.backend_domid = net2->backend_domid;
     device.backend_kind = DEVICE_VIF2;
     device.devid = net2->devid;
-    device.domid = net2->domid;
+    device.domid = domid;
     device.kind = DEVICE_VIF2;
 
     flexarray_append(back, "domain");
     flexarray_append(back, dom);
     flexarray_append(back, "frontend-id");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", net2->domid));
+    flexarray_append(back, libxl__sprintf(&gc, "%d", domid));
 
     flexarray_append(back, "local-trusted");
     flexarray_append(back, libxl__sprintf(&gc, "%d", net2->back_trusted));
@@ -1579,7 +1577,7 @@ err:
     return NULL;
 }
 
-int libxl_device_net2_del(libxl_ctx *ctx, libxl_device_net2 *net2, int wait)
+int libxl_device_net2_del(libxl_ctx *ctx, uint32_t domid, libxl_device_net2 
*net2, int wait)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
     libxl__device device;
@@ -1589,7 +1587,7 @@ int libxl_device_net2_del(libxl_ctx *ctx
     device.backend_domid    = net2->backend_domid;
     device.backend_kind     = DEVICE_VIF2;
     device.devid            = net2->devid;
-    device.domid            = net2->domid;
+    device.domid            = domid;
     device.kind             = DEVICE_VIF2;
 
     rc = libxl__device_del(&gc, &device, wait);
@@ -1622,11 +1620,11 @@ int libxl_device_console_add(libxl_ctx *
     device.backend_domid = console->backend_domid;
     device.backend_kind = DEVICE_CONSOLE;
     device.devid = console->devid;
-    device.domid = console->domid;
+    device.domid = domid;
     device.kind = DEVICE_CONSOLE;
 
     flexarray_append(back, "frontend-id");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", console->domid));
+    flexarray_append(back, libxl__sprintf(&gc, "%d", domid));
     flexarray_append(back, "online");
     flexarray_append(back, "1");
     flexarray_append(back, "state");
@@ -1706,11 +1704,11 @@ int libxl_device_vkb_add(libxl_ctx *ctx,
     device.backend_domid = vkb->backend_domid;
     device.backend_kind = DEVICE_VKBD;
     device.devid = vkb->devid;
-    device.domid = vkb->domid;
+    device.domid = domid;
     device.kind = DEVICE_VKBD;
 
     flexarray_append(back, "frontend-id");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", vkb->domid));
+    flexarray_append(back, libxl__sprintf(&gc, "%d", domid));
     flexarray_append(back, "online");
     flexarray_append(back, "1");
     flexarray_append(back, "state");
@@ -1768,7 +1766,6 @@ static unsigned int libxl__append_disk_l
         pdisk_end = *disks + *ndisks;
         for (; pdisk < pdisk_end; pdisk++, dir++) {
             pdisk->backend_domid = 0;
-            pdisk->domid = domid;
             physpath_tmp = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(gc, 
"%s/%s/params", be_path, *dir), &len);
             if (physpath_tmp && strchr(physpath_tmp, ':')) {
                 pdisk->pdev_path = strdup(strchr(physpath_tmp, ':') + 1);
@@ -1866,15 +1863,12 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u
 
     ret = 0;
 
-    libxl_device_disk_del(ctx, disks + i, 1);
+    libxl_device_disk_del(ctx, domid, disks + i, 1);
     libxl_device_disk_add(ctx, domid, disk);
     stubdomid = libxl_get_stubdom_id(ctx, domid);
     if (stubdomid) {
-        disks[i].domid = stubdomid;
-        libxl_device_disk_del(ctx, disks + i, 1);
-        disk->domid = stubdomid;
+        libxl_device_disk_del(ctx, stubdomid, disks + i, 1);
         libxl_device_disk_add(ctx, stubdomid, disk);
-        disk->domid = domid;
     }
 out:
     for (i = 0; i < num; i++)
@@ -1923,10 +1917,10 @@ int libxl_device_vfb_add(libxl_ctx *ctx,
     device.backend_domid = vfb->backend_domid;
     device.backend_kind = DEVICE_VFB;
     device.devid = vfb->devid;
-    device.domid = vfb->domid;
+    device.domid = domid;
     device.kind = DEVICE_VFB;
 
-    flexarray_append_pair(back, "frontend-id", libxl__sprintf(&gc, "%d", 
vfb->domid));
+    flexarray_append_pair(back, "frontend-id", libxl__sprintf(&gc, "%d", 
domid));
     flexarray_append_pair(back, "online", "1");
     flexarray_append_pair(back, "state", libxl__sprintf(&gc, "%d", 1));
     flexarray_append_pair(back, "domain", libxl__domid_to_name(&gc, domid));
diff -r fff89897e9c2 -r ca75b204dca4 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Thu Mar 24 14:09:43 2011 +0000
+++ b/tools/libxl/libxl.h       Thu Mar 24 14:09:45 2011 +0000
@@ -360,7 +360,7 @@ libxl_vminfo * libxl_list_vm(libxl_ctx *
 libxl_vminfo * libxl_list_vm(libxl_ctx *ctx, int *nb_vm);
 
 int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk 
*disk);
-int libxl_device_disk_del(libxl_ctx *ctx, libxl_device_disk *disk, int wait);
+int libxl_device_disk_del(libxl_ctx *ctx, uint32_t domid, libxl_device_disk 
*disk, int wait);
 libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int 
*num);
 int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid,
                               libxl_device_disk *disk, libxl_diskinfo 
*diskinfo);
@@ -374,7 +374,7 @@ int libxl_device_disk_local_detach(libxl
 
 int libxl_device_nic_init(libxl_device_nic *nic, int dev_num);
 int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic 
*nic);
-int libxl_device_nic_del(libxl_ctx *ctx, libxl_device_nic *nic, int wait);
+int libxl_device_nic_del(libxl_ctx *ctx, uint32_t domid, libxl_device_nic 
*nic, int wait);
 libxl_nicinfo *libxl_list_nics(libxl_ctx *ctx, uint32_t domid, unsigned int 
*nb);
 
 int libxl_device_console_add(libxl_ctx *ctx, uint32_t domid, 
libxl_device_console *console);
@@ -482,7 +482,7 @@ int libxl_device_net2_add(libxl_ctx *ctx
                           libxl_device_net2 *net2);
 libxl_net2info *libxl_device_net2_list(libxl_ctx *ctx, uint32_t domid,
                                        unsigned int *nb);
-int libxl_device_net2_del(libxl_ctx *ctx, libxl_device_net2 *net2,
+int libxl_device_net2_del(libxl_ctx *ctx, uint32_t domid, libxl_device_net2 
*net2,
                           int wait);
 
 int libxl_get_freecpus(libxl_ctx *ctx, libxl_cpumap *cpumap);
diff -r fff89897e9c2 -r ca75b204dca4 tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl     Thu Mar 24 14:09:43 2011 +0000
+++ b/tools/libxl/libxl.idl     Thu Mar 24 14:09:45 2011 +0000
@@ -228,7 +228,6 @@ Network is missing""")
 
 libxl_device_vfb = Struct("device_vfb", [
     ("backend_domid", uint32),
-    ("domid",         uint32),
     ("devid",         integer),
     ("vnc",           bool,     False, "vnc enabled or disabled"),
     ("vnclisten",     string,   False, "address:port that should be listened 
on for the VNC server if vnc is set"),
@@ -244,13 +243,11 @@ libxl_device_vfb = Struct("device_vfb", 
 
 libxl_device_vkb = Struct("device_vkb", [
     ("backend_domid", uint32),
-    ("domid", domid),
     ("devid", integer),
     ])
 
 libxl_device_console = Struct("device_console", [
     ("backend_domid", uint32),
-    ("domid", domid),
     ("devid", integer),
     ("consback", libxl_console_backend),
     ("build_state", Reference(libxl_domain_build_state), True),
@@ -259,7 +256,6 @@ libxl_device_console = Struct("device_co
 
 libxl_device_disk = Struct("device_disk", [
     ("backend_domid", uint32),
-    ("domid", domid),
     ("pdev_path", string),
     ("vdev", string),
     ("backend", libxl_disk_backend),
@@ -271,7 +267,6 @@ libxl_device_disk = Struct("device_disk"
 
 libxl_device_nic = Struct("device_nic", [
     ("backend_domid", uint32),
-    ("domid", domid),
     ("devid", integer),
     ("mtu", integer),
     ("model", string),
@@ -288,7 +283,6 @@ libxl_device_net2 = Struct("device_net2"
     ("front_mac", libxl_mac),
     ("back_mac", libxl_mac),
     ("backend_domid", uint32),
-    ("domid", domid),
     ("trusted", BitField(uint32, 1)),
     ("back_trusted", BitField(uint32, 1)),
     ("filter_mac", BitField(uint32, 1)),
diff -r fff89897e9c2 -r ca75b204dca4 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Thu Mar 24 14:09:43 2011 +0000
+++ b/tools/libxl/libxl_create.c        Thu Mar 24 14:09:45 2011 +0000
@@ -446,7 +446,6 @@ static int do_domain_create(libxl__gc *g
     }
 
     for (i = 0; i < d_config->num_disks; i++) {
-        d_config->disks[i].domid = domid;
         ret = libxl_device_disk_add(ctx, domid, &d_config->disks[i]);
         if (ret) {
             fprintf(stderr, "cannot add disk %d to domain: %d\n", i, ret);
@@ -455,7 +454,6 @@ static int do_domain_create(libxl__gc *g
         }
     }
     for (i = 0; i < d_config->num_vifs; i++) {
-        d_config->vifs[i].domid = domid;
         ret = libxl_device_nic_add(ctx, domid, &d_config->vifs[i]);
         if (ret) {
             fprintf(stderr, "cannot add nic %d to domain: %d\n", i, ret);
@@ -465,7 +463,6 @@ static int do_domain_create(libxl__gc *g
     }
     if (!d_config->c_info.hvm) {
         for (i = 0; i < d_config->num_vif2s; i++) {
-            d_config->vif2s[i].domid = domid;
             ret = libxl_device_net2_add(ctx, domid, &d_config->vif2s[i]);
             if (ret) {
                 fprintf(stderr, "cannot add net2 %d to domain: %d\n", i, ret);
@@ -480,7 +477,6 @@ static int do_domain_create(libxl__gc *g
         ret = init_console_info(&console, 0, &state);
         if ( ret )
             goto error_out;
-        console.domid = domid;
         libxl_device_console_add(ctx, domid, &console);
         libxl_device_console_destroy(&console);
 
@@ -499,16 +495,13 @@ static int do_domain_create(libxl__gc *g
         libxl_device_console console;
 
         for (i = 0; i < d_config->num_vfbs; i++) {
-            d_config->vfbs[i].domid = domid;
             libxl_device_vfb_add(ctx, domid, &d_config->vfbs[i]);
-            d_config->vkbs[i].domid = domid;
             libxl_device_vkb_add(ctx, domid, &d_config->vkbs[i]);
         }
 
         ret = init_console_info(&console, 0, &state);
         if ( ret )
             goto error_out;
-        console.domid = domid;
 
         need_qemu = libxl__need_xenpv_qemu(gc, 1, &console,
                 d_config->num_vfbs, d_config->vfbs,
diff -r fff89897e9c2 -r ca75b204dca4 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Thu Mar 24 14:09:43 2011 +0000
+++ b/tools/libxl/libxl_dm.c    Thu Mar 24 14:09:45 2011 +0000
@@ -532,22 +532,18 @@ retry_transaction:
             goto retry_transaction;
 
     for (i = 0; i < num_disks; i++) {
-        disks[i].domid = domid;
         ret = libxl_device_disk_add(ctx, domid, &disks[i]);
         if (ret)
             goto out_free;
     }
     for (i = 0; i < num_vifs; i++) {
-        vifs[i].domid = domid;
         ret = libxl_device_nic_add(ctx, domid, &vifs[i]);
         if (ret)
             goto out_free;
     }
-    vfb->domid = domid;
     ret = libxl_device_vfb_add(ctx, domid, vfb);
     if (ret)
         goto out_free;
-    vkb->domid = domid;
     ret = libxl_device_vkb_add(ctx, domid, vkb);
     if (ret)
         goto out_free;
@@ -564,7 +560,6 @@ retry_transaction:
     for (i = 0; i < num_console; i++) {
         console[i].devid = i;
         console[i].consback = LIBXL_CONSOLE_BACKEND_IOEMU;
-        console[i].domid = domid;
         /* STUBDOM_CONSOLE_LOGGING (console 0) is for minios logging
          * STUBDOM_CONSOLE_SAVE (console 1) is for writing the save file
          * STUBDOM_CONSOLE_RESTORE (console 2) is for reading the save file
diff -r fff89897e9c2 -r ca75b204dca4 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Thu Mar 24 14:09:43 2011 +0000
+++ b/tools/libxl/libxl_utils.c Thu Mar 24 14:09:45 2011 +0000
@@ -476,7 +476,6 @@ int libxl_mac_to_device_nic(libxl_ctx *c
             ;
         if ((b >= mac_n + 6) && (*a == *b)) {
             nic->backend_domid = nics[i].backend_id;
-            nic->domid = nics[i].frontend_id;
             nic->devid = nics[i].devid;
             memcpy(nic->mac, nics[i].mac, sizeof (nic->mac));
             nic->script = strdup(nics[i].script);
@@ -551,7 +550,6 @@ int libxl_devid_to_device_disk(libxl_ctx
     if (!val)
         goto out;
     disk->backend_domid = strtoul(val, NULL, 10);
-    disk->domid = domid;
     be_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend", 
diskpath));
     disk->pdev_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, 
"%s/params", be_path));
     val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/type", 
be_path));
@@ -606,7 +604,6 @@ int libxl_devid_to_device_net2(libxl_ctx
     val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", 
net2path));
     net2->backend_domid = strtoul(val, NULL, 10);
 
-    net2->domid = domid;
     val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, 
"%s/remote-trusted", be_path));
     net2->trusted = strtoul(val, NULL, 10);
     val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, 
"%s/local-trusted", be_path));
diff -r fff89897e9c2 -r ca75b204dca4 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Mar 24 14:09:43 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Thu Mar 24 14:09:45 2011 +0000
@@ -379,7 +379,7 @@ static void printf_info(int domid,
         printf("\t(device\n");
         printf("\t\t(tap\n");
         printf("\t\t\t(backend_domid %d)\n", d_config->disks[i].backend_domid);
-        printf("\t\t\t(domid %d)\n", d_config->disks[i].domid);
+        printf("\t\t\t(domid %d)\n", domid);
         printf("\t\t\t(physpath %s)\n", d_config->disks[i].pdev_path);
         printf("\t\t\t(phystype %d)\n", d_config->disks[i].backend);
         printf("\t\t\t(virtpath %s)\n", d_config->disks[i].vdev);
@@ -394,7 +394,7 @@ static void printf_info(int domid,
         printf("\t(device\n");
         printf("\t\t(vif\n");
         printf("\t\t\t(backend_domid %d)\n", d_config->vifs[i].backend_domid);
-        printf("\t\t\t(domid %d)\n", d_config->vifs[i].domid);
+        printf("\t\t\t(domid %d)\n", domid);
         printf("\t\t\t(devid %d)\n", d_config->vifs[i].devid);
         printf("\t\t\t(mtu %d)\n", d_config->vifs[i].mtu);
         printf("\t\t\t(model %s)\n", d_config->vifs[i].model);
@@ -424,7 +424,7 @@ static void printf_info(int domid,
         printf("\t(device\n");
         printf("\t\t(vfb\n");
         printf("\t\t\t(backend_domid %d)\n", d_config->vfbs[i].backend_domid);
-        printf("\t\t\t(domid %d)\n", d_config->vfbs[i].domid);
+        printf("\t\t\t(domid %d)\n", domid);
         printf("\t\t\t(devid %d)\n", d_config->vfbs[i].devid);
         printf("\t\t\t(vnc %d)\n", d_config->vfbs[i].vnc);
         printf("\t\t\t(vnclisten %s)\n", d_config->vfbs[i].vnclisten);
@@ -1885,7 +1885,6 @@ static void cd_insert(const char *dom, c
         return;
     }
     disk.backend_domid = 0;
-    disk.domid = domid;
 
     libxl_cdrom_insert(ctx, domid, &disk);
     free(buf);
@@ -4300,7 +4299,6 @@ int main_networkattach(int argc, char **
             return 1;
         }
     }
-    nic.domid = domid;
     if (libxl_device_nic_add(ctx, domid, &nic)) {
         fprintf(stderr, "libxl_device_nic_add failed.\n");
         return 1;
@@ -4395,7 +4393,7 @@ int main_networkdetach(int argc, char **
             return 1;
         }
     }
-    if (libxl_device_nic_del(ctx, &nic, 1)) {
+    if (libxl_device_nic_del(ctx, domid, &nic, 1)) {
         fprintf(stderr, "libxl_device_nic_del failed.\n");
         return 1;
     }
@@ -4470,7 +4468,6 @@ int main_blockattach(int argc, char **ar
             return 1;
         }
     }
-    disk.domid = fe_domid;
     disk.backend_domid = be_domid;
 
     if (libxl_device_disk_add(ctx, fe_domid, &disk)) {
@@ -4555,7 +4552,7 @@ int main_blockdetach(int argc, char **ar
         fprintf(stderr, "Error: Device %s not connected.\n", argv[optind+1]);
         return 1;
     }
-    if (libxl_device_disk_del(ctx, &disk, 1)) {
+    if (libxl_device_disk_del(ctx, domid, &disk, 1)) {
         fprintf(stderr, "libxl_device_disk_del failed.\n");
     }
     return 0;
@@ -4650,7 +4647,6 @@ int main_network2attach(int argc, char *
             return 1;
         }
     }
-    net2.domid = domid;
     net2.backend_domid = back_domid;
     if (libxl_device_net2_add(ctx, domid, &net2)) {
         fprintf(stderr, "libxl_device_net2_add failed.\n");
@@ -4731,7 +4727,7 @@ int main_network2detach(int argc, char *
         fprintf(stderr, "Error: Device %s not connected.\n", argv[optind+1]);
         return 1;
     }
-    if (libxl_device_net2_del(ctx, &net2, 1)) {
+    if (libxl_device_net2_del(ctx, domid, &net2, 1)) {
         fprintf(stderr, "libxl_device_net2_del failed.\n");
         return 1;
     }
diff -r fff89897e9c2 -r ca75b204dca4 tools/ocaml/libs/xl/xl_stubs.c
--- a/tools/ocaml/libs/xl/xl_stubs.c    Thu Mar 24 14:09:43 2011 +0000
+++ b/tools/ocaml/libs/xl/xl_stubs.c    Thu Mar 24 14:09:45 2011 +0000
@@ -353,7 +353,6 @@ value stub_xl_disk_add(value info, value
        INIT_STRUCT();
 
        device_disk_val(&gc, &c_info, info);
-       c_info.domid = Int_val(domid);
 
        INIT_CTX();
        ret = libxl_device_disk_add(ctx, Int_val(domid), &c_info);
@@ -371,10 +370,9 @@ value stub_xl_disk_remove(value info, va
        INIT_STRUCT();
 
        device_disk_val(&gc, &c_info, info);
-       c_info.domid = Int_val(domid);
 
        INIT_CTX();
-       ret = libxl_device_disk_del(ctx, &c_info, 0);
+       ret = libxl_device_disk_del(ctx, Int_val(domid), &c_info, 0);
        if (ret != 0)
                failwith_xl("disk_remove", &lg);
        FREE_CTX();
@@ -389,7 +387,6 @@ value stub_xl_nic_add(value info, value 
        INIT_STRUCT();
 
        device_nic_val(&gc, &c_info, info);
-       c_info.domid = Int_val(domid);
 
        INIT_CTX();
        ret = libxl_device_nic_add(ctx, Int_val(domid), &c_info);
@@ -407,10 +404,9 @@ value stub_xl_nic_remove(value info, val
        INIT_STRUCT();
 
        device_nic_val(&gc, &c_info, info);
-       c_info.domid = Int_val(domid);
 
        INIT_CTX();
-       ret = libxl_device_nic_del(ctx, &c_info, 0);
+       ret = libxl_device_nic_del(ctx, Int_val(domid), &c_info, 0);
        if (ret != 0)
                failwith_xl("nic_remove", &lg);
        FREE_CTX();
@@ -427,7 +423,6 @@ value stub_xl_console_add(value info, va
 
        device_console_val(&gc, &c_info, info);
        domain_build_state_val(&gc, &c_state, state);
-       c_info.domid = Int_val(domid);
        c_info.build_state = &c_state;
 
        INIT_CTX();
@@ -446,7 +441,6 @@ value stub_xl_vkb_add(value info, value 
        INIT_STRUCT();
 
        device_vkb_val(&gc, &c_info, info);
-       c_info.domid = Int_val(domid);
 
        INIT_CTX();
        ret = libxl_device_vkb_add(ctx, Int_val(domid), &c_info);
@@ -495,7 +489,6 @@ value stub_xl_vfb_add(value info, value 
        INIT_STRUCT();
 
        device_vfb_val(&gc, &c_info, info);
-       c_info.domid = Int_val(domid);
 
        INIT_CTX();
        ret = libxl_device_vfb_add(ctx, Int_val(domid), &c_info);

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

<Prev in Thread] Current Thread [Next in Thread>