summaryrefslogtreecommitdiffhomepage
path: root/Private/FSKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 21:49:58 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 21:49:58 +0100
commitdf44a789fc90497325ba91be515c02145ae39142 (patch)
tree71fca5d75367399a38c37e9adc43ac5e816a0327 /Private/FSKit
parent08eeda990be33db8048031df2a40ec28955e6430 (diff)
Kernel: Provide platform specific code for IOArray.
Kernel: Add PE header for Kernel AND bootloader. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/FSKit')
-rw-r--r--Private/FSKit/NewFS.hxx221
1 files changed, 105 insertions, 116 deletions
diff --git a/Private/FSKit/NewFS.hxx b/Private/FSKit/NewFS.hxx
index 1d32e676..d197db80 100644
--- a/Private/FSKit/NewFS.hxx
+++ b/Private/FSKit/NewFS.hxx
@@ -9,8 +9,8 @@
#pragma once
-#include <KernelKit/DriveManager.hpp>
#include <CompilerKit/CompilerKit.hpp>
+#include <KernelKit/DriveManager.hpp>
#include <NewKit/Defines.hpp>
#define kInvalidFork -1
@@ -23,180 +23,169 @@
#define kFilesystemVersion 1
-enum
-{
- kHardDrive = 0xC0, // Hard Drive
- kOpticalDrive = 0x0C, // Blu-Ray/DVD
- kMassStorageDevice = 0xCC, // USB
- kUnknowmn = 0xFF, // unknown device or unsupported (floppy)
+enum {
+ kHardDrive = 0xC0, // Hard Drive
+ kOpticalDrive = 0x0C, // Blu-Ray/DVD
+ kMassStorageDevice = 0xCC, // USB
+ kUnknowmn = 0xFF, // unknown device or unsupported (floppy)
};
-struct NewBootBlock
-{
- HCore::Char Ident[kIdentLen];
-
- HCore::Char Kernel[kNameLen];
- HCore::Char GUI[kNameLen];
+struct NewBootBlock final {
+ HCore::Char Ident[kIdentLen];
+ HCore::Char Shell[kNameLen];
- HCore::Int64 NumParts;
- HCore::Int64 FreeSectors;
- HCore::Int64 SectorCount;
- HCore::Int64 SectorSz;
+ HCore::Int64 NumParts;
+ HCore::Int64 FreeSectors;
+ HCore::Int64 SectorCount;
+ HCore::Int64 SectorSz;
- HCore::Int64 DiskSize;
- HCore::Int32 DiskKind;
+ HCore::Int64 DiskSize;
+ HCore::Int32 DiskKind;
- HCore::Lba FirstPartBlock;
- HCore::Lba LastPartBlock;
+ HCore::Lba FirstPartBlock;
+ HCore::Lba LastPartBlock;
- HCore::Char Pad[kPadLen];
+ HCore::Char Pad[kPadLen];
};
-#define kFlagDeleted 0xF0
+#define kFlagDeleted 0xF0
#define kFlagUnallocated 0x0F
-#define kFlagCatalog 0xFF
+#define kFlagCatalog 0xFF
#define kKindCatalog 1
#define kKindDirectory 2
#define kKindSymlink 3
-struct NewCatalog
-{
- HCore::Char Name[kNameLen];
+struct NewCatalog final {
+ HCore::Char Name[kNameLen];
- HCore::Int32 Flags;
- HCore::Int32 Kind;
+ HCore::Int32 Flags;
+ HCore::Int32 Kind;
- HCore::Lba FirstFork;
- HCore::Lba LastFork;
+ HCore::Lba FirstFork;
+ HCore::Lba LastFork;
};
-struct NewFork
-{
- HCore::Int32 Flags;
- HCore::Int32 Kind;
+struct NewFork {
+ HCore::Int32 Flags;
+ HCore::Int32 Kind;
- HCore::Int64 ID;
+ HCore::Int64 ID;
- HCore::Int64 ResourceId;
- HCore::Int32 ResourceKind;
- HCore::Int32 ResourceFlags;
+ HCore::Int64 ResourceId;
+ HCore::Int32 ResourceKind;
+ HCore::Int32 ResourceFlags;
- HCore::Lba DataOffset;
- HCore::SizeT DataSize;
-
- HCore::Lba NextSibling;
- HCore::Lba PreviousSibling;
+ HCore::Lba DataOffset;
+ HCore::SizeT DataSize;
+
+ HCore::Lba NextSibling;
+ HCore::Lba PreviousSibling;
};
#define kResourceTypeDialog 10
#define kResourceTypeString 11
-#define kResourceTypeMenu 12
+#define kResourceTypeMenu 12
#define kConfigLen 64
#define kPartLen 32
-struct NewPartitionBlock
-{
- HCore::Char PartitionName[kPartLen];
- HCore::Char JsonPath[kConfigLen];
+struct NewPartitionBlock final {
+ HCore::Char PartitionName[kPartLen];
+ HCore::Char JsonPath[kConfigLen];
- HCore::Int32 Flags;
- HCore::Int32 Kind;
+ HCore::Int32 Flags;
+ HCore::Int32 Kind;
- HCore::Lba StartCatalog;
- HCore::SizeT CatalogCount;
+ HCore::Lba StartCatalog;
+ HCore::SizeT CatalogCount;
- HCore::SizeT DiskSize;
+ HCore::SizeT DiskSize;
- HCore::SizeT FreeCatalog;
- HCore::SizeT FreeSectors;
+ HCore::SizeT FreeCatalog;
+ HCore::SizeT FreeSectors;
- HCore::SizeT SectorCount;
- HCore::SizeT SectorSize;
+ HCore::SizeT SectorCount;
+ HCore::SizeT SectorSize;
- HCore::Char Pad[kPadLen];
+ HCore::Char Pad[kPadLen];
};
-#define kCatalogKindFile 1
-#define kCatalogKindDir 2
-#define kCatalogKindAlias 3
+#define kCatalogKindFile 1
+#define kCatalogKindDir 2
+#define kCatalogKindAlias 3
//! shared between network or
//! other filesystems. Export forks as .zip when copying.
-#define kCatalogKindShared 4
-
-#define kCatalogKindResource 5
-#define kCatalogKindExecutable 6
+#define kCatalogKindShared 4
-#define kCatalogKindPage 8
+#define kCatalogKindResource 5
+#define kCatalogKindExecutable 6
-#define kCatalogKindDevice 9
-#define kCatalogKindLock 10
+#define kCatalogKindPage 8
-#define kFilesystemSeparator '/'
+#define kCatalogKindDevice 9
+#define kCatalogKindLock 10
-#define kFilesystemUpDir ".."
-#define kFilesystemRoot "/"
+#define kFilesystemSeparator '/'
-#define kFilesystemLE '\r'
-#define kFilesystemEOF 0xFF11
+#define kFilesystemUpDir ".."
+#define kFilesystemRoot "/"
-#define kFilesystemBitWidth sizeof(UInt16)
-#define kFilesystemLbaType HCore::Lba
+#define kFilesystemLE '\r'
+#define kFilesystemEOF 0xFF11
-namespace HCore
-{
- ///
- /// \name NewFSImpl
- /// NewFS filesystem operations. (catalog creation, remove removal, root fork...)
- ///
+#define kFilesystemBitWidth sizeof(HCore::WideChar)
+#define kFilesystemLbaType HCore::Lba
- class NewFSImpl
- {
- public:
- explicit NewFSImpl() = default;
- virtual ~NewFSImpl() = default;
+namespace HCore {
+///
+/// \name NewFSImpl
+/// NewFS filesystem operations. (catalog creation, remove removal, root
+/// fork...)
+///
- public:
- HCORE_COPY_DEFAULT(NewFSImpl);
+class NewFSImpl {
+ public:
+ explicit NewFSImpl() = default;
+ virtual ~NewFSImpl() = default;
- virtual NewFork* ForkFrom(NewCatalog& catalog, const Int64& id) = 0;
+ public:
+ HCORE_COPY_DEFAULT(NewFSImpl);
- virtual NewCatalog* RootCatalog(void) = 0;
- virtual NewCatalog* NextCatalog(NewCatalog& cur) = 0;
- virtual NewCatalog* PrevCatalog(NewCatalog& cur) = 0;
+ virtual NewFork* ForkFrom(NewCatalog& catalog, const Int64& id) = 0;
- virtual NewCatalog* GetCatalog(const char* name) = 0;
+ virtual NewCatalog* RootCatalog(void) = 0;
+ virtual NewCatalog* NextCatalog(NewCatalog& cur) = 0;
+ virtual NewCatalog* PrevCatalog(NewCatalog& cur) = 0;
- virtual NewCatalog* CreateCatalog(const char* name, const Int32& flags, const Int32& kind) = 0;
- virtual NewCatalog* CreateCatalog(const char* name) = 0;
+ virtual NewCatalog* GetCatalog(const char* name) = 0;
- virtual bool WriteCatalog(NewCatalog& catalog, voidPtr data) = 0;
- virtual bool RemoveCatalog(NewCatalog& catalog) = 0;
+ virtual NewCatalog* CreateCatalog(const char* name, const Int32& flags,
+ const Int32& kind) = 0;
+ virtual NewCatalog* CreateCatalog(const char* name) = 0;
- virtual bool Format(DriveTraits& drive) = 0;
+ virtual bool WriteCatalog(NewCatalog& catalog, voidPtr data) = 0;
+ virtual bool RemoveCatalog(NewCatalog& catalog) = 0;
- };
-
- ///
- /// \name MeFilesystemHelper
- /// Filesystem helper and utils.
- ///
+ virtual bool Format(DriveTraits& drive) = 0;
+};
- class MeFilesystemHelper final
- {
- public:
- static const char* Root() { return kFilesystemRoot; }
- static const char* UpDir() { return kFilesystemUpDir; }
- static const char Separator() { return kFilesystemSeparator; }
+///
+/// \name MeFilesystemHelper
+/// Filesystem helper and utils.
+///
- };
-}
+class MeFilesystemHelper final {
+ public:
+ static const char* Root() { return kFilesystemRoot; }
+ static const char* UpDir() { return kFilesystemUpDir; }
+ static const char Separator() { return kFilesystemSeparator; }
+};
+} // namespace HCore
-#define kNewFSAddressAsLba 5
-#define kNewFSAddressAsCHS 6
+#define kNewFSAddressAsLba 5
+#define kNewFSAddressAsCHS 6
// FSControl() syscall
// FSOpen, FSClose, FSWhereAt, FSSetCursor, FSNodeSize, FSWrite, FSRead syscalls
-