|
|
|
@@ -210,8 +210,6 @@ scsi_reportluns_cdb(int report_type, int alloc_len)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = alloc_len;
|
|
|
|
task->expxferlen = alloc_len;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.reportluns.report_type = report_type;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -264,7 +262,6 @@ scsi_reportluns_datain_unmarshall(struct scsi_task *task)
|
|
|
|
return list;
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* READCAPACITY10
|
|
|
|
* READCAPACITY10
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@@ -291,14 +288,9 @@ scsi_cdb_readcapacity10(int lba, int pmi)
|
|
|
|
task->xfer_dir = SCSI_XFER_READ;
|
|
|
|
task->xfer_dir = SCSI_XFER_READ;
|
|
|
|
task->expxferlen = 8;
|
|
|
|
task->expxferlen = 8;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.readcapacity10.lba = lba;
|
|
|
|
|
|
|
|
task->params.readcapacity10.pmi = pmi;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* READTOC
|
|
|
|
* READTOC
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@@ -325,6 +317,8 @@ scsi_cdb_readtoc(int msf, int format, int track_session, uint16_t alloc_len)
|
|
|
|
task->cdb[1] |= 0x02;
|
|
|
|
task->cdb[1] |= 0x02;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
task->cdb[2] = format & 0xf;
|
|
|
|
|
|
|
|
|
|
|
|
/* Prevent invalid setting of Track/Session Number */
|
|
|
|
/* Prevent invalid setting of Track/Session Number */
|
|
|
|
if (format == SCSI_READ_TOC || format == SCSI_READ_FULL_TOC) {
|
|
|
|
if (format == SCSI_READ_TOC || format == SCSI_READ_FULL_TOC) {
|
|
|
|
task->cdb[6] = 0xff & track_session;
|
|
|
|
task->cdb[6] = 0xff & track_session;
|
|
|
|
@@ -340,10 +334,6 @@ scsi_cdb_readtoc(int msf, int format, int track_session, uint16_t alloc_len)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = alloc_len;
|
|
|
|
task->expxferlen = alloc_len;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.readtoc.msf = msf;
|
|
|
|
|
|
|
|
task->params.readtoc.format = format;
|
|
|
|
|
|
|
|
task->params.readtoc.track_session = track_session;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -361,10 +351,16 @@ scsi_readtoc_datain_getfullsize(struct scsi_task *task)
|
|
|
|
return toc_data_len;
|
|
|
|
return toc_data_len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline enum scsi_readtoc_fmt
|
|
|
|
|
|
|
|
scsi_readtoc_format(const struct scsi_task *task)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return task->cdb[2] & 0xf;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
static void
|
|
|
|
scsi_readtoc_desc_unmarshall(struct scsi_task *task, struct scsi_readtoc_list *list, int i)
|
|
|
|
scsi_readtoc_desc_unmarshall(struct scsi_task *task, struct scsi_readtoc_list *list, int i)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch(task->params.readtoc.format){
|
|
|
|
switch(scsi_readtoc_format(task)) {
|
|
|
|
case SCSI_READ_TOC:
|
|
|
|
case SCSI_READ_TOC:
|
|
|
|
list->desc[i].desc.toc.adr
|
|
|
|
list->desc[i].desc.toc.adr
|
|
|
|
= task->datain.data[4+8*i+1] & 0xf0;
|
|
|
|
= task->datain.data[4+8*i+1] & 0xf0;
|
|
|
|
@@ -411,8 +407,11 @@ scsi_readtoc_desc_unmarshall(struct scsi_task *task, struct scsi_readtoc_list *l
|
|
|
|
list->desc[i].desc.full.pframe
|
|
|
|
list->desc[i].desc.full.pframe
|
|
|
|
= task->datain.data[4+11*i+10];
|
|
|
|
= task->datain.data[4+11*i+10];
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* unmarshall the data in blob for read TOC into a structure
|
|
|
|
* unmarshall the data in blob for read TOC into a structure
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@@ -496,6 +495,11 @@ scsi_cdb_release6(void)
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline uint8_t
|
|
|
|
|
|
|
|
scsi_serviceactionin_sa(const struct scsi_task *task)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return task->cdb[1];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* service_action_in unmarshall
|
|
|
|
* service_action_in unmarshall
|
|
|
|
@@ -503,14 +507,10 @@ scsi_cdb_release6(void)
|
|
|
|
static void *
|
|
|
|
static void *
|
|
|
|
scsi_serviceactionin_datain_unmarshall(struct scsi_task *task)
|
|
|
|
scsi_serviceactionin_datain_unmarshall(struct scsi_task *task)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
struct scsi_readcapacity16 *rc16;
|
|
|
|
switch (scsi_serviceactionin_sa(task)) {
|
|
|
|
struct scsi_get_lba_status *gls;
|
|
|
|
case SCSI_READCAPACITY16: {
|
|
|
|
int32_t len;
|
|
|
|
struct scsi_readcapacity16 *rc16 = scsi_malloc(task,
|
|
|
|
int i;
|
|
|
|
sizeof(*rc16));
|
|
|
|
|
|
|
|
|
|
|
|
switch (task->params.serviceactionin.sa) {
|
|
|
|
|
|
|
|
case SCSI_READCAPACITY16:
|
|
|
|
|
|
|
|
rc16 = scsi_malloc(task, sizeof(struct scsi_readcapacity16));
|
|
|
|
|
|
|
|
if (rc16 == NULL) {
|
|
|
|
if (rc16 == NULL) {
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -525,20 +525,27 @@ scsi_serviceactionin_datain_unmarshall(struct scsi_task *task)
|
|
|
|
rc16->lbprz = !!(task->datain.data[14] & 0x40);
|
|
|
|
rc16->lbprz = !!(task->datain.data[14] & 0x40);
|
|
|
|
rc16->lalba = ntohs(*(uint16_t *)&(task->datain.data[14])) & 0x3fff;
|
|
|
|
rc16->lalba = ntohs(*(uint16_t *)&(task->datain.data[14])) & 0x3fff;
|
|
|
|
return rc16;
|
|
|
|
return rc16;
|
|
|
|
case SCSI_GET_LBA_STATUS:
|
|
|
|
}
|
|
|
|
len = ntohl(*(uint32_t *)&(task->datain.data[0]));
|
|
|
|
case SCSI_GET_LBA_STATUS: {
|
|
|
|
|
|
|
|
struct scsi_get_lba_status *gls = scsi_malloc(task,
|
|
|
|
|
|
|
|
sizeof(*gls));
|
|
|
|
|
|
|
|
int32_t len = ntohl(*(uint32_t *)&(task->datain.data[0]));
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (gls == NULL) {
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (len > task->datain.size - 4) {
|
|
|
|
if (len > task->datain.size - 4) {
|
|
|
|
len = task->datain.size - 4;
|
|
|
|
len = task->datain.size - 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
len = len / 16;
|
|
|
|
len = len / 16;
|
|
|
|
|
|
|
|
|
|
|
|
gls = scsi_malloc(task, sizeof(struct scsi_get_lba_status));
|
|
|
|
|
|
|
|
if (gls == NULL) {
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gls->num_descriptors = len;
|
|
|
|
gls->num_descriptors = len;
|
|
|
|
gls->descriptors = scsi_malloc(task, sizeof(struct scsi_lba_status_descriptor) * gls->num_descriptors);
|
|
|
|
gls->descriptors = scsi_malloc(task,
|
|
|
|
|
|
|
|
sizeof(*gls->descriptors) * len);
|
|
|
|
if (gls->descriptors == NULL) {
|
|
|
|
if (gls->descriptors == NULL) {
|
|
|
|
|
|
|
|
free(gls);
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -554,10 +561,22 @@ scsi_serviceactionin_datain_unmarshall(struct scsi_task *task)
|
|
|
|
|
|
|
|
|
|
|
|
return gls;
|
|
|
|
return gls;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
|
|
|
|
scsi_maintenancein_return_timeouts(const struct scsi_task *task)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return task->cdb[2] & 0x80;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline uint8_t
|
|
|
|
|
|
|
|
scsi_maintenancein_sa(const struct scsi_task *task)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return task->cdb[1];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* parse the data in blob and calculate the size of a full maintenancein
|
|
|
|
* parse the data in blob and calculate the size of a full maintenancein
|
|
|
|
@@ -567,16 +586,14 @@ static int
|
|
|
|
scsi_maintenancein_datain_getfullsize(struct scsi_task *task)
|
|
|
|
scsi_maintenancein_datain_getfullsize(struct scsi_task *task)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
switch (task->params.maintenancein.sa) {
|
|
|
|
switch (scsi_maintenancein_sa(task)) {
|
|
|
|
case SCSI_REPORT_SUPPORTED_OP_CODES:
|
|
|
|
case SCSI_REPORT_SUPPORTED_OP_CODES:
|
|
|
|
return ntohl(*(uint32_t *)&(task->datain.data[0])) + 4;
|
|
|
|
return ntohl(*(uint32_t *)&(task->datain.data[0])) + 4;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* maintenance_in unmarshall
|
|
|
|
* maintenance_in unmarshall
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@@ -588,7 +605,7 @@ scsi_maintenancein_datain_unmarshall(struct scsi_task *task)
|
|
|
|
uint32_t len, i;
|
|
|
|
uint32_t len, i;
|
|
|
|
int return_timeouts, desc_size;
|
|
|
|
int return_timeouts, desc_size;
|
|
|
|
|
|
|
|
|
|
|
|
switch (task->params.maintenancein.sa) {
|
|
|
|
switch (scsi_maintenancein_sa(task)) {
|
|
|
|
case SCSI_REPORT_SUPPORTED_OP_CODES:
|
|
|
|
case SCSI_REPORT_SUPPORTED_OP_CODES:
|
|
|
|
if (task->datain.size < 4) {
|
|
|
|
if (task->datain.size < 4) {
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
@@ -600,7 +617,7 @@ scsi_maintenancein_datain_unmarshall(struct scsi_task *task)
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Does the descriptor include command timeout info? */
|
|
|
|
/* Does the descriptor include command timeout info? */
|
|
|
|
return_timeouts = task->params.maintenancein.params.reportsupported.return_timeouts;
|
|
|
|
return_timeouts = scsi_maintenancein_return_timeouts(task);
|
|
|
|
|
|
|
|
|
|
|
|
/* Size of descriptor depends on whether timeout included. */
|
|
|
|
/* Size of descriptor depends on whether timeout included. */
|
|
|
|
desc_size = sizeof (struct scsi_command_descriptor);
|
|
|
|
desc_size = sizeof (struct scsi_command_descriptor);
|
|
|
|
@@ -666,9 +683,6 @@ scsi_cdb_report_supported_opcodes(int return_timeouts, uint32_t alloc_len)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = alloc_len;
|
|
|
|
task->expxferlen = alloc_len;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.maintenancein.sa = SCSI_REPORT_SUPPORTED_OP_CODES;
|
|
|
|
|
|
|
|
task->params.maintenancein.params.reportsupported.return_timeouts = return_timeouts;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -704,10 +718,6 @@ scsi_readcapacity10_datain_unmarshall(struct scsi_task *task)
|
|
|
|
return rc10;
|
|
|
|
return rc10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* INQUIRY
|
|
|
|
* INQUIRY
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@@ -740,12 +750,21 @@ scsi_cdb_inquiry(int evpd, int page_code, int alloc_len)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = alloc_len;
|
|
|
|
task->expxferlen = alloc_len;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.inquiry.evpd = evpd;
|
|
|
|
|
|
|
|
task->params.inquiry.page_code = page_code;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
|
|
|
|
scsi_inquiry_evpd_set(const struct scsi_task *task)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return task->cdb[1] & 0x1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline uint8_t
|
|
|
|
|
|
|
|
scsi_inquiry_page_code(const struct scsi_task *task)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return task->cdb[2];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* parse the data in blob and calculate the size of a full
|
|
|
|
* parse the data in blob and calculate the size of a full
|
|
|
|
* inquiry datain structure
|
|
|
|
* inquiry datain structure
|
|
|
|
@@ -753,11 +772,11 @@ scsi_cdb_inquiry(int evpd, int page_code, int alloc_len)
|
|
|
|
static int
|
|
|
|
static int
|
|
|
|
scsi_inquiry_datain_getfullsize(struct scsi_task *task)
|
|
|
|
scsi_inquiry_datain_getfullsize(struct scsi_task *task)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (task->params.inquiry.evpd == 0) {
|
|
|
|
if (scsi_inquiry_evpd_set(task) == 0) {
|
|
|
|
return task->datain.data[4] + 5;
|
|
|
|
return task->datain.data[4] + 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (task->params.inquiry.page_code) {
|
|
|
|
switch (scsi_inquiry_page_code(task)) {
|
|
|
|
case SCSI_INQUIRY_PAGECODE_SUPPORTED_VPD_PAGES:
|
|
|
|
case SCSI_INQUIRY_PAGECODE_SUPPORTED_VPD_PAGES:
|
|
|
|
case SCSI_INQUIRY_PAGECODE_BLOCK_DEVICE_CHARACTERISTICS:
|
|
|
|
case SCSI_INQUIRY_PAGECODE_BLOCK_DEVICE_CHARACTERISTICS:
|
|
|
|
case SCSI_INQUIRY_PAGECODE_UNIT_SERIAL_NUMBER:
|
|
|
|
case SCSI_INQUIRY_PAGECODE_UNIT_SERIAL_NUMBER:
|
|
|
|
@@ -771,17 +790,10 @@ scsi_inquiry_datain_getfullsize(struct scsi_task *task)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
static struct scsi_inquiry_standard *
|
|
|
|
* unmarshall the data in blob for inquiry into a structure
|
|
|
|
scsi_inquiry_unmarshall_standard(struct scsi_task *task)
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void *
|
|
|
|
|
|
|
|
scsi_inquiry_datain_unmarshall(struct scsi_task *task)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (task->params.inquiry.evpd == 0) {
|
|
|
|
struct scsi_inquiry_standard *inq = scsi_malloc(task, sizeof(*inq));
|
|
|
|
struct scsi_inquiry_standard *inq;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* standard inquiry */
|
|
|
|
|
|
|
|
inq = scsi_malloc(task, sizeof(struct scsi_inquiry_standard));
|
|
|
|
|
|
|
|
if (inq == NULL) {
|
|
|
|
if (inq == NULL) {
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -821,14 +833,13 @@ scsi_inquiry_datain_unmarshall(struct scsi_task *task)
|
|
|
|
inq->ius = !!(task->datain.data[56]&0x01);
|
|
|
|
inq->ius = !!(task->datain.data[56]&0x01);
|
|
|
|
|
|
|
|
|
|
|
|
return inq;
|
|
|
|
return inq;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (task->params.inquiry.page_code
|
|
|
|
static struct scsi_inquiry_supported_pages *
|
|
|
|
== SCSI_INQUIRY_PAGECODE_SUPPORTED_VPD_PAGES) {
|
|
|
|
scsi_inquiry_unmarshall_supported_pages(struct scsi_task *task)
|
|
|
|
struct scsi_inquiry_supported_pages *inq;
|
|
|
|
{
|
|
|
|
|
|
|
|
struct scsi_inquiry_supported_pages *inq = scsi_malloc(task,
|
|
|
|
inq = scsi_malloc(task,
|
|
|
|
sizeof(*inq));
|
|
|
|
sizeof(struct scsi_inquiry_supported_pages));
|
|
|
|
|
|
|
|
if (inq == NULL) {
|
|
|
|
if (inq == NULL) {
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -839,16 +850,18 @@ scsi_inquiry_datain_unmarshall(struct scsi_task *task)
|
|
|
|
inq->num_pages = task->datain.data[3];
|
|
|
|
inq->num_pages = task->datain.data[3];
|
|
|
|
inq->pages = scsi_malloc(task, inq->num_pages);
|
|
|
|
inq->pages = scsi_malloc(task, inq->num_pages);
|
|
|
|
if (inq->pages == NULL) {
|
|
|
|
if (inq->pages == NULL) {
|
|
|
|
|
|
|
|
free (inq);
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
memcpy(inq->pages, &task->datain.data[4], inq->num_pages);
|
|
|
|
memcpy(inq->pages, &task->datain.data[4], inq->num_pages);
|
|
|
|
return inq;
|
|
|
|
return inq;
|
|
|
|
} else if (task->params.inquiry.page_code
|
|
|
|
}
|
|
|
|
== SCSI_INQUIRY_PAGECODE_UNIT_SERIAL_NUMBER) {
|
|
|
|
|
|
|
|
struct scsi_inquiry_unit_serial_number *inq;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inq = scsi_malloc(task,
|
|
|
|
static struct scsi_inquiry_unit_serial_number *
|
|
|
|
sizeof(struct scsi_inquiry_unit_serial_number));
|
|
|
|
scsi_inquiry_unmarshall_unit_serial_number(struct scsi_task* task)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct scsi_inquiry_unit_serial_number *inq = scsi_malloc(task,
|
|
|
|
|
|
|
|
sizeof(*inq));
|
|
|
|
if (inq == NULL) {
|
|
|
|
if (inq == NULL) {
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -858,19 +871,22 @@ scsi_inquiry_datain_unmarshall(struct scsi_task *task)
|
|
|
|
|
|
|
|
|
|
|
|
inq->usn = scsi_malloc(task, task->datain.data[3]+1);
|
|
|
|
inq->usn = scsi_malloc(task, task->datain.data[3]+1);
|
|
|
|
if (inq->usn == NULL) {
|
|
|
|
if (inq->usn == NULL) {
|
|
|
|
|
|
|
|
free(inq);
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
memcpy(inq->usn, &task->datain.data[4], task->datain.data[3]);
|
|
|
|
memcpy(inq->usn, &task->datain.data[4], task->datain.data[3]);
|
|
|
|
inq->usn[task->datain.data[3]] = 0;
|
|
|
|
inq->usn[task->datain.data[3]] = 0;
|
|
|
|
return inq;
|
|
|
|
return inq;
|
|
|
|
} else if (task->params.inquiry.page_code
|
|
|
|
}
|
|
|
|
== SCSI_INQUIRY_PAGECODE_DEVICE_IDENTIFICATION) {
|
|
|
|
|
|
|
|
struct scsi_inquiry_device_identification *inq;
|
|
|
|
static struct scsi_inquiry_device_identification *
|
|
|
|
|
|
|
|
scsi_inquiry_unmarshall_device_identification(struct scsi_task *task)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct scsi_inquiry_device_identification *inq = scsi_malloc(task,
|
|
|
|
|
|
|
|
sizeof(*inq));
|
|
|
|
int remaining = ntohs(*(uint16_t *)&task->datain.data[2]);
|
|
|
|
int remaining = ntohs(*(uint16_t *)&task->datain.data[2]);
|
|
|
|
unsigned char *dptr;
|
|
|
|
unsigned char *dptr;
|
|
|
|
|
|
|
|
|
|
|
|
inq = scsi_malloc(task,
|
|
|
|
|
|
|
|
sizeof(struct scsi_inquiry_device_identification));
|
|
|
|
|
|
|
|
if (inq == NULL) {
|
|
|
|
if (inq == NULL) {
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -880,12 +896,10 @@ scsi_inquiry_datain_unmarshall(struct scsi_task *task)
|
|
|
|
|
|
|
|
|
|
|
|
dptr = &task->datain.data[4];
|
|
|
|
dptr = &task->datain.data[4];
|
|
|
|
while (remaining > 0) {
|
|
|
|
while (remaining > 0) {
|
|
|
|
struct scsi_inquiry_device_designator *dev;
|
|
|
|
struct scsi_inquiry_device_designator *dev =
|
|
|
|
|
|
|
|
scsi_malloc(task, sizeof(*dev));
|
|
|
|
dev = scsi_malloc(task,
|
|
|
|
|
|
|
|
sizeof(struct scsi_inquiry_device_designator));
|
|
|
|
|
|
|
|
if (dev == NULL) {
|
|
|
|
if (dev == NULL) {
|
|
|
|
return NULL;
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dev->next = inq->designators;
|
|
|
|
dev->next = inq->designators;
|
|
|
|
@@ -898,10 +912,9 @@ scsi_inquiry_datain_unmarshall(struct scsi_task *task)
|
|
|
|
dev->designator_type = dptr[1]&0x0f;
|
|
|
|
dev->designator_type = dptr[1]&0x0f;
|
|
|
|
|
|
|
|
|
|
|
|
dev->designator_length = dptr[3];
|
|
|
|
dev->designator_length = dptr[3];
|
|
|
|
dev->designator = scsi_malloc(task,
|
|
|
|
dev->designator = scsi_malloc(task, dev->designator_length + 1);
|
|
|
|
dev->designator_length+1);
|
|
|
|
|
|
|
|
if (dev->designator == NULL) {
|
|
|
|
if (dev->designator == NULL) {
|
|
|
|
return NULL;
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dev->designator[dev->designator_length] = 0;
|
|
|
|
dev->designator[dev->designator_length] = 0;
|
|
|
|
memcpy(dev->designator, &dptr[4],
|
|
|
|
memcpy(dev->designator, &dptr[4],
|
|
|
|
@@ -913,12 +926,24 @@ scsi_inquiry_datain_unmarshall(struct scsi_task *task)
|
|
|
|
dptr += dev->designator_length + 4;
|
|
|
|
dptr += dev->designator_length + 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return inq;
|
|
|
|
return inq;
|
|
|
|
} else if (task->params.inquiry.page_code
|
|
|
|
|
|
|
|
== SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS) {
|
|
|
|
|
|
|
|
struct scsi_inquiry_block_limits *inq;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inq = scsi_malloc(task,
|
|
|
|
err:
|
|
|
|
sizeof(struct scsi_inquiry_block_limits));
|
|
|
|
while (inq->designators) {
|
|
|
|
|
|
|
|
struct scsi_inquiry_device_designator *dev = inq->designators;
|
|
|
|
|
|
|
|
inq->designators = dev->next;
|
|
|
|
|
|
|
|
free(dev->designator);
|
|
|
|
|
|
|
|
free(dev);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
free(inq);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static struct scsi_inquiry_block_limits *
|
|
|
|
|
|
|
|
scsi_inquiry_unmarshall_block_limits(struct scsi_task *task)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct scsi_inquiry_block_limits *inq = scsi_malloc(task,
|
|
|
|
|
|
|
|
sizeof(*inq));
|
|
|
|
if (inq == NULL) {
|
|
|
|
if (inq == NULL) {
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -941,12 +966,13 @@ scsi_inquiry_datain_unmarshall(struct scsi_task *task)
|
|
|
|
inq->max_ws_len = (inq->max_ws_len << 32) | ntohl(*(uint32_t *)&task->datain.data[40]);
|
|
|
|
inq->max_ws_len = (inq->max_ws_len << 32) | ntohl(*(uint32_t *)&task->datain.data[40]);
|
|
|
|
|
|
|
|
|
|
|
|
return inq;
|
|
|
|
return inq;
|
|
|
|
} else if (task->params.inquiry.page_code
|
|
|
|
}
|
|
|
|
== SCSI_INQUIRY_PAGECODE_BLOCK_DEVICE_CHARACTERISTICS) {
|
|
|
|
|
|
|
|
struct scsi_inquiry_block_device_characteristics *inq;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inq = scsi_malloc(task,
|
|
|
|
static struct scsi_inquiry_block_device_characteristics *
|
|
|
|
sizeof(struct scsi_inquiry_block_device_characteristics));
|
|
|
|
scsi_inquiry_unmarshall_block_device_characteristics(struct scsi_task *task)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct scsi_inquiry_block_device_characteristics *inq =
|
|
|
|
|
|
|
|
scsi_malloc(task, sizeof(*inq));
|
|
|
|
if (inq == NULL) {
|
|
|
|
if (inq == NULL) {
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -956,12 +982,13 @@ scsi_inquiry_datain_unmarshall(struct scsi_task *task)
|
|
|
|
|
|
|
|
|
|
|
|
inq->medium_rotation_rate = ntohs(*(uint16_t *)&task->datain.data[4]);
|
|
|
|
inq->medium_rotation_rate = ntohs(*(uint16_t *)&task->datain.data[4]);
|
|
|
|
return inq;
|
|
|
|
return inq;
|
|
|
|
} else if (task->params.inquiry.page_code
|
|
|
|
}
|
|
|
|
== SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING) {
|
|
|
|
|
|
|
|
struct scsi_inquiry_logical_block_provisioning *inq;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inq = scsi_malloc(task,
|
|
|
|
struct scsi_inquiry_logical_block_provisioning *
|
|
|
|
sizeof(struct scsi_inquiry_logical_block_provisioning));
|
|
|
|
scsi_inquiry_unmarshall_logical_block_provisioning(struct scsi_task *task)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct scsi_inquiry_logical_block_provisioning *inq =
|
|
|
|
|
|
|
|
scsi_malloc(task, sizeof(*inq));
|
|
|
|
if (inq == NULL) {
|
|
|
|
if (inq == NULL) {
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -979,9 +1006,35 @@ scsi_inquiry_datain_unmarshall(struct scsi_task *task)
|
|
|
|
inq->provisioning_type = task->datain.data[6] & 0x07;
|
|
|
|
inq->provisioning_type = task->datain.data[6] & 0x07;
|
|
|
|
|
|
|
|
|
|
|
|
return inq;
|
|
|
|
return inq;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* unmarshall the data in blob for inquiry into a structure
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void *
|
|
|
|
|
|
|
|
scsi_inquiry_datain_unmarshall(struct scsi_task *task)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (scsi_inquiry_evpd_set(task) == 0) {
|
|
|
|
|
|
|
|
return scsi_inquiry_unmarshall_standard(task);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (scsi_inquiry_page_code(task))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case SCSI_INQUIRY_PAGECODE_SUPPORTED_VPD_PAGES:
|
|
|
|
|
|
|
|
return scsi_inquiry_unmarshall_supported_pages(task);
|
|
|
|
|
|
|
|
case SCSI_INQUIRY_PAGECODE_UNIT_SERIAL_NUMBER:
|
|
|
|
|
|
|
|
return scsi_inquiry_unmarshall_unit_serial_number(task);
|
|
|
|
|
|
|
|
case SCSI_INQUIRY_PAGECODE_DEVICE_IDENTIFICATION:
|
|
|
|
|
|
|
|
return scsi_inquiry_unmarshall_device_identification(task);
|
|
|
|
|
|
|
|
case SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS:
|
|
|
|
|
|
|
|
return scsi_inquiry_unmarshall_block_limits(task);
|
|
|
|
|
|
|
|
case SCSI_INQUIRY_PAGECODE_BLOCK_DEVICE_CHARACTERISTICS:
|
|
|
|
|
|
|
|
return scsi_inquiry_unmarshall_block_device_characteristics(task);
|
|
|
|
|
|
|
|
case SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING:
|
|
|
|
|
|
|
|
return scsi_inquiry_unmarshall_logical_block_provisioning(task);
|
|
|
|
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
@@ -1026,9 +1079,6 @@ scsi_cdb_read6(uint32_t lba, uint32_t xferlen, int blocksize)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.read6.lba = lba;
|
|
|
|
|
|
|
|
task->params.read6.num_blocks = num_blocks;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1072,9 +1122,6 @@ scsi_cdb_read10(uint32_t lba, uint32_t xferlen, int blocksize, int rdprotect, in
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.read10.lba = lba;
|
|
|
|
|
|
|
|
task->params.read10.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1118,9 +1165,6 @@ scsi_cdb_read12(uint32_t lba, uint32_t xferlen, int blocksize, int rdprotect, in
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.read12.lba = lba;
|
|
|
|
|
|
|
|
task->params.read12.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1165,9 +1209,6 @@ scsi_cdb_read16(uint64_t lba, uint32_t xferlen, int blocksize, int rdprotect, in
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.read16.lba = lba;
|
|
|
|
|
|
|
|
task->params.read16.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1211,9 +1252,6 @@ scsi_cdb_write10(uint32_t lba, uint32_t xferlen, int blocksize, int wrprotect, i
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.write10.lba = lba;
|
|
|
|
|
|
|
|
task->params.write10.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1257,9 +1295,6 @@ scsi_cdb_write12(uint32_t lba, uint32_t xferlen, int blocksize, int wrprotect, i
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.write12.lba = lba;
|
|
|
|
|
|
|
|
task->params.write12.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1304,9 +1339,6 @@ scsi_cdb_write16(uint64_t lba, uint32_t xferlen, int blocksize, int wrprotect, i
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.write16.lba = lba;
|
|
|
|
|
|
|
|
task->params.write16.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1351,9 +1383,6 @@ scsi_cdb_orwrite(uint64_t lba, uint32_t xferlen, int blocksize, int wrprotect, i
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.orwrite.lba = lba;
|
|
|
|
|
|
|
|
task->params.orwrite.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1397,9 +1426,6 @@ scsi_cdb_compareandwrite(uint64_t lba, uint32_t xferlen, int blocksize, int wrpr
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.compareandwrite.lba = lba;
|
|
|
|
|
|
|
|
task->params.compareandwrite.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1441,12 +1467,6 @@ scsi_cdb_verify10(uint32_t lba, uint32_t xferlen, int vprotect, int dpo, int byt
|
|
|
|
task->expxferlen = 0;
|
|
|
|
task->expxferlen = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
task->params.verify10.lba = lba;
|
|
|
|
|
|
|
|
task->params.verify10.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
task->params.verify10.vprotect = vprotect;
|
|
|
|
|
|
|
|
task->params.verify10.dpo = dpo;
|
|
|
|
|
|
|
|
task->params.verify10.bytchk = bytchk;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1488,12 +1508,6 @@ scsi_cdb_verify12(uint32_t lba, uint32_t xferlen, int vprotect, int dpo, int byt
|
|
|
|
task->expxferlen = 0;
|
|
|
|
task->expxferlen = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
task->params.verify12.lba = lba;
|
|
|
|
|
|
|
|
task->params.verify12.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
task->params.verify12.vprotect = vprotect;
|
|
|
|
|
|
|
|
task->params.verify12.dpo = dpo;
|
|
|
|
|
|
|
|
task->params.verify12.bytchk = bytchk;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1536,12 +1550,6 @@ scsi_cdb_verify16(uint64_t lba, uint32_t xferlen, int vprotect, int dpo, int byt
|
|
|
|
task->expxferlen = 0;
|
|
|
|
task->expxferlen = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
task->params.verify16.lba = lba;
|
|
|
|
|
|
|
|
task->params.verify16.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
task->params.verify16.vprotect = vprotect;
|
|
|
|
|
|
|
|
task->params.verify16.dpo = dpo;
|
|
|
|
|
|
|
|
task->params.verify16.bytchk = bytchk;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1701,11 +1709,6 @@ scsi_cdb_modesense6(int dbd, enum scsi_modesense_page_control pc,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = alloc_len;
|
|
|
|
task->expxferlen = alloc_len;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.modesense6.dbd = dbd;
|
|
|
|
|
|
|
|
task->params.modesense6.pc = pc;
|
|
|
|
|
|
|
|
task->params.modesense6.page_code = page_code;
|
|
|
|
|
|
|
|
task->params.modesense6.sub_page_code = sub_page_code;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1895,13 +1898,6 @@ scsi_cdb_startstopunit(int immed, int pcm, int pc, int no_flush, int loej, int s
|
|
|
|
task->xfer_dir = SCSI_XFER_NONE;
|
|
|
|
task->xfer_dir = SCSI_XFER_NONE;
|
|
|
|
task->expxferlen = 0;
|
|
|
|
task->expxferlen = 0;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.startstopunit.immed = immed;
|
|
|
|
|
|
|
|
task->params.startstopunit.pcm = pcm;
|
|
|
|
|
|
|
|
task->params.startstopunit.pc = pc;
|
|
|
|
|
|
|
|
task->params.startstopunit.no_flush = no_flush;
|
|
|
|
|
|
|
|
task->params.startstopunit.loej = loej;
|
|
|
|
|
|
|
|
task->params.startstopunit.start = start;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1927,8 +1923,6 @@ scsi_cdb_preventallow(int prevent)
|
|
|
|
task->xfer_dir = SCSI_XFER_NONE;
|
|
|
|
task->xfer_dir = SCSI_XFER_NONE;
|
|
|
|
task->expxferlen = 0;
|
|
|
|
task->expxferlen = 0;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.preventallow.prevent = prevent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2087,8 +2081,6 @@ scsi_cdb_serviceactionin16(enum scsi_service_action_in sa, uint32_t xferlen)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.serviceactionin.sa = sa;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2131,8 +2123,6 @@ scsi_cdb_get_lba_status(uint64_t starting_lba, uint32_t alloc_len)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = alloc_len;
|
|
|
|
task->expxferlen = alloc_len;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.serviceactionin.sa = SCSI_GET_LBA_STATUS;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2173,9 +2163,6 @@ scsi_cdb_writeverify10(uint32_t lba, uint32_t xferlen, int blocksize, int wrprot
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.writeverify10.lba = lba;
|
|
|
|
|
|
|
|
task->params.writeverify10.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2216,9 +2203,6 @@ scsi_cdb_writeverify12(uint32_t lba, uint32_t xferlen, int blocksize, int wrprot
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.writeverify12.lba = lba;
|
|
|
|
|
|
|
|
task->params.writeverify12.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2260,9 +2244,6 @@ scsi_cdb_writeverify16(uint64_t lba, uint32_t xferlen, int blocksize, int wrprot
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
task->expxferlen = xferlen;
|
|
|
|
|
|
|
|
|
|
|
|
task->params.writeverify16.lba = lba;
|
|
|
|
|
|
|
|
task->params.writeverify16.num_blocks = xferlen/blocksize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2558,4 +2539,3 @@ scsi_task_get_data_in_buffer(struct scsi_task *task, uint32_t pos, ssize_t *coun
|
|
|
|
|
|
|
|
|
|
|
|
return &sdb->data[pos];
|
|
|
|
return &sdb->data[pos];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|