2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
7 #include <aros/libcall.h>
8 #include <dos/dosextens.h>
10 #include <proto/exec.h>
12 #include "partition_support.h"
15 /*****************************************************************************
18 AROS_LH0(LONG
, LoadBootFileSystems
,
23 struct Library
*, PartitionBase
, 24, Partition
)
26 Perform a deferred loading of boot filesystems.
32 Zero if everything went okay or DOS error code in case of failure.
35 This function is actually private; it's called by dos.library during
36 the initialization process. There's no sense to call it from within
47 *****************************************************************************/
51 struct BootFileSystem
*bfs
, *bfs2
;
52 struct DosLibrary
*DOSBase
;
55 PBASE(PartitionBase
)->pb_DOSBase
= OpenLibrary("dos.library", 36);
56 DOSBase
= (struct DosLibrary
*)PBASE(PartitionBase
)->pb_DOSBase
;
57 /* We should really have dos.library online now */
58 D(bug("[LoadBootPartitions] DOSBase 0x%p\n", DOSBase
));
60 return ERROR_INVALID_RESIDENT_LIBRARY
;
62 ObtainSemaphore(&PBASE(PartitionBase
)->bootSem
);
64 ForeachNodeSafe(&PBASE(PartitionBase
)->bootList
, bfs
, bfs2
)
68 * Unfortunately we have no way to process errors here.
69 * Well, let's hope that everything will be okay.
71 D(bug("[LoadBootPartitions] Loading %s...\n", bfs
->ln
.ln_Name
));
73 res
= AddFS(PartitionBase
, bfs
->handle
);
80 /* A filesystem is loaded, remove it from the queue and free associated data. */
82 bfs
->handle
->handler
->freeFileSystem(bfs
->handle
);
83 FreeMem(bfs
, sizeof(struct BootFileSystem
));
87 ReleaseSemaphore(&PBASE(PartitionBase
)->bootSem
);
90 * We don't hold dos.library here because it may want to be expunged
91 * (see dos_init.c and cliinit.c).
93 CloseLibrary(&DOSBase
->dl_lib
);