summaryrefslogtreecommitdiffhomepage
path: root/Private/KernelKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-04 10:59:24 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-04 10:59:24 +0100
commite2bbec91d70847cc5a2ff67eb84ca4a3c2d03e85 (patch)
tree1e7fec7c232b0c750157007113ce8f86d43b7e76 /Private/KernelKit
parentaff54fd3dc6855b62c047f126c6fe20ca717ee0f (diff)
Kernel: Depend less on NewFS, add support for FileSystem protocol in
NewBoot. Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/KernelKit')
-rw-r--r--Private/KernelKit/FileManager.hpp8
-rw-r--r--Private/KernelKit/HError.hpp29
-rw-r--r--Private/KernelKit/OSErr.hpp29
3 files changed, 36 insertions, 30 deletions
diff --git a/Private/KernelKit/FileManager.hpp b/Private/KernelKit/FileManager.hpp
index cfd06f07..a52daa7d 100644
--- a/Private/KernelKit/FileManager.hpp
+++ b/Private/KernelKit/FileManager.hpp
@@ -17,7 +17,10 @@
#pragma once
+#ifdef __USE_NEWFS__
#include <FSKit/NewFS.hxx>
+#endif // __USE_NEWFS__
+
#include <NewKit/ErrorID.hpp>
#include <NewKit/Ref.hpp>
#include <NewKit/Stream.hpp>
@@ -87,6 +90,7 @@ class IFilesystemManager {
/** @brief invalid position. (n-pos) */
#define kNPos (SizeT)(-1);
+#ifdef __USE_NEWFS__
/**
* @brief Based of IFilesystemManager, takes care of managing NewFS disks.
*/
@@ -148,12 +152,14 @@ class NewFilesystemManager final : public IFilesystemManager {
NewFSImplementation *fImpl{nullptr};
};
+#endif // ifdef __USE_NEWFS__
+
/**
* Usable FileStream
* @tparam Encoding file encoding (char, wchar_t...)
* @tparam FSClass Filesystem contract who takes care of it.
*/
-template <typename Encoding = char, typename FSClass = NewFilesystemManager>
+template <typename Encoding = char, typename FSClass = IFilesystemManager>
class FileStream final {
public:
explicit FileStream(const Encoding *path);
diff --git a/Private/KernelKit/HError.hpp b/Private/KernelKit/HError.hpp
new file mode 100644
index 00000000..c03e8104
--- /dev/null
+++ b/Private/KernelKit/HError.hpp
@@ -0,0 +1,29 @@
+/*
+ * ========================================================
+ *
+ * HCore
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#pragma once
+
+#include <NewKit/Defines.hpp>
+
+namespace HCore {
+typedef Int32 HError;
+
+inline constexpr HError kErrorExecutable = 33;
+inline constexpr HError kErrorExecutableLib = 34;
+inline constexpr HError kErrorFileNotFound = 35;
+inline constexpr HError kErrorDirectoryNotFound = 36;
+inline constexpr HError kErrorDiskReadOnly = 37;
+inline constexpr HError kErrorDiskIsFull = 38;
+inline constexpr HError kErrorProcessFault = 39;
+inline constexpr HError kErrorSocketHangUp = 40;
+inline constexpr HError kErrorThreadLocalStorage = 41;
+inline constexpr HError kErrorMath = 42;
+inline constexpr HError kErrorNoNetwork = 43;
+inline constexpr HError kErrorHeapOutOfMemory = 44;
+} // namespace HCore
diff --git a/Private/KernelKit/OSErr.hpp b/Private/KernelKit/OSErr.hpp
deleted file mode 100644
index 62916959..00000000
--- a/Private/KernelKit/OSErr.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * ========================================================
- *
- * HCore
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
-
-#pragma once
-
-#include <NewKit/Defines.hpp>
-
-namespace HCore {
-typedef Int32 OSErr;
-
-inline constexpr OSErr kErrorExecutable = 33;
-inline constexpr OSErr kErrorExecutableLib = 34;
-inline constexpr OSErr kErrorFileNotFound = 35;
-inline constexpr OSErr kErrorDirectoryNotFound = 36;
-inline constexpr OSErr kErrorDiskReadOnly = 37;
-inline constexpr OSErr kErrorDiskIsFull = 38;
-inline constexpr OSErr kErrorProcessFault = 39;
-inline constexpr OSErr kErrorSocketHangUp = 40;
-inline constexpr OSErr kErrorThreadLocalStorage = 41;
-inline constexpr OSErr kErrorMath = 42;
-inline constexpr OSErr kErrorNoNetwork = 43;
-inline constexpr OSErr kErrorHeapOutOfMemory = 44;
-} // namespace HCore