Revision 8d278467

b/block.c
1305 1305
    bs->secs = secs;
1306 1306
}
1307 1307

  
1308
void bdrv_set_type_hint(BlockDriverState *bs, int type)
1309
{
1310
    bs->type = type;
1311
    bs->removable = ((type == BDRV_TYPE_CDROM ||
1312
                      type == BDRV_TYPE_FLOPPY));
1313
}
1314

  
1315 1308
void bdrv_set_translation_hint(BlockDriverState *bs, int translation)
1316 1309
{
1317 1310
    bs->translation = translation;
......
1428 1421
    }
1429 1422
}
1430 1423

  
1431
int bdrv_get_type_hint(BlockDriverState *bs)
1432
{
1433
    return bs->type;
1434
}
1435

  
1436 1424
int bdrv_get_translation_hint(BlockDriverState *bs)
1437 1425
{
1438 1426
    return bs->translation;
b/block.h
152 152
int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
153 153
	int *pnum);
154 154

  
155
#define BDRV_TYPE_HD     0
156
#define BDRV_TYPE_CDROM  1
157
#define BDRV_TYPE_FLOPPY 2
158 155
#define BIOS_ATA_TRANSLATION_AUTO   0
159 156
#define BIOS_ATA_TRANSLATION_NONE   1
160 157
#define BIOS_ATA_TRANSLATION_LBA    2
......
163 160

  
164 161
void bdrv_set_geometry_hint(BlockDriverState *bs,
165 162
                            int cyls, int heads, int secs);
166
void bdrv_set_type_hint(BlockDriverState *bs, int type);
167 163
void bdrv_set_translation_hint(BlockDriverState *bs, int translation);
168 164
void bdrv_get_geometry_hint(BlockDriverState *bs,
169 165
                            int *pcyls, int *pheads, int *psecs);
......
177 173
void bdrv_get_floppy_geometry_hint(BlockDriverState *bs, int *nb_heads,
178 174
                                   int *max_track, int *last_sect,
179 175
                                   FDriveType drive_in, FDriveType *drive);
180
int bdrv_get_type_hint(BlockDriverState *bs);
181 176
int bdrv_get_translation_hint(BlockDriverState *bs);
182 177
void bdrv_set_on_error(BlockDriverState *bs, BlockErrorAction on_read_error,
183 178
                       BlockErrorAction on_write_error);
b/block_int.h
194 194
    /* NOTE: the following infos are only hints for real hardware
195 195
       drivers. They are not used by the block driver */
196 196
    int cyls, heads, secs, translation;
197
    int type;
198 197
    BlockErrorAction on_read_error, on_write_error;
199 198
    char device_name[32];
200 199
    unsigned long *dirty_bitmap;
b/blockdev.c
487 487
            }
488 488
	    break;
489 489
	case MEDIA_CDROM:
490
            bdrv_set_type_hint(dinfo->bdrv, BDRV_TYPE_CDROM);
490
            bdrv_set_removable(dinfo->bdrv, 1);
491 491
            dinfo->media_cd = 1;
492 492
	    break;
493 493
	}
......
496 496
        /* FIXME: This isn't really a floppy, but it's a reasonable
497 497
           approximation.  */
498 498
    case IF_FLOPPY:
499
        bdrv_set_type_hint(dinfo->bdrv, BDRV_TYPE_FLOPPY);
499
        bdrv_set_removable(dinfo->bdrv, 1);
500 500
        break;
501 501
    case IF_PFLASH:
502 502
    case IF_MTD:

Also available in: Unified diff