diff options
author | Naphtali Sprei <nsprei@redhat.com> | 2009-10-29 11:42:11 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-11-09 08:43:01 -0600 |
commit | c79662f7f765a0e6cb7aa26902cc8d61f9022dd5 (patch) | |
tree | b7c9d1dde699a690c487f2ef9c57b556558ac866 /hw/scsi-disk.c | |
parent | 59f2689d9082f2f631253c810f73cd22290144a9 (diff) | |
download | qemu-c79662f7f765a0e6cb7aa26902cc8d61f9022dd5.tar.gz qemu-c79662f7f765a0e6cb7aa26902cc8d61f9022dd5.tar.bz2 qemu-c79662f7f765a0e6cb7aa26902cc8d61f9022dd5.zip |
Pass the drive's readonly attribute to the guest OS
Implemented for virtio-blk and for scsi
Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/scsi-disk.c')
-rw-r--r-- | hw/scsi-disk.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 2a9268aa63..5da573d59e 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -633,7 +633,8 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, memset(p, 0, 4); outbuf[1] = 0; /* Default media type. */ outbuf[3] = 0; /* Block descriptor length. */ - if (bdrv_get_type_hint(s->dinfo->bdrv) == BDRV_TYPE_CDROM) { + if (bdrv_get_type_hint(s->dinfo->bdrv) == BDRV_TYPE_CDROM || + bdrv_is_read_only(s->dinfo->bdrv)) { outbuf[2] = 0x80; /* Readonly. */ } p += 4; |