mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-25 22:14:37 +00:00
Update filesystem structure
This commit is contained in:
parent
81c40be73a
commit
e8162bc3cb
@ -24,7 +24,7 @@
|
||||
#include <cwalk.h>
|
||||
#include <md5.h>
|
||||
|
||||
#include "../../Drivers/drv.hpp"
|
||||
#include "../../Modules/drv.hpp"
|
||||
#include "../../kernel.h"
|
||||
#include "../../DAPI.hpp"
|
||||
#include "../../Fex.hpp"
|
||||
|
41
Kernel.cpp
41
Kernel.cpp
@ -205,7 +205,6 @@ PCI::PCI *PCIManager = nullptr;
|
||||
Tasking::Task *TaskManager = nullptr;
|
||||
Time::time *TimeManager = nullptr;
|
||||
VirtualFileSystem::Virtual *vfs = nullptr;
|
||||
VirtualFileSystem::Virtual *bootanim_vfs = nullptr;
|
||||
|
||||
KernelConfig Config = {
|
||||
.AllocatorType = Memory::MemoryAllocatorType::XallocV1,
|
||||
@ -403,9 +402,6 @@ EXTERNC NIF void Main()
|
||||
KPrint("Initializing Filesystem...");
|
||||
vfs = new VirtualFileSystem::Virtual;
|
||||
|
||||
if (Config.BootAnimation)
|
||||
bootanim_vfs = new VirtualFileSystem::Virtual;
|
||||
|
||||
for (size_t i = 0; i < MAX_MODULES; i++)
|
||||
{
|
||||
if (!bInfo.Modules[i].Address)
|
||||
@ -418,13 +414,6 @@ EXTERNC NIF void Main()
|
||||
if (!initrd++)
|
||||
new VirtualFileSystem::USTAR((uintptr_t)bInfo.Modules[i].Address, vfs);
|
||||
}
|
||||
if (strcmp(bInfo.Modules[i].CommandLine, "bootanim") == 0 && Config.BootAnimation)
|
||||
{
|
||||
debug("Found bootanim at %p", bInfo.Modules[i].Address);
|
||||
static char bootanim = 0;
|
||||
if (!bootanim++)
|
||||
new VirtualFileSystem::USTAR((uintptr_t)bInfo.Modules[i].Address, bootanim_vfs);
|
||||
}
|
||||
}
|
||||
|
||||
if (vfs->GetRootNode()->Children.size() == 0)
|
||||
@ -436,45 +425,42 @@ EXTERNC NIF void Main()
|
||||
vfs->CreateRoot("/", &null_op);
|
||||
}
|
||||
|
||||
if (!vfs->PathExists("/system"))
|
||||
vfs->Create("/system", NodeFlags::DIRECTORY);
|
||||
|
||||
if (!vfs->PathExists("/system/dev"))
|
||||
DevFS = vfs->Create("/system/dev", NodeFlags::DIRECTORY);
|
||||
if (!vfs->PathExists("/dev"))
|
||||
DevFS = vfs->Create("/dev", NodeFlags::DIRECTORY);
|
||||
else
|
||||
{
|
||||
File dev = vfs->Open("/system/dev");
|
||||
File dev = vfs->Open("/dev");
|
||||
if (dev.node->Flags != NodeFlags::DIRECTORY)
|
||||
{
|
||||
KPrint("\eE85230/system/dev is not a directory! Halting...");
|
||||
KPrint("\eE85230/dev is not a directory! Halting...");
|
||||
CPU::Stop();
|
||||
}
|
||||
vfs->Close(dev);
|
||||
DevFS = dev.node;
|
||||
}
|
||||
|
||||
if (!vfs->PathExists("/system/mnt"))
|
||||
MntFS = vfs->Create("/system/mnt", NodeFlags::DIRECTORY);
|
||||
if (!vfs->PathExists("/mnt"))
|
||||
MntFS = vfs->Create("/mnt", NodeFlags::DIRECTORY);
|
||||
else
|
||||
{
|
||||
File mnt = vfs->Open("/system/mnt");
|
||||
File mnt = vfs->Open("/mnt");
|
||||
if (mnt.node->Flags != NodeFlags::DIRECTORY)
|
||||
{
|
||||
KPrint("\eE85230/system/mnt is not a directory! Halting...");
|
||||
KPrint("\eE85230/mnt is not a directory! Halting...");
|
||||
CPU::Stop();
|
||||
}
|
||||
vfs->Close(mnt);
|
||||
MntFS = mnt.node;
|
||||
}
|
||||
|
||||
if (!vfs->PathExists("/system/proc"))
|
||||
ProcFS = vfs->Create("/system/proc", NodeFlags::DIRECTORY);
|
||||
if (!vfs->PathExists("/proc"))
|
||||
ProcFS = vfs->Create("/proc", NodeFlags::DIRECTORY);
|
||||
else
|
||||
{
|
||||
File proc = vfs->Open("/system/proc", nullptr);
|
||||
File proc = vfs->Open("/proc", nullptr);
|
||||
if (proc.node->Flags != NodeFlags::DIRECTORY)
|
||||
{
|
||||
KPrint("\eE85230/system/proc is not a directory! Halting...");
|
||||
KPrint("\eE85230/proc is not a directory! Halting...");
|
||||
CPU::Stop();
|
||||
}
|
||||
vfs->Close(proc);
|
||||
@ -571,9 +557,6 @@ EXTERNC __no_stack_protector void BeforeShutdown(bool Reboot)
|
||||
if (vfs)
|
||||
delete vfs, vfs = nullptr;
|
||||
|
||||
if (bootanim_vfs)
|
||||
delete bootanim_vfs, bootanim_vfs = nullptr;
|
||||
|
||||
if (TimeManager)
|
||||
delete TimeManager, TimeManager = nullptr;
|
||||
|
||||
|
@ -258,9 +258,9 @@ void TestSyscallsKernel()
|
||||
Execute::SpawnData SpawnInit()
|
||||
{
|
||||
const char *envp[5] = {
|
||||
"PATH=/system:/system/bin",
|
||||
"PATH=/bin:/usr/bin",
|
||||
"TERM=tty",
|
||||
"HOME=/",
|
||||
"HOME=/root",
|
||||
"USER=root",
|
||||
nullptr};
|
||||
|
||||
@ -283,11 +283,11 @@ void BootLogoAnimationThread()
|
||||
char BootAnimPath[16];
|
||||
while (FrameCount < 27)
|
||||
{
|
||||
sprintf(BootAnimPath, "%ld.tga", FrameCount);
|
||||
File ba = bootanim_vfs->Open(BootAnimPath);
|
||||
sprintf(BootAnimPath, "/etc/boot/%ld.tga", FrameCount);
|
||||
File ba = vfs->Open(BootAnimPath);
|
||||
if (!ba.IsOK())
|
||||
{
|
||||
bootanim_vfs->Close(ba);
|
||||
vfs->Close(ba);
|
||||
debug("Failed to load boot animation frame %s", BootAnimPath);
|
||||
break;
|
||||
}
|
||||
@ -295,7 +295,7 @@ void BootLogoAnimationThread()
|
||||
FrameSizes[FrameCount] = s_cst(uint32_t, ba.node->Length);
|
||||
Frames[FrameCount] = new uint8_t[ba.node->Length];
|
||||
memcpy((void *)Frames[FrameCount], (void *)ba.node->Address, ba.node->Length);
|
||||
bootanim_vfs->Close(ba);
|
||||
vfs->Close(ba);
|
||||
FrameCount++;
|
||||
}
|
||||
|
||||
@ -436,7 +436,7 @@ void KernelMainThread()
|
||||
KPrint("Initializing Disk Manager...");
|
||||
DiskManager = new Disk::Manager;
|
||||
|
||||
KPrint("Loading Drivers...");
|
||||
KPrint("Loading Modules...");
|
||||
DriverManager = new Driver::Driver;
|
||||
DriverManager->LoadDrivers();
|
||||
|
||||
|
2
Makefile
2
Makefile
@ -200,4 +200,4 @@ endif
|
||||
$(NM) $@
|
||||
|
||||
clean:
|
||||
rm -f *.bin *.o *.elf *.sym kernel.map kernel_dump.map kernel_dump_intel.map $(OBJ) $(STACK_USAGE_OBJ) $(GCNO_OBJ) $(KERNEL_FILENAME)
|
||||
rm -f kernel.map kernel_dump.map kernel_dump_intel.map $(OBJ) $(STACK_USAGE_OBJ) $(GCNO_OBJ) $(KERNEL_FILENAME)
|
||||
|
@ -47,7 +47,7 @@ namespace Recovery
|
||||
WidgetCollection *wdgDbgWin = nullptr;
|
||||
Window *DbgWin = nullptr;
|
||||
|
||||
char *AudioFile = (char *)"/home/default/Music/Ludwig van Beethoven - Fur Elise.mp3";
|
||||
char *AudioFile = (char *)"none";
|
||||
|
||||
void PlayAudio()
|
||||
{
|
||||
@ -185,13 +185,6 @@ namespace Recovery
|
||||
void BufBight90() { Display->SetBrightness(90, 200); }
|
||||
void BufBight100() { Display->SetBrightness(100, 200); }
|
||||
|
||||
// void audio_dev_connected() { AudioFile = (char *)"/system/config/audio/media/dev_connected.mp3"; }
|
||||
// void audio_dev_disconnected() { AudioFile = (char *)"/system/config/audio/media/dev_disconnected.mp3"; }
|
||||
// void audio_dev_error() { AudioFile = (char *)"/system/config/audio/media/dev_error.mp3"; }
|
||||
// void audio_error() { AudioFile = (char *)"/system/config/audio/media/error.mp3"; }
|
||||
// void audio_notification() { AudioFile = (char *)"/system/config/audio/media/notification.mp3"; }
|
||||
// void audio_warning() { AudioFile = (char *)"/system/config/audio/media/warning.mp3"; }
|
||||
|
||||
void KernelRecovery::RecoveryThread()
|
||||
{
|
||||
while (wdgDbgWin == nullptr || DbgWin == nullptr)
|
||||
|
@ -149,13 +149,13 @@ static uintptr_t sys_kernelctl(SyscallsFrame *Frame, enum KCtl Command, uint64_t
|
||||
switch (retries)
|
||||
{
|
||||
case 0:
|
||||
FullPath = "/system/lib/";
|
||||
FullPath = "/lib/";
|
||||
break;
|
||||
case 1:
|
||||
FullPath = "/system/lib64/";
|
||||
FullPath = "/usr/lib/";
|
||||
break;
|
||||
case 2:
|
||||
FullPath = "/system/";
|
||||
FullPath = "/";
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
namespace VirtualFileSystem
|
||||
{
|
||||
/* Manage /system/dev */
|
||||
/* Manage /dev */
|
||||
class Device
|
||||
{
|
||||
public:
|
||||
@ -33,7 +33,7 @@ namespace VirtualFileSystem
|
||||
~Device();
|
||||
};
|
||||
|
||||
/* Manage /system/mnt */
|
||||
/* Manage /mnt */
|
||||
class Mount
|
||||
{
|
||||
public:
|
||||
@ -43,7 +43,7 @@ namespace VirtualFileSystem
|
||||
~Mount();
|
||||
};
|
||||
|
||||
/* Manage /system/prc */
|
||||
/* Manage /prc */
|
||||
class Process
|
||||
{
|
||||
public:
|
||||
@ -51,7 +51,7 @@ namespace VirtualFileSystem
|
||||
~Process();
|
||||
};
|
||||
|
||||
/* Manage /system/drv */
|
||||
/* Manage /drv */
|
||||
class Driver
|
||||
{
|
||||
public:
|
||||
@ -60,7 +60,7 @@ namespace VirtualFileSystem
|
||||
~Driver();
|
||||
};
|
||||
|
||||
/* Manage /system/net */
|
||||
/* Manage /net */
|
||||
class Network
|
||||
{
|
||||
public:
|
||||
@ -69,7 +69,7 @@ namespace VirtualFileSystem
|
||||
~Network();
|
||||
};
|
||||
|
||||
/* Manage /system/dev/serialX */
|
||||
/* Manage /dev/serialX */
|
||||
class Serial
|
||||
{
|
||||
public:
|
||||
@ -77,7 +77,7 @@ namespace VirtualFileSystem
|
||||
~Serial();
|
||||
};
|
||||
|
||||
/* Manage /system/dev/random */
|
||||
/* Manage /dev/random */
|
||||
class Random
|
||||
{
|
||||
public:
|
||||
@ -85,7 +85,7 @@ namespace VirtualFileSystem
|
||||
~Random();
|
||||
};
|
||||
|
||||
/* Manage /system/dev/null */
|
||||
/* Manage /dev/null */
|
||||
class Null
|
||||
{
|
||||
public:
|
||||
@ -93,7 +93,7 @@ namespace VirtualFileSystem
|
||||
~Null();
|
||||
};
|
||||
|
||||
/* Manage /system/dev/zero */
|
||||
/* Manage /dev/zero */
|
||||
class Zero
|
||||
{
|
||||
public:
|
||||
@ -101,7 +101,7 @@ namespace VirtualFileSystem
|
||||
~Zero();
|
||||
};
|
||||
|
||||
/* Manage /system/dev/fbX */
|
||||
/* Manage /dev/fbX */
|
||||
class FB
|
||||
{
|
||||
public:
|
||||
|
1
kernel.h
1
kernel.h
@ -55,7 +55,6 @@ extern KernelConfig Config;
|
||||
extern Tasking::Task *TaskManager;
|
||||
extern Time::time *TimeManager;
|
||||
extern VirtualFileSystem::Virtual *vfs;
|
||||
extern VirtualFileSystem::Virtual *bootanim_vfs;
|
||||
extern Driver::Driver *DriverManager;
|
||||
extern Disk::Manager *DiskManager;
|
||||
extern NetworkInterfaceManager::NetworkInterface *NIManager;
|
||||
|
Loading…
x
Reference in New Issue
Block a user