Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / dos / deviceproc.c
blobbbb6d77953881b5ddd810fcabf6e9d1ebf2418cd
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: DeviceProc - Return a handle to a devices process.
6 Lang: english
7 */
8 #include "dos_intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <proto/dos.h>
15 AROS_LH1(struct MsgPort *, DeviceProc,
17 /* SYNOPSIS */
18 AROS_LHA(CONST_STRPTR, name, D1),
20 /* LOCATION */
21 struct DosLibrary *, DOSBase, 29, Dos)
23 /* FUNCTION
24 DeviceProc() is an obsolete function that returns the Process
25 responsible for a DOS device. It has been updated to return a
26 new filesystem device.
28 DeviceProc() will fail if you ask for the Process of a device
29 created with AssignPath() as there is no process to return.
30 If the device requested is an assign, the IoErr() will contain
31 the Lock to the directory (the function will return the device
32 on which the lock is set).
34 INPUTS
35 name - The name of the DOS device, without the ':'.
37 RESULT
38 Either a pointer to the Device structure, or NULL.
40 NOTES
41 You should really use GetDeviceProc() as this function caters
42 for all possible device types.
44 EXAMPLE
46 BUGS
47 Does not support late- and non-bound assigns, or multiple
48 path assigns very well.
50 SEE ALSO
51 GetDeviceProc(), FreeDeviceProc()
53 INTERNALS
55 *****************************************************************************/
57 AROS_LIBFUNC_INIT
59 struct MsgPort *res = NULL;
60 struct DevProc *dvp;
62 /* just use GetDeviceProc(), it knows everything useful anyway */
63 if ((dvp = GetDeviceProc(name, NULL)) == NULL)
64 return NULL;
66 /* if GetDeviceProc() had to create the lock (ie non-binding assigns), we
67 * can't return it as there's no cleanup function, so we have to error */
68 if (dvp->dvp_Flags & DVPF_UNLOCK) {
69 FreeDeviceProc(dvp);
70 SetIoErr(ERROR_DEVICE_NOT_MOUNTED);
71 return NULL;
74 /* all good. get the lock and device */
75 SetIoErr(dvp->dvp_Lock);
76 res = dvp->dvp_Port;
78 FreeDeviceProc(dvp);
80 return res;
82 AROS_LIBFUNC_EXIT
83 } /* DeviceProc */