mirror of
https://github.com/qemu/qemu.git
synced 2025-08-16 06:43:21 +00:00
ide: Reject readonly drives unless CD-ROM
drive_init() doesn't permit option readonly for if=ide, but that's worthless: we get it via if=none and -device. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
c4d74df726
commit
7aa9c811ca
@ -2617,6 +2617,11 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs,
|
|||||||
if (bdrv_get_type_hint(bs) == BDRV_TYPE_CDROM) {
|
if (bdrv_get_type_hint(bs) == BDRV_TYPE_CDROM) {
|
||||||
s->drive_kind = IDE_CD;
|
s->drive_kind = IDE_CD;
|
||||||
bdrv_set_change_cb(bs, cdrom_change_cb, s);
|
bdrv_set_change_cb(bs, cdrom_change_cb, s);
|
||||||
|
} else {
|
||||||
|
if (bdrv_is_read_only(bs)) {
|
||||||
|
error_report("Can't use a read-only drive");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (serial) {
|
if (serial) {
|
||||||
strncpy(s->drive_serial_str, serial, sizeof(s->drive_serial_str));
|
strncpy(s->drive_serial_str, serial, sizeof(s->drive_serial_str));
|
||||||
|
Loading…
Reference in New Issue
Block a user