diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-30 11:12:49 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-30 11:12:49 +0200 |
| commit | 62eef2c13fb95ab3cee86b0c066d26ceade417dd (patch) | |
| tree | 7696344260c61374e331f0b24de84c9089e15ae2 /Private/Source/AppMain.cxx | |
| parent | f86125cf437fb49587d588413d69646959a58541 (diff) | |
MHR-18: NewFS: Fix fork allocation.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/Source/AppMain.cxx')
| -rw-r--r-- | Private/Source/AppMain.cxx | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Private/Source/AppMain.cxx b/Private/Source/AppMain.cxx index 966172df..d9c02843 100644 --- a/Private/Source/AppMain.cxx +++ b/Private/Source/AppMain.cxx @@ -41,19 +41,33 @@ EXTERN_C NewOS::Void AppMain(NewOS::Void) { NewOS::rt_string_len("EditableText")); theFork.Kind = NewOS::kNewFSDataForkKind; - theFork.DataSize = cDataSz; + theFork.DataSize = kNewFSForkSize; textCatalog = newFS->GetImpl()->CreateCatalog("/EditableText"); newFS->GetImpl()->CreateFork(textCatalog, theFork); - newFS->GetImpl()->WriteCatalog(textCatalog, theData, cDataSz); + newFS->GetImpl()->WriteCatalog(textCatalog, theData, cDataSz, "EditableText"); + + NewFork theForkPreview{0}; + + theForkPreview.Kind = NewOS::kNewFSDataForkKind; + theForkPreview.DataSize = kNewFSForkSize; + + NewOS::rt_copy_memory((NewOS::VoidPtr) "EditableTextPreview", + (NewOS::VoidPtr)theForkPreview.Name, + NewOS::rt_string_len("EditableTextPreview")); + + NewOS::Char theDataPreview[cDataSz] = { "NewKernel Info:\r\tNewKernel!" }; + newFS->GetImpl()->CreateFork(textCatalog, theForkPreview); + + newFS->GetImpl()->WriteCatalog(textCatalog, theDataPreview, cDataSz, "EditableTextPreview"); } else { NewOS::kcout << "Catalog already exists.\r"; } char* buf = nullptr; - buf = (NewOS::Char*)newFS->GetImpl()->ReadCatalog(newFS->GetImpl()->GetCatalog("/EditableText"), 512); + buf = (NewOS::Char*)newFS->GetImpl()->ReadCatalog(newFS->GetImpl()->GetCatalog("/EditableText"), 512, "EditableTextPreview"); NewOS::kcout << buf << NewOS::endl; } |
