[Spice-devel] [PATCH spice-gtk 22/44] fixup! usb-redir: add files for SCSI and USB MSC implementation
Frediano Ziglio
fziglio at redhat.com
Tue Jul 30 12:03:10 UTC 2019
Limit lines to 100 characters.
---
src/cd-scsi.c | 48 ++++++++++++++++++++++++++++++++----------------
1 file changed, 32 insertions(+), 16 deletions(-)
diff --git a/src/cd-scsi.c b/src/cd-scsi.c
index 39692576..9963762f 100644
--- a/src/cd-scsi.c
+++ b/src/cd-scsi.c
@@ -52,7 +52,8 @@ typedef struct ScsiShortSense {
} ScsiShortSense;
#define CD_MEDIA_EVENT_NO_CHANGE 0x0
-#define CD_MEDIA_EVENT_EJECT_REQ 0x1 /* user request (mechanical switch) to eject the media */
+#define CD_MEDIA_EVENT_EJECT_REQ 0x1 /* user request (mechanical switch) to
+ * eject the media */
#define CD_MEDIA_EVENT_NEW_MEDIA 0x2 /* new media received */
#define CD_MEDIA_EVENT_MEDIA_REMOVAL 0x3 /* media removed */
#define CD_MEDIA_EVENT_MEDIA_CHANGED 0x4 /* user request to load new media */
@@ -1071,7 +1072,8 @@ static void cd_scsi_cmd_inquiry_standard_no_lun(CdScsiLU *dev, CdScsiRequest *re
static void cd_scsi_cmd_inquiry_standard(CdScsiLU *dev, CdScsiRequest *req)
{
uint8_t *outbuf = req->buf;
- uint32_t resp_len = (dev->claim_version == 0) ? INQUIRY_STANDARD_LEN_NO_VER : INQUIRY_STANDARD_LEN;
+ uint32_t resp_len =
+ (dev->claim_version == 0) ? INQUIRY_STANDARD_LEN_NO_VER : INQUIRY_STANDARD_LEN;
outbuf[0] = (PERIF_QUALIFIER_CONNECTED << 5) | TYPE_ROM;
outbuf[1] = (dev->removable) ? INQUIRY_REMOVABLE_MEDIUM : 0;
@@ -1440,7 +1442,8 @@ static uint32_t cd_scsi_add_mode_page_caps_mech_status(CdScsiLU *dev, uint8_t *o
outbuf[2] = CD_MODE_PAGE_CAPS_CD_R_READ | CD_MODE_PAGE_CAPS_CD_RW_READ |
CD_MODE_PAGE_CAPS_DVD_ROM_READ | CD_MODE_PAGE_CAPS_DVD_R_READ |
CD_MODE_PAGE_CAPS_DVD_RAM_READ;
- outbuf[6] = CD_MODE_PAGE_CAPS_LOADING_TRAY | CD_MODE_PAGE_CAPS_EJECT | CD_MODE_PAGE_CAPS_LOCK_SUPPORT;
+ outbuf[6] = CD_MODE_PAGE_CAPS_LOADING_TRAY | CD_MODE_PAGE_CAPS_EJECT |
+ CD_MODE_PAGE_CAPS_LOCK_SUPPORT;
if (dev->prevent_media_removal) {
outbuf[6] |= CD_MODE_PAGE_CAPS_LOCK_STATE;
}
@@ -1633,7 +1636,8 @@ static void cd_scsi_cmd_mode_select_10(CdScsiLU *dev, CdScsiRequest *req)
#define CD_FEATURE_REMOVABLE_NO_PRVNT_JMPR (0x01 << 2)
#define CD_FEATURE_REMOVABLE_LOCK (0x01)
-static gboolean cd_scsi_feature_reportable(uint32_t feature, uint32_t start_feature, uint32_t req_type)
+static gboolean cd_scsi_feature_reportable(uint32_t feature, uint32_t start_feature,
+ uint32_t req_type)
{
return (req_type == CD_FEATURE_REQ_SINGLE && start_feature == feature) ||
(feature >= start_feature);
@@ -1863,11 +1867,13 @@ static void cd_scsi_cmd_get_configuration(CdScsiLU *dev, CdScsiRequest *req)
switch (req_type) {
case CD_FEATURE_REQ_ALL:
case CD_FEATURE_REQ_CURRENT:
- resp_len += cd_scsi_add_feature_profiles_list(dev, outbuf + resp_len, start_feature, req_type);
+ resp_len += cd_scsi_add_feature_profiles_list(dev, outbuf + resp_len, start_feature,
+ req_type);
resp_len += cd_scsi_add_feature_core(dev, outbuf + resp_len, start_feature, req_type);
resp_len += cd_scsi_add_feature_morph(dev, outbuf + resp_len, start_feature, req_type);
resp_len += cd_scsi_add_feature_removable(dev, outbuf + resp_len, start_feature, req_type);
- resp_len += cd_scsi_add_feature_random_read(dev, outbuf + resp_len, start_feature, req_type);
+ resp_len += cd_scsi_add_feature_random_read(dev, outbuf + resp_len, start_feature,
+ req_type);
resp_len += cd_scsi_add_feature_cd_read(dev, outbuf + resp_len, start_feature, req_type);
resp_len += cd_scsi_add_feature_dvd_read(dev, outbuf + resp_len, start_feature, req_type);
resp_len += cd_scsi_add_feature_power_mgmt(dev, outbuf + resp_len, start_feature, req_type);
@@ -1882,22 +1888,28 @@ static void cd_scsi_cmd_get_configuration(CdScsiLU *dev, CdScsiRequest *req)
resp_len += cd_scsi_add_feature_morph(dev, outbuf + resp_len, start_feature, req_type);
break;
case CD_FEATURE_NUM_REMOVABLE:
- resp_len += cd_scsi_add_feature_removable(dev, outbuf + resp_len, start_feature, req_type);
+ resp_len += cd_scsi_add_feature_removable(dev, outbuf + resp_len, start_feature,
+ req_type);
break;
case CD_FEATURE_NUM_RANDOM_READ:
- resp_len += cd_scsi_add_feature_random_read(dev, outbuf + resp_len, start_feature, req_type);
+ resp_len += cd_scsi_add_feature_random_read(dev, outbuf + resp_len, start_feature,
+ req_type);
break;
case CD_FEATURE_NUM_CD_READ:
- resp_len += cd_scsi_add_feature_cd_read(dev, outbuf + resp_len, start_feature, req_type);
+ resp_len += cd_scsi_add_feature_cd_read(dev, outbuf + resp_len, start_feature,
+ req_type);
break;
case CD_FEATURE_NUM_DVD_READ:
- resp_len += cd_scsi_add_feature_dvd_read(dev, outbuf + resp_len, start_feature, req_type);
+ resp_len += cd_scsi_add_feature_dvd_read(dev, outbuf + resp_len, start_feature,
+ req_type);
break;
case CD_FEATURE_NUM_POWER_MNGT:
- resp_len += cd_scsi_add_feature_power_mgmt(dev, outbuf + resp_len, start_feature, req_type);
+ resp_len += cd_scsi_add_feature_power_mgmt(dev, outbuf + resp_len, start_feature,
+ req_type);
break;
case CD_FEATURE_NUM_TIMEOUT:
- resp_len += cd_scsi_add_feature_timeout(dev, outbuf + resp_len, start_feature, req_type);
+ resp_len += cd_scsi_add_feature_timeout(dev, outbuf + resp_len, start_feature,
+ req_type);
break;
default:
break;
@@ -2031,7 +2043,8 @@ static void cd_scsi_cmd_get_event_status_notification(CdScsiLU *dev, CdScsiReque
" none of requested events supported",
req->lun, immed, classes_requested, classes_supported);
}
- outbuf[1] = (uint8_t)(resp_len - 2); /* Event Data Length LSB, length excluding the field itself */
+ outbuf[1] = (uint8_t)(resp_len - 2); /* Event Data Length LSB, length excluding the
+ * field itself */
outbuf[3] = (uint8_t)classes_supported;
req->in_len = (req->req_len < resp_len) ? req->req_len : resp_len;
@@ -2217,7 +2230,8 @@ static void cd_scsi_cmd_start_stop_unit(CdScsiLU *dev, CdScsiRequest *req)
SPICE_DEBUG("start_stop_unit, lun:0x%" G_GUINT32_FORMAT " started", req->lun);
if (load_eject) { /* load medium */
- SPICE_DEBUG("start_stop_unit, lun:0x%" G_GUINT32_FORMAT " load with no media", req->lun);
+ SPICE_DEBUG("start_stop_unit, lun:0x%" G_GUINT32_FORMAT " load with no media",
+ req->lun);
cd_scsi_lu_load(dev, NULL);
cd_scsi_dev_changed(dev->tgt->user_data, req->lun);
}
@@ -2500,7 +2514,8 @@ static void cd_scsi_read_async_canceled(GCancellable *cancellable, gpointer user
g_cancellable_disconnect(cancellable, req->cancel_id);
req->cancel_id = 0;
- req->req_state = (st->state == CD_SCSI_TGT_STATE_RUNNING) ? SCSI_REQ_CANCELED : SCSI_REQ_DISPOSED;
+ req->req_state =
+ (st->state == CD_SCSI_TGT_STATE_RUNNING) ? SCSI_REQ_CANCELED : SCSI_REQ_DISPOSED;
req->in_len = 0;
req->status = GOOD;
@@ -2715,7 +2730,8 @@ void cd_scsi_dev_request_submit(CdScsiTarget *st, CdScsiRequest *req)
done:
SPICE_DEBUG("request_submit done, lun: %" G_GUINT32_FORMAT
" op: 0x%02x %s, state: %s status: %" G_GUINT32_FORMAT " len: %" G_GUINT64_FORMAT,
- lun, opcode, cmd_name, CdScsiReqState_str(req->req_state), req->status, req->in_len);
+ lun, opcode, cmd_name, CdScsiReqState_str(req->req_state), req->status,
+ req->in_len);
if (req->req_state == SCSI_REQ_COMPLETE) {
cd_scsi_dev_request_complete(st->user_data, req);
--
2.20.1
More information about the Spice-devel
mailing list