diff options
author | ed <ed@FreeBSD.org> | 2011-12-13 21:26:33 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2011-12-13 21:26:33 +0000 |
commit | 145914e3e7153161b6dd67fdcd58c7a8201845bc (patch) | |
tree | e02efcb01d78c24b732f3a55945ad6e71c726343 /share/examples/scsi_target | |
parent | 84c9c96d4a9d825c7978a804d7c208aacb2d2c67 (diff) | |
download | FreeBSD-src-145914e3e7153161b6dd67fdcd58c7a8201845bc.zip FreeBSD-src-145914e3e7153161b6dd67fdcd58c7a8201845bc.tar.gz |
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>
Diffstat (limited to 'share/examples/scsi_target')
-rw-r--r-- | share/examples/scsi_target/scsi_target.c | 16 |
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 e6ff5c71..6f665af 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); |