[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 22/23] usb-msd: Propagate removable bit to SCSI devi
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 22/23] usb-msd: Propagate removable bit to SCSI device |
Date: |
Mon, 24 Jan 2011 22:10:51 +0100 |
From: Stefan Hajnoczi <address@hidden>
USB Mass Storage Devices sometimes have the RMB (removable) bit set in
the SCSI INQUIRY response. Thumbdrives tend to have the bit set whereas
hard disks do not.
Operating systems differentiate between removable devices and fixed
devices. Under Linux, the anaconda installer looks for removable
devices. Under Windows, only fixed devices may have more than one
partition and AutoRun is also affected by the removable bit.
For these reasons, allow USB Mass Storage Devices to override the
removable bit:
qemu -usb
-drive if=none,file=test.img,cache=none,id=disk0
-device usb-storage,drive=disk0,removable=on
The default is off.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/usb-msd.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index ccdf8ff..11722c7 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -51,6 +51,7 @@ typedef struct {
SCSIBus bus;
BlockConf conf;
SCSIDevice *scsi_dev;
+ uint32_t removable;
int result;
/* For async completion. */
USBPacket *packet;
@@ -515,7 +516,7 @@ static int usb_msd_initfn(USBDevice *dev)
usb_desc_init(dev);
scsi_bus_new(&s->bus, &s->dev.qdev, 0, 1, usb_msd_command_complete);
- s->scsi_dev = scsi_bus_legacy_add_drive(&s->bus, bs, 0, false);
+ s->scsi_dev = scsi_bus_legacy_add_drive(&s->bus, bs, 0, !!s->removable);
if (!s->scsi_dev) {
return -1;
}
@@ -607,6 +608,7 @@ static struct USBDeviceInfo msd_info = {
.usbdevice_init = usb_msd_init,
.qdev.props = (Property[]) {
DEFINE_BLOCK_PROPERTIES(MSDState, conf),
+ DEFINE_PROP_BIT("removable", MSDState, removable, 0, false),
DEFINE_PROP_END_OF_LIST(),
},
};
--
1.7.2.3
- [Qemu-devel] [PATCH 11/23] qcow2: Batch flushes for COW, (continued)
- [Qemu-devel] [PATCH 11/23] qcow2: Batch flushes for COW, Kevin Wolf, 2011/01/24
- [Qemu-devel] [PATCH 10/23] qcow2: Use QcowCache, Kevin Wolf, 2011/01/24
- [Qemu-devel] [PATCH 12/23] ide: Remove unneeded null pointer check, Kevin Wolf, 2011/01/24
- [Qemu-devel] [PATCH 13/23] Documentation: Add qemu-img check/rebase, Kevin Wolf, 2011/01/24
- [Qemu-devel] [PATCH 14/23] qed: Refuse to create images on block devices, Kevin Wolf, 2011/01/24
- [Qemu-devel] [PATCH 15/23] Fix block migration when the device size is not a multiple of 1 MB, Kevin Wolf, 2011/01/24
- [Qemu-devel] [PATCH 16/23] blockdev: Fix error message for invalid -drive CHS, Kevin Wolf, 2011/01/24
- [Qemu-devel] [PATCH 17/23] blockdev: Make drive_init() use error_report(), Kevin Wolf, 2011/01/24
- [Qemu-devel] [PATCH 18/23] blockdev: Fix drive_del not to crash when drive is not in use, Kevin Wolf, 2011/01/24
- [Qemu-devel] [PATCH 19/23] block: Use backing format driver during image creation, Kevin Wolf, 2011/01/24
- [Qemu-devel] [PATCH 22/23] usb-msd: Propagate removable bit to SCSI device,
Kevin Wolf <=
- [Qemu-devel] [PATCH 20/23] scsi-disk: Allow overriding SCSI INQUIRY removable bit, Kevin Wolf, 2011/01/24
- [Qemu-devel] [PATCH 23/23] docs: Document scsi-disk and usb-storage removable parameter, Kevin Wolf, 2011/01/24
- [Qemu-devel] [PATCH 21/23] scsi: Allow scsi_bus_legacy_add_drive() to set removable bit, Kevin Wolf, 2011/01/24
- [Qemu-devel] Re: [PULL 00/23] Block patches, Anthony Liguori, 2011/01/24