20 #include "modules/Module.h" 21 #include "modules/system/lodisk/LoDisk.h" 23 #include "modules/system/vfs/Filesystem.h" 24 #include "modules/system/vfs/VFS.h" 25 #include "pedigree/kernel/Log.h" 26 #include "pedigree/kernel/core/BootIO.h" 27 #include "pedigree/kernel/machine/Device.h" 28 #include "pedigree/kernel/machine/Disk.h" 29 #include "pedigree/kernel/utilities/Iterator.h" 30 #include "pedigree/kernel/utilities/List.h" 31 #include "pedigree/kernel/utilities/StaticString.h" 32 #include "pedigree/kernel/utilities/String.h" 33 #include "pedigree/kernel/utilities/Tree.h" 34 #include "pedigree/kernel/utilities/utility.h" 38 static bool bRootMounted =
false;
40 static void error(
const char *s)
46 bootIO.
write(str, BootIO::Red, BootIO::Black);
57 Disk *pDisk =
static_cast<Disk *
>(diskDevice);
62 bool didMountAsRoot =
false;
69 s +=
"»/.pedigree-root";
73 if (f && !bRootMounted)
75 NOTICE(
"Mounted " << alias <<
" successfully as root.");
77 bRootMounted = didMountAsRoot =
true;
83 NOTICE(
"Mounted " << alias <<
".");
103 pRuntimeFs->setProcessOwnership(
true);
111 error(
"raw» does not exist - cannot continue startup.");
121 NOTICE(
"trying to find live disk");
124 if (pRamDisk && pRamDisk->initialise())
126 NOTICE(
"have a live disk");
131 bRootMounted =
false;
132 NOTICE(
"probing ram disk for partitions");
142 error(
"No root disk on this system (no root»/.pedigree-root found).");
150 static void destroy()
152 NOTICE(
"Unmounting all filesystems...");
157 for (
auto it = mounts.
begin(); it != mounts.
end(); ++it)
162 while (deletionQueue.
count())
172 NOTICE(
"Unmounting all filesystems has completed.");
175 MODULE_INFO(
"mountroot", &init, &destroy,
"vfs",
"partition");
179 MODULE_OPTIONAL_DEPENDS(
"filesystems");
void removeAlias(const String &alias)
File * find(const String &path, File *pStartNode=0)
void pushBack(const T &value)
virtual bool initialise(Disk *pDisk)
EXPORTED_PUBLIC void write(T &str, Colour foreColour, Colour backColour)
Tree< Filesystem *, List< String * > * > & getMounts()
void addAlias(Filesystem *pFs, const String &alias)
A disk device - a block device in UNIX terms.
static void addToRoot(Device *device)
void removeAllAliases(Filesystem *pFs, bool canDelete=true)
static void foreach(Callback callback, Device *root=0)
virtual String getVolumeLabel() const =0
bool mount(Disk *pDisk, String &alias)