mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
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:
parent
b196b1532f
commit
f5edb014ed
11 changed files with 44 additions and 42 deletions
8
vl.c
8
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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue