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 <hch@lst.de>
This commit is contained in:
committed by
Ronnie Sahlberg
parent
ba120e4347
commit
e2e401c50c
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user