From 27585af8ea93d05e8b8a0c2c5faa7de483fb9859 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 7 Jan 2026 11:11:24 +0100 Subject: feat! kernel/boot: standalone release prep and huge kernel improvements. Signed-off-by: Amlal El Mahrouss --- src/kernel/KernelKit/FileMgr.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/kernel/KernelKit/FileMgr.h') 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 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 Write(UIntPtr offset, const VoidPtr data, SizeT len) { + Ref Write(UIntPtr offset, const VoidPtr data, SizeT len) { if (this->fFileRestrict != kFileMgrRestrictReadWrite && this->fFileRestrict != kFileMgrRestrictReadWriteBinary && this->fFileRestrict != kFileMgrRestrictWrite && this->fFileRestrict != kFileMgrRestrictWriteBinary) - return ErrorOr(kErrorInvalidData); + return Ref(0L); - if (data == nullptr) return ErrorOr(kErrorInvalidData); + if (data == nullptr) return Ref(0L); auto man = FSClass::GetMounted(); if (man) { man->Seek(fFile, offset); man->Write(fFile, data, 0, len); - return ErrorOr(kErrorSuccess); + return Ref(len); } - return ErrorOr(kErrorInvalidData); + return Ref(0L); } - ErrorOr Write(const Char* name, const VoidPtr data, SizeT len) { + Ref Write(const Char* name, const VoidPtr data, SizeT len) { if (this->fFileRestrict != kFileMgrRestrictReadWrite && this->fFileRestrict != kFileMgrRestrictReadWriteBinary && this->fFileRestrict != kFileMgrRestrictWrite && this->fFileRestrict != kFileMgrRestrictWriteBinary) - return ErrorOr(kErrorInvalidData); + return Ref(0L); - if (data == nullptr) return ErrorOr(kErrorInvalidData); + if (data == nullptr) return Ref(0L); auto man = FSClass::GetMounted(); if (man) { man->Write(name, fFile, data, 0, len); - return ErrorOr(kErrorSuccess); + return Ref(len); } - return ErrorOr(kErrorInvalidData); + return Ref(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::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; -- cgit v1.2.3