home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / mac / programm / 15073 < prev    next >
Encoding:
Text File  |  1992-09-08  |  3.9 KB  |  101 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!sun-barr!ames!agate!iat.holonet.net!bwilliam
  3. From: bwilliam@iat.holonet.net (Bill Williams)
  4. Subject: Re: How do I mount a SCSI device?
  5. Message-ID: <Bu7C66.DqM@iat.holonet.net>
  6. Organization: HoloNet (BBS: 510-704-1058)
  7. References: <BtuqLx.2xE@acsu.buffalo.edu>
  8. Distribution: comp
  9. Date: Mon, 7 Sep 1992 09:39:41 GMT
  10. Lines: 89
  11.  
  12. >>mount all SCSI devices it finds in the chain.....
  13.  
  14.  
  15.  
  16. Do not write a mounting program unless you do it correctly. To do
  17.  it correctly is too much work. I'll demonstrate:
  18.  
  19. Steps include
  20.  
  21. 1: Finding all devices on the bus that are FIXED STORAGE, OPTICAL, and CD-ROM
  22. while ignoring things like Voice Navigators and Scanners. Requires 
  23. knowledge of the SCSI Manager.
  24.  
  25. 2: Unmounting all currently existing unmountable volumes supported by the
  26. existing drivers for safety (plus you won't be able to unmount the system
  27. volume or the current app volume)
  28.  
  29. 3: Finding the first VALID HFS SCSI driver form the devices from the DDM
  30. Driver Descriptor Map, in Block0 structure of disk (first block) Plus
  31. reading just the first 512 bytes of the SCSI Block even if its logical 
  32. block size is larger than 512 bytes.
  33.  
  34. Then via block zero you can deduce which of several Partition map entries
  35. in the PARTITION MAP partition is the desired driver. Then you need to
  36. officially validate the checksum found in the partition map entry
  37. describing the driver you are seeking via IM 5 if the partition map name
  38. begins with 'MACI' in upper OR lower case
  39.  
  40. 4: once found you need to load the driver into memory and check its memory
  41. against its checksum for safety. Also you need to load it into a non
  42. relocatable area of the system heap, and GUARANTEE THAT THE SYSTEM HEAP
  43.  CAN AFFORD to accept a further loss of space (if not in System 7 with
  44. expandable system 7 heaps). Size of driver is stored in partition map
  45. entry but be careful not to multiply the logical block size (its units)
  46. by the "ddSize" of the DDM since Apple structures are all internally
  47.  stored using 512 byte logical blocks.
  48.  
  49. 5: once the driver is ready and found, you need to jumpstart the driver as
  50. if it was being called by the normal bootup processes of the Mac after
  51. ILLEGALLY TAKING OVER THE CURRENT SCSI SLOT SPACE in the driver for that
  52. device using Apples official current regular (non "Cousin It") guidlines:
  53. (unit_Table_Ptr = (DCtlHandle *)UTableBase;
  54. unit_Table_Ptr += 32 + device_ID;/* Point at SCSI ID direct slot */)
  55.  
  56.  
  57. void Mount_SCSI_Drive(long scsi_Address, Ptr driver_Start)
  58. {
  59.   asm {
  60.     movem.l    d0-d7/a0-a6,-(sp)
  61.     suba.l     a0,a0
  62.     moveq.l    #0,d7
  63.     move.l     scsi_Address,d5
  64.     bset.l     #31,d5    ;To indicate not being called at boot time
  65.     move.l     driver_Start,a1
  66.     jsr        (a1)
  67.     movem.l    (sp)+,d0-d7/a0-a6
  68.   } /* asm */
  69.   
  70. } /* pascal void Mount_SCSI_Device(INTEGER_32 scsi_Address... */
  71.  
  72.  
  73. 6: The Driver, not you,has the duty of cycling through partition entries
  74. so Thats all there is. Thats it. They will mount.
  75.  
  76.  
  77.  
  78. Problems with ANY technique such as mounting like this include:
  79. Having drivers ORPANED IN MEMORY! This is because no
  80. SCSI drivers currently have to support a "Close" command and WILL BE
  81. ORPAHANED. They may be may be doing evil background tasks, VBL tasks,
  82. or have nasty shutdown manager calls installed. Taking over a SCSI Slot
  83. space is naughty.
  84.  
  85.  
  86. Conclusion: DO NOT WRITE a "SCSI Probe", nor use SCSI Probe. However the
  87. steps just listed in this article are all properly done in the "SCSI
  88. Director* Assistant 1.5.1" CDEV that has various names and was available
  89. from 18 different companies including APS,Club Mac,VCP, etc etc. 
  90.  
  91. PS "SCSI Probe 3.x" violates most rules and does things such as mounting
  92.  OFFLINE devices that are OFFLINE and not Normal Device Queue Entries 
  93. (such as RAM Disks that are closed down with raw memory addresses in the
  94.  entry, MS-DOS volumes, etc.  KaBOOM.
  95.  
  96. BWilliams
  97.  
  98. (If you need to speak to me use EMail since I never usually read
  99. Mac oriented usenet stuff... but I may start)
  100.  
  101.