test-tool: fix initiatorname and initiatorname2 issues

gcc-4.6.3 warned about this one on several occasions:
  gcc -DHAVE_CONFIG_H -I.  -I. -I./include "-D_U_=__attribute__((unused))" -I./test-tool  -Wall -W -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -ggdb3 -O0 -MT test-tool/bin_iscsi_test-0000_testunitready_simple.o -MD -MP -MF test-tool/.deps/bin_iscsi_test-0000_testunitready_simple.Tpo -c -o test-tool/bin_iscsi_test-0000_testunitready_simple.o `test -f 'test-tool/0000_testunitready_simple.c' || echo './'`test-tool/0000_testunitready_simple.c
  test-tool/0000_testunitready_simple.c: In function 'T0000_testunitready_simple':
  test-tool/0000_testunitready_simple.c:23:44: warning: declaration of 'initiator' shadows a global declaration [-Wshadow]
  test-tool/iscsi-test.h:20:20: warning: shadowed declaration is here [-Wshadow]

For now the global initiator is renamed to initiatorname1 (and initiator2 is
renamed to initiatorname2, respectively), but ultimately the globals should
probably go away.

While fixing this it also became apparent that initiator-name-2 was parsed
into the "initiator" variable as well.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
This commit is contained in:
Arne Redlich
2012-10-31 15:32:18 +01:00
parent 3af45f5867
commit 4d27ecae32
7 changed files with 91 additions and 93 deletions

View File

@@ -1,16 +1,16 @@
/*
/*
Copyright (C) 2012 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
@@ -38,7 +38,7 @@ static void mgmt_cb(struct iscsi_context *iscsi _U_, int status _U_,
}
int T0424_reserve6_target_reset(const char *initiator, const char *url, int data_loss, int show_info)
{
{
struct iscsi_context *iscsi, *iscsi2;
struct scsi_task *task;
int ret, lun;
@@ -65,7 +65,7 @@ int T0424_reserve6_target_reset(const char *initiator, const char *url, int data
return -1;
}
iscsi2 = iscsi_context_login(initiator2, url, &lun);
iscsi2 = iscsi_context_login(initiatorname2, url, &lun);
if (iscsi2 == NULL) {
printf("Failed to login to target\n");
return -1;
@@ -86,8 +86,8 @@ int T0424_reserve6_target_reset(const char *initiator, const char *url, int data
goto finished;
}
if (task->status == SCSI_STATUS_CHECK_CONDITION
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
printf("[SKIPPED]\n");
printf("RESERVE6 Not Supported\n");
ret = -2;
@@ -96,9 +96,9 @@ int T0424_reserve6_target_reset(const char *initiator, const char *url, int data
}
if (task->status != SCSI_STATUS_GOOD) {
printf("[FAILED]\n");
printf("RESERVE6 failed with sense:%s\n",
printf("RESERVE6 failed with sense:%s\n",
iscsi_get_error(iscsi));
ret = -1;
ret = -1;
scsi_free_scsi_task(task);
goto test2;
}
@@ -111,7 +111,7 @@ test2:
task = iscsi_testunitready_sync(iscsi, lun);
if (task == NULL) {
printf("[FAILED]\n");
printf("Failed to send TEST UNIT READY command: %s\n",
printf("Failed to send TEST UNIT READY command: %s\n",
iscsi_get_error(iscsi));
ret = -1;
goto finished;
@@ -133,7 +133,7 @@ test3:
task = iscsi_testunitready_sync(iscsi2, lun);
if (task == NULL) {
printf("[FAILED]\n");
printf("Failed to send TEST UNIT READY command: %s\n",
printf("Failed to send TEST UNIT READY command: %s\n",
iscsi_get_error(iscsi2));
ret = -1;
goto finished;
@@ -179,7 +179,7 @@ test5:
task = iscsi_testunitready_sync(iscsi2, lun);
if (task == NULL) {
printf("[FAILED]\n");
printf("Failed to send TEST UNIT READY command: %s\n",
printf("Failed to send TEST UNIT READY command: %s\n",
iscsi_get_error(iscsi2));
ret = -1;
goto finished;
@@ -189,7 +189,7 @@ test5:
&& task->sense.ascq == SCSI_SENSE_ASCQ_BUS_RESET) {
printf("Got BUS RESET. Retry accessing the LUN\n");
goto test5;
}
if (task->status != SCSI_STATUS_GOOD) {
printf("[FAILED]\n");