Moved support routines from iscsi-test to iscsi-support,
in preperation for sharing non-main functions.
This commit is contained in:
@@ -58,6 +58,7 @@ dist_noinst_HEADERS += test-tool/iscsi-test.h
|
|||||||
bin_iscsi_test_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/test-tool
|
bin_iscsi_test_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/test-tool
|
||||||
bin_iscsi_test_LDFLAGS = -ldl
|
bin_iscsi_test_LDFLAGS = -ldl
|
||||||
bin_iscsi_test_SOURCES = test-tool/iscsi-test.c \
|
bin_iscsi_test_SOURCES = test-tool/iscsi-test.c \
|
||||||
|
test-tool/iscsi-support.c \
|
||||||
test-tool/0000_testunitready_simple.c \
|
test-tool/0000_testunitready_simple.c \
|
||||||
test-tool/0100_read10_simple.c test-tool/0101_read10_beyond_eol.c \
|
test-tool/0100_read10_simple.c test-tool/0101_read10_beyond_eol.c \
|
||||||
test-tool/0102_read10_0blocks.c test-tool/0103_read10_rdprotect.c \
|
test-tool/0102_read10_0blocks.c test-tool/0103_read10_rdprotect.c \
|
||||||
|
|||||||
@@ -34,11 +34,18 @@
|
|||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
#include "iscsi-private.h"
|
#include "iscsi-private.h"
|
||||||
#include "iscsi-test.h"
|
#include "iscsi-test.h"
|
||||||
|
#include "iscsi-support.h"
|
||||||
|
|
||||||
#ifndef discard_const
|
#ifndef discard_const
|
||||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
int (*real_iscsi_queue_pdu)(struct iscsi_context *iscsi, struct iscsi_pdu *pdu);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef STILL_HERE
|
||||||
|
|
||||||
const char *initiatorname1 = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-test";
|
const char *initiatorname1 = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-test";
|
||||||
const char *initiatorname2 = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-test-2";
|
const char *initiatorname2 = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-test-2";
|
||||||
|
|
||||||
@@ -55,12 +62,14 @@ int encserv;
|
|||||||
int data_loss;
|
int data_loss;
|
||||||
int show_info;
|
int show_info;
|
||||||
|
|
||||||
|
#endif /* STILL_HERE */
|
||||||
|
|
||||||
struct scsi_test {
|
struct scsi_test {
|
||||||
const char *name;
|
const char *name;
|
||||||
int (*test)(const char *initiator, const char *url);
|
int (*test)(const char *initiator, const char *url);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct scsi_test tests[] = {
|
static struct scsi_test tests[] = {
|
||||||
/* SCSI protocol tests */
|
/* SCSI protocol tests */
|
||||||
|
|
||||||
/* testunitready*/
|
/* testunitready*/
|
||||||
@@ -280,14 +289,14 @@ struct scsi_test tests[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void print_usage(void)
|
static void print_usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: iscsi-test [-?] [-?|--help] [--usage] [-t|--test=<test>] [-s|--skip=<test>]\n"
|
fprintf(stderr, "Usage: iscsi-test [-?] [-?|--help] [--usage] [-t|--test=<test>] [-s|--skip=<test>]\n"
|
||||||
"\t\t[-l|--list] [--info] [-i|--initiator-name=<iqn-name>]\n"
|
"\t\t[-l|--list] [--info] [-i|--initiator-name=<iqn-name>]\n"
|
||||||
"\t\t<iscsi-url>\n");
|
"\t\t<iscsi-url>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_help(void)
|
static void print_help(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: iscsi-test [OPTION...] <iscsi-url>\n");
|
fprintf(stderr, "Usage: iscsi-test [OPTION...] <iscsi-url>\n");
|
||||||
fprintf(stderr, " -i, --initiator-name=iqn-name Initiatorname to use\n");
|
fprintf(stderr, " -i, --initiator-name=iqn-name Initiatorname to use\n");
|
||||||
@@ -311,6 +320,8 @@ void print_help(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef STILL_HERE
|
||||||
|
|
||||||
struct iscsi_context *iscsi_context_login(const char *initiatorname, const char *url, int *lun)
|
struct iscsi_context *iscsi_context_login(const char *initiatorname, const char *url, int *lun)
|
||||||
{
|
{
|
||||||
struct iscsi_context *iscsi;
|
struct iscsi_context *iscsi;
|
||||||
@@ -397,7 +408,6 @@ void wait_until_test_finished(struct iscsi_context *iscsi, struct iscsi_async_st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int (*real_iscsi_queue_pdu)(struct iscsi_context *iscsi, struct iscsi_pdu *pdu);
|
|
||||||
|
|
||||||
int iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
|
int iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
|
||||||
{
|
{
|
||||||
@@ -1593,6 +1603,8 @@ int inquiry(struct iscsi_context *iscsi, int lun, int evpd, int page_code, int m
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* STILL_HERE */
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
int main(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,6 +25,10 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "iscsi-support.h"
|
||||||
|
|
||||||
|
#ifdef STILL_HERE
|
||||||
|
|
||||||
extern const char *initiatorname1;
|
extern const char *initiatorname1;
|
||||||
extern const char *initiatorname2;
|
extern const char *initiatorname2;
|
||||||
|
|
||||||
@@ -40,13 +44,16 @@ extern enum scsi_inquiry_peripheral_device_type device_type;
|
|||||||
extern int sccs;
|
extern int sccs;
|
||||||
extern int encserv;
|
extern int encserv;
|
||||||
|
|
||||||
|
|
||||||
struct iscsi_context *iscsi_context_login(const char *initiatorname, const char *url, int *lun);
|
struct iscsi_context *iscsi_context_login(const char *initiatorname, const char *url, int *lun);
|
||||||
|
|
||||||
|
#ifdef STILL_HERE
|
||||||
struct iscsi_async_state {
|
struct iscsi_async_state {
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
int status;
|
int status;
|
||||||
int finished;
|
int finished;
|
||||||
};
|
};
|
||||||
|
#endif /* STILL_HERE */
|
||||||
void wait_until_test_finished(struct iscsi_context *iscsi, struct iscsi_async_state *test_state);
|
void wait_until_test_finished(struct iscsi_context *iscsi, struct iscsi_async_state *test_state);
|
||||||
|
|
||||||
struct iscsi_pdu;
|
struct iscsi_pdu;
|
||||||
@@ -289,4 +296,6 @@ int verify16_miscompare(struct iscsi_context *iscsi, int lun, unsigned char *dat
|
|||||||
int verify16_lbaoutofrange(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t datalen, uint64_t lba, int vprotect, int dpo, int bytchk, int blocksize);
|
int verify16_lbaoutofrange(struct iscsi_context *iscsi, int lun, unsigned char *data, uint32_t datalen, uint64_t lba, int vprotect, int dpo, int bytchk, int blocksize);
|
||||||
int inquiry(struct iscsi_context *iscsi, int lun, int evpd, int page_code, int maxsize);
|
int inquiry(struct iscsi_context *iscsi, int lun, int evpd, int page_code, int maxsize);
|
||||||
|
|
||||||
|
#endif /* STILL_HERE */
|
||||||
|
|
||||||
#endif /* _ISCSI_TEST_H_ */
|
#endif /* _ISCSI_TEST_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user