]> Git Repo - qemu.git/commitdiff
ide: Reject readonly drives unless CD-ROM
authorMarkus Armbruster <[email protected]>
Mon, 28 Jun 2010 17:10:36 +0000 (19:10 +0200)
committerKevin Wolf <[email protected]>
Tue, 6 Jul 2010 15:05:50 +0000 (17:05 +0200)
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 <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
hw/ide/core.c

index dbb7accca0b8ebc786b9c6d2d553a98d259c24f5..3b84bea5cf144343e4c50175e7aa4a1a3eeebe52 100644 (file)
@@ -2617,6 +2617,11 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs,
     if (bdrv_get_type_hint(bs) == BDRV_TYPE_CDROM) {
         s->drive_kind = IDE_CD;
         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) {
         strncpy(s->drive_serial_str, serial, sizeof(s->drive_serial_str));
This page took 0.030346 seconds and 4 git commands to generate.