summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-06-17 18:55:38 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-06-17 18:55:38 +0200
commit8051ad2bd4af1f226a9751288957ee6af7e787d7 (patch)
tree6438701e1ecb669f05954a3ac65bc850dab42634
parente8f7e653364e4a2d48529c07b8325a8f147cf3e9 (diff)
MHR-31: IMP: Add setter for Name.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
-rw-r--r--Drv/GSMDrv/GSMDrv.c6
-rw-r--r--Drv/VideoDrv/VideoDrv.c4
-rw-r--r--Kernel/NetworkKit/NetworkDevice.hpp9
-rw-r--r--Kernel/Sources/Network/NetworkDevice.cxx20
4 files changed, 32 insertions, 7 deletions
diff --git a/Drv/GSMDrv/GSMDrv.c b/Drv/GSMDrv/GSMDrv.c
index 791c0678..1b7cfed6 100644
--- a/Drv/GSMDrv/GSMDrv.c
+++ b/Drv/GSMDrv/GSMDrv.c
@@ -7,7 +7,8 @@
#include <DDK/KernelString.h>
#include <DDK/KernelPrint.h>
-int __ImageStart(void)
+/// @brief GSM entrypoint.
+int __at_enter(void)
{
kernelPrintStr("GSMDrv: Starting up...\r");
@@ -16,7 +17,8 @@ int __ImageStart(void)
return 0;
}
-int __ImageEnd(void)
+/// @brief GSM 'atexit' function.
+int __at_exit(void)
{
kernelPrintStr("GSMDrv: Shutting down...\r");
return 0;
diff --git a/Drv/VideoDrv/VideoDrv.c b/Drv/VideoDrv/VideoDrv.c
index 3ba104d6..fc79d2a0 100644
--- a/Drv/VideoDrv/VideoDrv.c
+++ b/Drv/VideoDrv/VideoDrv.c
@@ -9,13 +9,13 @@
#include <Builtins/GX/GX>
-int __ImageStart(void)
+int __at_enter(void)
{
kernelPrintStr("VideoDrv: Starting up...\r");
return 0;
}
-int __ImageEnd(void)
+int __at_exit(void)
{
kernelPrintStr("VideoDrv: Shutting down...\r");
return 0;
diff --git a/Kernel/NetworkKit/NetworkDevice.hpp b/Kernel/NetworkKit/NetworkDevice.hpp
index 20c2a66a..4ea98e4f 100644
--- a/Kernel/NetworkKit/NetworkDevice.hpp
+++ b/Kernel/NetworkKit/NetworkDevice.hpp
@@ -35,12 +35,17 @@ namespace NewOS
public:
const char* Name() const override;
+ Boolean Name(const char* strView);
private:
- void (*fCleanup)(void);
+ constexpr auto cNetworkNameLen = 512;
+
+ Void (*fCleanup)(void);
+ Char fNetworkName[cNetworkNameLen];
+
};
- struct PACKED NetworkDeviceCommand final
+ struct NetworkDeviceCommand final
{
UInt32 CommandName;
UInt32 CommandType;
diff --git a/Kernel/Sources/Network/NetworkDevice.cxx b/Kernel/Sources/Network/NetworkDevice.cxx
index 511246c7..e1994baa 100644
--- a/Kernel/Sources/Network/NetworkDevice.cxx
+++ b/Kernel/Sources/Network/NetworkDevice.cxx
@@ -8,8 +8,26 @@
namespace NewOS
{
+ /// \brief Getter for fNetworkName.
const char* NetworkDevice::Name() const
{
- return "NetworkDevice";
+ return this->fNetworkName;
+ }
+
+ /// \brief Setter for fNetworkName.
+ Boolean NetworkDevice::Name(const char* strView)
+ {
+ if (strView == nullptr)
+ return false;
+
+ if (*strView == 0)
+ return false;
+
+ if (rt_string_len(strView) > cNetworkNameLen)
+ return false;
+
+ rt_copy_memory(strView, this->fNetworkName, rt_string_len(strView));
+
+ return true;
}
} // namespace NewOS