aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi-bus.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2012-07-16 08:53:28 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2012-07-26 17:44:11 +0200
commit6a8a685c4d022d4edee57b0fb78c0ae1b4876478 (patch)
tree8c8c862b9c2b68364f83da87c9d5f61bdca4e884 /hw/scsi-bus.c
parentba6095cd6b497783e3621606b6b2320781aa3f52 (diff)
downloadqemu-6a8a685c4d022d4edee57b0fb78c0ae1b4876478.zip
qemu-6a8a685c4d022d4edee57b0fb78c0ae1b4876478.tar.gz
qemu-6a8a685c4d022d4edee57b0fb78c0ae1b4876478.tar.bz2
scsi-disk: Fail medium writes with proper sense for readonly LUNs
Add sense code for DATA_PROTECT/WRITE_PROTECTED and return this error for any WRITE*/WRITE_VERIFY* calls if the device is readonly=on, i.e. write-protected Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi-bus.c')
-rw-r--r--hw/scsi-bus.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index efbda6f..dd0cdd0 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -1182,6 +1182,11 @@ const struct SCSISense sense_code_DEVICE_INTERNAL_RESET = {
.key = UNIT_ATTENTION, .asc = 0x29, .ascq = 0x04
};
+/* Data Protection, Write Protected */
+const struct SCSISense sense_code_WRITE_PROTECTED = {
+ .key = DATA_PROTECT, .asc = 0x27, .ascq = 0x00
+};
+
/*
* scsi_build_sense
*