2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Add a DOS device to the system.
8 #include "expansion_intern.h"
10 #include <dos/filesystem.h>
11 #include <proto/exec.h>
12 #include <proto/dos.h>
14 /*****************************************************************************
17 #include <dos/filehandler.h>
18 #include <dos/dosextens.h>
19 #include <libraries/expansion.h>
20 #include <proto/expansion.h>
22 AROS_LH3(BOOL
, AddDosNode
,
25 AROS_LHA(LONG
, bootPri
, D0
),
26 AROS_LHA(ULONG
, flags
, D1
),
27 AROS_LHA(struct DeviceNode
*, deviceNode
, A0
),
30 struct ExpansionBase
*, ExpansionBase
, 25, Expansion
)
33 This is the old function for adding devices to the system. It
34 is recommended that you use the AddBootNode() function.
36 Unlike AddBootNode() you will have to add a BootNode to the
40 bootPri - The priority of the device (-128 --> 127).
41 flags - Flags (ADNF_STARTPROC etc)
42 deviceNode - The device to add to the system.
45 non-zero if everything succeeded, zero on failure.
48 It is much better to use AddBootNode() as it will also
49 construct the BootNode structure, and add it to the system.
52 // Add a bootable disk to the system. This will start a
53 // file handler process immediately.
55 if( AddDosNode( 0, ADNF_STARTPROC, MakeDosNode( paramPacket )))
63 AddBootNode(), MakeDosNode()
68 27-11-96 digulla automatically created from
69 expansion_lib.fd and clib/expansion_protos.h
71 *****************************************************************************/
74 AROS_LIBBASE_EXT_DECL(struct ExpansionBase
*,ExpansionBase
)
76 struct DosLibrary
*DOSBase
;
79 /* Have we been asked to start a filesystem, and there is none already */
80 if ((flags
& ADNF_STARTPROC
) && (deviceNode
->dn_Device
== NULL
))
82 /* yes, better do so */
84 struct IOFileSys
*iofs
;
90 iofs
= (struct IOFileSys
*)CreateIORequest(mp
,
91 sizeof(struct IOFileSys
));
96 struct FileSysStartupMsg
*fssm
;
98 if (deviceNode
->dn_Handler
== NULL
)
100 handler
= "ffs.handler";
104 handler
= AROS_BSTR_ADDR(deviceNode
->dn_Handler
);
107 fssm
= (struct FileSysStartupMsg
*)BADDR(deviceNode
->dn_Startup
);
108 iofs
->io_Union
.io_OpenDevice
.io_DeviceName
= AROS_BSTR_ADDR(fssm
->fssm_Device
);
109 iofs
->io_Union
.io_OpenDevice
.io_Unit
= fssm
->fssm_Unit
;
110 iofs
->io_Union
.io_OpenDevice
.io_Environ
= (IPTR
*)BADDR(fssm
->fssm_Environ
);
111 iofs
->io_Union
.io_OpenDevice
.io_DosName
= deviceNode
->dn_NewName
;
113 if (!OpenDevice(handler
, 0, &iofs
->IOFS
, fssm
->fssm_Flags
))
116 Ok, this means that the handler was able to open,
117 the old mount command just left the device hanging?
119 I suppose that is one one of preventing it from
122 deviceNode
->dn_Device
= iofs
->IOFS
.io_Device
;
123 deviceNode
->dn_Unit
= iofs
->IOFS
.io_Unit
;
127 DeleteIORequest(&iofs
->IOFS
);
140 DOSBase
= (struct DosLibrary
*)OpenLibrary("dos.library", 0);
142 /* Aha, DOS is up and running... */
145 /* We should add the filesystem to the DOS device list. It will
146 usable from this point onwards.
148 The DeviceNode structure that was passed to us can be added
149 to the DOS list as it is, and we will let DOS start the
150 filesystem task if it is necessary to do so.
153 AddDosEntry((struct DosList
*)deviceNode
);
154 CloseLibrary((struct Library
*)DOSBase
);