diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-06-17 18:55:38 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-06-17 18:55:38 +0200 |
| commit | 8051ad2bd4af1f226a9751288957ee6af7e787d7 (patch) | |
| tree | 6438701e1ecb669f05954a3ac65bc850dab42634 /Kernel/Sources | |
| parent | e8f7e653364e4a2d48529c07b8325a8f147cf3e9 (diff) | |
MHR-31: IMP: Add setter for Name.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/Sources')
| -rw-r--r-- | Kernel/Sources/Network/NetworkDevice.cxx | 20 |
1 files changed, 19 insertions, 1 deletions
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 |
