From e2bbec91d70847cc5a2ff67eb84ca4a3c2d03e85 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 4 Feb 2024 10:59:24 +0100 Subject: Kernel: Depend less on NewFS, add support for FileSystem protocol in NewBoot. Signed-off-by: Amlal El Mahrouss --- Private/KernelKit/FileManager.hpp | 8 +++++++- Private/KernelKit/HError.hpp | 29 +++++++++++++++++++++++++++++ Private/KernelKit/OSErr.hpp | 29 ----------------------------- 3 files changed, 36 insertions(+), 30 deletions(-) create mode 100644 Private/KernelKit/HError.hpp delete mode 100644 Private/KernelKit/OSErr.hpp (limited to 'Private/KernelKit') 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 +#endif // __USE_NEWFS__ + #include #include #include @@ -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 +template 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 + +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 - -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 -- cgit v1.2.3