Added missing SVN properties.
[cake.git] / rom / expansion / adddosnode.c
blob6d4142e5662bdf19bbf84e4725febc7846beaa9c
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add a DOS device to the system.
6 Lang: English
7 */
8 #include "expansion_intern.h"
9 #include <exec/io.h>
10 #include <dos/filesystem.h>
11 #include <proto/exec.h>
12 #include <proto/dos.h>
14 /*****************************************************************************
16 NAME */
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,
24 /* SYNOPSIS */
25 AROS_LHA(LONG , bootPri, D0),
26 AROS_LHA(ULONG , flags, D1),
27 AROS_LHA(struct DeviceNode *, deviceNode, A0),
29 /* LOCATION */
30 struct ExpansionBase *, ExpansionBase, 25, Expansion)
32 /* FUNCTION
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
37 system yourself.
39 INPUTS
40 bootPri - The priority of the device (-128 --> 127).
41 flags - Flags (ADNF_STARTPROC etc)
42 deviceNode - The device to add to the system.
44 RESULT
45 non-zero if everything succeeded, zero on failure.
47 NOTES
48 It is much better to use AddBootNode() as it will also
49 construct the BootNode structure, and add it to the system.
51 EXAMPLE
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 )))
57 // AddDosNode() ok
60 BUGS
62 SEE ALSO
63 AddBootNode(), MakeDosNode()
65 INTERNALS
67 HISTORY
68 19-05-07 sonic Rewritten to use dos.library for starting up
69 a handler.
70 27-11-96 digulla automatically created from
71 expansion_lib.fd and clib/expansion_protos.h
73 *****************************************************************************/
75 AROS_LIBFUNC_INIT
77 struct DosLibrary *DOSBase;
78 BOOL ok = FALSE;
80 DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 0);
82 /* Aha, DOS is up and running... */
83 if (DOSBase != NULL)
85 /* We should add the filesystem to the DOS device list. It will
86 be usable from this point onwards.
88 The DeviceNode structure that was passed to us can be added
89 to the DOS list as it is, and we will let DOS start the
90 filesystem task if it is necessary to do so.
93 ok = AddDosEntry((struct DosList *)deviceNode);
94 /* Have we been asked to start a filesystem, and there is none already */
95 if (flags & ADNF_STARTPROC)
97 /* Yes, better do so.
99 DeviceProc() will see that dn_Device for this node is NULL
100 and start up the handler. */
101 DeviceProc((struct Device *)deviceNode);
104 CloseLibrary((struct Library *)DOSBase);
107 return ok;
109 AROS_LIBFUNC_EXIT
110 } /* AddDosNode */