diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-26 18:36:09 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-26 18:36:09 +0100 |
| commit | 9a0c2664b0ca5634aa557b0761139cccfb0fe753 (patch) | |
| tree | 004c49f89076c8b1f6f5ab9db031c4e010bfe95f | |
| parent | 66e4f909bd1a495d3f1c34d2e1b5cd71099ab1ae (diff) | |
Kernel: Add NewFS support: initial commit.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
12 files changed, 78 insertions, 61 deletions
diff --git a/Private/FSKit/NewFS.hxx b/Private/FSKit/NewFS.hxx index 8e306180..9645d29c 100644 --- a/Private/FSKit/NewFS.hxx +++ b/Private/FSKit/NewFS.hxx @@ -21,7 +21,7 @@ #include <NewKit/Defines.hpp> /** - @brief New File System. + @brief New File System specification. @author Amlal EL Mahrouss */ @@ -89,34 +89,15 @@ typedef HCore::Char NewCharType; enum { - kNewFSHardDrive = 0xC0, // Hard Drive + kNewFSHardDrive = 0xC0, // Hard Drive (SSD, HDD) kNewFSOpticalDrive = 0x0C, // Blu-Ray/DVD kNewFSMassStorageDevice = 0xCC, // USB - kNewFSUnknown = 0xFF, // unknown device or unsupported (floppy) - kNewFSDriveCount = 4, + kNewFSScsi = 0xC4, // SCSI Hard Drive + kNewFSUnknown = 0xFF, // Unknown device. (floppy) + kNewFSDriveCount = 5, }; -/// @brief NewFS filesystem block. -/// @author Amlal El Mahrouss. -struct PACKED NewBootBlock final { - NewCharType Ident[kNewFSIdentLen]; - NewCharType Shell[kNewFSNodeNameLen]; - - HCore::Int64 NumParts; // number of sub-partitions. - HCore::Int64 FreeSectors; - HCore::Int64 SectorCount; - HCore::Int64 SectorSz; - - HCore::Int64 DiskSize; // size of media. - HCore::Int32 DiskKind; // kind of disk. - - HCore::Lba FirstPartBlock; - HCore::Lba LastPartBlock; - - NewCharType Pad[kNewFSPadLen]; -}; - -/// @brief File catalog type. +/// @brief Ccatalog type. struct PACKED NewCatalog final { NewCharType Name[kNewFSNodeNameLen]; @@ -130,7 +111,7 @@ struct PACKED NewCatalog final { HCore::Lba PrevSibling; }; -/// @brief File fork type. +/// @brief Fork type. struct PACKED NewFork final { NewCharType Name[kNewFSNodeNameLen]; diff --git a/Private/KernelKit/FileManager.hpp b/Private/KernelKit/FileManager.hpp index 7af1ab0d..d02c087c 100644 --- a/Private/KernelKit/FileManager.hpp +++ b/Private/KernelKit/FileManager.hpp @@ -27,8 +27,9 @@ /// Main filesystem abstraction manager. #define kBootFolder "/Boot" -#define kBinFolder "/Programs" +#define kBinFolder "/Applications" #define kShLibsFolder "/Library" +#define kMountFolder "/Mount" /// refer to first enum. #define kFileOpsCount 4 diff --git a/Private/Source/NewFS+IO.cxx b/Private/Source/NewFS+IO.cxx index a62970e7..1fd85dd8 100644 --- a/Private/Source/NewFS+IO.cxx +++ b/Private/Source/NewFS+IO.cxx @@ -7,11 +7,16 @@ #include <KernelKit/DriveManager.hxx> #include <KernelKit/FileManager.hpp> -/** --------------------------------------------------- +/************************************************************* + * + * File: NewFS+IO.cxx + * Purpose: Filesystem to mountpoint interface. + * Date: 3/26/24 + * + * Copyright Mahrouss Logic, all rights reserved. + * + *************************************************************/ - * THIS FILE CONTAINS CODE FOR THE HCFS I/O DEVICES. - -------------------------------------------------------- */ #ifdef __FSKIT_NEWFS__ diff --git a/Public/Developer/System.Core/Headers/Defines.hxx b/Public/Developer/System.Core/Headers/Defines.hxx index 9d6d84ee..55810d9d 100644 --- a/Public/Developer/System.Core/Headers/Defines.hxx +++ b/Public/Developer/System.Core/Headers/Defines.hxx @@ -6,16 +6,12 @@ #pragma once -#ifndef __cplusplus -#error This API is meant to be used with C++. -#endif - #ifdef CA_MUST_PASS #undef CA_MUST_PASS #endif #ifdef _DEBUG -#define CA_MUST_PASS(e) { if (!e) { __assert_chk_fail() } } +#define CA_MUST_PASS(e) { if (!e) { MsgBox("Sorry, ssertion failed.\nFile: %s\nLine: %i", __FILE__, __LINE__) __assert_chk_fail() } } #else #define CA_MUST_PASS(e) CA_UNREFERENCED_PARAMETER(e) #endif @@ -153,7 +149,7 @@ enum { * @brief GUID type, something you can also find in CFKit. * @author AMlal El Mahrouss */ -typedef struct GUID final { +typedef struct GUID { DWordType Data1; WordType Data2; WordType Data3; @@ -162,23 +158,38 @@ typedef struct GUID final { /// \brief Object handle. /// \author Amlal El Mahrouss -typedef struct Object final { - CharacterTypeUTF8 ObjectName[255]; - DWordType ObjectType; - CharacterTypeUTF8 ObjectNamespace[255]; +typedef struct Object { + CharacterTypeUTF8 Name[255]; + DWordType Kind; + DWordType Flags; VoidType(*Release)(struct Object* Self); IntPtrType(*Invoke)(struct Object* Self, DWordType Sel, ...); VoidType(*Query)(struct Object* Self, PtrVoidType* Dst, SizeType SzDst, struct GUID* GuidOf); } *ObjectRef; +#ifdef __cplusplus + #define object_cast reinterpret_cast<ObjectRef> +template <SizeType N> +using StrType = CharacterTypeUTF8[N]; + +#else + +#define object_cast (ObjectRef) + +#endif // ifdef C++ + CA_EXTERN_C ObjectRef HcGetAppObject(VoidType); CA_INLINE ObjectRef kApplicationObject; typedef CharacterTypeUTF8 Str255Type[255]; -template <SizeType N> -using StrType = CharacterTypeUTF8[N]; +/// @brief Shows an message box with a formatting. +/// @param title the message box title +/// @param format the format +/// @param va_list the va args, that goes along with it. +/// @return void +CA_EXTERN_C VoidType MsgBox(CharacterTypeUTF8* title, CharacterTypeUTF8* format, ...); diff --git a/Public/Developer/System.Core/Headers/Window/Dialog.hxx b/Public/Developer/System.Core/Headers/Dialog.hxx index 3e445532..0fc4e738 100644 --- a/Public/Developer/System.Core/Headers/Window/Dialog.hxx +++ b/Public/Developer/System.Core/Headers/Dialog.hxx @@ -6,4 +6,4 @@ #pragma once -#include <System.Core/Headers/Window/Window.hxx> +#include <System.Core/Headers/Window.hxx> diff --git a/Public/Developer/System.Core/Headers/Window/Image.hxx b/Public/Developer/System.Core/Headers/Image.hxx index 3e445532..0fc4e738 100644 --- a/Public/Developer/System.Core/Headers/Window/Image.hxx +++ b/Public/Developer/System.Core/Headers/Image.hxx @@ -6,4 +6,4 @@ #pragma once -#include <System.Core/Headers/Window/Window.hxx> +#include <System.Core/Headers/Window.hxx> diff --git a/Public/Developer/System.Core/Headers/Window/Menu.hxx b/Public/Developer/System.Core/Headers/Menu.hxx index 3e445532..0fc4e738 100644 --- a/Public/Developer/System.Core/Headers/Window/Menu.hxx +++ b/Public/Developer/System.Core/Headers/Menu.hxx @@ -6,4 +6,4 @@ #pragma once -#include <System.Core/Headers/Window/Window.hxx> +#include <System.Core/Headers/Window.hxx> diff --git a/Public/Developer/System.Core/Headers/Window/Rsrc.hxx b/Public/Developer/System.Core/Headers/Rsrc.hxx index 3e445532..0fc4e738 100644 --- a/Public/Developer/System.Core/Headers/Window/Rsrc.hxx +++ b/Public/Developer/System.Core/Headers/Rsrc.hxx @@ -6,4 +6,4 @@ #pragma once -#include <System.Core/Headers/Window/Window.hxx> +#include <System.Core/Headers/Window.hxx> diff --git a/Public/Developer/System.Core/Headers/TrueType.hxx b/Public/Developer/System.Core/Headers/TrueType.hxx new file mode 100644 index 00000000..14a85823 --- /dev/null +++ b/Public/Developer/System.Core/Headers/TrueType.hxx @@ -0,0 +1,19 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#pragma once + +#include <System.Core/Headers/Window.hxx> + +/************************************************************* + * + * File: TrueType.hxx + * Purpose: TrueType font implementation for System Software. + * Date: 3/26/24 + * + * Copyright Mahrouss Logic, all rights reserved. + * + *************************************************************/ diff --git a/Public/Developer/System.Core/Headers/Window/Window.hxx b/Public/Developer/System.Core/Headers/Window.hxx index 4c79d50b..02be0681 100644 --- a/Public/Developer/System.Core/Headers/Window/Window.hxx +++ b/Public/Developer/System.Core/Headers/Window.hxx @@ -8,9 +8,18 @@ #include <System.Core/Headers/Defines.hxx> -/// @file Window.hxx -/// @brief Tracker window protocol. -/// @author Amlal El Mahrouss. +/************************************************************* + * + * File: Window.hxx + * Purpose: Window Manager implementation for System Software. + * Date: 3/26/24 + * + * Copyright Mahrouss Logic, all rights reserved. + * + *************************************************************/ + +struct _GraphicsPoint; +struct _GraphicsPort; typedef float PositionType; diff --git a/Public/Developer/System.Core/Headers/Window/TrueType.hxx b/Public/Developer/System.Core/Headers/Window/TrueType.hxx deleted file mode 100644 index 3e445532..00000000 --- a/Public/Developer/System.Core/Headers/Window/TrueType.hxx +++ /dev/null @@ -1,9 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include <System.Core/Headers/Window/Window.hxx> diff --git a/Public/Developer/System.Core/Sources/CRT0.cxx b/Public/Developer/System.Core/Sources/CRT0.cxx index a0235e68..b6fb9de1 100644 --- a/Public/Developer/System.Core/Sources/CRT0.cxx +++ b/Public/Developer/System.Core/Sources/CRT0.cxx @@ -4,9 +4,9 @@ #include <System.Core/Headers/Heap.hxx> -/// @brief Inits the DLL. +/// @brief Inits the library. /// @return if it was succesful or not. -CA_EXTERN_C DWordType __DllMain(VoidType) { +CA_EXTERN_C DWordType __start(VoidType) { kApplicationObject = HcGetAppObject(); CA_MUST_PASS(kApplicationObject); |
