scsi-lowlevel: remove scsi_readtoc_params and fix READ TOC format field

Set the format field in the READ TOC CDB (lower nibble of byte 2).

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
This commit is contained in:
Arne Redlich
2012-11-18 23:16:45 +01:00
parent 551298adfb
commit 8baa843d73
2 changed files with 12 additions and 13 deletions

View File

@@ -176,13 +176,6 @@ struct scsi_readtoc_list {
struct scsi_readtoc_desc desc[0]; struct scsi_readtoc_desc desc[0];
}; };
struct scsi_readtoc_params {
int msf;
int format;
int track_session;
};
struct scsi_report_supported_params { struct scsi_report_supported_params {
int return_timeouts; int return_timeouts;
}; };
@@ -219,7 +212,6 @@ struct scsi_task {
int expxferlen; int expxferlen;
unsigned char cdb[SCSI_CDB_MAX_SIZE]; unsigned char cdb[SCSI_CDB_MAX_SIZE];
union { union {
struct scsi_readtoc_params readtoc;
struct scsi_maintenancein_params maintenancein; struct scsi_maintenancein_params maintenancein;
} params; } params;

View File

@@ -317,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;
@@ -332,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;
} }
@@ -353,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;
@@ -403,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
*/ */