summaryrefslogtreecommitdiffhomepage
path: root/Private/Source
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-07 17:42:32 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-07 17:43:56 +0200
commitca83108fd138cc0398f900e6a6c0a53ad51aee31 (patch)
tree66146e07671517ab1867663081ec39e348205731 /Private/Source
parent636a6034a613f98f13848bf4bf1143bf5966dbce (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/Source')
-rw-r--r--Private/Source/ErrorOr.cxx4
-rw-r--r--Private/Source/FileManager.cxx74
-rw-r--r--Private/Source/LockDelegate.cxx1
-rw-r--r--Private/Source/ProcessTeam.cxx6
4 files changed, 58 insertions, 27 deletions
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;