提交 2db7ad59 编写于 作者: N Naphtali Sprei 提交者: Aurelien Jarno

read-only: allow read-only CDROM with any interface

Signed-off-by: NNaphtali Sprei <nsprei@redhat.com>
Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
上级 f7c11b53
......@@ -1185,19 +1185,16 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
bdrv_flags &= ~BDRV_O_NATIVE_AIO;
}
if (ro == 1) {
if (media == MEDIA_CDROM) {
/* CDROM is fine for any interface, don't check. */
ro = 1;
} else if (ro == 1) {
if (type != IF_SCSI && type != IF_VIRTIO && type != IF_FLOPPY) {
fprintf(stderr, "qemu: readonly flag not supported for drive with this interface\n");
return NULL;
}
}
/*
* cdrom is read-only. Set it now, after above interface checking
* since readonly attribute not explicitly required, so no error.
*/
if (media == MEDIA_CDROM) {
ro = 1;
}
bdrv_flags |= ro ? 0 : BDRV_O_RDWR;
if (bdrv_open2(dinfo->bdrv, file, bdrv_flags, drv) < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册