diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2013-08-27 14:54:44 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2013-09-02 11:06:19 +0200 |
commit | 1556a8fc38dbf4e950c50427192a3a37cdea3cba (patch) | |
tree | 16530b6991cc435e79b9ab5f1970747666ff8f4d | |
parent | 5c67dd7b4884979a2613a4702ac1ab68b0e6a16e (diff) |
uas: add property for request logging
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | hw/usb/dev-uas.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c index 63ad12ea6..87012925e 100644 --- a/hw/usb/dev-uas.c +++ b/hw/usb/dev-uas.c @@ -113,6 +113,9 @@ struct UASDevice { QTAILQ_HEAD(, UASStatus) results; QTAILQ_HEAD(, UASRequest) requests; + /* properties */ + uint32_t requestlog; + /* usb 2.0 only */ USBPacket *status2; UASRequest *datain2; @@ -692,9 +695,9 @@ static void usb_uas_command(UASDevice *uas, uas_ui *ui) req->req = scsi_req_new(req->dev, req->tag, usb_uas_get_lun(req->lun), ui->command.cdb, req); -#if 1 - scsi_req_print(req->req); -#endif + if (uas->requestlog) { + scsi_req_print(req->req); + } len = scsi_req_enqueue(req->req); if (len) { req->data_size = len; @@ -902,6 +905,11 @@ static const VMStateDescription vmstate_usb_uas = { } }; +static Property uas_properties[] = { + DEFINE_PROP_UINT32("log-scsi-req", UASDevice, requestlog, 0), + DEFINE_PROP_END_OF_LIST(), +}; + static void usb_uas_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -919,6 +927,7 @@ static void usb_uas_class_initfn(ObjectClass *klass, void *data) set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); dc->fw_name = "storage"; dc->vmsd = &vmstate_usb_uas; + dc->props = uas_properties; } static const TypeInfo uas_info = { |