diff --git a/include/scsi-lowlevel.h b/include/scsi-lowlevel.h index 8c4fb08..3b28b7a 100644 --- a/include/scsi-lowlevel.h +++ b/include/scsi-lowlevel.h @@ -180,13 +180,6 @@ struct scsi_report_supported_params { int return_timeouts; }; -struct scsi_maintenancein_params { - enum scsi_maintenance_in sa; - union { - struct scsi_report_supported_params reportsupported; - } params; -}; - struct scsi_sense { unsigned char error_type; enum scsi_sense_key key; @@ -211,9 +204,6 @@ struct scsi_task { int xfer_dir; int expxferlen; unsigned char cdb[SCSI_CDB_MAX_SIZE]; - union { - struct scsi_maintenancein_params maintenancein; - } params; enum scsi_residual residual_status; int residual; diff --git a/lib/scsi-lowlevel.c b/lib/scsi-lowlevel.c index ba48b57..9f4ffe2 100644 --- a/lib/scsi-lowlevel.c +++ b/lib/scsi-lowlevel.c @@ -566,6 +566,17 @@ scsi_serviceactionin_datain_unmarshall(struct scsi_task *task) } } +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 @@ -575,16 +586,14 @@ static int scsi_maintenancein_datain_getfullsize(struct scsi_task *task) { - switch (task->params.maintenancein.sa) { + switch (scsi_maintenancein_sa(task)) { case SCSI_REPORT_SUPPORTED_OP_CODES: return ntohl(*(uint32_t *)&(task->datain.data[0])) + 4; default: return -1; } - } - /* * maintenance_in unmarshall */ @@ -596,7 +605,7 @@ scsi_maintenancein_datain_unmarshall(struct scsi_task *task) uint32_t len, i; int return_timeouts, desc_size; - switch (task->params.maintenancein.sa) { + switch (scsi_maintenancein_sa(task)) { case SCSI_REPORT_SUPPORTED_OP_CODES: if (task->datain.size < 4) { return NULL; @@ -608,7 +617,7 @@ scsi_maintenancein_datain_unmarshall(struct scsi_task *task) return NULL; } /* 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. */ desc_size = sizeof (struct scsi_command_descriptor); @@ -674,9 +683,6 @@ scsi_cdb_report_supported_opcodes(int return_timeouts, uint32_t 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; }