1 #include <aros/debug.h>
2 #include <aros/libcall.h>
3 #include <dos/dosextens.h>
5 #include <proto/exec.h>
7 #include "partition_support.h"
10 /*****************************************************************************
13 AROS_LH0(LONG
, LoadBootFileSystems
,
18 struct Library
*, PartitionBase
, 24, Partition
)
21 Perform a deferred loading of boot filesystems.
27 Zero if everything went okay or DOS error code in case of failure.
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
44 *****************************************************************************/
48 struct BootFileSystem
*bfs
, *bfs2
;
49 struct DosLibrary
*DOSBase
= (struct DosLibrary
*)OpenLibrary("dos.library", 36);
52 /* We should really have dos.library online now */
53 D(bug("[LoadBootPartitions] DOSBase 0x%p\n", DOSBase
));
55 return ERROR_INVALID_RESIDENT_LIBRARY
;
57 ObtainSemaphore(&PBASE(PartitionBase
)->bootSem
);
59 ForeachNodeSafe(&PBASE(PartitionBase
)->bootList
, bfs
, bfs2
)
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
);
75 /* A filesystem is loaded, remove it from the queue and free associated data. */
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
);