]> xenbits.xensource.com Git - people/vhanquez/xen.git/commitdiff
ioemu: cache the BlockDriverState pointer
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 24 Jan 2008 14:52:57 +0000 (14:52 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 24 Jan 2008 14:52:57 +0000 (14:52 +0000)
This actually fixes a bug in the scsi case.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
xen-unstable changeset:   16863:6496ad18c3e286d03dc5f3b80588d06deec7c39f
xen-unstable date:        Wed Jan 23 18:02:48 2008 +0000

tools/ioemu/xenstore.c

index c3ee11b19c4b45b61d605a5b477976d7af9d45f9..beafcad47da11048d0f3d9aa721da27f93f134fe 100644 (file)
@@ -85,6 +85,7 @@ void xenstore_parse_domain_config(int domid)
         *dev = NULL, *params = NULL, *type = NULL;
     int i, is_scsi;
     unsigned int len, num, hd_index;
+    BlockDriverState *bs;
 
     for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++)
         media_filename[i] = NULL;
@@ -164,17 +165,17 @@ void xenstore_parse_domain_config(int domid)
             }
         }
 
-        bs_table[hd_index + (is_scsi ? MAX_DISKS : 0)] = bdrv_new(dev);
+        bs = bs_table[hd_index + (is_scsi ? MAX_DISKS : 0)] = bdrv_new(dev);
         /* check if it is a cdrom */
         if (type && !strcmp(type, "cdrom")) {
-            bdrv_set_type_hint(bs_table[hd_index], BDRV_TYPE_CDROM);
+            bdrv_set_type_hint(bs, BDRV_TYPE_CDROM);
             if (pasprintf(&buf, "%s/params", bpath) != -1)
                 xs_watch(xsh, buf, dev);
         }
+
         /* open device now if media present */
         if (params[0]) {
-            if (bdrv_open(bs_table[hd_index + (is_scsi ? MAX_DISKS : 0)],
-                          params, 0 /* snapshot */) < 0)
+            if (bdrv_open(bs, params, 0 /* snapshot */) < 0)
                 fprintf(stderr, "qemu: could not open hard disk image '%s'\n",
                         params);
         }