diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-07 17:42:32 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-07 17:43:56 +0200 |
| commit | ca83108fd138cc0398f900e6a6c0a53ad51aee31 (patch) | |
| tree | 66146e07671517ab1867663081ec39e348205731 /Private | |
| parent | 636a6034a613f98f13848bf4bf1143bf5966dbce (diff) | |
MHR-23: Rework graphics stack, moving to another repository.
- Alongside patches on the FileManager.
- And code improvements on the System API.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private')
| -rw-r--r-- | Private/CRT/__mpcc_exception.hxx | 3 | ||||
| -rw-r--r-- | Private/HALKit/POWER/HalHart.cxx | 2 | ||||
| -rw-r--r-- | Private/HALKit/POWER/HalThread.cxx | 2 | ||||
| -rw-r--r-- | Private/KernelKit/FileManager.hpp | 6 | ||||
| -rw-r--r-- | Private/KernelKit/PEF.hpp | 2 | ||||
| -rw-r--r-- | Private/NewKit/Defines.hpp | 1 | ||||
| -rw-r--r-- | Private/Source/ErrorOr.cxx | 4 | ||||
| -rw-r--r-- | Private/Source/FileManager.cxx | 74 | ||||
| -rw-r--r-- | Private/Source/LockDelegate.cxx | 1 | ||||
| -rw-r--r-- | Private/Source/ProcessTeam.cxx | 6 |
10 files changed, 69 insertions, 32 deletions
diff --git a/Private/CRT/__mpcc_exception.hxx b/Private/CRT/__mpcc_exception.hxx index 44e341d3..fdecbcec 100644 --- a/Private/CRT/__mpcc_exception.hxx +++ b/Private/CRT/__mpcc_exception.hxx @@ -6,10 +6,9 @@ #pragma once -/// This file is an implementation of __throw* family of functions. - #include <KernelKit/DebugOutput.hpp> +/// @brief Standard C++ namespace namespace std { #ifdef __x86_64__ diff --git a/Private/HALKit/POWER/HalHart.cxx b/Private/HALKit/POWER/HalHart.cxx index 88f5132b..7a33d2d0 100644 --- a/Private/HALKit/POWER/HalHart.cxx +++ b/Private/HALKit/POWER/HalHart.cxx @@ -14,10 +14,12 @@ using namespace NewOS; /// wakes up thread from hang. void rt_wakeup_thread(HAL::StackFramePtr stack) { + NEWOS_UNUSED(stack); } /// @brief makes thread sleep. /// hooks and hangs thread to prevent code from executing. void rt_hang_thread(HAL::StackFramePtr stack) { + NEWOS_UNUSED(stack); } diff --git a/Private/HALKit/POWER/HalThread.cxx b/Private/HALKit/POWER/HalThread.cxx index 592ab6bd..7bb95b4f 100644 --- a/Private/HALKit/POWER/HalThread.cxx +++ b/Private/HALKit/POWER/HalThread.cxx @@ -7,7 +7,7 @@ #include <HALKit/POWER/Processor.hpp> #include <KernelKit/DebugOutput.hpp> -extern "C" NewOS::HAL::StackFramePtr rt_get_current_context() +EXTERN_C NewOS::HAL::StackFramePtr rt_get_current_context() { return nullptr; } diff --git a/Private/KernelKit/FileManager.hpp b/Private/KernelKit/FileManager.hpp index 7da08cbb..c92c7409 100644 --- a/Private/KernelKit/FileManager.hpp +++ b/Private/KernelKit/FileManager.hpp @@ -129,9 +129,15 @@ namespace NewOS SizeT Tell(NodePtr node) override; bool Rewind(NodePtr node) override; + public: + void SetResourceFork(const char* forkName); + void SetDataFork(const char* forkName); + NewFSParser* GetImpl() noexcept; private: + Char fDataFork[kNewFSForkNameLen] = {0}; + Char fRsrcFork[kNewFSForkNameLen] = {0}; NewFSParser* fImpl{nullptr}; }; diff --git a/Private/KernelKit/PEF.hpp b/Private/KernelKit/PEF.hpp index 6c3cc5fe..9a097727 100644 --- a/Private/KernelKit/PEF.hpp +++ b/Private/KernelKit/PEF.hpp @@ -26,8 +26,6 @@ #define kPefVersion 1 #define kPefNameLen 255 -/// @brief Preferred Executable Format. - namespace NewOS { enum diff --git a/Private/NewKit/Defines.hpp b/Private/NewKit/Defines.hpp index fb7d84bb..81c0be9b 100644 --- a/Private/NewKit/Defines.hpp +++ b/Private/NewKit/Defines.hpp @@ -22,6 +22,7 @@ #endif #endif +/// @brief NewOS namespace. namespace NewOS { using voidPtr = void*; diff --git a/Private/Source/ErrorOr.cxx b/Private/Source/ErrorOr.cxx index 14941eba..2eac8d2f 100644 --- a/Private/Source/ErrorOr.cxx +++ b/Private/Source/ErrorOr.cxx @@ -7,6 +7,6 @@ #include <NewKit/ErrorOr.hpp> /***********************************************************************************/ -/// @file ErrorOr.cxx -/// @brief Error Or Value class. +/// @file ErrorOr.cxx /// +/// @brief Error Or Value class. /// /***********************************************************************************/ diff --git a/Private/Source/FileManager.cxx b/Private/Source/FileManager.cxx index 5f6ed174..23305fa8 100644 --- a/Private/Source/FileManager.cxx +++ b/Private/Source/FileManager.cxx @@ -74,33 +74,45 @@ namespace NewOS return node_cast(catalog); } - /// @brief Writes to a catalog - /// @param node - /// @param data - /// @param flags + /// @brief Writes to a catalog's fork. + /// @param node the node ptr. + /// @param data the data. + /// @param flags the size. /// @return Void NewFilesystemManager::Write(NodePtr node, VoidPtr data, Int32 flags, SizeT size) { - constexpr const char* cReadAllFork = kNewFSDataFork; + if (!size || + size > kNewFSForkSize) + return; + + if (!data) + return; + + NEWOS_UNUSED(flags); + + const char* cReadAllFork = fDataFork; if ((reinterpret_cast<NewCatalog*>(node))->Kind == kNewFSCatalogKindFile) fImpl->WriteCatalog(reinterpret_cast<NewCatalog*>(node), data, size, cReadAllFork); } - /** - * NOTE: Write and Read are implemented using a custom NodePtr, retrieved - * using OpenFork. - */ - - /// @brief Reads from filesystem. - /// @param node - /// @param flags - /// @param sz + /// @brief Read from filesystem fork. + /// @param node the catalog node. + /// @param flags the flags with it. + /// @param sz the size to read. /// @return VoidPtr NewFilesystemManager::Read(NodePtr node, Int32 flags, SizeT sz) { - constexpr const char* cReadAllFork = kNewFSDataFork; + if (sz > kNewFSForkSize) + return nullptr; + + if (!sz) + return nullptr; + + NEWOS_UNUSED(flags); + + const char* cReadAllFork = fDataFork; if ((reinterpret_cast<NewCatalog*>(node))->Kind == kNewFSCatalogKindFile) return fImpl->ReadCatalog(reinterpret_cast<NewCatalog*>(node), sz, @@ -112,7 +124,9 @@ namespace NewOS /// @brief Seek from Catalog. /// @param node /// @param off - /// @return + /// @retval true always returns false, this is unimplemented. + /// @retval false always returns this, it is unimplemented. + bool NewFilesystemManager::Seek(NodePtr node, SizeT off) { if (!node || off == 0) @@ -121,9 +135,11 @@ namespace NewOS return fImpl->Seek(reinterpret_cast<NewCatalog*>(node), off); } - /// @brief Tell where the catalog is/ + /// @brief Tell where the catalog is. /// @param node - /// @return + /// @retval true always returns false, this is unimplemented. + /// @retval false always returns this, it is unimplemented. + SizeT NewFilesystemManager::Tell(NodePtr node) { if (!node) @@ -132,9 +148,11 @@ namespace NewOS return fImpl->Tell(reinterpret_cast<NewCatalog*>(node)); } - /// @brief Rewind the catalog. + /// @brief Rewinds the catalog. /// @param node - /// @return + /// @retval true always returns false, this is unimplemented. + /// @retval false always returns this, it is unimplemented. + bool NewFilesystemManager::Rewind(NodePtr node) { if (!node) @@ -143,11 +161,23 @@ namespace NewOS return this->Seek(node, 0); } - /// @brief The filesystem implementation. - /// @return + /// @brief Returns the filesystem parser. + /// @return the Filesystem parser class. NewFSParser* NewFilesystemManager::GetImpl() noexcept { return fImpl; } + + void NewFilesystemManager::SetResourceFork(const char* forkName) + { + if (!forkName) return; + rt_copy_memory((VoidPtr)forkName, (VoidPtr)fRsrcFork, rt_string_len(forkName)); + } + + void NewFilesystemManager::SetDataFork(const char* forkName) + { + if (!forkName) return; + rt_copy_memory((VoidPtr)forkName, (VoidPtr)fDataFork, rt_string_len(forkName)); + } #endif // __FSKIT_NEWFS__ } // namespace NewOS diff --git a/Private/Source/LockDelegate.cxx b/Private/Source/LockDelegate.cxx index 863c2fcf..b8920bcc 100644 --- a/Private/Source/LockDelegate.cxx +++ b/Private/Source/LockDelegate.cxx @@ -8,4 +8,5 @@ namespace NewOS { + /// Leave it empty for now. } // namespace NewOS
\ No newline at end of file diff --git a/Private/Source/ProcessTeam.cxx b/Private/Source/ProcessTeam.cxx index 81edca14..d9711ad9 100644 --- a/Private/Source/ProcessTeam.cxx +++ b/Private/Source/ProcessTeam.cxx @@ -6,7 +6,7 @@ /***********************************************************************************/ /// @file ProcessTeam.cxx -/// @brief Process teams. +/// @brief Process teams implementation. /***********************************************************************************/ #include <KernelKit/ProcessScheduler.hpp> @@ -14,14 +14,14 @@ namespace NewOS { /// @brief Process list array getter. - /// @return + /// @return The list of process to schedule. MutableArray<Ref<ProcessHeader>>& ProcessTeam::AsArray() { return mProcessList; } /// @brief Current process getter. - /// @return + /// @return The current process header. Ref<ProcessHeader>& ProcessTeam::AsRef() { return mCurrentProcess; |
