home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mips / 1190 < prev    next >
Encoding:
Text File  |  1993-01-28  |  2.2 KB  |  72 lines

  1. Newsgroups: comp.sys.mips
  2. Path: sparky!uunet!charon.amdahl.com!amdahl!rtech!pacbell.com!sgiblab!munnari.oz.au!metro!basser.cs.su.oz.au!rex
  3. From: rex@cs.su.oz.au (Rex Monty di Bona)
  4. Subject: Re: Adding an unformatted Seagate ST11200N to RC3230
  5. Reply-To: rex@cs.su.oz.au (Rex Monty di Bona)
  6. Organization: Basser Dept of Computer Science, University of Sydney, Australia
  7. Date: Thu, 28 Jan 1993 02:02:33 GMT
  8. Message-ID: <1993Jan28.020233.20145@cs.su.oz.au>
  9. References: <JOOST.93Jan20220655@ori.cadlab.de> <1993Jan27.070111.1135@cs.su.oz.au>
  10. Sender: news@cs.su.oz.au (News)
  11. Lines: 59
  12.  
  13. In article <1993Jan27.070111.1135@cs.su.oz.au> rex@cs.su.oz.au writes:
  14. >     BTW, I have a version of sprobe that works in multiuser (really
  15. > useful for sys-admin type tasks) I'll put it up for ftp, ot post it if
  16. > the demand is there)..
  17.  
  18. Ok, I was aksed, here it is. Basically in the common_scsi.c device
  19. driver for SCSI devices the 'sprobe' information line is available
  20. inside the kernel. This is available by using the GIOCPRSTR ioctl on
  21. each device. The problem is that the devices are called different things
  22. on the various machines. The 3230s and later machines seem to use the
  23. sdcXdYvh coding, but the M120s and earlier ones use isCXdYvh coding,
  24. and what the Jaguar interface ones use I don't know... 
  25.  
  26. P.s. This has to run as root, or as somebody who can open the raw devices. :-)
  27. ---- cut here ----
  28. #include <sys/types.h>
  29. #include <sys/param.h>
  30. #include <sys/buf.h>
  31. #include <sys/dvh.h>
  32. #include <sys/scsi.h>
  33. #include <sys/ioctl.h>
  34. #include <sys/dkio.h>
  35. #include <sys/gen_ioctl.h>
  36.  
  37. main(int argc, char **argv)
  38. {
  39.     int    i, j;
  40.     char    buf[20];
  41.  
  42.     printf("          Vendor  -Product ID      -Rev -Prom Rev-Serial Num. -Decive Type\n");
  43.     for(j = 0; j < 4; j++) {
  44.         for(i = 0; i < 7; i++) {
  45.             sprintf(buf, "/dev/rscsi/sdc%dd%ds8", j, i);
  46.             do_check(i, buf);
  47.             sprintf(buf, "/dev/rscsi/isc%dd%ds8", j, i);
  48.             do_check(i, buf);
  49.         }
  50.     }
  51.     exit(0);
  52. }
  53.  
  54. do_check(int id, char *dev)
  55. {
  56.     int    fd;
  57.     char    buf[IDENT_LEN+4];    /* Make sure it's long enough */
  58.  
  59.     if ((fd = open(dev, 0)) == -1) {
  60.         /*
  61.          * can't open - might not be there.
  62.          */
  63.         return;
  64.     }
  65.     if (ioctl(fd, GIOCPRSTR, buf) == -1) {
  66.         return;
  67.     }
  68.     printf("SCSI %dL0: %s\n", id, buf);
  69. }
  70. --
  71. Rex di Bona (rex@cs.su.oz.au)         Penguin Lust is NOT immoral
  72.