summaryrefslogtreecommitdiffhomepage
path: root/Private/FSKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-04 10:59:24 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-04 10:59:24 +0100
commite2bbec91d70847cc5a2ff67eb84ca4a3c2d03e85 (patch)
tree1e7fec7c232b0c750157007113ce8f86d43b7e76 /Private/FSKit
parentaff54fd3dc6855b62c047f126c6fe20ca717ee0f (diff)
Kernel: Depend less on NewFS, add support for FileSystem protocol in
NewBoot. Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/FSKit')
-rw-r--r--Private/FSKit/Defines.hpp2
-rw-r--r--Private/FSKit/IndexableProperty.hxx66
-rw-r--r--Private/FSKit/NewFS.hxx36
3 files changed, 58 insertions, 46 deletions
diff --git a/Private/FSKit/Defines.hpp b/Private/FSKit/Defines.hpp
index cb0903d1..1d64be5d 100644
--- a/Private/FSKit/Defines.hpp
+++ b/Private/FSKit/Defines.hpp
@@ -11,4 +11,4 @@
#include <NewKit/Defines.hpp>
-#define FSKIT_VERSION "1.0.0" \ No newline at end of file
+#define FSKIT_VERSION "1.0.0"
diff --git a/Private/FSKit/IndexableProperty.hxx b/Private/FSKit/IndexableProperty.hxx
index 3eddf5e1..553eb945 100644
--- a/Private/FSKit/IndexableProperty.hxx
+++ b/Private/FSKit/IndexableProperty.hxx
@@ -10,39 +10,37 @@
#pragma once
#include <CFKit/Property.hpp>
+#include <CompilerKit/CompilerKit.hpp>
#include <KernelKit/DriveManager.hpp>
-namespace HCore
-{
- namespace Indexer
- {
- struct IndexProperty final
- {
- public:
- Char Drive[kDriveNameLen];
- Char Path[256];
- Char From[256];
- Char To[256];
-
- };
-
- class IndexableProperty final : public Property
- {
- public:
- explicit IndexableProperty() : Property(StringBuilder::Construct("IndexableProperty").Leak().Leak()) {}
- ~IndexableProperty() override = default;
-
- public:
- IndexProperty& LeakProperty() noexcept;
-
- public:
- void AddFlag(Int16 flag);
- void RemoveFlag(Int16 flag);
-
- private:
- IndexProperty fIndex;
- UInt32 fFlags;
-
- };
- }
-}
+namespace HCore {
+namespace Indexer {
+struct IndexProperty final {
+ public:
+ Char Drive[kDriveNameLen];
+ Char Path[256];
+ Char From[256];
+ Char To[256];
+};
+
+class IndexableProperty final : public Property {
+ public:
+ explicit IndexableProperty()
+ : Property(StringBuilder::Construct("IndexableProperty").Leak().Leak()) {}
+ ~IndexableProperty() override = default;
+
+ HCORE_COPY_DEFAULT(IndexableProperty);
+
+ public:
+ IndexProperty& LeakProperty() noexcept;
+
+ public:
+ void AddFlag(Int16 flag);
+ void RemoveFlag(Int16 flag);
+
+ private:
+ IndexProperty fIndex;
+ UInt32 fFlags;
+};
+} // namespace Indexer
+} // namespace HCore
diff --git a/Private/FSKit/NewFS.hxx b/Private/FSKit/NewFS.hxx
index 0be6ece0..d0c43f02 100644
--- a/Private/FSKit/NewFS.hxx
+++ b/Private/FSKit/NewFS.hxx
@@ -13,6 +13,13 @@
#include <KernelKit/DriveManager.hpp>
#include <NewKit/Defines.hpp>
+#include "KernelKit/FileManager.hpp"
+
+/**
+ @brief NewFS or HCFS
+ HCore FileSystem.
+*/
+
#define kInvalidFork -1
#define kInvalidCatalog -1
#define kNameLen 256
@@ -68,20 +75,26 @@ struct PACKED NewCatalog final {
HCore::Lba FirstFork;
HCore::Lba LastFork;
+
+ HCore::Lba SiblingRecords[12];
+};
+
+#define kNewFSMaxEntries 256
+
+struct PACKED NewCatalogRecord final {
+ HCore::Lba Entries[kNewFSMaxEntries];
};
struct PACKED NewFork final {
HCore::Int32 Flags;
HCore::Int32 Kind;
- HCore::Int64 ID;
-
HCore::Int64 ResourceId;
HCore::Int32 ResourceKind;
HCore::Int32 ResourceFlags;
- HCore::Lba DataOffset;
- HCore::SizeT DataSize;
+ HCore::Lba DataOffset; // Where to look for this data?
+ HCore::SizeT DataSize; // Data size according using sector count.
HCore::Lba NextSibling;
HCore::Lba PreviousSibling;
@@ -136,7 +149,8 @@ struct PACKED NewPartitionBlock final {
#define kFilesystemUpDir ".."
#define kFilesystemRoot "\\"
-#define kFilesystemLE '\r'
+#define kFilesystemCR '\r'
+#define kFilesystemLF '\n'
#define kFilesystemEOF (-1)
#define kFilesystemBitWidth sizeof(NewCharType)
@@ -176,15 +190,15 @@ class NewFSImplementation {
};
///
-/// \name MeFilesystemHelper
-/// Filesystem helper and utils.
+/// \name NewFilesystemHelper
+/// \brief Filesystem helper and utils.
///
-class MeFilesystemHelper final {
+class NewFilesystemHelper final {
public:
- static const char* Root() { return kFilesystemRoot; }
- static const char* UpDir() { return kFilesystemUpDir; }
- static const char Separator() { return kFilesystemSeparator; }
+ static const char* Root();
+ static const char* UpDir();
+ static const char Separator();
};
} // namespace HCore