ia64/xen-unstable

changeset 16863:6496ad18c3e2

ioemu: cache the BlockDriverState pointer
This actually fixes a bug in the scsi case.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jan 23 18:02:48 2008 +0000 (2008-01-23)
parents 1c826ea72a80
children f98a26b5b398
files tools/ioemu/xenstore.c
line diff
     1.1 --- a/tools/ioemu/xenstore.c	Wed Jan 23 15:42:52 2008 +0000
     1.2 +++ b/tools/ioemu/xenstore.c	Wed Jan 23 18:02:48 2008 +0000
     1.3 @@ -85,6 +85,7 @@ void xenstore_parse_domain_config(int do
     1.4          *dev = NULL, *params = NULL, *type = NULL, *drv = NULL;
     1.5      int i, is_scsi, is_hdN = 0;
     1.6      unsigned int len, num, hd_index;
     1.7 +    BlockDriverState *bs;
     1.8  
     1.9      for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++)
    1.10          media_filename[i] = NULL;
    1.11 @@ -209,17 +210,17 @@ void xenstore_parse_domain_config(int do
    1.12              }
    1.13          }
    1.14  
    1.15 -        bs_table[hd_index + (is_scsi ? MAX_DISKS : 0)] = bdrv_new(dev);
    1.16 +        bs = bs_table[hd_index + (is_scsi ? MAX_DISKS : 0)] = bdrv_new(dev);
    1.17          /* check if it is a cdrom */
    1.18          if (type && !strcmp(type, "cdrom")) {
    1.19 -            bdrv_set_type_hint(bs_table[hd_index], BDRV_TYPE_CDROM);
    1.20 +            bdrv_set_type_hint(bs, BDRV_TYPE_CDROM);
    1.21              if (pasprintf(&buf, "%s/params", bpath) != -1)
    1.22                  xs_watch(xsh, buf, dev);
    1.23          }
    1.24 +
    1.25          /* open device now if media present */
    1.26          if (params[0]) {
    1.27 -            if (bdrv_open(bs_table[hd_index + (is_scsi ? MAX_DISKS : 0)],
    1.28 -                          params, 0 /* snapshot */) < 0)
    1.29 +            if (bdrv_open(bs, params, 0 /* snapshot */) < 0)
    1.30                  fprintf(stderr, "qemu: could not open hard disk image '%s'\n",
    1.31                          params);
    1.32          }