Init control word to zero, cdrom-handler reads this and will crash if it is non-zero...
[AROS.git] / rom / partition / loadbootfilesystems.c
blob31536c389fa4ac7d81b85c42ae15c64025a1da02
1 #include <aros/debug.h>
2 #include <aros/libcall.h>
3 #include <dos/dosextens.h>
4 #include <proto/dos.h>
5 #include <proto/exec.h>
7 #include "partition_support.h"
8 #include "fsloader.h"
10 /*****************************************************************************
12 NAME */
13 AROS_LH0(LONG, LoadBootFileSystems,
15 /* SYNOPSIS */
17 /* LOCATION */
18 struct Library *, PartitionBase, 24, Partition)
20 /* FUNCTION
21 Perform a deferred loading of boot filesystems.
23 INPUTS
24 None.
26 RESULT
27 Zero if everything went okay or DOS error code in case of failure.
29 NOTES
30 This function is actually private, it's called by dos.library during
31 initialization process. There's no sense to call it from within user
32 software.
34 EXAMPLE
36 BUGS
38 SEE ALSO
40 INTERNALS
42 HISTORY
44 *****************************************************************************/
46 AROS_LIBFUNC_INIT
48 struct BootFileSystem *bfs, *bfs2;
49 struct DosLibrary *DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 36);
50 ULONG lasterr = 0;
52 /* We should really have dos.library online now */
53 D(bug("[LoadBootPartitions] DOSBase 0x%p\n", DOSBase));
54 if (!DOSBase)
55 return ERROR_INVALID_RESIDENT_LIBRARY;
57 ObtainSemaphore(&PBASE(PartitionBase)->bootSem);
59 ForeachNodeSafe(&PBASE(PartitionBase)->bootList, bfs, bfs2)
61 ULONG res;
63 * Unfortunately we have no way to process errors here.
64 * Well, let's hope that everything will be okay.
66 D(bug("[LoadBootPartitions] Loading %s...\n", bfs->ln.ln_Name));
68 res = AddFS(PartitionBase, bfs->handle);
69 if (res)
71 lasterr = res;
73 else
75 /* A filesystem is loaded, remove it from the queue and free associated data. */
76 Remove(&bfs->ln);
77 bfs->handle->handler->freeFileSystem(bfs->handle);
78 FreeMem(bfs, sizeof(struct BootFileSystem));
82 ReleaseSemaphore(&PBASE(PartitionBase)->bootSem);
85 * We don't hold dos.library here because it may want to be expunged
86 * (see dos_init.c and cliinit.c).
88 CloseLibrary(&DOSBase->dl_lib);
89 return lasterr;
91 AROS_LIBFUNC_EXIT