diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-12 09:27:10 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-12 09:28:17 +0100 |
| commit | dafb757549b5238f67c49b2c8c0a1b44aedf0bd4 (patch) | |
| tree | 4ba7e264247736115e820c9a1babc3c0c4a2a701 | |
| parent | 2035b324141cbebb1f51a13a28046fbde2735c96 (diff) | |
chore: make Ref `operator bool` explicit, remove useless `MUST_PASS` in TLS.inl, use `CFRef` in LaunchHelpers.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
| -rw-r--r-- | .github/workflows/boot-ahci.yml | 2 | ||||
| -rw-r--r-- | .github/workflows/kernel-ahci-dev.yml | 2 | ||||
| -rw-r--r-- | .github/workflows/kernel-pio-dev.yml | 2 | ||||
| -rw-r--r-- | public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h | 14 | ||||
| -rw-r--r-- | public/frameworks/LaunchHelpers.fwrk/src/Foundation.cc | 4 | ||||
| -rw-r--r-- | src/kernel/HALKit/AMD64/HalKernelMain.cc | 1 | ||||
| -rw-r--r-- | src/kernel/KernelKit/FileMgr.h | 1 | ||||
| -rw-r--r-- | src/kernel/KernelKit/Semaphore.h | 40 | ||||
| -rw-r--r-- | src/kernel/KernelKit/ThreadLocalStorage.inl | 2 | ||||
| -rw-r--r-- | src/kernel/NeKit/ErrorOr.h | 2 | ||||
| -rw-r--r-- | src/kernel/NeKit/Ref.h | 2 | ||||
| -rw-r--r-- | src/kernel/NeKit/Utils.h | 12 | ||||
| -rw-r--r-- | src/kernel/NeKit/Vettable.h | 6 | ||||
| -rw-r--r-- | src/kernel/src/FS/Ext2+IFS.cc | 40 | ||||
| -rw-r--r-- | src/kernel/src/FS/OpenHeFS+FileMgr.cc | 18 | ||||
| -rw-r--r-- | src/kernel/src/Pmm.cc | 9 |
16 files changed, 94 insertions, 63 deletions
diff --git a/.github/workflows/boot-ahci.yml b/.github/workflows/boot-ahci.yml index 8232219a..4277aeaf 100644 --- a/.github/workflows/boot-ahci.yml +++ b/.github/workflows/boot-ahci.yml @@ -1,4 +1,4 @@ -name: BootZ CI (ATA PIO) +name: BootZ CI (Develop,AHCI) on: push: diff --git a/.github/workflows/kernel-ahci-dev.yml b/.github/workflows/kernel-ahci-dev.yml index 69263228..5097caa8 100644 --- a/.github/workflows/kernel-ahci-dev.yml +++ b/.github/workflows/kernel-ahci-dev.yml @@ -1,4 +1,4 @@ -name: NeKernel CI (AHCI) +name: NeKernel (Develop,AHCI) on: push: diff --git a/.github/workflows/kernel-pio-dev.yml b/.github/workflows/kernel-pio-dev.yml index 614f0c9b..11330e83 100644 --- a/.github/workflows/kernel-pio-dev.yml +++ b/.github/workflows/kernel-pio-dev.yml @@ -1,4 +1,4 @@ -name: NeKernel CI (ATA PIO) +name: NeKernel (Develop,ATA PIO) on: push: diff --git a/public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h b/public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h index b20ca17e..cba2e7c4 100644 --- a/public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h +++ b/public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h @@ -20,17 +20,27 @@ inline constexpr auto kMaxArgs = 256; struct LHLaunchInfo final { CF::CFString fExecutablePath{kMaxPath}; CF::CFString fWorkingDirectory{kMaxPath}; - CF::CFString fArguments[kMaxArgs]; + CF::CFRef<CF::CFString> fArguments[kMaxArgs]; CF::CFString fEnvironment{kMaxPath}; CF::CFInteger64 fUID{0}; CF::CFInteger64 fGID{0}; + LHLaunchInfo() = default; + ~LHLaunchInfo() = default; + + LIBSYS_COPY_DELETE(LHLaunchInfo) + explicit operator bool() { return fUID && fGID; } + + CF::CFRef<CF::CFString>* begin() { return fArguments; } + CF::CFRef<CF::CFString>* end() { return fArguments + kMaxArgs; } + + SizeT size() { return kMaxArgs; } }; using LHLaunchInfoPtr = LHLaunchInfo*; /// @brief Get launch information. /// @return the launch information structure. -LHLaunchInfo* LHGetLaunchInfo(Void); +CF::CFRef<LHLaunchInfo> LHGetLaunchInfo(Void); } // namespace LaunchHelpers
\ No newline at end of file diff --git a/public/frameworks/LaunchHelpers.fwrk/src/Foundation.cc b/public/frameworks/LaunchHelpers.fwrk/src/Foundation.cc index 6cc3bff3..159ea243 100644 --- a/public/frameworks/LaunchHelpers.fwrk/src/Foundation.cc +++ b/public/frameworks/LaunchHelpers.fwrk/src/Foundation.cc @@ -9,7 +9,7 @@ /// @brief Get launch information. /// @return the launch information structure. -LaunchHelpers::LHLaunchInfo* LaunchHelpers::LHGetLaunchInfo(Void) { +CF::CFRef<LaunchHelpers::LHLaunchInfo> LaunchHelpers::LHGetLaunchInfo(Void) { return static_cast<LaunchHelpers::LHLaunchInfo*>( - libsys_syscall_arg_1(libsys_hash_64("__LHGetLaunchInfo"))); + libsys_syscall_arg_1(libsys_hash_64("__LHGetLaunchInfoRef"))); }
\ No newline at end of file diff --git a/src/kernel/HALKit/AMD64/HalKernelMain.cc b/src/kernel/HALKit/AMD64/HalKernelMain.cc index 831c3636..5f1d2430 100644 --- a/src/kernel/HALKit/AMD64/HalKernelMain.cc +++ b/src/kernel/HALKit/AMD64/HalKernelMain.cc @@ -17,7 +17,6 @@ #include <misc/BenchKit/HWChronometer.h> #include <modules/ACPI/ACPIFactoryInterface.h> #include <modules/CoreGfx/TextGfx.h> -#include "NeKit/InitializerList.h" #ifndef __NE_MODULAR_KERNEL_COMPONENTS__ EXTERN_C Kernel::VoidPtr kInterruptVectorTable[]; diff --git a/src/kernel/KernelKit/FileMgr.h b/src/kernel/KernelKit/FileMgr.h index 9aebe1e9..5d3ab581 100644 --- a/src/kernel/KernelKit/FileMgr.h +++ b/src/kernel/KernelKit/FileMgr.h @@ -265,6 +265,7 @@ class HeFileSystemMgr final : public IFilesystemMgr { private: HeFileSystemParser* mParser{nullptr}; + DriveTrait mDriveTrait; }; #endif // ifdef __FSKIT_INCLUDES_OPENHEFS__ diff --git a/src/kernel/KernelKit/Semaphore.h b/src/kernel/KernelKit/Semaphore.h index 1cbc08c0..20965d91 100644 --- a/src/kernel/KernelKit/Semaphore.h +++ b/src/kernel/KernelKit/Semaphore.h @@ -25,37 +25,37 @@ namespace Kernel { /// @brief Semaphore structure used for synchronization. -typedef UInt64 SemaphoreArr[kSemaphoreCount]; +using SemaphoreArr = UInt64[kSemaphoreCount]; /// @brief Checks if the semaphore is valid. -inline BOOL rtl_sem_is_valid(const SemaphoreArr& sem, UInt64 owner = 0) { +inline bool rtl_sem_is_valid(const SemaphoreArr& sem, UInt64 owner = 0) { return sem[kSemaphoreOwnerIndex] == owner && sem[kSemaphoreCountIndex] > 0; } /// @brief Releases the semaphore, resetting its owner and count. /// @param sem /// @return -inline BOOL rtl_sem_release(SemaphoreArr& sem) { +inline bool rtl_sem_release(SemaphoreArr& sem) { sem[kSemaphoreOwnerIndex] = 0; sem[kSemaphoreCountIndex] = 0; - return TRUE; + return true; } /// @brief Initializes the semaphore with an owner and a count of zero. /// @param sem the semaphore array to use. /// @param owner the owner to set, could be anything identifitable. /// @return -inline BOOL rtl_sem_acquire(SemaphoreArr& sem, UInt64 owner) { +inline bool rtl_sem_acquire(SemaphoreArr& sem, const UInt64 owner) { if (!owner) { err_global_get() = kErrorInvalidData; - return FALSE; // Invalid owner + return false; // Invalid owner } sem[kSemaphoreOwnerIndex] = owner; sem[kSemaphoreCountIndex] = 0; - return TRUE; + return true; } /// @brief Waits for the semaphore to be available, blocking until it is. @@ -63,50 +63,50 @@ inline BOOL rtl_sem_acquire(SemaphoreArr& sem, UInt64 owner) { /// @param timeout /// @param condition condition pointer. /// @return -inline BOOL rtl_sem_wait(SemaphoreArr& sem, UInt64 owner, UInt64 timeout, - BOOL* condition = nullptr) { +inline bool rtl_sem_wait(SemaphoreArr& sem, const UInt64 owner, const UInt64 timeout, + bool& condition) { if (!rtl_sem_is_valid(sem, owner)) { - return FALSE; + return false; } - if (timeout <= 0) { + if (timeout < 1) { err_global_get() = kErrorTimeout; - return FALSE; + return false; } - if (!condition || *condition) { + if (!condition) { if (sem[kSemaphoreCountIndex] == 0) { err_global_get() = kErrorUnavailable; - return FALSE; + return false; } err_global_get() = kErrorSuccess; sem[kSemaphoreCountIndex]--; - return TRUE; + return true; } HardwareTimer timer(timeout); - BOOL ret = timer.Wait(); + bool ret = timer.Wait(); if (ret) { - if (!condition || *condition) { + if (!condition) { if (sem[kSemaphoreCountIndex] == 0) { err_global_get() = kErrorUnavailable; - return FALSE; + return false; } err_global_get() = kErrorSuccess; sem[kSemaphoreCountIndex]--; - return TRUE; + return true; } } err_global_get() = kErrorTimeout; - return FALSE; // Failed to acquire semaphore + return false; // Failed to acquire semaphore } } // namespace Kernel diff --git a/src/kernel/KernelKit/ThreadLocalStorage.inl b/src/kernel/KernelKit/ThreadLocalStorage.inl index 8e33cff3..dff2de30 100644 --- a/src/kernel/KernelKit/ThreadLocalStorage.inl +++ b/src/kernel/KernelKit/ThreadLocalStorage.inl @@ -16,7 +16,6 @@ inline T* tls_new_ptr(void) { using namespace Kernel; auto ref_process = UserProcessScheduler::The().TheCurrentProcess(); - MUST_PASS(ref_process); auto pointer = ref_process.Leak().New(sizeof(T)); @@ -34,7 +33,6 @@ inline Kernel::Bool tls_delete_ptr(T* obj) { if (!obj) return No; auto ref_process = UserProcessScheduler::The().TheCurrentProcess(); - MUST_PASS(ref_process); ErrorOr<T*> obj_wrapped{obj}; diff --git a/src/kernel/NeKit/ErrorOr.h b/src/kernel/NeKit/ErrorOr.h index a8280406..4e43cb27 100644 --- a/src/kernel/NeKit/ErrorOr.h +++ b/src/kernel/NeKit/ErrorOr.h @@ -16,7 +16,7 @@ namespace Kernel { /// ================================================================================ /// @brief ErrorOr class for error handling. /// ================================================================================ -template <typename T> +template <class T> class ErrorOr final { public: explicit ErrorOr() = default; diff --git a/src/kernel/NeKit/Ref.h b/src/kernel/NeKit/Ref.h index 960df31f..253ee379 100644 --- a/src/kernel/NeKit/Ref.h +++ b/src/kernel/NeKit/Ref.h @@ -46,7 +46,7 @@ class Ref final { Type operator*() { return fClass; } - operator bool() { return Vettable<Type>::kValue; } + explicit operator bool() { return Vettable<Type>::kValue; } bool operator!() { return !Vettable<Type>::kValue; } private: diff --git a/src/kernel/NeKit/Utils.h b/src/kernel/NeKit/Utils.h index 28a153af..71cae42b 100644 --- a/src/kernel/NeKit/Utils.h +++ b/src/kernel/NeKit/Utils.h @@ -51,12 +51,22 @@ Size urt_string_len(const Utf8Char* str); /// =========================================================== /// template <typename CharType = Char> -inline SizeT oe_string_len(const CharType* str) { +inline constexpr SizeT oe_string_len(const CharType* str) { if (!str) return 0; +#if __cplusplus == 202302L + if consteval { + return ARRAY_SIZE(str); + } else { + SizeT len{0}; + while (str[len] != 0) ++len; + return len; + } +#else SizeT len{0}; while (str[len] != 0) ++len; return len; +#endif } } // namespace Kernel diff --git a/src/kernel/NeKit/Vettable.h b/src/kernel/NeKit/Vettable.h index 52528847..6769507f 100644 --- a/src/kernel/NeKit/Vettable.h +++ b/src/kernel/NeKit/Vettable.h @@ -29,7 +29,7 @@ struct INotVettable { NE_COPY_DEFAULT(INotVettable) }; -template <typename T> +template <class Type> struct Vettable final { static constexpr bool kValue = false; }; @@ -50,9 +50,9 @@ concept IsVettable = requires(OnFallback fallback) { { Vettable<T>::kValue ? true : fallback() }; }; -template <typename T, typename OnFallback> +template <class Type, typename OnFallback> concept IsNotVettable = requires(OnFallback fallback) { - { !Vettable<T>::kValue ? true : fallback() }; + { !Vettable<Type>::kValue ? true : fallback() }; }; } // namespace Kernel diff --git a/src/kernel/src/FS/Ext2+IFS.cc b/src/kernel/src/FS/Ext2+IFS.cc index 106229f7..bd70f334 100644 --- a/src/kernel/src/FS/Ext2+IFS.cc +++ b/src/kernel/src/FS/Ext2+IFS.cc @@ -26,16 +26,18 @@ constexpr ATTRIBUTE(unused) static UInt32 EXT2_SUPERBLOCK_BLOCK = 1; constexpr static UInt32 EXT2_GROUP_DESC_BLOCK_SMALL = 2; constexpr static UInt32 EXT2_GROUP_DESC_BLOCK_LARGE = 1; +namespace Detail { static inline SizeT ext2_min(SizeT a, SizeT b) { return a < b ? a : b; } -struct Ext2GroupInfo { +struct Ext2GroupInfo final { EXT2_GROUP_DESCRIPTOR* groupDesc; UInt32 groupDescriptorBlock; UInt32 offsetInGroupDescBlock; UInt8* blockBuffer; }; +} // namespace Detail // Convert EXT2 block number -> LBA (sector index) for Drive I/O. static inline UInt32 ext2_block_to_lba(Ext2Context* ctx, UInt32 blockNumber) { @@ -169,7 +171,7 @@ static ErrorOr<voidPtr> ext2_read_inode_data(Ext2Context* ctx, Ext2Node* node, S return ErrorOr<voidPtr>(5); // block read failed } - SizeT chunk = ext2_min(remaining, blockSize - offsetInBlock); + SizeT chunk = ::Detail::ext2_min(remaining, blockSize - offsetInBlock); rt_copy_memory_safe(static_cast<void*>(static_cast<UInt8*>(blockBuf) + offsetInBlock), static_cast<void*>(dest), chunk, chunk); @@ -185,9 +187,9 @@ static ErrorOr<voidPtr> ext2_read_inode_data(Ext2Context* ctx, Ext2Node* node, S } // Get group descriptor information for a given block/inode number -static ErrorOr<Ext2GroupInfo*> ext2_get_group_descriptor_info(Ext2Context* ctx, +static ErrorOr<::Detail::Ext2GroupInfo*> ext2_get_group_descriptor_info(Ext2Context* ctx, UInt32 targetBlockOrInode) { - if (!ctx || !ctx->superblock || !ctx->drive) return ErrorOr<Ext2GroupInfo*>(kErrorInvalidData); + if (!ctx || !ctx->superblock || !ctx->drive) return ErrorOr<::Detail::Ext2GroupInfo*>(kErrorInvalidData); UInt32 blockSize = ctx->BlockSize(); UInt32 blocksPerGroup = ctx->superblock->fBlocksPerGroup; @@ -195,7 +197,7 @@ static ErrorOr<Ext2GroupInfo*> ext2_get_group_descriptor_info(Ext2Context* ctx, UInt32 totalBlocks = ctx->superblock->fBlockCount; UInt32 totalInodes = ctx->superblock->fInodeCount; - if (blocksPerGroup == 0 || inodesPerGroup == 0) return ErrorOr<Ext2GroupInfo*>(kErrorInvalidData); + if (blocksPerGroup == 0 || inodesPerGroup == 0) return ErrorOr<::Detail::Ext2GroupInfo*>(kErrorInvalidData); // block group index UInt32 groupIndex = 0; @@ -215,7 +217,7 @@ static ErrorOr<Ext2GroupInfo*> ext2_get_group_descriptor_info(Ext2Context* ctx, // Calculate number of block groups UInt32 groupsCount = static_cast<UInt32>((totalBlocks + blocksPerGroup - 1) / blocksPerGroup); - if (groupIndex >= groupsCount) return ErrorOr<Ext2GroupInfo*>(kErrorInvalidData); + if (groupIndex >= groupsCount) return ErrorOr<::Detail::Ext2GroupInfo*>(kErrorInvalidData); // Determine GDT start block UInt32 gdtStartBlock = @@ -232,18 +234,18 @@ static ErrorOr<Ext2GroupInfo*> ext2_get_group_descriptor_info(Ext2Context* ctx, // Allocate buffer and read the block containing the descriptor auto blockBuffer = mm_alloc_ptr(blockSize, true, false); - if (!blockBuffer) return ErrorOr<Ext2GroupInfo*>(kErrorHeapOutOfMemory); + if (!blockBuffer) return ErrorOr<::Detail::Ext2GroupInfo*>(kErrorHeapOutOfMemory); UInt32 groupDescriptorLba = ext2_block_to_lba(ctx, groupDescriptorBlock); if (!ext2_read_block(ctx->drive, groupDescriptorLba, blockBuffer, blockSize)) { mm_free_ptr(blockBuffer); - return ErrorOr<Ext2GroupInfo*>(kErrorDisk); + return ErrorOr<::Detail::Ext2GroupInfo*>(kErrorDisk); } - auto groupInfo = (Ext2GroupInfo*) mm_alloc_ptr(sizeof(Ext2GroupInfo), true, false); + auto groupInfo = (::Detail::Ext2GroupInfo*) mm_alloc_ptr(sizeof(::Detail::Ext2GroupInfo), true, false); if (!groupInfo) { mm_free_ptr(blockBuffer); - return ErrorOr<Ext2GroupInfo*>(kErrorHeapOutOfMemory); + return ErrorOr<::Detail::Ext2GroupInfo*>(kErrorHeapOutOfMemory); } groupInfo->groupDesc = reinterpret_cast<EXT2_GROUP_DESCRIPTOR*>( @@ -252,7 +254,7 @@ static ErrorOr<Ext2GroupInfo*> ext2_get_group_descriptor_info(Ext2Context* ctx, groupInfo->offsetInGroupDescBlock = offsetInGroupDescBlock; groupInfo->blockBuffer = reinterpret_cast<UInt8*>(blockBuffer); - return ErrorOr<Ext2GroupInfo*>(groupInfo); + return ErrorOr<::Detail::Ext2GroupInfo*>(groupInfo); } // Allocate a new block @@ -324,7 +326,7 @@ static ErrorOr<Void*> ext2_set_block_address(Ext2Context* ctx, Ext2Node* node, auto groupInfoRes = ext2_get_group_descriptor_info(ctx, node->inodeNumber); if (groupInfoRes.HasError()) return ErrorOr<Void*>(groupInfoRes.Error()); - auto groupInfo = groupInfoRes.Leak().Leak(); // Ref<Ext2GroupInfo*> + auto groupInfo = groupInfoRes.Leak().Leak(); // Ref<::Detail::Ext2GroupInfo*> auto newBlockRes = ext2_alloc_block(ctx, groupInfo->groupDesc); if (newBlockRes.HasError()) { mm_free_ptr(reinterpret_cast<void*>(groupInfo->blockBuffer)); @@ -332,7 +334,7 @@ static ErrorOr<Void*> ext2_set_block_address(Ext2Context* ctx, Ext2Node* node, return ErrorOr<Void*>(newBlockRes.Error()); } - node->inode.fBlock[EXT2_SINGLE_INDIRECT_INDEX] = newBlockRes.Leak(); + node->inode.fBlock[EXT2_SINGLE_INDIRECT_INDEX] = newBlockRes.Leak().Leak(); UInt32 gdtLba = ext2_block_to_lba(ctx, groupInfo->groupDescriptorBlock); if (!ext2_write_block(ctx->drive, gdtLba, groupInfo->blockBuffer, blockSize)) { @@ -391,7 +393,7 @@ static ErrorOr<Void*> ext2_set_block_address(Ext2Context* ctx, Ext2Node* node, return ErrorOr<Void*>(newBlockRes.Error()); } - node->inode.fBlock[EXT2_DOUBLE_INDIRECT_INDEX] = newBlockRes.Leak(); + node->inode.fBlock[EXT2_DOUBLE_INDIRECT_INDEX] = newBlockRes.Leak().Leak(); UInt32 gdtLba = ext2_block_to_lba(ctx, groupInfo->groupDescriptorBlock); if (!ext2_write_block(ctx->drive, gdtLba, groupInfo->blockBuffer, blockSize)) { @@ -445,7 +447,7 @@ static ErrorOr<Void*> ext2_set_block_address(Ext2Context* ctx, Ext2Node* node, return ErrorOr<Void*>(newBlockRes.Error()); } - singleIndirectBlock = newBlockRes.Leak(); + singleIndirectBlock = newBlockRes.Leak().Leak(); doublePtr[firstIdx] = singleIndirectBlock; // Write back GDT @@ -595,7 +597,7 @@ static ErrorOr<Void*> ext2_add_dir_entry(Ext2Context* ctx, Ext2Node* parentDirNo return ErrorOr<Void*>(groupInfoRes.Error()); } - auto groupInfo = *groupInfoRes.Leak(); // Dereference to get Ext2GroupInfo* + auto groupInfo = *groupInfoRes.Leak(); // Dereference to get ::Detail::Ext2GroupInfo* auto allocBlockRes = ext2_alloc_block(ctx, groupInfo->groupDesc); if (!allocBlockRes) { mm_free_ptr(reinterpret_cast<void*>(groupInfo->blockBuffer)); @@ -708,7 +710,7 @@ static ErrorOr<Void*> ext2_add_dir_entry(Ext2Context* ctx, Ext2Node* parentDirNo return ErrorOr<Void*>(groupInfoResult.Error()); } - auto groupInfo = *groupInfoResult.Leak(); // Dereference to get Ext2GroupInfo* + auto groupInfo = *groupInfoResult.Leak(); // Dereference to get ::Detail::Ext2GroupInfo* auto newBlockRes = ext2_alloc_block(ctx, groupInfo->groupDesc); if (!newBlockRes) { mm_free_ptr(reinterpret_cast<void*>(groupInfo->blockBuffer)); @@ -820,7 +822,7 @@ static ErrorOr<Void*> ext2_write_inode(Ext2Context* ctx, Ext2Node* node) { auto groupInfoResult = ext2_get_group_descriptor_info(ctx, node->inodeNumber); if (!groupInfoResult) return ErrorOr<Void*>(groupInfoResult.Error()); - auto groupInfo = *groupInfoResult.Leak(); // Dereference to get Ext2GroupInfo* + auto groupInfo = *groupInfoResult.Leak(); // Dereference to get ::Detail::Ext2GroupInfo* // Calculate inode table position UInt32 inodeTableBlock = groupInfo->groupDesc->fInodeTable; @@ -1131,7 +1133,7 @@ void Ext2FileSystemParser::Write(NodePtr node, void* data, Int32 flags, SizeT si } UInt32 bytesInCurrentBlock = - static_cast<UInt32>(ext2_min(size - bytesWritten, blockSize - offsetInBlock)); + static_cast<UInt32>(::Detail::ext2_min(size - bytesWritten, blockSize - offsetInBlock)); rt_copy_memory_safe(src, static_cast<void*>((UInt8*) blockBuf + offsetInBlock), bytesInCurrentBlock, blockSize - offsetInBlock); diff --git a/src/kernel/src/FS/OpenHeFS+FileMgr.cc b/src/kernel/src/FS/OpenHeFS+FileMgr.cc index 4c49ac11..10c6da45 100644 --- a/src/kernel/src/FS/OpenHeFS+FileMgr.cc +++ b/src/kernel/src/FS/OpenHeFS+FileMgr.cc @@ -50,6 +50,24 @@ NodePtr HeFileSystemMgr::Create(_Input const Char* path) { kout << "OpenHeFS: Create called with null or empty path\n"; return nullptr; } + + // AMLALE: TODO, its own helper! + SizeT len = oe_string_len<Char>(path); + +#if defined(__clang__) + Utf8Char out[len]; + rt_set_memory(out, 0, len); +#else + Utf8Char* out = static_cast<Utf8Char*>(RTL_ALLOCA(sizeof(Utf8Char) * len)); +#endif + + for (SizeT indx = 0UL; indx < len; ++indx) { + out[indx] = path[indx]; + } + + if (mParser->CreateINode(&mDriveTrait, 0, nullptr, out, 0)) + return nullptr; // AMLALE TODO: FetchINode method! + return nullptr; } diff --git a/src/kernel/src/Pmm.cc b/src/kernel/src/Pmm.cc index 84086929..074ae54b 100644 --- a/src/kernel/src/Pmm.cc +++ b/src/kernel/src/Pmm.cc @@ -6,14 +6,7 @@ #include <KernelKit/DebugOutput.h> #include <NeKit/Pmm.h> - -#if defined(__NE_ARM64__) -#include <HALKit/ARM64/Processor.h> -#endif // defined(__NE_ARM64__) - -#if defined(__NE_AMD64__) -#include <HALKit/AMD64/Processor.h> -#endif // defined(__NE_AMD64__) +#include <ArchKit/ArchKit.h> namespace Kernel { /***********************************************************************************/ |
