home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mips
- Path: sparky!uunet!charon.amdahl.com!amdahl!rtech!pacbell.com!sgiblab!munnari.oz.au!metro!basser.cs.su.oz.au!rex
- From: rex@cs.su.oz.au (Rex Monty di Bona)
- Subject: Re: Adding an unformatted Seagate ST11200N to RC3230
- Reply-To: rex@cs.su.oz.au (Rex Monty di Bona)
- Organization: Basser Dept of Computer Science, University of Sydney, Australia
- Date: Thu, 28 Jan 1993 02:02:33 GMT
- Message-ID: <1993Jan28.020233.20145@cs.su.oz.au>
- References: <JOOST.93Jan20220655@ori.cadlab.de> <1993Jan27.070111.1135@cs.su.oz.au>
- Sender: news@cs.su.oz.au (News)
- Lines: 59
-
- In article <1993Jan27.070111.1135@cs.su.oz.au> rex@cs.su.oz.au writes:
- > BTW, I have a version of sprobe that works in multiuser (really
- > useful for sys-admin type tasks) I'll put it up for ftp, ot post it if
- > the demand is there)..
-
- Ok, I was aksed, here it is. Basically in the common_scsi.c device
- driver for SCSI devices the 'sprobe' information line is available
- inside the kernel. This is available by using the GIOCPRSTR ioctl on
- each device. The problem is that the devices are called different things
- on the various machines. The 3230s and later machines seem to use the
- sdcXdYvh coding, but the M120s and earlier ones use isCXdYvh coding,
- and what the Jaguar interface ones use I don't know...
-
- P.s. This has to run as root, or as somebody who can open the raw devices. :-)
- ---- cut here ----
- #include <sys/types.h>
- #include <sys/param.h>
- #include <sys/buf.h>
- #include <sys/dvh.h>
- #include <sys/scsi.h>
- #include <sys/ioctl.h>
- #include <sys/dkio.h>
- #include <sys/gen_ioctl.h>
-
- main(int argc, char **argv)
- {
- int i, j;
- char buf[20];
-
- printf(" Vendor -Product ID -Rev -Prom Rev-Serial Num. -Decive Type\n");
- for(j = 0; j < 4; j++) {
- for(i = 0; i < 7; i++) {
- sprintf(buf, "/dev/rscsi/sdc%dd%ds8", j, i);
- do_check(i, buf);
- sprintf(buf, "/dev/rscsi/isc%dd%ds8", j, i);
- do_check(i, buf);
- }
- }
- exit(0);
- }
-
- do_check(int id, char *dev)
- {
- int fd;
- char buf[IDENT_LEN+4]; /* Make sure it's long enough */
-
- if ((fd = open(dev, 0)) == -1) {
- /*
- * can't open - might not be there.
- */
- return;
- }
- if (ioctl(fd, GIOCPRSTR, buf) == -1) {
- return;
- }
- printf("SCSI %dL0: %s\n", id, buf);
- }
- --
- Rex di Bona (rex@cs.su.oz.au) Penguin Lust is NOT immoral
-