summaryrefslogtreecommitdiffhomepage
path: root/Private/Source
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-29 20:20:57 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-29 20:20:57 +0200
commit77423c4fa55a060c5cf710bbe5c4de02fce43e97 (patch)
tree9fd6308619a7ee4deca80c05d44fea2566d99da4 /Private/Source
parenta21859d722597e4eb1216a4a48d08d8f2659b514 (diff)
MHR-18: Fixing last bugs...
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/Source')
-rw-r--r--Private/Source/AppMain.cxx23
-rw-r--r--Private/Source/FS/NewFS.cxx195
-rw-r--r--Private/Source/FileManager.cxx2
-rw-r--r--Private/Source/KernelCheck.cxx50
-rw-r--r--Private/Source/Network/IP.cxx4
-rw-r--r--Private/Source/NewFS+FileManager.cxx11
-rw-r--r--Private/Source/ProcessScheduler.cxx10
-rw-r--r--Private/Source/ThreadLocalStorage.cxx6
-rw-r--r--Private/Source/UserHeap.cxx4
9 files changed, 182 insertions, 123 deletions
diff --git a/Private/Source/AppMain.cxx b/Private/Source/AppMain.cxx
index 6a23e20d..8fb9a4ba 100644
--- a/Private/Source/AppMain.cxx
+++ b/Private/Source/AppMain.cxx
@@ -34,6 +34,8 @@ EXTERN_C NewOS::Void AppMain(NewOS::Void) {
NewCatalog* newKernelCatalog =
newFS->GetImpl()->CreateCatalog("/Boot/System/ExampleTextFile");
+ NewOS::kcout << NewOS::hex_number(newKernelCatalog->Flags) << NewOS::endl;
+
if (newKernelCatalog)
NewOS::kcout << "Catalog-Path-Name: " << newKernelCatalog->Name
<< NewOS::endl;
@@ -43,14 +45,8 @@ EXTERN_C NewOS::Void AppMain(NewOS::Void) {
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.."};
+ "About NewKernel...\rNewKernel is the System behind "
+ "NewOS.\rFeaturing modern common features, yet innovative.\r"};
NewFork theFork{0};
NewOS::rt_copy_memory((NewOS::VoidPtr) "EditableText",
@@ -63,6 +59,17 @@ EXTERN_C NewOS::Void AppMain(NewOS::Void) {
newFS->GetImpl()->CreateFork(newKernelCatalog, theFork);
newFS->GetImpl()->WriteCatalog(newKernelCatalog, theData, cDataSz);
+ //newFS->GetImpl()->RemoveCatalog("/Boot/System/ExampleTextFile");
+
+
+
+ char* buf = nullptr;
+
+ buf =
+ (NewOS::Char*)newFS->GetImpl()->ReadCatalog("/Boot/System/ExampleTextFile", 512);
+
+ NewOS::kcout << buf << NewOS::endl;
+
delete newKernelCatalog;
delete mountCatalog;
} else {
diff --git a/Private/Source/FS/NewFS.cxx b/Private/Source/FS/NewFS.cxx
index 57f61cd2..fe208389 100644
--- a/Private/Source/FS/NewFS.cxx
+++ b/Private/Source/FS/NewFS.cxx
@@ -31,7 +31,7 @@ _Output NewFork* NewFSParser::CreateFork(_Input NewCatalog* catalog,
if (lba <= kNewFSCatalogStartAddress) return nullptr;
- theFork.DataOffset = lba + sizeof(NewFork);
+ theFork.DataOffset = lba + sizeof(NewCatalog) + sizeof(NewFork);
if (!sMountpointInterface.GetAddressOf(this->fDriveIndex)) return nullptr;
@@ -195,9 +195,8 @@ _Output NewCatalog* NewFSParser::CreateCatalog(_Input const char* name,
catalogChild->NextSibling = 0UL;
catalogChild->PrevSibling = outLba;
- catalogChild->Flags = flags;
catalogChild->Kind = kind;
- catalogChild->Flags |= kNewFSFlagCreated;
+ catalogChild->Flags = kNewFSFlagCreated;
rt_copy_memory((VoidPtr)name, (VoidPtr)catalogChild->Name,
rt_string_len(name));
@@ -227,72 +226,64 @@ _Output NewCatalog* NewFSParser::CreateCatalog(_Input const char* name,
}
/// allocation or reallocation or catalog...
- if ((nextSibling->Name[0] == 0 &&
- nextSibling->Flags != kNewFSFlagCreated)) {
+ if (nextSibling->Name[0] == 0 && nextSibling->Flags != kNewFSFlagCreated) {
catalogChild->DataFork = startFree + sizeof(NewCatalog);
catalogChild->ResourceFork =
startFree + sizeof(NewCatalog) + catalogChild->DataForkSize;
- if ((nextSibling->Flags != kNewFSFlagCreated)) {
- nextSibling->Flags = kNewFSFlagCreated;
-
- drive->fPacket.fPacketContent = catalogChild;
- drive->fPacket.fPacketSize = sizeof(NewCatalog);
- drive->fPacket.fLba = startFree;
+ if (catalogChild->Kind == kNewFSCatalogKindFile) {
+ rt_copy_memory((VoidPtr) "x-kind/file", (VoidPtr)catalogChild->Mime,
+ rt_string_len("x-kind/file"));
+ } else {
+ rt_copy_memory((VoidPtr) "x-kind/dir", (VoidPtr)catalogChild->Mime,
+ rt_string_len("x-kind/dir"));
+ }
- if (catalogChild->Kind == kNewFSCatalogKindFile) {
- rt_copy_memory((VoidPtr) "x-kind/file", (VoidPtr)catalogChild->Mime,
- rt_string_len("x-kind/file"));
- } else {
- rt_copy_memory((VoidPtr) "x-kind/dir", (VoidPtr)catalogChild->Mime,
- rt_string_len("x-kind/dir"));
- }
+ catalogChild->NextSibling = sizeof(NewCatalog) +
+ catalogChild->DataForkSize +
+ catalogChild->ResourceForkOverallSize;
- catalogChild->NextSibling = sizeof(NewCatalog) +
- catalogChild->DataForkSize +
- catalogChild->ResourceForkOverallSize;
+ drive->fPacket.fPacketContent = catalogChild;
+ drive->fPacket.fPacketSize = sizeof(NewCatalog);
+ drive->fPacket.fLba = startFree;
- drive->fOutput(&drive->fPacket);
+ drive->fOutput(&drive->fPacket);
- kcout << "New OS: Create new catalog successfully!\r\n";
+ kcout << "New OS: Create new catalog successfully!\r";
- Char sectBuf[sizeof(NewCatalog)] = {0};
+ Char sectBuf[sizeof(NewCatalog)] = {0};
- drive->fPacket.fPacketContent = sectBuf;
- drive->fPacket.fPacketSize = sizeof(NewCatalog);
- drive->fPacket.fLba = catalogChild->PrevSibling;
+ drive->fPacket.fPacketContent = sectBuf;
+ drive->fPacket.fPacketSize = sizeof(NewCatalog);
+ drive->fPacket.fLba = catalogChild->PrevSibling;
- drive->fInput(&drive->fPacket);
+ drive->fInput(&drive->fPacket);
- NewCatalog* prevCatalog = (NewCatalog*)sectBuf;
- prevCatalog->NextSibling = startFree;
+ NewCatalog* prevCatalog = (NewCatalog*)sectBuf;
+ prevCatalog->NextSibling = startFree;
- drive->fOutput(&drive->fPacket);
+ drive->fOutput(&drive->fPacket);
- kcout << "Edit-Catalog: " << prevCatalog->Name << endl;
+ kcout << "Edit-Catalog: " << prevCatalog->Name << endl;
- Char sectorBufPartBlock[kNewFSMinimumSectorSz] = {0};
+ Char sectorBufPartBlock[kNewFSMinimumSectorSz] = {0};
- drive->fPacket.fPacketContent = sectorBufPartBlock;
- drive->fPacket.fPacketSize = kNewFSMinimumSectorSz;
- drive->fPacket.fLba = kNewFSAddressAsLba;
+ drive->fPacket.fPacketContent = sectorBufPartBlock;
+ drive->fPacket.fPacketSize = kNewFSMinimumSectorSz;
+ drive->fPacket.fLba = kNewFSAddressAsLba;
- drive->fInput(&drive->fPacket);
+ drive->fInput(&drive->fPacket);
- NewPartitionBlock* partBlock = (NewPartitionBlock*)sectorBufPartBlock;
+ NewPartitionBlock* partBlock = (NewPartitionBlock*)sectorBufPartBlock;
- partBlock->SectorCount -= 1;
- partBlock->CatalogCount += 1;
- partBlock->FreeCatalog -= 1;
+ partBlock->SectorCount -= 1;
+ partBlock->CatalogCount += 1;
+ partBlock->FreeCatalog -= 1;
- drive->fOutput(&drive->fPacket);
+ drive->fOutput(&drive->fPacket);
- delete catalog;
- return catalogChild;
- } else {
- delete catalog;
- return nullptr;
- }
+ delete catalog;
+ return catalogChild;
}
//// @note that's how we find the next catalog in the partition block.
@@ -369,10 +360,19 @@ bool NewFSParser::Format(_Input _Output DriveTrait* drive) {
drive->fOutput(&drive->fPacket);
+ kcout << "Drive-Kind: " << drive->fDriveKind() << endl;
+
+ kcout << "Partition-Name: " << partBlock->PartitionName << endl;
+ kcout << "Start-Catalog: " << number(partBlock->StartCatalog) << endl;
+ kcout << "Catalog-Count: " << number(partBlock->CatalogCount) << endl;
+ kcout << "Free-Catalog: " << number(partBlock->FreeCatalog) << endl;
+ kcout << "Free-Sectors: " << number(partBlock->FreeSectors) << endl;
+ kcout << "Sector-Size: " << number(partBlock->SectorSize) << endl;
+
return true;
}
- kcout << "New OS: PartitionBlock already exists.\r\n";
+ kcout << "New OS: PartitionBlock already exists.\r";
/// return success as well, do not ignore that partition.
return true;
@@ -450,15 +450,6 @@ _Output NewCatalog* NewFSParser::FindCatalog(_Input const char* catalogName,
NewPartitionBlock* part = (NewPartitionBlock*)sectorBuf;
- kcout << "Drive-Kind: " << drive->fDriveKind() << endl;
-
- kcout << "Partition-Name: " << part->PartitionName << endl;
- kcout << "Start-Catalog: " << number(part->StartCatalog) << endl;
- kcout << "Catalog-Count: " << number(part->CatalogCount) << endl;
- kcout << "Free-Catalog: " << number(part->FreeCatalog) << endl;
- kcout << "Free-Sectors: " << number(part->FreeSectors) << endl;
- kcout << "Sector-Size: " << number(part->SectorSize) << endl;
-
auto start = part->StartCatalog;
drive->fPacket.fLba = start;
@@ -470,7 +461,16 @@ _Output NewCatalog* NewFSParser::FindCatalog(_Input const char* catalogName,
while (drive->fPacket.fPacketGood) {
NewCatalog* catalog = (NewCatalog*)sectorBuf;
+ kcout << "Catalog-Name: " << catalog->Name << endl;
+ kcout << "Catalog-Flags: " << hex_number(catalog->Flags) << endl;
+
if (StringBuilder::Equals(catalogName, catalog->Name)) {
+ /// ignore unallocated catalog, break
+ if (catalog->Flags != kNewFSFlagCreated) {
+
+ goto _NewFSContinueSearch;
+ }
+
NewCatalog* catalogPtr = new NewCatalog();
rt_copy_memory(catalog, catalogPtr, sizeof(NewCatalog));
@@ -479,8 +479,11 @@ _Output NewCatalog* NewFSParser::FindCatalog(_Input const char* catalogName,
return catalogPtr;
}
+ _NewFSContinueSearch:
start = catalog->NextSibling;
+ kcout << "Catalog-Next: " << number(start) << endl;
+
if (start <= kNewFSAddressAsLba) break;
drive->fPacket.fLba = start;
@@ -521,15 +524,32 @@ Boolean NewFSParser::CloseCatalog(_Input _Output NewCatalog* catalog) {
/// @brief Mark catalog as removed.
/// @param catalog The catalog structure.
/// @return
-Boolean NewFSParser::RemoveCatalog(_Input _Output NewCatalog* catalog) {
- if (!catalog) {
- DbgLastError() = kErrorFileNotFound;
+Boolean NewFSParser::RemoveCatalog(_Input const Char* catalogName) {
+ if (!catalogName) {
+ DbgLastError() = kErrorInternal;
return false;
}
- catalog->Flags |= kNewFSFlagDeleted;
- this->WriteCatalog(catalog, nullptr, 0);
+ Lba outLba = 0;
+ auto catalog = this->FindCatalog(catalogName, outLba);
+
+ if (outLba >= kNewFSCatalogStartAddress ||
+ catalog->Flags == kNewFSFlagCreated) {
+ catalog->Flags = kNewFSFlagDeleted;
+
+ auto drive = sMountpointInterface.GetAddressOf(this->fDriveIndex);
+
+ drive->fPacket.fLba = outLba; // the catalog position.
+ drive->fPacket.fPacketSize =
+ sizeof(NewCatalog); // size of catalog. roughly the sector size.
+ drive->fPacket.fPacketContent = catalog; // the catalog itself.
+
+ drive->fOutput(&drive->fPacket); // send packet.
+
+ return true;
+ }
+ delete catalog;
return false;
}
@@ -541,19 +561,54 @@ Boolean NewFSParser::RemoveCatalog(_Input _Output NewCatalog* catalog) {
/// @param catalog
/// @param dataSz
/// @return
-VoidPtr NewFSParser::ReadCatalog(_Input _Output NewCatalog* catalog,
+VoidPtr NewFSParser::ReadCatalog(_Input _Output const char* catalogName,
SizeT dataSz) {
- if (!catalog) {
+ if (!catalogName) {
DbgLastError() = kErrorFileNotFound;
return nullptr;
}
- return nullptr;
+ if (!sMountpointInterface.GetAddressOf(this->fDriveIndex)) return nullptr;
+
+ NewCatalog* catalog = this->GetCatalog(catalogName);
+
+ if (!catalog) return nullptr;
+
+ Char* sectorBuf = new Char[sizeof(NewFork)];
+ auto drive = sMountpointInterface.GetAddressOf(this->fDriveIndex);
+
+ drive->fPacket.fLba = catalog->DataFork;
+ drive->fPacket.fPacketSize = sizeof(NewFork);
+ drive->fPacket.fPacketContent = sectorBuf;
+
+ drive->fInput(&drive->fPacket);
+
+ NewFork* forkData = (NewFork*)sectorBuf;
+
+ kcout << forkData->Name << " " << hex_number(forkData->DataOffset) << endl;
+
+ if (dataSz > forkData->DataSize) {
+ delete[] sectorBuf;
+
+ return nullptr;
+ }
+
+ Char* forkBuf = new Char[dataSz];
+
+ drive->fPacket.fLba = forkData->DataOffset;
+ drive->fPacket.fPacketSize = dataSz;
+ drive->fPacket.fPacketContent = forkBuf;
+
+ drive->fInput(&drive->fPacket);
+
+ delete[] sectorBuf;
+
+ return forkBuf;
}
/// @brief Seek in the data fork.
-/// @param catalog
-/// @param off
+/// @param catalog the catalog offset.
+/// @param off where to seek.
/// @return
bool NewFSParser::Seek(_Input _Output NewCatalog* catalog, SizeT off) {
if (!catalog) {
@@ -561,7 +616,7 @@ bool NewFSParser::Seek(_Input _Output NewCatalog* catalog, SizeT off) {
return false;
}
- return false;
+ return true;
}
/// @brief Tell where we are inside the data fork.
@@ -570,7 +625,7 @@ bool NewFSParser::Seek(_Input _Output NewCatalog* catalog, SizeT off) {
SizeT NewFSParser::Tell(_Input _Output NewCatalog* catalog) {
if (!catalog) {
DbgLastError() = kErrorFileNotFound;
- return false;
+ return 0;
}
return 0;
diff --git a/Private/Source/FileManager.cxx b/Private/Source/FileManager.cxx
index aab3cff0..c7d0bf41 100644
--- a/Private/Source/FileManager.cxx
+++ b/Private/Source/FileManager.cxx
@@ -88,7 +88,7 @@ Void NewFilesystemManager::Write(NodePtr node, VoidPtr data,
/// @return
VoidPtr NewFilesystemManager::Read(NodePtr node, Int32 flags, SizeT sz) {
if ((reinterpret_cast<NewCatalog*>(node))->Kind == kNewFSCatalogKindFile)
- return fImpl->ReadCatalog(reinterpret_cast<NewCatalog*>(node), sz);
+ return fImpl->ReadCatalog(reinterpret_cast<NewCatalog*>(node)->Name, sz);
return nullptr;
}
diff --git a/Private/Source/KernelCheck.cxx b/Private/Source/KernelCheck.cxx
index d649ef35..516230ea 100644
--- a/Private/Source/KernelCheck.cxx
+++ b/Private/Source/KernelCheck.cxx
@@ -21,61 +21,61 @@ extern "C" [[noreturn]] void ke_wait_for_debugger() {
namespace NewOS {
void ke_stop(const NewOS::Int &id) {
- kcout << "*** STOP *** \r\n";
- kcout << "*** NewKernel.exe has trigerred a runtime stop. *** \r\n";
+ kcout << "*** STOP *** \r";
+ kcout << "*** NewKernel.exe has trigerred a runtime stop. *** \r";
switch (id) {
case RUNTIME_CHECK_PROCESS: {
- kcout << "*** CAUSE: RUNTIME_CHECK_PROCESS *** \r\n";
- kcout << "*** WHAT: BAD DRIVER. *** \r\n";
+ kcout << "*** CAUSE: RUNTIME_CHECK_PROCESS *** \r";
+ kcout << "*** WHAT: BAD DRIVER. *** \r";
break;
}
case RUNTIME_CHECK_ACPI: {
- kcout << "*** CAUSE: RUNTIME_CHECK_ACPI *** \r\n";
- kcout << "*** WHAT: ACPI ERROR, UNSTABLE STATE. *** \r\n";
+ kcout << "*** CAUSE: RUNTIME_CHECK_ACPI *** \r";
+ kcout << "*** WHAT: ACPI ERROR, UNSTABLE STATE. *** \r";
break;
}
case RUNTIME_CHECK_POINTER: {
- kcout << "*** CAUSE: RUNTIME_CHECK_POINTER *** \r\n";
- kcout << "*** WHAT: HEAP CRC32 ERROR, UNSTABLE STATE. *** \r\n";
+ kcout << "*** CAUSE: RUNTIME_CHECK_POINTER *** \r";
+ kcout << "*** WHAT: HEAP CRC32 ERROR, UNSTABLE STATE. *** \r";
break;
}
case RUNTIME_CHECK_BAD_BEHAVIOR: {
- kcout << "*** CAUSE: RUNTIME_CHECK_BAD_BEHAVIOR *** \r\n";
- kcout << "*** WHAT: KERNEL BECAME UNSTABLE. *** \r\n";
+ kcout << "*** CAUSE: RUNTIME_CHECK_BAD_BEHAVIOR *** \r";
+ kcout << "*** WHAT: KERNEL BECAME UNSTABLE. *** \r";
break;
}
case RUNTIME_CHECK_BOOTSTRAP: {
- kcout << "*** CAUSE: RUNTIME_CHECK_BOOTSTRAP *** \r\n";
- kcout << "*** WHAT: INVALID BOOT SEQUENCE. *** \r\n";
+ kcout << "*** CAUSE: RUNTIME_CHECK_BOOTSTRAP *** \r";
+ kcout << "*** WHAT: INVALID BOOT SEQUENCE. *** \r";
break;
}
case RUNTIME_CHECK_HANDSHAKE: {
- kcout << "*** CAUSE: RUNTIME_CHECK_HANDSHAKE *** \r\n";
- kcout << "*** WHAT: BAD HANDSHAKE. *** \r\n";
+ kcout << "*** CAUSE: RUNTIME_CHECK_HANDSHAKE *** \r";
+ kcout << "*** WHAT: BAD HANDSHAKE. *** \r";
break;
}
case RUNTIME_CHECK_IPC: {
- kcout << "*** CAUSE: RUNTIME_CHECK_IPC *** \r\n";
- kcout << "*** WHAT: RICH CALL VIOLATION. *** \r\n";
+ kcout << "*** CAUSE: RUNTIME_CHECK_IPC *** \r";
+ kcout << "*** WHAT: RICH CALL VIOLATION. *** \r";
break;
}
case RUNTIME_CHECK_INVALID_PRIVILEGE: {
- kcout << "*** CAUSE: RUNTIME_CHECK_INVALID_PRIVILEGE *** \r\n";
- kcout << "*** WHAT: HYPERVISOR POLICY VIOLATION. *** \r\n";
+ kcout << "*** CAUSE: RUNTIME_CHECK_INVALID_PRIVILEGE *** \r";
+ kcout << "*** WHAT: HYPERVISOR POLICY VIOLATION. *** \r";
break;
case RUNTIME_CHECK_UNEXCPECTED: {
- kcout << "*** CAUSE: RUNTIME_CHECK_UNEXCPECTED *** \r\n";
- kcout << "*** WHAT: CATASROPHIC FAILURE! *** \r\n";
+ kcout << "*** CAUSE: RUNTIME_CHECK_UNEXCPECTED *** \r";
+ kcout << "*** WHAT: CATASROPHIC FAILURE! *** \r";
break;
}
case RUNTIME_CHECK_FAILED: {
- kcout << "*** CAUSE: RUNTIME_CHECK_FAILED *** \r\n";
- kcout << "*** WHAT: ASSERTION FAILED! *** \r\n";
+ kcout << "*** CAUSE: RUNTIME_CHECK_FAILED *** \r";
+ kcout << "*** WHAT: ASSERTION FAILED! *** \r";
break;
}
default: {
- kcout << "*** CAUSE: RUNTIME_CHECK_GENERIC *** \r\n";
+ kcout << "*** CAUSE: RUNTIME_CHECK_GENERIC *** \r";
break;
}
}
@@ -91,8 +91,8 @@ void ke_stop(const NewOS::Int &id) {
void ke_runtime_check(bool expr, const char *file, const char *line) {
if (!expr) {
#ifdef __DEBUG__
- kcout << "New Kernel: File: " << file << "\r\n";
- kcout << "New Kernel: Line: " << line << "\r\n";
+ kcout << "New Kernel: File: " << file << "\r";
+ kcout << "New Kernel: Line: " << line << "\r";
#endif // __DEBUG__
diff --git a/Private/Source/Network/IP.cxx b/Private/Source/Network/IP.cxx
index 06421c21..b3107f17 100644
--- a/Private/Source/Network/IP.cxx
+++ b/Private/Source/Network/IP.cxx
@@ -29,7 +29,7 @@ bool RawIPAddress::operator!=(const RawIPAddress& ipv4) {
}
char& RawIPAddress::operator[](const Size& index) {
- kcout << "[RawIPAddress::operator[]] Fetching Index...\r\n";
+ kcout << "[RawIPAddress::operator[]] Fetching Index...\r";
static char IP_PLACEHOLDER = '0';
if (index > 4) return IP_PLACEHOLDER;
@@ -42,7 +42,7 @@ RawIPAddress6::RawIPAddress6(char bytes[8]) {
}
char& RawIPAddress6::operator[](const Size& index) {
- kcout << "[RawIPAddress6::operator[]] Fetching Index...\r\n";
+ kcout << "[RawIPAddress6::operator[]] Fetching Index...\r";
static char IP_PLACEHOLDER = '0';
if (index > 8) return IP_PLACEHOLDER;
diff --git a/Private/Source/NewFS+FileManager.cxx b/Private/Source/NewFS+FileManager.cxx
index 910ec841..27beb9e0 100644
--- a/Private/Source/NewFS+FileManager.cxx
+++ b/Private/Source/NewFS+FileManager.cxx
@@ -20,9 +20,9 @@ NewFilesystemManager::NewFilesystemManager() {
}
NewFilesystemManager::~NewFilesystemManager() {
- if (fImpl) {
- delete fImpl;
- }
+ if (fImpl) {
+ delete fImpl;
+ }
}
/// @brief Removes a node from the filesystem.
@@ -31,10 +31,7 @@ NewFilesystemManager::~NewFilesystemManager() {
bool NewFilesystemManager::Remove(const char* fileName) {
if (fileName == nullptr || *fileName == 0) return false;
- if (auto catalog = fImpl->GetCatalog(fileName); catalog)
- return fImpl->RemoveCatalog(catalog);
-
- return false;
+ return fImpl->RemoveCatalog(fileName);
}
/// @brief Creates a node with the specified.
diff --git a/Private/Source/ProcessScheduler.cxx b/Private/Source/ProcessScheduler.cxx
index 69236c18..3cd5f885 100644
--- a/Private/Source/ProcessScheduler.cxx
+++ b/Private/Source/ProcessScheduler.cxx
@@ -34,7 +34,7 @@ const Int32 &rt_get_exit_code() noexcept { return kExitCode; }
/***********************************************************************************/
void ProcessHeader::Crash() {
- kcout << "ProcessScheduler: Crashed, ExitCode: -1.\r\n";
+ kcout << "ProcessScheduler: Crashed, ExitCode: -1.\r";
MUST_PASS(ke_bug_check());
this->Exit(-1);
@@ -162,7 +162,7 @@ SizeT ProcessScheduler::Add(Ref<ProcessHeader> &process) {
if (process.Leak().Ring != (Int32)ProcessSelector::kRingKernel) return -1;
- kcout << "ProcessScheduler::Add(Ref<ProcessHeader>& process)\r\n";
+ kcout << "ProcessScheduler::Add(Ref<ProcessHeader>& process)\r";
/// Create heap according to type of process.
if (process.Leak().Kind == ProcessHeader::kUserKind)
@@ -188,7 +188,7 @@ SizeT ProcessScheduler::Add(Ref<ProcessHeader> &process) {
bool ProcessScheduler::Remove(SizeT process) {
if (process > mTeam.AsArray().Count()) return false;
- kcout << "ProcessScheduler::Remove(SizeT process)\r\n";
+ kcout << "ProcessScheduler::Remove(SizeT process)\r";
return mTeam.AsArray().Remove(process);
}
@@ -234,7 +234,7 @@ Ref<ProcessScheduler> ProcessScheduler::Shared() {
Ref<ProcessHeader> &ProcessScheduler::GetCurrent() { return mTeam.AsRef(); }
PID &ProcessHelper::GetCurrentPID() {
- kcout << "ProcessHelper::GetCurrentPID: Leaking ProcessId...\r\n";
+ kcout << "ProcessHelper::GetCurrentPID: Leaking ProcessId...\r";
return ProcessScheduler::Shared().Leak().GetCurrent().Leak().ProcessId;
}
@@ -275,7 +275,7 @@ bool ProcessHelper::StartScheduling() {
SizeT ret = processRef.Run();
kcout << StringBuilder::FromInt(
- "ProcessHelper::StartScheduling() Iterated over {%} jobs inside team.\r\n", ret);
+ "ProcessHelper::StartScheduling() Iterated over {%} jobs inside team.\r", ret);
return true;
}
diff --git a/Private/Source/ThreadLocalStorage.cxx b/Private/Source/ThreadLocalStorage.cxx
index 8d3281e3..05e0dbe9 100644
--- a/Private/Source/ThreadLocalStorage.cxx
+++ b/Private/Source/ThreadLocalStorage.cxx
@@ -31,7 +31,7 @@ Boolean tls_check_tib(ThreadInformationBlock* tib) {
Encoder encoder;
const char* tibAsBytes = encoder.AsBytes(tib);
- kcout << "New OS: Checking for a valid cookie...\r\n";
+ kcout << "New OS: Checking for a valid cookie...\r";
return tibAsBytes[0] == kCookieMag0 && tibAsBytes[1] == kCookieMag1 &&
tibAsBytes[2] == kCookieMag2;
@@ -46,9 +46,9 @@ EXTERN_C Void tls_check_syscall_impl(NewOS::HAL::StackFramePtr stackPtr) noexcep
ThreadInformationBlock* tib = (ThreadInformationBlock*)stackPtr->Gs;
if (!tls_check_tib(tib)) {
- kcout << "New OS: Verification failed, Crashing...\r\n";
+ kcout << "New OS: Verification failed, Crashing...\r";
ProcessScheduler::Shared().Leak().GetCurrent().Leak().Crash();
}
- kcout << "New OS: Verification succeeded! Keeping on...\r\n";
+ kcout << "New OS: Verification succeeded! Keeping on...\r";
}
diff --git a/Private/Source/UserHeap.cxx b/Private/Source/UserHeap.cxx
index 5f092102..9580c814 100644
--- a/Private/Source/UserHeap.cxx
+++ b/Private/Source/UserHeap.cxx
@@ -74,7 +74,7 @@ STATIC VoidPtr ke_find_unused_heap(Int32 flags) {
!UserHeapManager::The()[index].Leak().Leak().Present()) {
UserHeapManager::Leak().Leak().TogglePresent(
UserHeapManager::The()[index].Leak().Leak(), true);
- kcout << "[ke_find_unused_heap] Done, trying to make a pool now...\r\n";
+ kcout << "[ke_find_unused_heap] Done, trying to make a pool now...\r";
return ke_make_heap_internal(
(VoidPtr)UserHeapManager::The()[index].Leak().Leak().VirtualAddress(),
@@ -129,7 +129,7 @@ STATIC Void ke_free_heap_internal(VoidPtr virtualAddress) {
poolHdr->fFree = true;
poolHdr->fFlags = 0;
- kcout << "[ke_free_heap_internal] Successfully marked header as free!\r\n";
+ kcout << "[ke_free_heap_internal] Successfully marked header as free!\r";
}
}