From 1c43fb19cab6eb1121a6d41f4bbe180229a3ae9e Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 20 Mar 2025 20:30:18 +0100 Subject: Refactored BootKit and DiskImage framework, minor kernel fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Refactored BootKit classes: - Renamed `BTextWriter` → `BootTextWriter` - Renamed `BFileReader` → `BootFileReader` - Improved consistency across `BootKit.h`, `BootThread.cc`, and related files. - Updated NetBoot module: - Standardized text writer usage. - Improved error handling for missing patches and EEPROM flash. - DiskImage framework improvements: - Introduced `DI_DISK_IMAGE` struct. - Added new `DIFormatDisk()` and `DIFormatNeFS()` functions. - Improved error handling and structure alignment. - Kernel enhancements: - Updated PE loader structures for better readability. - Renamed PE header fields for consistency. - Improved SwapDisk API structure (`SwapDiskHdr` → `SWAP_DISK_HEADER`). Signed-off-by: Amlal El Mahrouss --- dev/Boot/BootKit/BootKit.h | 50 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'dev/Boot/BootKit') diff --git a/dev/Boot/BootKit/BootKit.h b/dev/Boot/BootKit/BootKit.h index ebaeeb7c..847a7e83 100644 --- a/dev/Boot/BootKit/BootKit.h +++ b/dev/Boot/BootKit/BootKit.h @@ -45,8 +45,8 @@ namespace EFI namespace Boot { - class BTextWriter; - class BFileReader; + class BootTextWriter; + class BootFileReader; class BootThread; class BVersionString; @@ -62,31 +62,31 @@ namespace Boot * @brief BootKit Text Writer class * Writes to UEFI StdOut. */ - class BTextWriter final + class BootTextWriter final { - BTextWriter& _Write(const Long& num); + BootTextWriter& _Write(const Long& num); public: - BTextWriter& Write(const Long& num); - BTextWriter& Write(const Char* str); - BTextWriter& Write(const CharacterTypeUTF16* str); - BTextWriter& WriteCharacter(CharacterTypeUTF16 c); - BTextWriter& Write(const UChar* str); + BootTextWriter& Write(const Long& num); + BootTextWriter& Write(const Char* str); + BootTextWriter& Write(const CharacterTypeUTF16* str); + BootTextWriter& WriteCharacter(CharacterTypeUTF16 c); + BootTextWriter& Write(const UChar* str); template - BTextWriter& operator<<(T elem) + BootTextWriter& operator<<(T elem) { this->Write(elem); return *this; } public: - explicit BTextWriter() = default; - ~BTextWriter() = default; + explicit BootTextWriter() = default; + ~BootTextWriter() = default; public: - BTextWriter& operator=(const BTextWriter&) = default; - BTextWriter(const BTextWriter&) = default; + BootTextWriter& operator=(const BootTextWriter&) = default; + BootTextWriter(const BootTextWriter&) = default; }; NeOS::SizeT BCopyMem(CharacterTypeUTF16* dest, CharacterTypeUTF16* src, const NeOS::SizeT len); @@ -105,12 +105,12 @@ namespace Boot * @brief BootKit File Reader class * Reads the Firmware Boot partition and filesystem. */ - class BFileReader final + class BootFileReader final { public: - explicit BFileReader(const CharacterTypeUTF16* path, - EfiHandlePtr ImageHandle); - ~BFileReader(); + explicit BootFileReader(const CharacterTypeUTF16* path, + EfiHandlePtr ImageHandle); + ~BootFileReader(); public: Void ReadAll(SizeT until, SizeT chunk = kib_cast(4), UIntPtr out_address = 0UL); @@ -139,14 +139,14 @@ namespace Boot UInt64& Size(); public: - BFileReader& operator=(const BFileReader&) = default; - BFileReader(const BFileReader&) = default; + BootFileReader& operator=(const BootFileReader&) = default; + BootFileReader(const BootFileReader&) = default; private: Int32 mErrorCode{kOperationOkay}; VoidPtr mBlob{nullptr}; CharacterTypeUTF16 mPath[kPathLen]; - BTextWriter mWriter; + BootTextWriter mWriter; EfiFileProtocol* mFile{nullptr}; UInt64 mSizeFile{0}; EfiFileProtocol* mRootFs; @@ -240,7 +240,7 @@ namespace Boot NEFS_ROOT_PARTITION_BLOCK* blockPart = reinterpret_cast(buf); - BTextWriter writer; + BootTextWriter writer; for (SizeT indexMag = 0UL; indexMag < kNeFSIdentLen; ++indexMag) { @@ -279,8 +279,8 @@ namespace Boot if (!blob) return NO; - Lba startLba = part.StartCatalog; - BTextWriter writer; + Lba startLba = part.StartCatalog; + BootTextWriter writer; NEFS_CATALOG_STRUCT catalogKind{0}; @@ -363,7 +363,7 @@ namespace Boot fDiskDev.Write((Char*)&part, sizeof(NEFS_ROOT_PARTITION_BLOCK)); - BTextWriter writer; + BootTextWriter writer; writer << "BootZ: Partition name: " << part.PartitionName << "\r"; writer << "BootZ: Start: " << part.StartCatalog << "\r"; -- cgit v1.2.3