* [Qemu-devel] [PATCH] usb-storage: Fix share-rw option parsing
@ 2017-12-18 14:01 Fam Zheng
2018-01-03 2:13 ` [Qemu-devel] [Qemu-stable] " Fam Zheng
0 siblings, 1 reply; 3+ messages in thread
From: Fam Zheng @ 2017-12-18 14:01 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Paolo Bonzini, Gerd Hoffmann, qemu-stable
Because usb-storage creates an internal scsi device, we should propagate
options. We already do so for bootindex etc, but failed to take care of
share-rw. Fix it in an apparent way: add a new parameter to
scsi_bus_legacy_add_drive and pass in s->conf.share_rw.
Cc: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>
---
hw/scsi/scsi-bus.c | 9 ++++++++-
hw/usb/dev-storage.c | 3 ++-
include/hw/scsi/scsi.h | 1 +
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 977f7bce1f..73ca842327 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -224,6 +224,7 @@ static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp)
/* handle legacy '-drive if=scsi,...' cmd line args */
SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
int unit, bool removable, int bootindex,
+ bool share_rw,
const char *serial, Error **errp)
{
const char *driver;
@@ -254,6 +255,12 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
object_unparent(OBJECT(dev));
return NULL;
}
+ object_property_set_bool(OBJECT(dev), share_rw, "share-rw", &err);
+ if (err != NULL) {
+ error_propagate(errp, err);
+ object_unparent(OBJECT(dev));
+ return NULL;
+ }
object_property_set_bool(OBJECT(dev), true, "realized", &err);
if (err != NULL) {
error_propagate(errp, err);
@@ -288,7 +295,7 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated)
}
}
scsi_bus_legacy_add_drive(bus, blk_by_legacy_dinfo(dinfo),
- unit, false, -1, NULL, &error_fatal);
+ unit, false, -1, false, NULL, &error_fatal);
}
loc_pop(&loc);
}
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 8a61ec94c8..ff18ad5324 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -635,7 +635,8 @@ static void usb_msd_realize_storage(USBDevice *dev, Error **errp)
scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev),
&usb_msd_scsi_info_storage, NULL);
scsi_dev = scsi_bus_legacy_add_drive(&s->bus, blk, 0, !!s->removable,
- s->conf.bootindex, dev->serial,
+ s->conf.bootindex, s->conf.share_rw,
+ dev->serial,
&err);
blk_unref(blk);
if (!scsi_dev) {
diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
index 23a8ee6a7d..802a647cdc 100644
--- a/include/hw/scsi/scsi.h
+++ b/include/hw/scsi/scsi.h
@@ -151,6 +151,7 @@ static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d)
SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
int unit, bool removable, int bootindex,
+ bool share_rw,
const char *serial, Error **errp);
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated);
void scsi_legacy_handle_cmdline(void);
--
2.14.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [Qemu-stable] [PATCH] usb-storage: Fix share-rw option parsing
2017-12-18 14:01 [Qemu-devel] [PATCH] usb-storage: Fix share-rw option parsing Fam Zheng
@ 2018-01-03 2:13 ` Fam Zheng
2018-01-12 13:28 ` Gerd Hoffmann
0 siblings, 1 reply; 3+ messages in thread
From: Fam Zheng @ 2018-01-03 2:13 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Paolo Bonzini, Gerd Hoffmann, qemu-stable
On Mon, 12/18 22:01, Fam Zheng wrote:
> Because usb-storage creates an internal scsi device, we should propagate
> options. We already do so for bootindex etc, but failed to take care of
> share-rw. Fix it in an apparent way: add a new parameter to
> scsi_bus_legacy_add_drive and pass in s->conf.share_rw.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Fam Zheng <famz@redhat.com>
Ping?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [Qemu-stable] [PATCH] usb-storage: Fix share-rw option parsing
2018-01-03 2:13 ` [Qemu-devel] [Qemu-stable] " Fam Zheng
@ 2018-01-12 13:28 ` Gerd Hoffmann
0 siblings, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2018-01-12 13:28 UTC (permalink / raw)
To: Fam Zheng; +Cc: qemu-devel, kwolf, Paolo Bonzini, qemu-stable
On Wed, Jan 03, 2018 at 10:13:50AM +0800, Fam Zheng wrote:
> On Mon, 12/18 22:01, Fam Zheng wrote:
> > Because usb-storage creates an internal scsi device, we should propagate
> > options. We already do so for bootindex etc, but failed to take care of
> > share-rw. Fix it in an apparent way: add a new parameter to
> > scsi_bus_legacy_add_drive and pass in s->conf.share_rw.
> >
> > Cc: qemu-stable@nongnu.org
> > Signed-off-by: Fam Zheng <famz@redhat.com>
>
> Ping?
Doesn't apply cleanly any more, please send rebase.
thanks,
Gerd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-12 13:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-18 14:01 [Qemu-devel] [PATCH] usb-storage: Fix share-rw option parsing Fam Zheng
2018-01-03 2:13 ` [Qemu-devel] [Qemu-stable] " Fam Zheng
2018-01-12 13:28 ` Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).