READ SUPPORTED OPCODES. Update the signature to allow setting all of the

parameters to this command.
This commit is contained in:
Ronnie Sahlberg
2013-05-18 12:34:03 -07:00
parent c6754fe73b
commit ce4623b2fb
6 changed files with 37 additions and 15 deletions

View File

@@ -837,7 +837,9 @@ iscsi_release6_task(struct iscsi_context *iscsi, int lun,
EXTERN struct scsi_task *
iscsi_report_supported_opcodes_task(struct iscsi_context *iscsi, int lun,
int return_timeouts, int maxsize,
int rctd, int options,
int opcode, int sa,
uint32_t alloc_len,
iscsi_command_cb cb, void *private_data);
/*
@@ -1011,7 +1013,9 @@ iscsi_release6_sync(struct iscsi_context *iscsi, int lun);
EXTERN struct scsi_task *
iscsi_report_supported_opcodes_sync(struct iscsi_context *iscsi, int lun,
int return_timeouts, int maxsize);
int rctd, int options,
int opcode, int sa,
uint32_t alloc_len);
/*
* These functions are used when the application wants to specify its own buffers to read the data

View File

@@ -943,7 +943,7 @@ EXTERN struct scsi_task *scsi_cdb_writesame10(int wrprotect, int anchor, int unm
EXTERN struct scsi_task *scsi_cdb_writesame16(int wrprotect, int anchor, int unmap, uint64_t lba, int group, uint32_t num_blocks);
EXTERN struct scsi_task *scsi_cdb_prefetch10(uint32_t lba, int num_blocks, int immed, int group);
EXTERN struct scsi_task *scsi_cdb_prefetch16(uint64_t lba, int num_blocks, int immed, int group);
EXTERN struct scsi_task *scsi_cdb_report_supported_opcodes(int report_timeouts, uint32_t alloc_len);
EXTERN struct scsi_task *scsi_cdb_report_supported_opcodes(int rctd, int options, enum scsi_opcode opcode, int sa, uint32_t alloc_len);
void *scsi_malloc(struct scsi_task *task, size_t size);

View File

@@ -1633,13 +1633,16 @@ iscsi_release6_task(struct iscsi_context *iscsi, int lun,
}
struct scsi_task *
iscsi_report_supported_opcodes_task(struct iscsi_context *iscsi,
int lun, int return_timeouts, int maxsize,
iscsi_report_supported_opcodes_task(struct iscsi_context *iscsi, int lun,
int rctd, int options,
int opcode, int sa,
uint32_t alloc_len,
iscsi_command_cb cb, void *private_data)
{
struct scsi_task *task;
task = scsi_cdb_report_supported_opcodes(return_timeouts, maxsize);
task = scsi_cdb_report_supported_opcodes(rctd, options, opcode, sa,
alloc_len);
if (task == NULL) {
iscsi_set_error(iscsi, "Out-of-memory: Failed to create "
"Maintenance In/Read Supported Op Codes cdb.");

View File

@@ -895,7 +895,7 @@ scsi_maintenancein_datain_unmarshall(struct scsi_task *task)
* MAINTENANCE In / Read Supported Op Codes
*/
struct scsi_task *
scsi_cdb_report_supported_opcodes(int return_timeouts, uint32_t alloc_len)
scsi_cdb_report_supported_opcodes(int rctd, int options, enum scsi_opcode opcode, int sa, uint32_t alloc_len)
{
struct scsi_task *task;
@@ -907,12 +907,16 @@ scsi_cdb_report_supported_opcodes(int return_timeouts, uint32_t alloc_len)
memset(task, 0, sizeof(struct scsi_task));
task->cdb[0] = SCSI_OPCODE_MAINTENANCE_IN;
task->cdb[1] = SCSI_REPORT_SUPPORTED_OP_CODES;
task->cdb[2] = SCSI_REPORT_SUPPORTING_OPS_ALL;
task->cdb[2] = options & 0x07;
if (return_timeouts) {
if (rctd) {
task->cdb[2] |= 0x80;
}
task->cdb[3] = opcode;
scsi_set_uint32(&task->cdb[4], sa);
scsi_set_uint32(&task->cdb[6], alloc_len);
task->cdb_size = 12;

View File

@@ -1031,13 +1031,16 @@ iscsi_release6_sync(struct iscsi_context *iscsi, int lun)
}
struct scsi_task *
iscsi_report_supported_opcodes_sync(struct iscsi_context *iscsi, int lun, int return_timeouts, int maxsize)
iscsi_report_supported_opcodes_sync(struct iscsi_context *iscsi, int lun,
int rctd, int options,
int opcode, int sa,
uint32_t alloc_len)
{
struct iscsi_sync_state state;
memset(&state, 0, sizeof(state));
if (iscsi_report_supported_opcodes_task(iscsi, lun, return_timeouts, maxsize, scsi_sync_cb, &state) == NULL) {
if (iscsi_report_supported_opcodes_task(iscsi, lun, rctd, options, opcode, sa, alloc_len, scsi_sync_cb, &state) == NULL) {
iscsi_set_error(iscsi, "Failed to send MaintenanceIn:"
"Report Supported Opcodes command");
return NULL;

View File

@@ -53,7 +53,9 @@ int T0430_report_all_supported_ops(const char *initiator, const char *url)
printf("See if Report Supported Opcodes is supported... ");
/* See how big data is */
task = iscsi_report_supported_opcodes_sync(iscsi, lun, 0, 4);
task = iscsi_report_supported_opcodes_sync(iscsi, lun,
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
4);
if (task == NULL) {
printf("[FAILED]\n");
printf("Failed to send Report Supported Opcodes command : %s\n",
@@ -84,7 +86,9 @@ int T0430_report_all_supported_ops(const char *initiator, const char *url)
if (full_size > task->datain.size) {
scsi_free_scsi_task(task);
/* we need more data for the full list */
if ((task = iscsi_report_supported_opcodes_sync(iscsi, lun, 0, full_size)) == NULL) {
if ((task = iscsi_report_supported_opcodes_sync(iscsi, lun,
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
full_size)) == NULL) {
printf("[FAILED]\n");
printf("REPORT SUPPORTED OPCODES failed : %s\n", iscsi_get_error(iscsi));
ret = -1;
@@ -115,7 +119,9 @@ int T0430_report_all_supported_ops(const char *initiator, const char *url)
/*Report All Supported Operations including timeout info.*/
printf("See if Report Supported Opcodes with Timeouts is supported... ");
/* See how big data is */
task = iscsi_report_supported_opcodes_sync(iscsi, lun, 1, 4);
task = iscsi_report_supported_opcodes_sync(iscsi, lun,
1, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
4);
if (task == NULL) {
printf("[FAILED]\n");
printf("Failed to send Report Supported Opcodes command : %s\n",
@@ -148,7 +154,9 @@ int T0430_report_all_supported_ops(const char *initiator, const char *url)
scsi_free_scsi_task(task);
/* we need more data for the full list */
if ((task = iscsi_report_supported_opcodes_sync(iscsi, lun, 1, full_size)) == NULL) {
if ((task = iscsi_report_supported_opcodes_sync(iscsi, lun,
1, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
full_size)) == NULL) {
printf("[FAILED]\n");
printf("REPORT SUPPORTED OPCODES failed : %s\n", iscsi_get_error(iscsi));
ret = -1;