2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
9 #include <aros/debug.h>
10 #include <proto/dos.h>
11 #include <proto/exec.h>
15 #include "dos_intern.h"
17 BOOL
getpacketinfo(struct DosLibrary
*DOSBase
, CONST_STRPTR name
, struct PacketHelperStruct
*phs
)
19 if (!strchr(name
, ':'))
22 struct Process
*me
= (struct Process
*)FindTask(NULL
);
24 BSTR bstrname
= C2BSTR(name
);
27 ASSERT_VALID_PROCESS(me
);
29 cur
= me
->pr_CurrentDir
;
30 if (cur
&& cur
!= (BPTR
)-1) {
32 phs
->port
= fl
->fl_Task
;
35 phs
->port
= DOSBase
->dl_Root
->rn_BootProc
;
42 BSTR bstrname
= C2BSTR(name
);
43 struct DevProc
*dvp
= NULL
;
44 if ((dvp
= GetDeviceProc(name
, dvp
))) {
46 phs
->port
= dvp
->dvp_Port
;
47 phs
->lock
= dvp
->dvp_Lock
;
55 BOOL
getdevpacketinfo(struct DosLibrary
*DOSBase
, CONST_STRPTR devname
, CONST_STRPTR name
, struct PacketHelperStruct
*phs
)
57 if ((phs
->dp
= GetDeviceProc(devname
, NULL
)) == NULL
)
59 /* we're only interested in real devices */
60 if (phs
->dp
->dvp_DevNode
== NULL
||
61 phs
->dp
->dvp_DevNode
->dol_Type
!= DLT_DEVICE
) {
62 FreeDeviceProc(phs
->dp
);
63 SetIoErr(ERROR_DEVICE_NOT_MOUNTED
);
66 phs
->port
= phs
->dp
->dvp_Port
;
71 phs
->name
= C2BSTR(name
);
73 FreeDeviceProc(phs
->dp
);
74 SetIoErr(ERROR_NO_FREE_STORE
);
80 void freepacketinfo(struct DosLibrary
*DOSBase
, struct PacketHelperStruct
*phs
)
83 FreeDeviceProc(phs
->dp
);
84 FREEC2BSTR(phs
->name
);