diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-29 16:59:14 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-29 16:59:14 +0200 |
| commit | a21859d722597e4eb1216a4a48d08d8f2659b514 (patch) | |
| tree | 84b30c251e1b444873f4723ecab047689526e9f0 /Private/Source/AppMain.cxx | |
| parent | 461fe537aa1f9533bfa5c2504cb84843b9eac501 (diff) | |
MHR-18: Fixes and improvements regarding NewFS.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/Source/AppMain.cxx')
| -rw-r--r-- | Private/Source/AppMain.cxx | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/Private/Source/AppMain.cxx b/Private/Source/AppMain.cxx index 404889d7..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,25 +26,52 @@ EXTERN_C NewOS::Void AppMain(NewOS::Void) { NewOS::FilesystemManagerInterface::Mount(newFS); if (newFS->GetImpl()) { - NewCatalog* mountCatalog = newFS->GetImpl()->GetCatalog("/Boot/"); + NewCatalog* mountCatalog = newFS->GetImpl()->GetCatalog("/Boot/"); - if (mountCatalog) { - delete newFS->GetImpl()->CreateCatalog("/Boot/System/", 0, kNewFSCatalogKindDir); - NewCatalog* newKernelCatalog = newFS->GetImpl()->CreateCatalog("/Boot/System/NewKernel"); + 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; + if (newKernelCatalog) + NewOS::kcout << "Catalog-Path-Name: " << newKernelCatalog->Name + << NewOS::endl; - NewOS::kcout << "Catalog-Path-Name: " << mountCatalog->Name << NewOS::endl; + NewOS::kcout << "Catalog-Path-Name: " << mountCatalog->Name + << NewOS::endl; - delete newKernelCatalog; - delete mountCatalog; - } else { - delete newFS->GetImpl()->CreateCatalog("/Boot/", 0, kNewFSCatalogKindDir); - } + 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; } |
