summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Private/KernelKit/Device.hpp155
-rw-r--r--Private/KernelKit/FileManager.hpp17
-rw-r--r--ReadMe.md2
3 files changed, 94 insertions, 80 deletions
diff --git a/Private/KernelKit/Device.hpp b/Private/KernelKit/Device.hpp
index e172880b..13022896 100644
--- a/Private/KernelKit/Device.hpp
+++ b/Private/KernelKit/Device.hpp
@@ -7,88 +7,89 @@
* ========================================================
*/
+/* -------------------------------------------
+
+ Revision History:
+
+ 31/01/24: Add kDeviceCnt (amlel)
+
+ ------------------------------------------- */
+
#pragma once
/* HCore */
/* File: KernelKit/Device.hpp */
-/* Device abstraction utilities. */
+/* Device abstraction and I/O buffer. */
#include <NewKit/ErrorOr.hpp>
#include <NewKit/Ref.hpp>
-namespace HCore
-{
- template<typename T>
- class DeviceInterface;
-
- template<typename T>
- class DeviceInterface
- {
- public:
- explicit DeviceInterface(void (*Out)(T), void (*In)(T))
- : m_Out(Out), m_In(In) {}
-
- virtual ~DeviceInterface() = default;
-
- public:
- DeviceInterface &operator=(const DeviceInterface<T> &) = default;
- DeviceInterface(const DeviceInterface<T> &) = default;
-
- public:
- DeviceInterface<T>& operator<<(T Data)
- {
- m_Out(Data);
- return *this;
- }
-
- DeviceInterface<T>& operator>>(T Data)
- {
- m_In(Data);
- return *this;
- }
-
- virtual const char* Name() const { return "DeviceInterface"; }
-
- operator bool() { return m_Out && m_In; }
- bool operator!() { return !m_Out && !m_In; }
-
- private:
- void (*m_Out)(T Data);
- void (*m_In)(T Data);
-
- };
-
- template<typename T>
- class IOBuf final
- {
- public:
- explicit IOBuf(T Dat) : m_Data(Dat) {}
-
- IOBuf &operator=(const IOBuf<T> &) = default;
- IOBuf(const IOBuf<T> &) = default;
-
- ~IOBuf() = default;
-
- public:
- T operator->() const { return m_Data; }
- T &operator[](Size index) const { return m_Data[index]; }
-
- private:
- T m_Data;
-
- };
-
- ///! device types.
- enum
- {
- kDeviceIde,
- kDeviceNetwork,
- kDevicePrinter,
- kDeviceGSDB,
- kDeviceScsi,
- kDeviceSata,
- kDeviceUsb,
- kDeviceCD,
- kDeviceSwap,
- };
-} // namespace HCore
+namespace HCore {
+template <typename T>
+class DeviceInterface;
+
+template <typename T>
+class DeviceInterface {
+ public:
+ explicit DeviceInterface(void (*Out)(T), void (*In)(T))
+ : m_Out(Out), m_In(In) {}
+
+ virtual ~DeviceInterface() = default;
+
+ public:
+ DeviceInterface &operator=(const DeviceInterface<T> &) = default;
+ DeviceInterface(const DeviceInterface<T> &) = default;
+
+ public:
+ DeviceInterface<T> &operator<<(T Data) {
+ m_Out(Data);
+ return *this;
+ }
+
+ DeviceInterface<T> &operator>>(T Data) {
+ m_In(Data);
+ return *this;
+ }
+
+ virtual const char *Name() const { return "DeviceInterface"; }
+
+ operator bool() { return m_Out && m_In; }
+ bool operator!() { return !m_Out && !m_In; }
+
+ private:
+ void (*m_Out)(T Data);
+ void (*m_In)(T Data);
+};
+
+template <typename T>
+class IOBuf final {
+ public:
+ explicit IOBuf(T Dat) : m_Data(Dat) {}
+
+ IOBuf &operator=(const IOBuf<T> &) = default;
+ IOBuf(const IOBuf<T> &) = default;
+
+ ~IOBuf() = default;
+
+ public:
+ T operator->() const { return m_Data; }
+ T &operator[](Size index) const { return m_Data[index]; }
+
+ private:
+ T m_Data;
+};
+
+///! @brief Device types enum.
+enum {
+ kDeviceIde,
+ kDeviceNetwork,
+ kDevicePrinter,
+ kDeviceGSDB,
+ kDeviceScsi,
+ kDeviceSata,
+ kDeviceUsb,
+ kDeviceCD,
+ kDeviceSwap,
+ kDeviceCnt,
+};
+} // namespace HCore
diff --git a/Private/KernelKit/FileManager.hpp b/Private/KernelKit/FileManager.hpp
index 1d7c33b2..75f64373 100644
--- a/Private/KernelKit/FileManager.hpp
+++ b/Private/KernelKit/FileManager.hpp
@@ -7,6 +7,14 @@
* ========================================================
*/
+/* -------------------------------------------
+
+ Revision History:
+
+ 31/01/24: Update documentation (amlel)
+
+ ------------------------------------------- */
+
#pragma once
#include <FSKit/NewFS.hxx>
@@ -35,6 +43,10 @@ enum {
typedef VoidPtr NodePtr;
+/**
+ @brief Filesystem Manager Interface class
+ @brief Used to provide common I/O for a specific filesystem.
+*/
class IFilesystemManager {
public:
IFilesystemManager() = default;
@@ -71,10 +83,11 @@ class IFilesystemManager {
virtual bool Rewind(NodePtr node) = 0;
};
-#define kNPos (SizeT)0xFFFFFF;
+/** @brief invalid position. (n-pos) */
+#define kNPos (SizeT)(-1);
/**
- * @brief Child of IFilesystemManager, takes care of managing NewFS disks.
+ * @brief Based of IFilesystemManager, takes care of managing NewFS disks.
*/
class NewFilesystemManager final : public IFilesystemManager {
public:
diff --git a/ReadMe.md b/ReadMe.md
index 9df855e0..ea49f6d4 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -1,4 +1,4 @@
-# h-core
+# h-core (codename: SuperTrouper)
## Microkernel and it's components source code.