diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-07 11:11:24 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-07 11:12:10 +0100 |
| commit | 27585af8ea93d05e8b8a0c2c5faa7de483fb9859 (patch) | |
| tree | 29f83a2dbdf000e673cacb9373a3a7d631cf5adf /src/kernel/KernelKit | |
| parent | bd1598a2b97277e527240f721df14911602cbf11 (diff) | |
feat! kernel/boot: standalone release prep and huge kernel improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/kernel/KernelKit')
| -rw-r--r-- | src/kernel/KernelKit/FileMgr.h | 40 | ||||
| -rw-r--r-- | src/kernel/KernelKit/PE32CodeMgr.h | 2 | ||||
| -rw-r--r-- | src/kernel/KernelKit/PEFCodeMgr.h | 2 | ||||
| -rw-r--r-- | src/kernel/KernelKit/TraceSrv.h | 4 |
4 files changed, 25 insertions, 23 deletions
diff --git a/src/kernel/KernelKit/FileMgr.h b/src/kernel/KernelKit/FileMgr.h index 3b6cabe2..df12a65a 100644 --- a/src/kernel/KernelKit/FileMgr.h +++ b/src/kernel/KernelKit/FileMgr.h @@ -261,7 +261,7 @@ class HeFileSystemMgr final : public IFilesystemMgr { template <typename Encoding = Char, typename FSClass = IFilesystemMgr> class FileStream final { public: - explicit FileStream(const Encoding* path, const Encoding* restrict_type); + FileStream(const Encoding* path, const Encoding* restrict_type); ~FileStream(); public: @@ -269,68 +269,68 @@ class FileStream final { FileStream(const FileStream&); public: - ErrorOr<Int64> Write(UIntPtr offset, const VoidPtr data, SizeT len) { + Ref<Int64> Write(UIntPtr offset, const VoidPtr data, SizeT len) { if (this->fFileRestrict != kFileMgrRestrictReadWrite && this->fFileRestrict != kFileMgrRestrictReadWriteBinary && this->fFileRestrict != kFileMgrRestrictWrite && this->fFileRestrict != kFileMgrRestrictWriteBinary) - return ErrorOr<Int64>(kErrorInvalidData); + return Ref<Int64>(0L); - if (data == nullptr) return ErrorOr<Int64>(kErrorInvalidData); + if (data == nullptr) return Ref<Int64>(0L); auto man = FSClass::GetMounted(); if (man) { man->Seek(fFile, offset); man->Write(fFile, data, 0, len); - return ErrorOr<Int64>(kErrorSuccess); + return Ref<Int64>(len); } - return ErrorOr<Int64>(kErrorInvalidData); + return Ref<Int64>(0L); } - ErrorOr<Int64> Write(const Char* name, const VoidPtr data, SizeT len) { + Ref<Int64> Write(const Char* name, const VoidPtr data, SizeT len) { if (this->fFileRestrict != kFileMgrRestrictReadWrite && this->fFileRestrict != kFileMgrRestrictReadWriteBinary && this->fFileRestrict != kFileMgrRestrictWrite && this->fFileRestrict != kFileMgrRestrictWriteBinary) - return ErrorOr<Int64>(kErrorInvalidData); + return Ref<Int64>(0L); - if (data == nullptr) return ErrorOr<Int64>(kErrorInvalidData); + if (data == nullptr) return Ref<Int64>(0L); auto man = FSClass::GetMounted(); if (man) { man->Write(name, fFile, data, 0, len); - return ErrorOr<Int64>(kErrorSuccess); + return Ref<Int64>(len); } - return ErrorOr<Int64>(kErrorInvalidData); + return Ref<Int64>(0L); } - VoidPtr Read(const Char* name, SizeT sz) { + ErrorOrAny Read(const Char* name, SizeT sz) { if (this->fFileRestrict != kFileMgrRestrictReadWrite && this->fFileRestrict != kFileMgrRestrictReadWriteBinary && this->fFileRestrict != kFileMgrRestrictRead && this->fFileRestrict != kFileMgrRestrictReadBinary) - return nullptr; + return ErrorOrAny(kErrorInvalidData); auto man = FSClass::GetMounted(); if (man) { VoidPtr ret = man->Read(name, fFile, kFileReadAll, sz); - return ret; + return ErrorOrAny(ret); } - return nullptr; + return ErrorOrAny(kErrorInvalidData); } - VoidPtr Read(UIntPtr offset, SizeT sz) { + ErrorOrAny Read(UIntPtr offset, SizeT sz) { if (this->fFileRestrict != kFileMgrRestrictReadWrite && this->fFileRestrict != kFileMgrRestrictReadWriteBinary && this->fFileRestrict != kFileMgrRestrictRead && this->fFileRestrict != kFileMgrRestrictReadBinary) - return nullptr; + return ErrorOrAny(kErrorInvalidData); auto man = FSClass::GetMounted(); @@ -338,10 +338,10 @@ class FileStream final { man->Seek(fFile, offset); auto ret = man->Read(fFile, kFileReadChunk, sz); - return ret; + return ErrorOrAny(ret); } - return nullptr; + return ErrorOrAny(kErrorInvalidData); } public: @@ -408,7 +408,7 @@ inline FileStream<Encoding, Class>::FileStream(const Encoding* path, const Encod .fMappedTo = kFileMgrRestrictReadWrite, }}; - for (SizeT index = 0; index < kRestrictCount; ++index) { + for (SizeT index{}; index < kRestrictCount; ++index) { if (rt_string_cmp(restrict_type, kRestrictList[index].fRestrict, rt_string_len(kRestrictList[index].fRestrict)) == 0) { fFileRestrict = kRestrictList[index].fMappedTo; diff --git a/src/kernel/KernelKit/PE32CodeMgr.h b/src/kernel/KernelKit/PE32CodeMgr.h index 9504615d..3a3ea6f3 100644 --- a/src/kernel/KernelKit/PE32CodeMgr.h +++ b/src/kernel/KernelKit/PE32CodeMgr.h @@ -66,7 +66,7 @@ class PE32Loader : public ILoader { #endif // __FSKIT_INCLUDES_NEFS__ Ref<KString> fPath; - RefAny fCachedBlob{}; + ErrorOrAny fCachedBlob{}; BOOL fBad{}; }; diff --git a/src/kernel/KernelKit/PEFCodeMgr.h b/src/kernel/KernelKit/PEFCodeMgr.h index 59b13db7..e5daa4f5 100644 --- a/src/kernel/KernelKit/PEFCodeMgr.h +++ b/src/kernel/KernelKit/PEFCodeMgr.h @@ -60,7 +60,7 @@ class PEFLoader : public ILoader { #endif // __FSKIT_INCLUDES_NEFS__ Ref<KString> fPath; - VoidPtr fCachedBlob; + ErrorOrAny fCachedBlob; BOOL fFatBinary{}; BOOL fBad{}; }; diff --git a/src/kernel/KernelKit/TraceSrv.h b/src/kernel/KernelKit/TraceSrv.h index 25bbc4c8..5a9d365c 100644 --- a/src/kernel/KernelKit/TraceSrv.h +++ b/src/kernel/KernelKit/TraceSrv.h @@ -8,6 +8,7 @@ #include <CompilerKit/CompilerKit.h> namespace Kernel { + namespace Detail { inline constexpr auto kDebugCmdLen = 256U; inline constexpr auto kDebugPort = 51820; @@ -17,6 +18,7 @@ namespace Detail { inline constexpr auto kDebugDelim = ';'; inline constexpr auto kDebugEnd = '\r'; } // namespace Detail + } // namespace Kernel -#endif // !__KERNELKIT_TRACESRV_H__
\ No newline at end of file +#endif // !__KERNELKIT_TRACESRV_H__ |
