Clean-up a little bit the RW related bits of BDRV_O_FLAGS. BDRV_O_RDONLY gone (and so is BDRV_O_ACCESS). Default value for bdrv_flags (0/zero) is READ-ONLY. Need to explicitly request READ-WRITE.

Instead of using the field 'readonly' of the BlockDriverState struct for passing the request,
pass the request in the flags parameter to the function.

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Naphtali Sprei 2010-01-17 16:48:13 +02:00 committed by Anthony Liguori
parent b196b1532f
commit f5edb014ed
11 changed files with 44 additions and 42 deletions

8
vl.c
View file

@ -2227,19 +2227,19 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
}
if (ro == 1) {
if (type == IF_IDE) {
fprintf(stderr, "qemu: readonly flag not supported for drive with ide interface\n");
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;
}
(void)bdrv_set_read_only(dinfo->bdrv, 1);
}
/*
* cdrom is read-only. Set it now, after above interface checking
* since readonly attribute not explicitly required, so no error.
*/
if (media == MEDIA_CDROM) {
(void)bdrv_set_read_only(dinfo->bdrv, 1);
ro = 1;
}
bdrv_flags |= ro ? 0 : BDRV_O_RDWR;
if (bdrv_open2(dinfo->bdrv, file, bdrv_flags, drv) < 0) {
fprintf(stderr, "qemu: could not open disk image %s: %s\n",