home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!stanford.edu!ames!elroy.jpl.nasa.gov!jato!jdickson
- From: jdickson@jato.jpl.nasa.gov (Jeff Dickson)
- Subject: Re: Going from volume lock to device name
- Message-ID: <1992Jul28.165001.4591@jato.jpl.nasa.gov>
- Organization: Jet Propulsion Laboratory
- References: <rfmmkdp.davids@netcom.com>
- Date: Tue, 28 Jul 1992 16:50:01 GMT
- Lines: 47
-
- In article <rfmmkdp.davids@netcom.com> davids@netcom.com (Dave Schreiber) writes:
- >Can anyone tell me how to get a device name, given a lock on the volume
- >that the device is associated with. I'm writing a program that takes
- >as input locks (to disks) from Workbench, and need to go to the appropriate
- >device name ("DF0:", "WB_2.X:", etc).
- >
- >I tried doing something like this already:
- >
- >{
- >for(all disk devices in system)
- >{
- > lock=Lock(devicename,ACCESS_READ);
- > if(SameLock(lock,volumelock)==LOCK_SAME)
- > unlock lock;
- > return device name
- > else
- > unlock lock;
- >}
- >
- >return error;
- >}
- >
- >But this caused Workbench to become unstable (dragging an icon into a
- >floppy disk's trashcan froze Workbench), even with all the appropriate
- >checking of return values, etc. Could this be a bug in Workbench, or
- >am I missing something (Kickstart V37.175, Workbench V37.67)?
- >
- >Thanks.
- >
- >
- >--
- >Dave Schreiber/davids@netcom.com (until 9/15/92)/"Ask, don't touch"
-
- Every lock issued by a device contains a pointer to that device's device
- node entry. The pointer is stored in the fl_Volume field as a BPTR. Going
- to that structure you could extract the device name of the device the lock
- belongs via the dl_Name field (BSTR). I believe the relative include file
- is libraries/dosextens.h.
-
- It is up to you to exercise arbitration of the DOS list. You're asking for
- trouble if you don't. From a process it is best to use the functions
- LockDosList(), etc. From a task you have no choice, but to use Forbid/Permit.
-
- Hope this helps.
-
- Jeff
-
-