diff options
| author | Amlal <amlalelmahrouss@icloud.com> | 2024-04-29 15:01:06 +0000 |
|---|---|---|
| committer | Amlal <amlalelmahrouss@icloud.com> | 2024-04-29 15:01:06 +0000 |
| commit | a06c8a375f0c5f5e3613e9fe8228cebf442731ba (patch) | |
| tree | 84b30c251e1b444873f4723ecab047689526e9f0 /Private/Source/AppMain.cxx | |
| parent | 14f10cc0b35155ddb19ec9069ebb884246e61dcf (diff) | |
| parent | a21859d722597e4eb1216a4a48d08d8f2659b514 (diff) | |
Merged in MHR-18 (pull request #9)
MHR-18
Diffstat (limited to 'Private/Source/AppMain.cxx')
| -rw-r--r-- | Private/Source/AppMain.cxx | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/Private/Source/AppMain.cxx b/Private/Source/AppMain.cxx index 8fa74459..6a23e20d 100644 --- a/Private/Source/AppMain.cxx +++ b/Private/Source/AppMain.cxx @@ -10,10 +10,12 @@ #include <KernelKit/FileManager.hpp> #include <KernelKit/Framebuffer.hpp> #include <KernelKit/KernelHeap.hpp> +#include <KernelKit/PEF.hpp> #include <KernelKit/PEFCodeManager.hxx> #include <KernelKit/ProcessScheduler.hpp> #include <KernelKit/UserHeap.hpp> #include <NewKit/Json.hpp> +#include <NewKit/Utils.hpp> /// @file Main microkernel entrypoint. @@ -24,14 +26,52 @@ EXTERN_C NewOS::Void AppMain(NewOS::Void) { NewOS::FilesystemManagerInterface::Mount(newFS); if (newFS->GetImpl()) { - auto catalog = newFS->GetImpl()->GetCatalog("/Boot"); - if (catalog) { - NewOS::kcout << "Catalog-Path-Name: " << catalog->Name << NewOS::endl; - delete catalog; - } + NewCatalog* mountCatalog = newFS->GetImpl()->GetCatalog("/Boot/"); + + if (mountCatalog) { + delete newFS->GetImpl()->CreateCatalog("/Boot/System/", 0, + kNewFSCatalogKindDir); + NewCatalog* newKernelCatalog = + newFS->GetImpl()->CreateCatalog("/Boot/System/ExampleTextFile"); + + if (newKernelCatalog) + NewOS::kcout << "Catalog-Path-Name: " << newKernelCatalog->Name + << NewOS::endl; + + NewOS::kcout << "Catalog-Path-Name: " << mountCatalog->Name + << NewOS::endl; + + constexpr auto cDataSz = 512; + NewOS::Char theData[cDataSz] = { + "THIS FORK\rCONTAINS DATA\rAS\rYOU\rCAN\rSEE...THIS FORK\rCONTAINS " + "DATA\rAS\rYOU\rCAN\rSEE..THIS FORK\rCONTAINS " + "DATA\rAS\rYOU\rCAN\rSEE..THIS FORK\rCONTAINS " + "DATA\rAS\rYOU\rCAN\rSEE..THIS FORK\rCONTAINS " + "DATA\rAS\rYOU\rCAN\rSEE..THIS FORK\rCONTAINS " + "DATA\rAS\rYOU\rCAN\rSEE..THIS FORK\rCONTAINS " + "DATA\rAS\rYOU\rCAN\rSEE..THIS FORK\rCONTAINS " + "DATA\rAS\rYOU\rCAN\rSEE.."}; + + NewFork theFork{0}; + NewOS::rt_copy_memory((NewOS::VoidPtr) "EditableText", + (NewOS::VoidPtr)theFork.Name, + NewOS::rt_string_len("EditableText")); + + theFork.Kind = NewOS::kNewFSDataForkKind; + theFork.DataSize = cDataSz; + + newFS->GetImpl()->CreateFork(newKernelCatalog, theFork); + newFS->GetImpl()->WriteCatalog(newKernelCatalog, theData, cDataSz); + + delete newKernelCatalog; + delete mountCatalog; + } else { + delete newFS->GetImpl()->CreateCatalog("/Boot/", 0, kNewFSCatalogKindDir); + } } - while (NewOS::ProcessScheduler::Shared().Leak().Run() > 0); + while (NewOS::ProcessScheduler::Shared().Leak().Run() > 0) + ; delete newFS; } |
