2 Copyright © 1995-2014, 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 initialization process. There's no sense to call it from within user
49 *****************************************************************************/
53 struct BootFileSystem
*bfs
, *bfs2
;
54 struct DosLibrary
*DOSBase
;
57 PBASE(PartitionBase
)->pb_DOSBase
= OpenLibrary("dos.library", 36);
58 DOSBase
= (struct DosLibrary
*)PBASE(PartitionBase
)->pb_DOSBase
;
59 /* We should really have dos.library online now */
60 D(bug("[LoadBootPartitions] DOSBase 0x%p\n", DOSBase
));
62 return ERROR_INVALID_RESIDENT_LIBRARY
;
64 ObtainSemaphore(&PBASE(PartitionBase
)->bootSem
);
66 ForeachNodeSafe(&PBASE(PartitionBase
)->bootList
, bfs
, bfs2
)
70 * Unfortunately we have no way to process errors here.
71 * Well, let's hope that everything will be okay.
73 D(bug("[LoadBootPartitions] Loading %s...\n", bfs
->ln
.ln_Name
));
75 res
= AddFS(PartitionBase
, bfs
->handle
);
82 /* A filesystem is loaded, remove it from the queue and free associated data. */
84 bfs
->handle
->handler
->freeFileSystem(bfs
->handle
);
85 FreeMem(bfs
, sizeof(struct BootFileSystem
));
89 ReleaseSemaphore(&PBASE(PartitionBase
)->bootSem
);
92 * We don't hold dos.library here because it may want to be expunged
93 * (see dos_init.c and cliinit.c).
95 CloseLibrary(&DOSBase
->dl_lib
);