[Spice-devel] [PATCH spice-gtk v2 12/33] fixup! usb-redir: add files for SCSI and USB MSC implementation
Frediano Ziglio
fziglio at redhat.com
Fri Aug 9 14:26:30 UTC 2019
Avoid G_GUINT32_FORMAT.
We don't support architectures less than 32 bit.
Due to C type promotion %u is surely fine.
---
src/cd-scsi.c | 244 ++++++++++++++++++++++++--------------------------
1 file changed, 116 insertions(+), 128 deletions(-)
diff --git a/src/cd-scsi.c b/src/cd-scsi.c
index 2a3595bb..9c5616b0 100644
--- a/src/cd-scsi.c
+++ b/src/cd-scsi.c
@@ -352,7 +352,7 @@ static void cd_scsi_cmd_complete_check_cond(CdScsiLU *dev, CdScsiRequest *req,
cd_scsi_dev_sense_set(dev, short_sense);
- SPICE_DEBUG("CHECK_COND, request lun:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("CHECK_COND, request lun:%u"
" op: 0x%02x, pending sense: 0x%02x %02x %02x - %s, %s",
dev->lun, (uint32_t)req->cdb[0],
(uint32_t)dev->short_sense.key,
@@ -409,7 +409,7 @@ CdScsiTarget *cd_scsi_target_alloc(void *target_user_data, uint32_t max_luns)
CdScsiTarget *st;
if (max_luns == 0 || max_luns > MAX_LUNS) {
- SPICE_ERROR("Alloc, illegal max_luns:%" G_GUINT32_FORMAT, max_luns);
+ SPICE_ERROR("Alloc, illegal max_luns:%u", max_luns);
return NULL;
}
@@ -448,11 +448,11 @@ int cd_scsi_dev_realize(CdScsiTarget *st, uint32_t lun,
CdScsiLU *dev;
if (!cd_scsi_target_lun_legal(st, lun)) {
- SPICE_ERROR("Realize, illegal lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Realize, illegal lun:%u", lun);
return -1;
}
if (cd_scsi_target_lun_realized(st, lun)) {
- SPICE_ERROR("Realize, already realized lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Realize, already realized lun:%u", lun);
return -1;
}
dev = &st->units[lun];
@@ -482,8 +482,7 @@ int cd_scsi_dev_realize(CdScsiTarget *st, uint32_t lun,
st->num_luns ++;
- SPICE_DEBUG("Realize lun:%" G_GUINT32_FORMAT " bs:%" G_GUINT32_FORMAT
- " VR:[%s] PT:[%s] ver:[%s] SN[%s]",
+ SPICE_DEBUG("Realize lun:%u bs:%u VR:[%s] PT:[%s] ver:[%s] SN[%s]",
lun, dev->block_size, dev->vendor,
dev->product, dev->version, dev->serial);
return 0;
@@ -503,16 +502,16 @@ int cd_scsi_dev_lock(CdScsiTarget *st, uint32_t lun, gboolean lock)
CdScsiLU *dev;
if (!cd_scsi_target_lun_legal(st, lun)) {
- SPICE_ERROR("Lock, illegal lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Lock, illegal lun:%u", lun);
return -1;
}
if (!cd_scsi_target_lun_realized(st, lun)) {
- SPICE_ERROR("Lock, unrealized lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Lock, unrealized lun:%u", lun);
return -1;
}
dev = &st->units[lun];
dev->prevent_media_removal = lock;
- SPICE_DEBUG("lun:%" G_GUINT32_FORMAT "%slock", lun, lock ? "un" :"");
+ SPICE_DEBUG("lun:%u %slock", lun, lock ? "un" :"");
return 0;
}
@@ -545,11 +544,11 @@ int cd_scsi_dev_load(CdScsiTarget *st, uint32_t lun,
CdScsiLU *dev;
if (!cd_scsi_target_lun_legal(st, lun)) {
- SPICE_ERROR("Load, illegal lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Load, illegal lun:%u", lun);
return -1;
}
if (!cd_scsi_target_lun_realized(st, lun)) {
- SPICE_ERROR("Load, unrealized lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Load, unrealized lun:%u", lun);
return -1;
}
dev = &st->units[lun];
@@ -560,8 +559,8 @@ int cd_scsi_dev_load(CdScsiTarget *st, uint32_t lun,
cd_scsi_dev_sense_set(dev, &sense_code_MEDIUM_CHANGED);
- SPICE_DEBUG("Load lun:%" G_GUINT32_FORMAT " size:%" G_GUINT64_FORMAT
- " blk_sz:%" G_GUINT32_FORMAT " num_blocks:%" G_GUINT32_FORMAT,
+ SPICE_DEBUG("Load lun:%u size:%" G_GUINT64_FORMAT
+ " blk_sz:%u num_blocks:%u",
lun, dev->size, dev->block_size, dev->num_blocks);
return 0;
}
@@ -571,11 +570,11 @@ int cd_scsi_dev_get_info(CdScsiTarget *st, uint32_t lun, CdScsiDeviceInfo *lun_i
CdScsiLU *dev;
if (!cd_scsi_target_lun_legal(st, lun)) {
- SPICE_ERROR("Load, illegal lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Load, illegal lun:%u", lun);
return -1;
}
if (!cd_scsi_target_lun_realized(st, lun)) {
- SPICE_ERROR("Load, unrealized lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Load, unrealized lun:%u", lun);
return -1;
}
dev = &st->units[lun];
@@ -597,20 +596,20 @@ int cd_scsi_dev_unload(CdScsiTarget *st, uint32_t lun)
CdScsiLU *dev;
if (!cd_scsi_target_lun_legal(st, lun)) {
- SPICE_ERROR("Unload, illegal lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Unload, illegal lun:%u", lun);
return -1;
}
if (!cd_scsi_target_lun_realized(st, lun)) {
- SPICE_ERROR("Unload, unrealized lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Unload, unrealized lun:%u", lun);
return -1;
}
dev = &st->units[lun];
if (!dev->loaded) {
- SPICE_ERROR("Unload, lun:%" G_GUINT32_FORMAT " not loaded yet", lun);
+ SPICE_ERROR("Unload, lun:%u not loaded yet", lun);
return 0;
}
if (dev->prevent_media_removal) {
- SPICE_ERROR("Unload, lun:%" G_GUINT32_FORMAT " prevent_media_removal set", lun);
+ SPICE_ERROR("Unload, lun:%u prevent_media_removal set", lun);
return -1;
}
@@ -620,7 +619,7 @@ int cd_scsi_dev_unload(CdScsiTarget *st, uint32_t lun)
cd_scsi_dev_sense_set(dev, &sense_code_UA_NO_MEDIUM);
- SPICE_DEBUG("Unload lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_DEBUG("Unload lun:%u", lun);
return 0;
}
@@ -629,11 +628,11 @@ int cd_scsi_dev_unrealize(CdScsiTarget *st, uint32_t lun)
CdScsiLU *dev;
if (!cd_scsi_target_lun_legal(st, lun)) {
- SPICE_ERROR("Unrealize, illegal lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Unrealize, illegal lun:%u", lun);
return -1;
}
if (!cd_scsi_target_lun_realized(st, lun)) {
- SPICE_ERROR("Unrealize, absent lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Unrealize, absent lun:%u", lun);
return -1;
}
dev = &st->units[lun];
@@ -661,7 +660,7 @@ int cd_scsi_dev_unrealize(CdScsiTarget *st, uint32_t lun)
st->num_luns --;
- SPICE_DEBUG("Unrealize lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_DEBUG("Unrealize lun:%u", lun);
return 0;
}
@@ -670,11 +669,11 @@ int cd_scsi_dev_reset(CdScsiTarget *st, uint32_t lun)
CdScsiLU *dev;
if (!cd_scsi_target_lun_legal(st, lun)) {
- SPICE_ERROR("Device reset, illegal lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Device reset, illegal lun:%u", lun);
return -1;
}
if (!cd_scsi_target_lun_realized(st, lun)) {
- SPICE_ERROR("Device reset, absent lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("Device reset, absent lun:%u", lun);
return -1;
}
dev = &st->units[lun];
@@ -688,7 +687,7 @@ int cd_scsi_dev_reset(CdScsiTarget *st, uint32_t lun)
dev->power_event = CD_POWER_EVENT_CHANGE_SUCCESS;
cd_scsi_dev_sense_set_power_on(dev);
- SPICE_DEBUG("Device reset lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_DEBUG("Device reset lun:%u", lun);
return 0;
}
@@ -859,7 +858,7 @@ static void cd_scsi_cmd_request_sense(CdScsiLU *dev, CdScsiRequest *req)
req->req_len : sizeof(dev->fixed_sense);
if (dev->short_sense.key != NO_SENSE) {
- SPICE_DEBUG("%s, lun:%" G_GUINT32_FORMAT " reported sense: 0x%02x %02x %02x - %s, %s",
+ SPICE_DEBUG("%s, lun:%u reported sense: 0x%02x %02x %02x - %s, %s",
__FUNCTION__, req->lun,
dev->short_sense.key, dev->short_sense.asc, dev->short_sense.ascq,
cd_scsi_sense_key_descr(dev->short_sense.key),
@@ -927,7 +926,7 @@ static void cd_scsi_cmd_inquiry_vpd_no_lun(CdScsiLU *dev, CdScsiRequest *req,
req->in_len = (req->req_len < resp_len) ? req->req_len : resp_len;
- SPICE_DEBUG("inquiry_vpd, unsupported lun:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("inquiry_vpd, unsupported lun:%u"
" perif_qual:0x%x resp_len: %" G_GUINT64_FORMAT,
req->lun, perif_qual, req->in_len);
@@ -955,7 +954,7 @@ static void cd_scsi_cmd_inquiry_vpd(CdScsiLU *dev, CdScsiRequest *req)
}
outbuf[buflen++] = 0x83; // device identification
- SPICE_DEBUG("Inquiry EVPD[Supported pages] lun:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("Inquiry EVPD[Supported pages] lun:%u"
" req_len: %" G_GUINT64_FORMAT " resp_len: %d",
req->lun, req->req_len, buflen);
break;
@@ -971,7 +970,7 @@ static void cd_scsi_cmd_inquiry_vpd(CdScsiLU *dev, CdScsiRequest *req)
memcpy(outbuf+buflen, dev->serial, serial_len);
buflen += serial_len;
- SPICE_DEBUG("Inquiry EVPD[Serial num] lun:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("Inquiry EVPD[Serial num] lun:%u"
" req_len: %" G_GUINT64_FORMAT " resp_len: %d",
req->lun, req->req_len, buflen);
break;
@@ -993,7 +992,7 @@ static void cd_scsi_cmd_inquiry_vpd(CdScsiLU *dev, CdScsiRequest *req)
memcpy(outbuf+buflen, dev->serial, serial_len);
buflen += serial_len;
- SPICE_DEBUG("Inquiry EVPD[Device id] lun:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("Inquiry EVPD[Device id] lun:%u"
" req_len: %" G_GUINT64_FORMAT " resp_len: %d",
req->lun, req->req_len, buflen);
break;
@@ -1001,7 +1000,7 @@ static void cd_scsi_cmd_inquiry_vpd(CdScsiLU *dev, CdScsiRequest *req)
default:
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_CDB_FIELD);
- SPICE_DEBUG("inquiry_standard, lun:%" G_GUINT32_FORMAT " invalid page_code: %02x",
+ SPICE_DEBUG("inquiry_standard, lun:%u invalid page_code: %02x",
req->lun, (int)page_code);
return;
}
@@ -1053,8 +1052,8 @@ static void cd_scsi_cmd_inquiry_standard_no_lun(CdScsiLU *dev, CdScsiRequest *re
req->in_len = (req->req_len < resp_len) ? req->req_len : resp_len;
- SPICE_DEBUG("inquiry_standard, unsupported lun:%" G_GUINT32_FORMAT " perif_qual:0x%x "
- "inquiry_len: %" G_GUINT32_FORMAT " resp_len: %" G_GUINT64_FORMAT,
+ SPICE_DEBUG("inquiry_standard, unsupported lun:%u perif_qual:0x%x "
+ "inquiry_len: %u resp_len: %" G_GUINT64_FORMAT,
req->lun, perif_qual, resp_len, req->in_len);
cd_scsi_cmd_complete_good(dev, req);
@@ -1096,8 +1095,8 @@ static void cd_scsi_cmd_inquiry_standard(CdScsiLU *dev, CdScsiRequest *req)
req->in_len = (req->req_len < resp_len) ? req->req_len : resp_len;
- SPICE_DEBUG("inquiry_standard, lun:%" G_GUINT32_FORMAT
- " inquiry_len: %" G_GUINT32_FORMAT " resp_len: %" G_GUINT64_FORMAT,
+ SPICE_DEBUG("inquiry_standard, lun:%u"
+ " inquiry_len: %u resp_len: %" G_GUINT64_FORMAT,
req->lun, resp_len, req->in_len);
cd_scsi_cmd_complete_good(dev, req);
@@ -1116,7 +1115,7 @@ static void cd_scsi_cmd_inquiry(CdScsiLU *dev, CdScsiRequest *req)
cmd_data = (req->cdb[1] & CD_INQUIRY_FLAG_CMD_DT) ? TRUE : FALSE;
if (cmd_data) {
- SPICE_DEBUG("inquiry, lun:%" G_GUINT32_FORMAT " CmdDT bit set - unsupported, "
+ SPICE_DEBUG("inquiry, lun:%u CmdDT bit set - unsupported, "
"cdb[1]:0x%02x cdb[1]:0x%02x",
req->lun, (int)req->cdb[1], (int)req->cdb[2]);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_CDB_FIELD);
@@ -1130,7 +1129,7 @@ static void cd_scsi_cmd_inquiry(CdScsiLU *dev, CdScsiRequest *req)
cd_scsi_cmd_inquiry_vpd(dev, req);
} else { /* standard inquiry data */
if (req->cdb[2] != 0) {
- SPICE_DEBUG("inquiry_standard, lun:%" G_GUINT32_FORMAT " non-zero page code: %02x",
+ SPICE_DEBUG("inquiry_standard, lun:%u non-zero page code: %02x",
req->lun, (int)req->cdb[2]);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_CDB_FIELD);
return;
@@ -1152,8 +1151,7 @@ static void cd_scsi_cmd_read_capacity(CdScsiLU *dev, CdScsiRequest *req)
*last_blk_out = htobe32(last_blk);
*blk_size_out = htobe32(blk_size);
- SPICE_DEBUG("Read capacity, lun:%" G_GUINT32_FORMAT
- " last_blk: %" G_GUINT32_FORMAT " blk_sz: %" G_GUINT32_FORMAT,
+ SPICE_DEBUG("Read capacity, lun:%u last_blk: %u blk_sz: %u",
req->lun, last_blk, blk_size);
req->in_len = 8;
@@ -1196,7 +1194,7 @@ static void cd_scsi_cmd_get_read_disc_information(CdScsiLU *dev, CdScsiRequest *
data_type = req->cdb[1] & 0x7;
if (data_type != RDI_TYPE_STANDARD) {
- SPICE_DEBUG("read_disc_information, lun:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("read_disc_information, lun:%u"
" unsupported data type: %02x",
req->lun, data_type);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_CDB_FIELD);
@@ -1218,7 +1216,7 @@ static void cd_scsi_cmd_get_read_disc_information(CdScsiLU *dev, CdScsiRequest *
outbuf[10] = (first_track >> 8) & 0xff; /* in last sesson, lsb */
outbuf[11] = (last_track >> 8) & 0xff; /* in last sesson, lsb */
- SPICE_DEBUG("read_disc_information, lun:%" G_GUINT32_FORMAT " len: %" G_GUINT64_FORMAT,
+ SPICE_DEBUG("read_disc_information, lun:%u len: %" G_GUINT64_FORMAT,
req->lun, req->in_len);
cd_scsi_cmd_complete_good(dev, req);
@@ -1257,9 +1255,9 @@ static void cd_scsi_cmd_get_read_track_information(CdScsiLU *dev, CdScsiRequest
switch (addr_type) {
case RTI_ADDR_TYPE_LBA:
if (addr_num > last_addr) {
- SPICE_DEBUG("read_track_information, lun:%" G_GUINT32_FORMAT
- " addr_type LBA: %" G_GUINT32_FORMAT
- " invalid LBA: %" G_GUINT32_FORMAT,
+ SPICE_DEBUG("read_track_information, lun:%u"
+ " addr_type LBA: %u"
+ " invalid LBA: %u",
req->lun, addr_type, addr_num);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_CDB_FIELD);
return;
@@ -1267,9 +1265,9 @@ static void cd_scsi_cmd_get_read_track_information(CdScsiLU *dev, CdScsiRequest
break;
case RTI_ADDR_TYPE_TRACK_NUM:
if (addr_num != track_num) {
- SPICE_DEBUG("read_track_information, lun:%" G_GUINT32_FORMAT
- " addr_type track: %" G_GUINT32_FORMAT
- " invalid track: %" G_GUINT32_FORMAT,
+ SPICE_DEBUG("read_track_information, lun:%u"
+ " addr_type track: %u"
+ " invalid track: %u",
req->lun, addr_type, addr_num);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_CDB_FIELD);
return;
@@ -1277,18 +1275,18 @@ static void cd_scsi_cmd_get_read_track_information(CdScsiLU *dev, CdScsiRequest
break;
case RTI_ADDR_TYPE_SESSION_NUM:
if (addr_num != session_num) {
- SPICE_DEBUG("read_track_information, lun:%" G_GUINT32_FORMAT
- " addr_type session: %" G_GUINT32_FORMAT
- " invalid session: %" G_GUINT32_FORMAT,
+ SPICE_DEBUG("read_track_information, lun:%u"
+ " addr_type session: %u"
+ " invalid session: %u",
req->lun, addr_type, addr_num);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_CDB_FIELD);
return;
}
break;
default:
- SPICE_DEBUG("read_track_information, lun:%" G_GUINT32_FORMAT
- "invalid addr_type: %" G_GUINT32_FORMAT
- " addr_num: %" G_GUINT32_FORMAT,
+ SPICE_DEBUG("read_track_information, lun:%u"
+ " invalid addr_type: %u"
+ " addr_num: %u",
req->lun, addr_type, addr_num);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_CDB_FIELD);
return;
@@ -1317,8 +1315,8 @@ static void cd_scsi_cmd_get_read_track_information(CdScsiLU *dev, CdScsiRequest
outbuf[30] = (last_addr >> 8) & 0xff;
outbuf[31] = (last_addr) & 0xff;
- SPICE_DEBUG("read_track_information, lun:%" G_GUINT32_FORMAT
- "addr_type: %" G_GUINT32_FORMAT " addr_num: %" G_GUINT32_FORMAT,
+ SPICE_DEBUG("read_track_information, lun:%u"
+ "addr_type: %u addr_num: %u",
req->lun, addr_type, addr_num);
cd_scsi_cmd_complete_good(dev, req);
@@ -1361,7 +1359,7 @@ static void cd_scsi_cmd_read_toc(CdScsiLU *dev, CdScsiRequest *req)
outbuf[18] = last_blk >> 8;
outbuf[19] = last_blk;
- SPICE_DEBUG("read_toc, lun:%" G_GUINT32_FORMAT " len: %" G_GUINT64_FORMAT
+ SPICE_DEBUG("read_toc, lun:%u len: %" G_GUINT64_FORMAT
" msf: %x format: 0x%02x track/session: 0x%02x",
req->lun, req->in_len, msf, format, track_num);
@@ -1485,7 +1483,7 @@ static void cd_scsi_cmd_mode_sense_10(CdScsiLU *dev, CdScsiRequest *req)
case MODE_PAGE_CD_DEVICE: /* CD Device parameters */
case MODE_PAGE_TO_PROTECT: /* Time-out and Protect */
default:
- SPICE_DEBUG("mode_sense_10, lun:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("mode_sense_10, lun:%u"
" page 0x%x not implemented",
req->lun, (unsigned)page);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_CDB_FIELD);
@@ -1497,9 +1495,9 @@ static void cd_scsi_cmd_mode_sense_10(CdScsiLU *dev, CdScsiRequest *req)
req->in_len = (req->req_len < resp_len) ? req->req_len : resp_len;
- SPICE_DEBUG("mode_sense_10, lun:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("mode_sense_10, lun:%u"
" long_lba %d, dbd %d, page %d, sub_page %d, pc %d; "
- "resp_len %" G_GUINT32_FORMAT,
+ "resp_len %u",
req->lun, long_lba, dbd, page, sub_page, pc, resp_len);
cd_scsi_cmd_complete_good(dev, req);
@@ -1518,9 +1516,9 @@ static void cd_scsi_cmd_mode_select_6(CdScsiLU *dev, CdScsiRequest *req)
list_len = req->cdb[4];
if (list_len > req->buf_len) {
- SPICE_DEBUG("mode_select_6, lun:%" G_GUINT32_FORMAT
- " pf:%" G_GUINT32_FORMAT " sp:%" G_GUINT32_FORMAT
- " list_len:%" G_GUINT32_FORMAT " exceeds data_len:%" G_GUINT32_FORMAT,
+ SPICE_DEBUG("mode_select_6, lun:%u"
+ " pf:%u sp:%u"
+ " list_len:%u exceeds data_len:%u",
req->lun, page_format, save_pages, list_len, req->buf_len);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_PARAM_LEN);
return;
@@ -1546,13 +1544,11 @@ static void cd_scsi_cmd_mode_select_6(CdScsiLU *dev, CdScsiRequest *req)
page_len = mode_data[1];
}
- SPICE_DEBUG("mode_select_6, lun:%" G_GUINT32_FORMAT
- " pf:%" G_GUINT32_FORMAT " sp:%" G_GUINT32_FORMAT
- " list_len:%" G_GUINT32_FORMAT " data_len:%" G_GUINT32_FORMAT
- " mode_len:%" G_GUINT32_FORMAT " medium:%" G_GUINT32_FORMAT
- " dev_param:%" G_GUINT32_FORMAT " blk_desc_len:%" G_GUINT32_FORMAT
- " num_blocks:%" G_GUINT32_FORMAT " block_len:%" G_GUINT32_FORMAT
- " page_num:%" G_GUINT32_FORMAT " page_len:%" G_GUINT32_FORMAT,
+ SPICE_DEBUG("mode_select_6, lun:%u"
+ " pf:%u sp:%u list_len:%u data_len:%u"
+ " mode_len:%u medium:%u dev_param:%u blk_desc_len:%u"
+ " num_blocks:%u block_len:%u"
+ " page_num:%u page_len:%u",
req->lun, page_format, save_pages, list_len, req->buf_len,
mode_len, medium_type, dev_param, block_desc_len,
num_blocks, block_len,
@@ -1570,17 +1566,15 @@ static void cd_scsi_cmd_mode_select_10(CdScsiLU *dev, CdScsiRequest *req)
list_len = (req->cdb[7] << 8) | req->cdb[8];
if (list_len > req->buf_len) {
- SPICE_DEBUG("mode_select_10, lun:%" G_GUINT32_FORMAT
- " pf:%" G_GUINT32_FORMAT " sp:%" G_GUINT32_FORMAT
- " list_len:%" G_GUINT32_FORMAT " exceeds data_len:%" G_GUINT32_FORMAT,
+ SPICE_DEBUG("mode_select_10, lun:%u pf:%u sp:%u"
+ " list_len:%u exceeds data_len:%u",
req->lun, page_format, save_pages, list_len, req->buf_len);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_PARAM_LEN);
return;
}
- SPICE_DEBUG("mode_select_10, lun:%" G_GUINT32_FORMAT
- " pf:%" G_GUINT32_FORMAT " sp:%" G_GUINT32_FORMAT
- " list_len:%" G_GUINT32_FORMAT " data_len:%" G_GUINT32_FORMAT,
+ SPICE_DEBUG("mode_select_10, lun:%u pf:%u sp:%u"
+ " list_len:%u data_len:%u",
req->lun, page_format, save_pages, list_len, req->buf_len);
cd_scsi_cmd_complete_good(dev, req);
@@ -1908,8 +1902,7 @@ static void cd_scsi_cmd_get_configuration(CdScsiLU *dev, CdScsiRequest *req)
break;
default:
- SPICE_DEBUG("get_configuration, lun:%" G_GUINT32_FORMAT
- " invalid rt:%" G_GUINT32_FORMAT " start_f:%" G_GUINT32_FORMAT,
+ SPICE_DEBUG("get_configuration, lun:%u invalid rt:%u start_f:%u",
req->lun, req_type, start_feature);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_CDB_FIELD);
return;
@@ -1927,9 +1920,7 @@ static void cd_scsi_cmd_get_configuration(CdScsiLU *dev, CdScsiRequest *req)
req->in_len = (req->req_len < resp_len) ? req->req_len : resp_len;
- SPICE_DEBUG("get_configuration, lun:%" G_GUINT32_FORMAT
- " rt:%" G_GUINT32_FORMAT " start_f:%" G_GUINT32_FORMAT
- " resp_len:%" G_GUINT32_FORMAT,
+ SPICE_DEBUG("get_configuration, lun:%u rt:%u start_f:%u resp_len:%u",
req->lun, req_type, start_feature, resp_len);
cd_scsi_cmd_complete_good(dev, req);
@@ -1994,7 +1985,7 @@ static void cd_scsi_cmd_get_event_status_notification(CdScsiLU *dev, CdScsiReque
req->req_len = (req->cdb[7] << 8) | req->cdb[8];
if (!immed) {
- SPICE_DEBUG("get_event_status_notification, lun:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("get_event_status_notification, lun:%u"
" imm:0 class_req:%02x, Non-immediate (async) mode unsupported",
req->lun, classes_requested);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_CDB_FIELD);
@@ -2007,8 +1998,8 @@ static void cd_scsi_cmd_get_event_status_notification(CdScsiLU *dev, CdScsiReque
outbuf[2] = CD_GET_EVENT_CLASS_POWER_MGMT;
outbuf[3] = (uint8_t)power_class_mask;
- SPICE_DEBUG("get_event_status_notification, lun:%" G_GUINT32_FORMAT
- " imm:%" G_GUINT32_FORMAT " class_req:0x%02x class_sup:0x%02x"
+ SPICE_DEBUG("get_event_status_notification, lun:%u"
+ " imm:%u class_req:0x%02x class_sup:0x%02x"
" power_event:0x%02x power_cond:0x%02x",
req->lun, immed, classes_requested, classes_supported,
dev->power_event, dev->power_cond);
@@ -2018,8 +2009,8 @@ static void cd_scsi_cmd_get_event_status_notification(CdScsiLU *dev, CdScsiReque
outbuf[2] = CD_GET_EVENT_CLASS_MEDIA;
outbuf[3] = (uint8_t)media_class_mask;
- SPICE_DEBUG("get_event_status_notification, lun:%" G_GUINT32_FORMAT
- " imm:%" G_GUINT32_FORMAT " class_req:0x%02x class_sup:0x%02x"
+ SPICE_DEBUG("get_event_status_notification, lun:%u"
+ " imm:%u class_req:0x%02x class_sup:0x%02x"
" media_event:0x%02x loaded: %d",
req->lun, immed, classes_requested, classes_supported,
dev->media_event, dev->loaded);
@@ -2029,10 +2020,10 @@ static void cd_scsi_cmd_get_event_status_notification(CdScsiLU *dev, CdScsiReque
} else {
outbuf[2] = CD_GET_EVENT_HEADER_NO_EVENT_AVAIL | CD_GET_EVENT_CLASS_NONE;
- SPICE_DEBUG("get_event_status_notification, lun:%" G_GUINT32_FORMAT
- " imm:%" G_GUINT32_FORMAT " class_req:0x%02x class_sup:0x%02x"
- " none of requested events supported",
- req->lun, immed, classes_requested, classes_supported);
+ SPICE_DEBUG("get_event_status_notification, lun:%u"
+ " imm:%u class_req:0x%02x class_sup:0x%02x"
+ " 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 */
@@ -2072,8 +2063,7 @@ static void cd_scsi_cmd_send_event(CdScsiLU *dev, CdScsiRequest *req)
param_list_len = (req->cdb[8] << 8) | req->cdb[9];
if (req->buf_len < param_list_len) {
- SPICE_DEBUG("send_event, lun:%" G_GUINT32_FORMAT
- " invalid param list len:0x%x, buf_len:0x%x",
+ SPICE_DEBUG("send_event, lun:%u invalid param list len:0x%x, buf_len:0x%x",
req->lun, param_list_len, req->buf_len);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_PARAM_LEN);
return;
@@ -2083,8 +2073,7 @@ static void cd_scsi_cmd_send_event(CdScsiLU *dev, CdScsiRequest *req)
notification_class = param[2] & 0x07;
if (notification_class != CD_GET_EVENT_CLASS_EXTERNAL_REQ) {
- SPICE_DEBUG("send_event, lun:%" G_GUINT32_FORMAT
- " invalid notification class:0x%x",
+ SPICE_DEBUG("send_event, lun:%u invalid notification class:0x%x",
req->lun, notification_class);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_CDB_FIELD);
return;
@@ -2096,8 +2085,7 @@ static void cd_scsi_cmd_send_event(CdScsiLU *dev, CdScsiRequest *req)
pers_prevent = event[1] & 0x80;
ext_req_code = (event[2] << 8) | event[3];
- SPICE_DEBUG("send_event, lun:0x%" G_GUINT32_FORMAT
- " immed:%" G_GUINT32_FORMAT " param_len:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("send_event, lun:0x%u immed:%u param_len:%u"
" ext_req_event:0x%x ext_req_status:0x%x"
" pers_prevent:0x%x ext_req_code:0x%x",
req->lun, immed, event_param_len, ext_req_event,
@@ -2124,7 +2112,7 @@ static void cd_scsi_cmd_allow_medium_removal(CdScsiLU *dev, CdScsiRequest *req)
prevent == CD_MEDIUM_REMOVAL_REQ_PREVENT_CHANGER);
req->in_len = 0;
- SPICE_DEBUG("allow_medium_removal, lun:%" G_GUINT32_FORMAT " prevent field::0x%02x flag:%d",
+ SPICE_DEBUG("allow_medium_removal, lun:%u prevent field::0x%02x flag:%d",
req->lun, prevent, dev->prevent_media_removal);
cd_scsi_cmd_complete_good(dev, req);
@@ -2132,14 +2120,14 @@ static void cd_scsi_cmd_allow_medium_removal(CdScsiLU *dev, CdScsiRequest *req)
static void cd_scsi_cmd_report_key(CdScsiLU *dev, CdScsiRequest *req)
{
- SPICE_DEBUG("report_key - content protection unsupported, lun:%" G_GUINT32_FORMAT, req->lun);
+ SPICE_DEBUG("report_key - content protection unsupported, lun:%u", req->lun);
req->xfer_dir = SCSI_XFER_NONE;
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_OPCODE);
}
static void cd_scsi_cmd_send_key(CdScsiLU *dev, CdScsiRequest *req)
{
- SPICE_DEBUG("send_key - content protection unsupported, lun:%" G_GUINT32_FORMAT, req->lun);
+ SPICE_DEBUG("send_key - content protection unsupported, lun:%u", req->lun);
req->xfer_dir = SCSI_XFER_NONE;
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_OPCODE);
}
@@ -2195,7 +2183,7 @@ static void cd_scsi_cmd_start_stop_unit(CdScsiLU *dev, CdScsiRequest *req)
load_eject = (req->cdb[4] & CD_START_STOP_FLAG_LOEJ) ? TRUE : FALSE;
power_cond = req->cdb[4] >> 4;
- SPICE_DEBUG("start_stop_unit, lun:0x%" G_GUINT32_FORMAT
+ SPICE_DEBUG("start_stop_unit, lun:0x%u"
" immed:%d start:%d load_eject:%d power_cond:0x%x(%s)",
req->lun, immed, start, load_eject, power_cond,
cd_scsi_start_stop_power_cond_name(power_cond));
@@ -2205,23 +2193,23 @@ static void cd_scsi_cmd_start_stop_unit(CdScsiLU *dev, CdScsiRequest *req)
if (!start) { /* stop the unit */
if (load_eject) { /* eject medium */
if (dev->prevent_media_removal) {
- SPICE_DEBUG("start_stop_unit, lun:0x%" G_GUINT32_FORMAT
+ SPICE_DEBUG("start_stop_unit, lun:0x%u"
" prevent_media_removal set, eject failed", req->lun);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_MEDIUM_REMOVAL_PREVENTED);
return;
}
- SPICE_DEBUG("start_stop_unit, lun:0x%" G_GUINT32_FORMAT " eject", req->lun);
+ SPICE_DEBUG("start_stop_unit, lun:0x%u eject", req->lun);
cd_scsi_lu_unload(dev);
cd_scsi_dev_changed(dev->tgt->user_data, req->lun);
}
dev->power_cond = CD_SCSI_POWER_STOPPED;
- SPICE_DEBUG("start_stop_unit, lun:0x%" G_GUINT32_FORMAT " stopped", req->lun);
+ SPICE_DEBUG("start_stop_unit, lun:0x%u stopped", req->lun);
} else { /* start the unit */
dev->power_cond = CD_SCSI_POWER_ACTIVE;
- SPICE_DEBUG("start_stop_unit, lun:0x%" G_GUINT32_FORMAT " started", req->lun);
+ SPICE_DEBUG("start_stop_unit, lun:0x%u started", req->lun);
if (load_eject) { /* load medium */
- SPICE_DEBUG("start_stop_unit, lun:0x%" G_GUINT32_FORMAT " load with no media",
+ SPICE_DEBUG("start_stop_unit, lun:0x%u load with no media",
req->lun);
cd_scsi_lu_load(dev, NULL);
cd_scsi_dev_changed(dev->tgt->user_data, req->lun);
@@ -2231,17 +2219,17 @@ static void cd_scsi_cmd_start_stop_unit(CdScsiLU *dev, CdScsiRequest *req)
case CD_START_STOP_POWER_COND_ACTIVE:
/* not error to specify transition to the current power condition */
dev->power_cond = CD_SCSI_POWER_ACTIVE;
- SPICE_DEBUG("start_stop_unit, lun:0x%" G_GUINT32_FORMAT " active", req->lun);
+ SPICE_DEBUG("start_stop_unit, lun:0x%u active", req->lun);
break;
case CD_START_STOP_POWER_COND_IDLE:
case CD_START_STOP_POWER_COND_FORCE_IDLE_0:
dev->power_cond = CD_SCSI_POWER_IDLE;
- SPICE_DEBUG("start_stop_unit, lun:0x%" G_GUINT32_FORMAT " idle", req->lun);
+ SPICE_DEBUG("start_stop_unit, lun:0x%u idle", req->lun);
break;
case CD_START_STOP_POWER_COND_STANDBY:
case CD_START_STOP_POWER_COND_FORCE_STANDBY_0:
dev->power_cond = CD_SCSI_POWER_STANDBY;
- SPICE_DEBUG("start_stop_unit, lun:0x%" G_GUINT32_FORMAT " standby", req->lun);
+ SPICE_DEBUG("start_stop_unit, lun:0x%u standby", req->lun);
break;
case CD_START_STOP_POWER_COND_LU_CONTROL:
break;
@@ -2279,7 +2267,7 @@ static void cd_scsi_get_performance_resp_empty(CdScsiLU *dev, CdScsiRequest *req
}
req->in_len = CD_PERF_HEADER_LEN;
- SPICE_DEBUG("get_performance, lun:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("get_performance, lun:%u"
" type:0x%x data_type:0x%x - sending empty response",
req->lun, type, data_type);
@@ -2306,17 +2294,17 @@ static void cd_scsi_get_performance_resp_performance(CdScsiLU *dev, CdScsiReques
write = (data_type >> 2) & 0x01;
tolerance = (data_type >> 3) & 0x03;
- SPICE_DEBUG("get_performance, lun:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("get_performance, lun:%u"
" performance type:0x00 data_type:0x%x"
" except:0x%x write:0x%x tolerance:0x%x"
- " max_num:%" G_GUINT32_FORMAT,
+ " max_num:%u",
req->lun, data_type, except, write,
tolerance, max_num_descr);
if (write) {
- SPICE_DEBUG("get_performance, lun:%" G_GUINT32_FORMAT
- " performance type:0x00 data_type:0x%x - write unsupported",
- req->lun, data_type);
+ SPICE_DEBUG("get_performance, lun:%u"
+ " performance type:0x00 data_type:0x%x - write unsupported",
+ req->lun, data_type);
cd_scsi_get_performance_resp_empty(dev, req, CD_PERF_TYPE_PERFORMANCE,
data_type, max_num_descr);
return;
@@ -2382,9 +2370,9 @@ static void cd_scsi_cmd_get_performance(CdScsiLU *dev, CdScsiRequest *req)
case CD_PERF_TYPE_DEFECT_STATUS: /* not restricted overwrite media */
case CD_PERF_TYPE_WRITE_SPEED: /* unsupported, irrelevant */
default:
- SPICE_DEBUG("get_performance, lun:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("get_performance, lun:%u"
" unsupported type:0x%x"
- " data_type:0x%x max_num:%" G_GUINT32_FORMAT,
+ " data_type:0x%x max_num:%u",
req->lun, type, data_type, max_num_descr);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INVALID_CDB_FIELD);
return;
@@ -2442,7 +2430,7 @@ static void cd_scsi_cmd_mechanism_status(CdScsiLU *dev, CdScsiRequest *req)
req->in_len = (req->req_len < resp_len) ? req->req_len : resp_len;
- SPICE_DEBUG("mechanism_status, lun:%" G_GUINT32_FORMAT, req->lun);
+ SPICE_DEBUG("mechanism_status, lun:%u", req->lun);
cd_scsi_cmd_complete_good(dev, req);
}
@@ -2465,7 +2453,7 @@ static void cd_scsi_read_async_complete(GObject *src_object,
// g_assert(stream == dev->stream);
if (stream != dev->stream) {
uint32_t opcode = (uint32_t)req->cdb[0];
- SPICE_DEBUG("read_async_complete BAD STREAM, lun: %" G_GUINT32_FORMAT
+ SPICE_DEBUG("read_async_complete BAD STREAM, lun: %u"
" req: %" G_GUINT64_FORMAT " op: 0x%02x",
req->lun, req->req_len, opcode);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_TARGET_FAILURE);
@@ -2476,7 +2464,7 @@ static void cd_scsi_read_async_complete(GObject *src_object,
bytes_read = g_input_stream_read_finish(G_INPUT_STREAM(stream), result, &error);
finished = bytes_read > 0;
if (finished) {
- SPICE_DEBUG("read_async_complete, lun: %" G_GUINT32_FORMAT
+ SPICE_DEBUG("read_async_complete, lun: %u"
" finished: %d bytes_read: %" G_GUINT64_FORMAT
" req: %" G_GUINT64_FORMAT,
req->lun, finished, (uint64_t)bytes_read, req->req_len);
@@ -2518,7 +2506,7 @@ static int cd_scsi_read_async_start(CdScsiLU *dev, CdScsiRequest *req)
CdScsiTarget *st = dev->tgt;
GFileInputStream *stream = dev->stream;
- SPICE_DEBUG("read_async_start, lun:%" G_GUINT32_FORMAT
+ SPICE_DEBUG("read_async_start, lun:%u"
" lba: %" G_GUINT64_FORMAT " offset: %" G_GUINT64_FORMAT
" cnt: %" G_GUINT64_FORMAT " len: %" G_GUINT64_FORMAT,
req->lun, req->lba, req->offset, req->count, req->req_len);
@@ -2551,11 +2539,11 @@ static int cd_scsi_read_async_start(CdScsiLU *dev, CdScsiRequest *req)
static void cd_scsi_cmd_read(CdScsiLU *dev, CdScsiRequest *req)
{
if (dev->power_cond == CD_SCSI_POWER_STOPPED) {
- SPICE_DEBUG("read, lun: %" G_GUINT32_FORMAT " is stopped", req->lun);
+ SPICE_DEBUG("read, lun: %u is stopped", req->lun);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_INIT_CMD_REQUIRED);
return;
} else if (!dev->loaded || dev->stream == NULL) {
- SPICE_DEBUG("read, lun: %" G_GUINT32_FORMAT " is not loaded", req->lun);
+ SPICE_DEBUG("read, lun: %u is not loaded", req->lun);
cd_scsi_cmd_complete_check_cond(dev, req, &sense_code_NOT_READY_NO_MEDIUM);
return;
}
@@ -2578,7 +2566,7 @@ void cd_scsi_dev_request_submit(CdScsiTarget *st, CdScsiRequest *req)
const char *cmd_name = scsi_cmd_name[opcode];
CdScsiLU *dev = &st->units[lun];
- SPICE_DEBUG("request_submit, lun: %" G_GUINT32_FORMAT " op: 0x%02x %s", lun, opcode, cmd_name);
+ SPICE_DEBUG("request_submit, lun: %u op: 0x%02x %s", lun, opcode, cmd_name);
if (st->cur_req != NULL) {
SPICE_ERROR("request_submit, request not idle");
@@ -2595,7 +2583,7 @@ void cd_scsi_dev_request_submit(CdScsiTarget *st, CdScsiRequest *req)
/* INQUIRY should send response even for non-existing LUNs */
if (!cd_scsi_target_lun_legal(st, lun)) {
- SPICE_ERROR("request_submit, illegal lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("request_submit, illegal lun:%u", lun);
if (opcode == INQUIRY) {
if (req->cdb[1] & 0x1) {
cd_scsi_cmd_inquiry_vpd_no_lun(dev, req, PERIF_QUALIFIER_UNSUPPORTED);
@@ -2608,7 +2596,7 @@ void cd_scsi_dev_request_submit(CdScsiTarget *st, CdScsiRequest *req)
goto done;
}
if (!cd_scsi_target_lun_realized(st, lun)) {
- SPICE_ERROR("request_submit, absent lun:%" G_GUINT32_FORMAT, lun);
+ SPICE_ERROR("request_submit, absent lun:%u", lun);
if (opcode == INQUIRY) {
if (req->cdb[1] & 0x1) {
cd_scsi_cmd_inquiry_vpd_no_lun(dev, req, PERIF_QUALIFIER_NOT_CONNECTED);
@@ -2719,8 +2707,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,
+ SPICE_DEBUG("request_submit done, lun: %u"
+ " op: 0x%02x %s, state: %s status: %u len: %" G_GUINT64_FORMAT,
lun, opcode, cmd_name, CdScsiReqState_str(req->req_state), req->status,
req->in_len);
@@ -2733,7 +2721,7 @@ void cd_scsi_dev_request_cancel(CdScsiTarget *st, CdScsiRequest *req)
{
if (st->cur_req == req) {
if (req->req_state == SCSI_REQ_RUNNING) {
- SPICE_DEBUG("request_cancel: lun: %" G_GUINT32_FORMAT
+ SPICE_DEBUG("request_cancel: lun: %u"
" op: 0x%02x len: %" G_GUINT64_FORMAT,
req->lun, (unsigned int)req->cdb[0], req->req_len);
g_cancellable_cancel(st->cancellable);
--
2.20.1
More information about the Spice-devel
mailing list