summaryrefslogtreecommitdiff
path: root/hw/virtio-blk.c
diff options
context:
space:
mode:
authorNaphtali Sprei <nsprei@redhat.com>2009-10-29 11:42:11 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-11-09 08:43:01 -0600
commitc79662f7f765a0e6cb7aa26902cc8d61f9022dd5 (patch)
treeb7c9d1dde699a690c487f2ef9c57b556558ac866 /hw/virtio-blk.c
parent59f2689d9082f2f631253c810f73cd22290144a9 (diff)
downloadqemu-c79662f7f765a0e6cb7aa26902cc8d61f9022dd5.tar.gz
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/virtio-blk.c')
-rw-r--r--hw/virtio-blk.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index 2630b99304..e6df9f2619 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -444,6 +444,9 @@ static uint32_t virtio_blk_get_features(VirtIODevice *vdev)
#endif
if (strcmp(s->serial_str, "0"))
features |= 1 << VIRTIO_BLK_F_IDENTIFY;
+
+ if (bdrv_is_read_only(s->bs))
+ features |= 1 << VIRTIO_BLK_F_RO;
return features;
}