ia64/xen-unstable

changeset 9661:4088dd0856a9

If the 'cdrom=' option is specified in the definition file but media is
not found in the CD drive then main() in vl.c exits and the guest appears
to hang. This patch modifies vl.c slightly to check for the presents of
media. If the cdrom cannot be opened then the cd entry is removed from
hd_filename[] and bs_table[] allowing the guest to continue initializing.
If the guest requires the CD media then the guest should report, gracefully
or otherwise, that it's missing.

From: Ross Maxfield <rmaxfiel@novell.com>

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Apr 10 17:16:25 2006 +0100 (2006-04-10)
parents b454a09cddb1
children c89d62e7015a
files tools/ioemu/vl.c
line diff
     1.1 --- a/tools/ioemu/vl.c	Mon Apr 10 17:02:49 2006 +0100
     1.2 +++ b/tools/ioemu/vl.c	Mon Apr 10 17:16:25 2006 +0100
     1.3 @@ -3245,8 +3245,17 @@ int main(int argc, char **argv)
     1.4      /* we always create the cdrom drive, even if no disk is there */
     1.5      bdrv_init();
     1.6      if (has_cdrom) {
     1.7 -        bs_table[2] = bdrv_new("cdrom");
     1.8 -        bdrv_set_type_hint(bs_table[2], BDRV_TYPE_CDROM);
     1.9 +        int fd;
    1.10 +        if ( (fd = open(hd_filename[2], O_RDONLY | O_BINARY)) < 0) {
    1.11 +                hd_filename[2]=NULL;
    1.12 +                bs_table[2]=NULL;
    1.13 +                fprintf(logfile, "Could not open CD %s.\n", hd_filename[i]);
    1.14 +        }
    1.15 +        else {
    1.16 +                close(fd);
    1.17 +                bs_table[2] = bdrv_new("cdrom");
    1.18 +                bdrv_set_type_hint(bs_table[2], BDRV_TYPE_CDROM);
    1.19 +        }
    1.20      }
    1.21  
    1.22      /* open the virtual block devices */