Revision 7d0d6950 hw/scsi-disk.c

b/hw/scsi-disk.c
1049 1049
static int scsi_disk_initfn(SCSIDevice *dev)
1050 1050
{
1051 1051
    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
1052
    int is_cd;
1052 1053
    DriveInfo *dinfo;
1053 1054

  
1054 1055
    if (!s->qdev.conf.bs) {
......
1056 1057
        return -1;
1057 1058
    }
1058 1059
    s->bs = s->qdev.conf.bs;
1060
    is_cd = bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM;
1059 1061

  
1060 1062
    if (!s->serial) {
1061 1063
        /* try to fall back to value set with legacy -drive serial=... */
......
1072 1074
        return -1;
1073 1075
    }
1074 1076

  
1075
    if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {
1077
    if (is_cd) {
1076 1078
        s->qdev.blocksize = 2048;
1077 1079
    } else {
1078 1080
        s->qdev.blocksize = s->qdev.conf.logical_block_size;
......
1081 1083

  
1082 1084
    s->qdev.type = TYPE_DISK;
1083 1085
    qemu_add_vm_change_state_handler(scsi_dma_restart_cb, s);
1086
    bdrv_set_removable(s->bs, is_cd);
1084 1087
    return 0;
1085 1088
}
1086 1089

  

Also available in: Unified diff