[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 4/7] scsi-disk: scsi-block device for scsi pass-thr
From: |
Paolo Bonzini |
Subject: |
[Qemu-stable] [PATCH 4/7] scsi-disk: scsi-block device for scsi pass-through should not be removable |
Date: |
Tue, 18 Jun 2013 16:16:53 +0200 |
From: Pavel Hrdina <address@hidden>
This patch adds a new SCSI_DISK_F_NO_REMOVABLE_DEVOPS feature. By this
feature we can set that the scsi-block (scsi pass-through) device will still
be removable from the guest side, but from monitor it cannot be removed.
Cc: address@hidden
Signed-off-by: Pavel Hrdina <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/scsi/scsi-disk.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 02733dc..74e6a14 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -61,8 +61,9 @@ typedef struct SCSIDiskReq {
BlockAcctCookie acct;
} SCSIDiskReq;
-#define SCSI_DISK_F_REMOVABLE 0
-#define SCSI_DISK_F_DPOFUA 1
+#define SCSI_DISK_F_REMOVABLE 0
+#define SCSI_DISK_F_DPOFUA 1
+#define SCSI_DISK_F_NO_REMOVABLE_DEVOPS 2
struct SCSIDiskState
{
@@ -2110,7 +2111,8 @@ static int scsi_initfn(SCSIDevice *dev)
return -1;
}
- if (s->features & (1 << SCSI_DISK_F_REMOVABLE)) {
+ if ((s->features & (1 << SCSI_DISK_F_REMOVABLE)) &&
+ !(s->features & (1 << SCSI_DISK_F_NO_REMOVABLE_DEVOPS))) {
bdrv_set_dev_ops(s->qdev.conf.bs, &scsi_disk_removable_block_ops, s);
} else {
bdrv_set_dev_ops(s->qdev.conf.bs, &scsi_disk_block_ops, s);
@@ -2322,6 +2324,12 @@ static int scsi_block_initfn(SCSIDevice *dev)
} else {
s->qdev.blocksize = 512;
}
+
+ /* Makes the scsi-block device not removable by using HMP and QMP eject
+ * command.
+ */
+ s->features |= (1 << SCSI_DISK_F_NO_REMOVABLE_DEVOPS);
+
return scsi_initfn(&s->qdev);
}
--
1.8.1.4
- [Qemu-stable] [PULL 0/7] SCSI patches for 2013-06-18 (including 1.5.1 patches), Paolo Bonzini, 2013/06/18
- [Qemu-stable] [PATCH 1/7] scsi: reset cdrom tray statuses on scsi_disk_reset, Paolo Bonzini, 2013/06/18
- [Qemu-stable] [PATCH 2/7] scsi-generic: fix sign extension of READ CAPACITY(10) data, Paolo Bonzini, 2013/06/18
- [Qemu-stable] [PATCH 3/7] scsi-generic: check the return value of bdrv_aio_ioctl in execute_command, Paolo Bonzini, 2013/06/18
- [Qemu-stable] [PATCH 7/7] iscsi: reorganize iscsi_readcapacity_sync, Paolo Bonzini, 2013/06/18
- [Qemu-stable] [PATCH 6/7] iscsi: simplify freeing of tasks, Paolo Bonzini, 2013/06/18
- [Qemu-stable] [PATCH 5/7] vhost-scsi: fix k->set_guest_notifiers() NULL dereference, Paolo Bonzini, 2013/06/18
- [Qemu-stable] [PATCH 4/7] scsi-disk: scsi-block device for scsi pass-through should not be removable,
Paolo Bonzini <=