aboutsummaryrefslogtreecommitdiff
path: root/share/examples/scsi_target
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2011-12-13 21:26:33 +0000
committerEd Schouten <ed@FreeBSD.org>2011-12-13 21:26:33 +0000
commit2f467d2d1697e01c86483e46fb65a89494892049 (patch)
treee02efcb01d78c24b732f3a55945ad6e71c726343 /share/examples/scsi_target
parentc0220d815a82b79a424c5bd76acb8bca59748ce9 (diff)
Change targ(4) to use cdevpriv, instead of multiple character devices.
Also update the manpage and the scsi_target example program accordingly. Discussed on: scsi@ Tested by: Chuck Tuffli <chuck tuffli net>
Notes
Notes: svn path=/head/; revision=228481
Diffstat (limited to 'share/examples/scsi_target')
-rw-r--r--share/examples/scsi_target/scsi_target.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/share/examples/scsi_target/scsi_target.c b/share/examples/scsi_target/scsi_target.c
index e6ff5c716a95..6f665af03c49 100644
--- a/share/examples/scsi_target/scsi_target.c
+++ b/share/examples/scsi_target/scsi_target.c
@@ -100,8 +100,8 @@ static void usage(void);
int
main(int argc, char *argv[])
{
- int ch, unit;
- char *file_name, targname[16];
+ int ch;
+ char *file_name;
u_int16_t req_flags, sim_flags;
off_t user_size;
@@ -283,17 +283,11 @@ main(int argc, char *argv[])
warnx("aio support tested ok");
}
- /* Go through all the control devices and find one that isn't busy. */
- unit = 0;
- do {
- snprintf(targname, sizeof(targname), "/dev/targ%d", unit++);
- targ_fd = open(targname, O_RDWR);
- } while (targ_fd < 0 && errno == EBUSY);
-
+ targ_fd = open("/dev/targ", O_RDWR);
if (targ_fd < 0)
- errx(1, "Tried to open %d devices, none available", unit);
+ err(1, "/dev/targ");
else
- warnx("opened %s", targname);
+ warnx("opened /dev/targ");
/* The first three are handled by kevent() later */
signal(SIGHUP, SIG_IGN);