home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / amiga / programm / 11726 < prev    next >
Encoding:
Text File  |  1992-07-28  |  1.9 KB  |  58 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!stanford.edu!ames!elroy.jpl.nasa.gov!jato!jdickson
  3. From: jdickson@jato.jpl.nasa.gov (Jeff Dickson)
  4. Subject: Re: Going from volume lock to device name
  5. Message-ID: <1992Jul28.165001.4591@jato.jpl.nasa.gov>
  6. Organization: Jet Propulsion Laboratory
  7. References: <rfmmkdp.davids@netcom.com>
  8. Date: Tue, 28 Jul 1992 16:50:01 GMT
  9. Lines: 47
  10.  
  11. In article <rfmmkdp.davids@netcom.com> davids@netcom.com (Dave Schreiber) writes:
  12. >Can anyone tell me how to get a device name, given a lock on the volume
  13. >that the device is associated with.  I'm writing a program that takes
  14. >as input locks (to disks) from Workbench, and need to go to the appropriate
  15. >device name ("DF0:", "WB_2.X:", etc). 
  16. >
  17. >I tried doing something like this already:
  18. >
  19. >{
  20. >for(all disk devices in system)
  21. >{
  22. >   lock=Lock(devicename,ACCESS_READ);
  23. >   if(SameLock(lock,volumelock)==LOCK_SAME)
  24. >      unlock lock;
  25. >      return device name
  26. >   else
  27. >      unlock lock;
  28. >}
  29. >
  30. >return error;
  31. >}
  32. >
  33. >But this caused Workbench to become unstable (dragging an icon into a 
  34. >floppy disk's trashcan froze Workbench), even with all the appropriate
  35. >checking of return values, etc.  Could this be a bug in Workbench, or
  36. >am I missing something (Kickstart V37.175, Workbench V37.67)?
  37. >
  38. >Thanks.
  39. >
  40. >
  41. >-- 
  42. >Dave Schreiber/davids@netcom.com (until 9/15/92)/"Ask, don't touch"
  43.  
  44. Every lock issued by a device contains a pointer to that device's device
  45. node entry. The pointer is stored in the fl_Volume field as a BPTR. Going
  46. to that structure you could extract the device name of the device the lock
  47. belongs via the dl_Name field (BSTR). I believe the relative include file
  48. is libraries/dosextens.h.
  49.  
  50. It is up to you to exercise arbitration of the DOS list. You're asking for
  51. trouble if you don't. From a process it is best to use the functions
  52. LockDosList(), etc. From a task you have no choice, but to use Forbid/Permit.
  53.  
  54. Hope this helps.
  55.  
  56. Jeff
  57.  
  58.