mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-27 05:20:50 +00:00
block: Remove type hint, it's guest matter, doesn't belong here
No users of bdrv_get_type_hint() left. bdrv_set_type_hint() can make the media removable by side effect. Make that explicit. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
95b5edcd92
commit
8d278467ff
12
block.c
12
block.c
@ -1305,13 +1305,6 @@ void bdrv_set_geometry_hint(BlockDriverState *bs,
|
|||||||
bs->secs = secs;
|
bs->secs = secs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bdrv_set_type_hint(BlockDriverState *bs, int type)
|
|
||||||
{
|
|
||||||
bs->type = type;
|
|
||||||
bs->removable = ((type == BDRV_TYPE_CDROM ||
|
|
||||||
type == BDRV_TYPE_FLOPPY));
|
|
||||||
}
|
|
||||||
|
|
||||||
void bdrv_set_translation_hint(BlockDriverState *bs, int translation)
|
void bdrv_set_translation_hint(BlockDriverState *bs, int translation)
|
||||||
{
|
{
|
||||||
bs->translation = translation;
|
bs->translation = translation;
|
||||||
@ -1428,11 +1421,6 @@ void bdrv_get_floppy_geometry_hint(BlockDriverState *bs, int *nb_heads,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int bdrv_get_type_hint(BlockDriverState *bs)
|
|
||||||
{
|
|
||||||
return bs->type;
|
|
||||||
}
|
|
||||||
|
|
||||||
int bdrv_get_translation_hint(BlockDriverState *bs)
|
int bdrv_get_translation_hint(BlockDriverState *bs)
|
||||||
{
|
{
|
||||||
return bs->translation;
|
return bs->translation;
|
||||||
|
5
block.h
5
block.h
@ -152,9 +152,6 @@ int bdrv_has_zero_init(BlockDriverState *bs);
|
|||||||
int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
|
int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
|
||||||
int *pnum);
|
int *pnum);
|
||||||
|
|
||||||
#define BDRV_TYPE_HD 0
|
|
||||||
#define BDRV_TYPE_CDROM 1
|
|
||||||
#define BDRV_TYPE_FLOPPY 2
|
|
||||||
#define BIOS_ATA_TRANSLATION_AUTO 0
|
#define BIOS_ATA_TRANSLATION_AUTO 0
|
||||||
#define BIOS_ATA_TRANSLATION_NONE 1
|
#define BIOS_ATA_TRANSLATION_NONE 1
|
||||||
#define BIOS_ATA_TRANSLATION_LBA 2
|
#define BIOS_ATA_TRANSLATION_LBA 2
|
||||||
@ -163,7 +160,6 @@ int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
|
|||||||
|
|
||||||
void bdrv_set_geometry_hint(BlockDriverState *bs,
|
void bdrv_set_geometry_hint(BlockDriverState *bs,
|
||||||
int cyls, int heads, int secs);
|
int cyls, int heads, int secs);
|
||||||
void bdrv_set_type_hint(BlockDriverState *bs, int type);
|
|
||||||
void bdrv_set_translation_hint(BlockDriverState *bs, int translation);
|
void bdrv_set_translation_hint(BlockDriverState *bs, int translation);
|
||||||
void bdrv_get_geometry_hint(BlockDriverState *bs,
|
void bdrv_get_geometry_hint(BlockDriverState *bs,
|
||||||
int *pcyls, int *pheads, int *psecs);
|
int *pcyls, int *pheads, int *psecs);
|
||||||
@ -177,7 +173,6 @@ typedef enum FDriveType {
|
|||||||
void bdrv_get_floppy_geometry_hint(BlockDriverState *bs, int *nb_heads,
|
void bdrv_get_floppy_geometry_hint(BlockDriverState *bs, int *nb_heads,
|
||||||
int *max_track, int *last_sect,
|
int *max_track, int *last_sect,
|
||||||
FDriveType drive_in, FDriveType *drive);
|
FDriveType drive_in, FDriveType *drive);
|
||||||
int bdrv_get_type_hint(BlockDriverState *bs);
|
|
||||||
int bdrv_get_translation_hint(BlockDriverState *bs);
|
int bdrv_get_translation_hint(BlockDriverState *bs);
|
||||||
void bdrv_set_on_error(BlockDriverState *bs, BlockErrorAction on_read_error,
|
void bdrv_set_on_error(BlockDriverState *bs, BlockErrorAction on_read_error,
|
||||||
BlockErrorAction on_write_error);
|
BlockErrorAction on_write_error);
|
||||||
|
@ -194,7 +194,6 @@ struct BlockDriverState {
|
|||||||
/* NOTE: the following infos are only hints for real hardware
|
/* NOTE: the following infos are only hints for real hardware
|
||||||
drivers. They are not used by the block driver */
|
drivers. They are not used by the block driver */
|
||||||
int cyls, heads, secs, translation;
|
int cyls, heads, secs, translation;
|
||||||
int type;
|
|
||||||
BlockErrorAction on_read_error, on_write_error;
|
BlockErrorAction on_read_error, on_write_error;
|
||||||
char device_name[32];
|
char device_name[32];
|
||||||
unsigned long *dirty_bitmap;
|
unsigned long *dirty_bitmap;
|
||||||
|
@ -487,7 +487,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MEDIA_CDROM:
|
case MEDIA_CDROM:
|
||||||
bdrv_set_type_hint(dinfo->bdrv, BDRV_TYPE_CDROM);
|
bdrv_set_removable(dinfo->bdrv, 1);
|
||||||
dinfo->media_cd = 1;
|
dinfo->media_cd = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -496,7 +496,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)
|
|||||||
/* FIXME: This isn't really a floppy, but it's a reasonable
|
/* FIXME: This isn't really a floppy, but it's a reasonable
|
||||||
approximation. */
|
approximation. */
|
||||||
case IF_FLOPPY:
|
case IF_FLOPPY:
|
||||||
bdrv_set_type_hint(dinfo->bdrv, BDRV_TYPE_FLOPPY);
|
bdrv_set_removable(dinfo->bdrv, 1);
|
||||||
break;
|
break;
|
||||||
case IF_PFLASH:
|
case IF_PFLASH:
|
||||||
case IF_MTD:
|
case IF_MTD:
|
||||||
|
Loading…
Reference in New Issue
Block a user