From e2e401c50c39220f83456720aa8a307f65a8aac2 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 18 Apr 2015 13:57:50 +0200 Subject: [PATCH] iscsi-test-cu: support arbitrary device nodes We support SG_IO on various block devices, including but not limited to: SCSI disks, CDROMs and tapes, virtio-blk and nvmve. Instead of checking a filename prefix just treat anything that isn't an iscsi:// url as a device node. The ioctl checks after open will weed out devices (or files) that don't support SG_IO. Signed-off-by: Christoph Hellwig --- test-tool/iscsi-test-cu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-tool/iscsi-test-cu.c b/test-tool/iscsi-test-cu.c index 1ecab72..e761555 100644 --- a/test-tool/iscsi-test-cu.c +++ b/test-tool/iscsi-test-cu.c @@ -1036,7 +1036,7 @@ main(int argc, char *argv[]) if (!strncmp(argv[optind], "iscsi://", 8)) { sd->iscsi_url = strdup(argv[optind++]); #ifdef HAVE_SG_IO - } else if (!strncmp(argv[optind], "/dev/sg", 7)) { + } else { sd->sgio_dev = strdup(argv[optind++]); #endif } @@ -1052,7 +1052,7 @@ main(int argc, char *argv[]) if (sd->iscsi_url == NULL && sd->sgio_dev== NULL ) { #ifdef HAVE_SG_IO - fprintf(stderr, "You must specify either an iSCSI URL or a /dev/sg device\n"); + fprintf(stderr, "You must specify either an iSCSI URL or a device file\n"); #else fprintf(stderr, "You must specify either an iSCSI URL\n"); #endif