get rid of the _async() scsi functions.

We dotn need two interfaces that only diuffer in whether they return a pointer or NULL vs an semiidentical interface that returns 0 or <0

All uses of _async() for scsi tasks should be replaced with the equivalent _task() function instead
This commit is contained in:
Ronnie Sahlberg
2011-03-27 18:17:12 +11:00
parent cedcc55796
commit 343d86dca7
5 changed files with 29 additions and 133 deletions

View File

@@ -41,9 +41,9 @@ iscsi_testunitready_cb(struct iscsi_context *iscsi, int status,
* you always get just after a fresh login. Try
* again.
*/
if (iscsi_testunitready_async(iscsi, ct->lun,
if (iscsi_testunitready_task(iscsi, ct->lun,
iscsi_testunitready_cb,
ct) != 0) {
ct) == NULL) {
iscsi_set_error(iscsi, "iscsi_testunitready "
"failed.");
ct->cb(iscsi, SCSI_STATUS_ERROR, NULL,
@@ -73,8 +73,8 @@ iscsi_login_cb(struct iscsi_context *iscsi, int status, void *command_data _U_,
return;
}
if (iscsi_testunitready_async(iscsi, ct->lun,
iscsi_testunitready_cb, ct) != 0) {
if (iscsi_testunitready_task(iscsi, ct->lun,
iscsi_testunitready_cb, ct) == NULL) {
iscsi_set_error(iscsi, "iscsi_testunitready_async failed.");
ct->cb(iscsi, SCSI_STATUS_ERROR, NULL, ct->private_data);
free(ct);

View File

@@ -492,14 +492,6 @@ iscsi_testunitready_task(struct iscsi_context *iscsi, int lun,
return task;
}
int
iscsi_testunitready_async(struct iscsi_context *iscsi, int lun,
iscsi_command_cb cb, void *private_data)
{
return iscsi_testunitready_task(iscsi, lun,
cb, private_data) == NULL ? -1 : 0;
}
struct scsi_task *
iscsi_reportluns_task(struct iscsi_context *iscsi, int report_type,
int alloc_len, iscsi_command_cb cb, void *private_data)
@@ -529,14 +521,6 @@ iscsi_reportluns_task(struct iscsi_context *iscsi, int report_type,
return task;
}
int
iscsi_reportluns_async(struct iscsi_context *iscsi, int report_type,
int alloc_len, iscsi_command_cb cb, void *private_data)
{
return iscsi_reportluns_task(iscsi, report_type,
alloc_len, cb, private_data) == NULL ? -1 : 0;
}
struct scsi_task *
iscsi_inquiry_task(struct iscsi_context *iscsi, int lun, int evpd,
int page_code, int maxsize,
@@ -559,16 +543,6 @@ iscsi_inquiry_task(struct iscsi_context *iscsi, int lun, int evpd,
return task;
}
int
iscsi_inquiry_async(struct iscsi_context *iscsi, int lun, int evpd,
int page_code, int maxsize,
iscsi_command_cb cb, void *private_data)
{
return iscsi_inquiry_task(iscsi, lun, evpd,
page_code, maxsize,
cb, private_data) == NULL ? -1 : 0;
}
struct scsi_task *
iscsi_readcapacity10_task(struct iscsi_context *iscsi, int lun, int lba,
int pmi, iscsi_command_cb cb, void *private_data)
@@ -590,14 +564,6 @@ iscsi_readcapacity10_task(struct iscsi_context *iscsi, int lun, int lba,
return task;
}
int
iscsi_readcapacity10_async(struct iscsi_context *iscsi, int lun, int lba,
int pmi, iscsi_command_cb cb, void *private_data)
{
return iscsi_readcapacity10_task(iscsi, lun, lba,
pmi, cb, private_data) == NULL ? -1 : 0;
}
struct scsi_task *
iscsi_read10_task(struct iscsi_context *iscsi, int lun, uint32_t lba,
uint32_t datalen, int blocksize,
@@ -626,16 +592,6 @@ iscsi_read10_task(struct iscsi_context *iscsi, int lun, uint32_t lba,
return task;
}
int
iscsi_read10_async(struct iscsi_context *iscsi, int lun, uint32_t lba,
uint32_t datalen, int blocksize,
iscsi_command_cb cb, void *private_data)
{
return iscsi_read10_task(iscsi, lun, lba,
datalen, blocksize,
cb, private_data) == NULL ? -1 : 0;
}
struct scsi_task *
iscsi_write10_task(struct iscsi_context *iscsi, int lun, unsigned char *data,
uint32_t datalen, uint32_t lba, int fua, int fuanv, int blocksize,
@@ -669,16 +625,6 @@ iscsi_write10_task(struct iscsi_context *iscsi, int lun, unsigned char *data,
return task;
}
int
iscsi_write10_async(struct iscsi_context *iscsi, int lun, unsigned char *data,
uint32_t datalen, uint32_t lba, int fua, int fuanv, int blocksize,
iscsi_command_cb cb, void *private_data)
{
return iscsi_write10_task(iscsi, lun, data,
datalen, lba, fua, fuanv, blocksize,
cb, private_data) == NULL ? -1 : 0;
}
struct scsi_task *
iscsi_modesense6_task(struct iscsi_context *iscsi, int lun, int dbd, int pc,
int page_code, int sub_page_code,
@@ -703,18 +649,6 @@ iscsi_modesense6_task(struct iscsi_context *iscsi, int lun, int dbd, int pc,
return task;
}
int
iscsi_modesense6_async(struct iscsi_context *iscsi, int lun, int dbd, int pc,
int page_code, int sub_page_code,
unsigned char alloc_len,
iscsi_command_cb cb, void *private_data)
{
return iscsi_modesense6_task(iscsi, lun, dbd, pc,
page_code, sub_page_code,
alloc_len,
cb, private_data) == NULL ? -1 : 0;
}
struct scsi_task *
iscsi_synchronizecache10_task(struct iscsi_context *iscsi, int lun, int lba,
int num_blocks, int syncnv, int immed,
@@ -738,12 +672,3 @@ iscsi_synchronizecache10_task(struct iscsi_context *iscsi, int lun, int lba,
return task;
}
int
iscsi_synchronizecache10_async(struct iscsi_context *iscsi, int lun, int lba,
int num_blocks, int syncnv, int immed,
iscsi_command_cb cb, void *private_data)
{
return iscsi_synchronizecache10_task(iscsi, lun, lba,
num_blocks, syncnv, immed,
cb, private_data) == NULL ? -1 : 0;
}

View File

@@ -166,8 +166,8 @@ iscsi_reportluns_sync(struct iscsi_context *iscsi, int report_type,
memset(&state, 0, sizeof(state));
if (iscsi_reportluns_async(iscsi, report_type, alloc_len,
scsi_sync_cb, &state) != 0) {
if (iscsi_reportluns_task(iscsi, report_type, alloc_len,
scsi_sync_cb, &state) == NULL) {
iscsi_set_error(iscsi, "Failed to send ReportLuns command");
return NULL;
}
@@ -185,8 +185,8 @@ iscsi_testunitready_sync(struct iscsi_context *iscsi, int lun)
memset(&state, 0, sizeof(state));
if (iscsi_testunitready_async(iscsi, lun,
scsi_sync_cb, &state) != 0) {
if (iscsi_testunitready_task(iscsi, lun,
scsi_sync_cb, &state) == NULL) {
iscsi_set_error(iscsi,
"Failed to send TestUnitReady command");
return NULL;
@@ -205,8 +205,8 @@ iscsi_inquiry_sync(struct iscsi_context *iscsi, int lun, int evpd,
memset(&state, 0, sizeof(state));
if (iscsi_inquiry_async(iscsi, lun, evpd, page_code, maxsize,
scsi_sync_cb, &state) != 0) {
if (iscsi_inquiry_task(iscsi, lun, evpd, page_code, maxsize,
scsi_sync_cb, &state) == NULL) {
iscsi_set_error(iscsi, "Failed to send Inquiry command");
return NULL;
}
@@ -224,8 +224,8 @@ iscsi_read10_sync(struct iscsi_context *iscsi, int lun, uint32_t lba,
memset(&state, 0, sizeof(state));
if (iscsi_read10_async(iscsi, lun, lba, datalen, blocksize,
scsi_sync_cb, &state) != 0) {
if (iscsi_read10_task(iscsi, lun, lba, datalen, blocksize,
scsi_sync_cb, &state) == NULL) {
iscsi_set_error(iscsi,
"Failed to send Read10 command");
return NULL;
@@ -244,8 +244,8 @@ iscsi_readcapacity10_sync(struct iscsi_context *iscsi, int lun, int lba,
memset(&state, 0, sizeof(state));
if (iscsi_readcapacity10_async(iscsi, lun, lba, pmi,
scsi_sync_cb, &state) != 0) {
if (iscsi_readcapacity10_task(iscsi, lun, lba, pmi,
scsi_sync_cb, &state) == NULL) {
iscsi_set_error(iscsi,
"Failed to send ReadCapacity10 command");
return NULL;
@@ -264,9 +264,9 @@ iscsi_synchronizecache10_sync(struct iscsi_context *iscsi, int lun, int lba,
memset(&state, 0, sizeof(state));
if (iscsi_synchronizecache10_async(iscsi, lun, lba, num_blocks,
if (iscsi_synchronizecache10_task(iscsi, lun, lba, num_blocks,
syncnv, immed,
scsi_sync_cb, &state) != 0) {
scsi_sync_cb, &state) == NULL) {
iscsi_set_error(iscsi,
"Failed to send SynchronizeCache10 command");
return NULL;