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 | |
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')
-rw-r--r-- | share/examples/scsi_target/scsi_target.c | 16 | ||||
-rw-r--r-- | share/man/man4/targ.4 | 18 |
2 files changed, 10 insertions, 24 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); diff --git a/share/man/man4/targ.4 b/share/man/man4/targ.4 index 5e78200..6c61735 100644 --- a/share/man/man4/targ.4 +++ b/share/man/man4/targ.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 15, 2002 +.Dd December 13, 2011 .Dt TARG 4 .Os .Sh NAME @@ -49,16 +49,8 @@ can be found in .Pp The .Nm -driver supplies control devices, -.Pa /dev/targ0 , -.Pa /dev/targ1 , -etc. -If a device is already in use, -.Xr open 2 -will fail and -.Va errno -will be set to -.Er EBUSY . +driver supplies the control device +.Pa /dev/targ . After opening the device, the file descriptor must be bound to a specific bus/target/LUN and enabled to process CCBs using the .Dv TARGIOCENABLE @@ -123,8 +115,8 @@ it. describes the usermode interface. .It Pa /sys/cam/scsi/scsi_target.c is the driver source file. -.It Pa /dev/targ* -are the control devices. +.It Pa /dev/targ +is the control device. .El .Sh SEE ALSO .Pa /usr/share/examples/scsi_target , |