aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorNaphtali Sprei <nsprei@redhat.com>2010-01-17 16:48:13 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-20 08:25:22 -0600
commitf5edb014ed221db6942225ec675aafe2675632dd (patch)
tree8c4d10e0d64b55c4320e1837749fc03cbf80941e /vl.c
parentb196b1532f2981e9c811c96214a44ee9e7d12af3 (diff)
downloadqemu-f5edb014ed221db6942225ec675aafe2675632dd.zip
qemu-f5edb014ed221db6942225ec675aafe2675632dd.tar.gz
qemu-f5edb014ed221db6942225ec675aafe2675632dd.tar.bz2
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>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/vl.c b/vl.c
index 76ef8ca..eee59dd 100644
--- a/vl.c
+++ b/vl.c
@@ -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",