Add Read TOC (0x43) Command Support (and basic testcase).

This commit is contained in:
Jon Grimm
2012-09-24 10:15:00 -05:00
parent 4b250c0abb
commit e55ec72f36
11 changed files with 458 additions and 0 deletions

View File

@@ -1477,6 +1477,28 @@ iscsi_get_user_in_buffer(struct iscsi_context *iscsi, struct iscsi_in_pdu *in, u
return scsi_task_get_data_in_buffer(pdu->scsi_cbdata->task, offset + pos, count);
}
struct scsi_task *
iscsi_readtoc_task(struct iscsi_context *iscsi, int lun, int msf,
int format, int track_session, int maxsize,
iscsi_command_cb cb, void *private_data)
{
struct scsi_task *task;
task = scsi_cdb_readtoc(msf, format, track_session, maxsize);
if (task == NULL) {
iscsi_set_error(iscsi, "Out-of-memory: Failed to create "
"read TOC cdb.");
return NULL;
}
if (iscsi_scsi_command_async(iscsi, lun, task, cb, NULL,
private_data) != 0) {
scsi_free_scsi_task(task);
return NULL;
}
return task;
}
struct scsi_task *
iscsi_scsi_get_task_from_pdu(struct iscsi_pdu *pdu)
{