diff options
Diffstat (limited to 'dev/Kernel')
| -rw-r--r-- | dev/Kernel/HALKit/AMD64/HalDebugOutput.cc | 4 | ||||
| -rw-r--r-- | dev/Kernel/HALKit/AMD64/Storage/AHCI.cc | 82 | ||||
| -rw-r--r-- | dev/Kernel/HALKit/AMD64/Storage/DMA.cc | 18 | ||||
| -rw-r--r-- | dev/Kernel/HALKit/AMD64/Storage/PIO.cc | 2 | ||||
| -rw-r--r-- | dev/Kernel/KernelKit/DebugOutput.h | 2 | ||||
| -rw-r--r-- | dev/Kernel/KernelKit/DeviceMgr.h | 12 | ||||
| -rw-r--r-- | dev/Kernel/KernelKit/User.h | 1 | ||||
| -rw-r--r-- | dev/Kernel/NetworkKit/NetworkDevice.h | 4 | ||||
| -rw-r--r-- | dev/Kernel/NetworkKit/NetworkDevice.inl | 4 | ||||
| -rw-r--r-- | dev/Kernel/StorageKit/AHCI.h | 23 | ||||
| -rw-r--r-- | dev/Kernel/StorageKit/ATA.h | 4 | ||||
| -rw-r--r-- | dev/Kernel/StorageKit/NVME.h | 4 | ||||
| -rw-r--r-- | dev/Kernel/src/Storage/AHCIDeviceInterface.cc | 11 | ||||
| -rw-r--r-- | dev/Kernel/src/Storage/ATADeviceInterface.cc | 6 | ||||
| -rw-r--r-- | dev/Kernel/src/Storage/NVMEDeviceInterface.cc | 6 | ||||
| -rw-r--r-- | dev/Kernel/src/User.cc | 17 |
16 files changed, 137 insertions, 63 deletions
diff --git a/dev/Kernel/HALKit/AMD64/HalDebugOutput.cc b/dev/Kernel/HALKit/AMD64/HalDebugOutput.cc index dfdf52f1..ba4e4a7c 100644 --- a/dev/Kernel/HALKit/AMD64/HalDebugOutput.cc +++ b/dev/Kernel/HALKit/AMD64/HalDebugOutput.cc @@ -63,7 +63,7 @@ namespace NeOS TerminalDevice::~TerminalDevice() = default; - EXTERN_C void ke_io_write(const Char* bytes) + EXTERN_C void ke_io_write(IDeviceObject<const Char*>* obj, const Char* bytes) { #ifdef __DEBUG__ Detail::hal_serial_init<Detail::kPort>(); @@ -138,7 +138,7 @@ namespace NeOS #endif // __DEBUG__ } - EXTERN_C void ke_io_read(const Char* bytes) + EXTERN_C void ke_io_read(IDeviceObject<const Char*>*, const Char* bytes) { #ifdef __DEBUG__ Detail::hal_serial_init<Detail::kPort>(); diff --git a/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc b/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc index 8334de7e..ba1b7223 100644 --- a/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc +++ b/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc @@ -15,6 +15,8 @@ * */ +#include <KernelKit/DeviceMgr.h> +#include <KernelKit/DriveMgr.h> #include <KernelKit/UserProcessScheduler.h> #include <KernelKit/LPC.h> @@ -24,7 +26,7 @@ #include <NewKit/Utils.h> #include <KernelKit/LockDelegate.h> -#ifdef __AHCI__ +#include <StorageKit/AHCI.h> #define kHBAErrTaskFile (1 << 30) #define kHBAPxCmdST (0x0001) @@ -39,9 +41,11 @@ #define kSATAPortCnt (0x20) +#define kSATASig (0x00000101) + #define kSATAProgIfAHCI (0x01) -#define kSATASubClass (0x06) -#define kSATABar5 (0x24) +#define kSATASubClass (0x06) +#define kSATABar5 (0x24) using namespace NeOS; @@ -50,7 +54,7 @@ STATIC Void drv_std_input_output(UInt64 lba, UInt8* buffer, SizeT sector_sz, Siz STATIC Int32 drv_find_cmd_slot(HbaPort* port) noexcept; -STATIC Void drv_calculate_disk_geometry() noexcept; +STATIC Void drv_compute_disk_ahci() noexcept; STATIC PCI::Device kPCIDevice; STATIC HbaMem* kSATA = nullptr; @@ -59,7 +63,7 @@ STATIC Lba kHighestLBA = 0UL; BOOL kAHCICommandIssued = NO; -STATIC Void drv_calculate_disk_geometry() noexcept +STATIC Void drv_compute_disk_ahci() noexcept { kHighestLBA = 0UL; @@ -175,7 +179,7 @@ STATIC Void drv_std_input_output(UInt64 lba, UInt8* buffer, SizeT sector_sz, Siz @brief Gets the number of sectors inside the drive. @return Sector size in bytes. */ -SizeT drv_get_sector_count() +SizeT drv_get_sector_count_ahci() { MUST_PASS(kHighestLBA > 0); return kHighestLBA; @@ -183,7 +187,7 @@ SizeT drv_get_sector_count() /// @brief Get the drive size. /// @return Disk size in bytes. -SizeT drv_get_size() +SizeT drv_get_size_ahci() { return drv_get_sector_count() * kAHCISectorSize; } @@ -191,7 +195,7 @@ SizeT drv_get_size() /// @brief Initializes an AHCI disk. /// @param pi the amount of ports that have been detected. /// @return if the disk was successfully initialized or not. -Bool drv_std_init(UInt16& pi) +Bool drv_std_init_ahci(UInt16& pi) { PCI::Iterator iterator(Types::PciDeviceKind::MassStorageController); @@ -211,7 +215,7 @@ Bool drv_std_init(UInt16& pi) UInt16 ahci_index = 0; const UInt16 kMaxPortsImplemented = kSATAPortCnt; - const UInt32 kSATASignature = 0x00000101; + const UInt32 kSATASignature = kSATASig; const UInt8 kSATAPresent = 0x03; const UInt8 kSATAIPMActive = 0x01; @@ -226,12 +230,10 @@ Bool drv_std_init(UInt16& pi) if (mem_ahci->Ports[ahci_index].Sig == kSATASignature && det == kSATAPresent && ipm == kSATAIPMActive) { - kout << "SATA port found.\r"; - kSATAIndex = ahci_index; kSATA = mem_ahci; - drv_calculate_disk_geometry(); + drv_compute_disk_ahci(); detected = YES; @@ -252,9 +254,41 @@ Bool drv_std_init(UInt16& pi) return No; } +Bool drv_std_detected_ahci() +{ + return kPCIDevice.DeviceId() != (UShort)PCI::PciConfigKind::Invalid && kPCIDevice.Bar(kSATABar5) != 0; +} + +ErrorOr<AHCIDeviceInterface> sk_acquire_ahci_device(Int32 drv_index) +{ + UInt16 pi = 0; + + if (!drv_std_init_ahci(pi)) + return ErrorOr<AHCIDeviceInterface>(kErrorDisk); + + AHCIDeviceInterface device([](IDeviceObject<MountpointInterface*>* self, MountpointInterface* mnt) -> void { + AHCIDeviceInterface* dev = (AHCIDeviceInterface*)self; + + auto disk = mnt->GetAddressOf(dev->fDriveIndex); + drv_std_input_output<YES, YES, NO>(disk->fPacket.fPacketLba, (UInt8*)disk->fPacket.fPacketContent, kAHCISectorSize, disk->fPacket.fPacketSize); + }, + [](IDeviceObject<MountpointInterface*>* self, MountpointInterface* mnt) -> void { + AHCIDeviceInterface* dev = (AHCIDeviceInterface*)self; + + auto disk = mnt->GetAddressOf(dev->fDriveIndex); + drv_std_input_output<NO, YES, NO>(disk->fPacket.fPacketLba, (UInt8*)disk->fPacket.fPacketContent, kAHCISectorSize, disk->fPacket.fPacketSize); + }, nullptr); + + device.SetPi(pi); + + return ErrorOr<AHCIDeviceInterface>(device); +} + +#ifdef __AHCI__ + Bool drv_std_detected(Void) { - return kPCIDevice.DeviceId() != (UShort)PCI::PciConfigKind::Invalid; + drv_std_detected_ahci(); } Void drv_std_write(UInt64 lba, Char* buffer, SizeT sector_sz, SizeT size_buffer) @@ -262,9 +296,29 @@ Void drv_std_write(UInt64 lba, Char* buffer, SizeT sector_sz, SizeT size_buffer) drv_std_input_output<YES, YES, NO>(lba, (UInt8*)buffer, sector_sz, size_buffer); } +Bool drv_std_init(UInt16& pi) +{ + return drv_std_init_ahci(pi); +} + Void drv_std_read(UInt64 lba, Char* buffer, SizeT sector_sz, SizeT size_buffer) { drv_std_input_output<NO, YES, NO>(lba, (UInt8*)buffer, sector_sz, size_buffer); } -#endif // ifdef __AHCI__
\ No newline at end of file +/*** + @brief Gets the number of sectors inside the drive. + @return Sector size in bytes. + */ +SizeT drv_get_sector_count() +{ + return drv_get_sector_count_ahci(); +} + +/// @brief Get the drive size. +/// @return Disk size in bytes. +SizeT drv_get_size() +{ + return drv_get_size_ahci(); +} +#endif // ifdef __AHCI__ diff --git a/dev/Kernel/HALKit/AMD64/Storage/DMA.cc b/dev/Kernel/HALKit/AMD64/Storage/DMA.cc index eafd86fa..a4190065 100644 --- a/dev/Kernel/HALKit/AMD64/Storage/DMA.cc +++ b/dev/Kernel/HALKit/AMD64/Storage/DMA.cc @@ -32,7 +32,7 @@ STATIC Boolean kATADetected = false; STATIC Int32 kATADeviceType = kATADeviceCount; STATIC Char kATAData[kATADataLen] = {0}; STATIC NeOS::PCI::Device kATADevice; -STATIC Char kCurrentDiskModel[50] = {"UNKNOWN ATA DRIVE"}; +STATIC Char kCurrentDiskModel[50] = {"UNKNOWN DMA DRIVE"}; Boolean drv_std_wait_io(UInt16 IO) { @@ -40,18 +40,18 @@ Boolean drv_std_wait_io(UInt16 IO) rt_in8(IO + ATA_REG_STATUS); ATAWaitForIO_Retry: - auto statRdy = rt_in8(IO + ATA_REG_STATUS); + auto status_rdy = rt_in8(IO + ATA_REG_STATUS); - if ((statRdy & ATA_SR_BSY)) + if ((status_rdy & ATA_SR_BSY)) goto ATAWaitForIO_Retry; ATAWaitForIO_Retry2: - statRdy = rt_in8(IO + ATA_REG_STATUS); + status_rdy = rt_in8(IO + ATA_REG_STATUS); - if (statRdy & ATA_SR_ERR) + if (status_rdy & ATA_SR_ERR) return false; - if (!(statRdy & ATA_SR_DRDY)) + if (!(status_rdy & ATA_SR_DRDY)) goto ATAWaitForIO_Retry2; return true; @@ -85,14 +85,14 @@ Boolean drv_std_init(UInt16 Bus, UInt8 Drive, UInt16& OutBus, UInt8& OutMaster) // identify until it's good. ATAInit_Retry: - auto statRdy = rt_in8(IO + ATA_REG_STATUS); + auto status_rdy = rt_in8(IO + ATA_REG_STATUS); - if (statRdy & ATA_SR_ERR) + if (status_rdy & ATA_SR_ERR) { return false; } - if ((statRdy & ATA_SR_BSY)) + if ((status_rdy & ATA_SR_BSY)) goto ATAInit_Retry; rt_out8(IO + ATA_REG_COMMAND, ATA_CMD_IDENTIFY); diff --git a/dev/Kernel/HALKit/AMD64/Storage/PIO.cc b/dev/Kernel/HALKit/AMD64/Storage/PIO.cc index 2563738a..96232e4b 100644 --- a/dev/Kernel/HALKit/AMD64/Storage/PIO.cc +++ b/dev/Kernel/HALKit/AMD64/Storage/PIO.cc @@ -30,7 +30,7 @@ using namespace NeOS::HAL; STATIC Boolean kATADetected = false; STATIC Int32 kATADeviceType = kATADeviceCount; STATIC Char kATAData[kATADataLen] = {0}; -STATIC Char kCurrentDiskModel[50] = {"UNKNOWN ATA DRIVE"}; +STATIC Char kCurrentDiskModel[50] = {"UNKNOWN PIO DRIVE"}; Boolean drv_std_wait_io(UInt16 IO) { diff --git a/dev/Kernel/KernelKit/DebugOutput.h b/dev/Kernel/KernelKit/DebugOutput.h index 498b2b6b..84a2d514 100644 --- a/dev/Kernel/KernelKit/DebugOutput.h +++ b/dev/Kernel/KernelKit/DebugOutput.h @@ -38,7 +38,7 @@ namespace NeOS class TerminalDevice final NE_DEVICE<const Char*> { public: - TerminalDevice(void (*print)(const Char*), void (*gets)(const Char*)) + TerminalDevice(void (*print)(IDeviceObject*, const Char*), void (*gets)(IDeviceObject*, const Char*)) : IDeviceObject<const Char*>(print, gets) { } diff --git a/dev/Kernel/KernelKit/DeviceMgr.h b/dev/Kernel/KernelKit/DeviceMgr.h index 34ca2957..a81a6586 100644 --- a/dev/Kernel/KernelKit/DeviceMgr.h +++ b/dev/Kernel/KernelKit/DeviceMgr.h @@ -40,7 +40,7 @@ namespace NeOS class IDeviceObject { public: - explicit IDeviceObject(void (*Out)(T), void (*In)(T)) + explicit IDeviceObject(void (*Out)(IDeviceObject<T>*, T), void (*In)(IDeviceObject<T>*, T)) : fOut(Out), fIn(In) { } @@ -54,19 +54,19 @@ namespace NeOS public: virtual IDeviceObject<T>& operator<<(T Data) { - fOut(Data); + fOut(this, Data); return *this; } virtual IDeviceObject<T>& operator>>(T Data) { - fIn(Data); + fIn(this, Data); return *this; } virtual const char* Name() const { - return "IDeviceObject"; + return "/dev/null"; } operator bool() @@ -80,8 +80,8 @@ namespace NeOS } protected: - Void (*fOut)(T Data) = {nullptr}; - Void (*fIn)(T Data) = {nullptr}; + Void (*fOut)(IDeviceObject<T>*, T Data) = {nullptr}; + Void (*fIn)(IDeviceObject<T>*, T Data) = {nullptr}; }; /// diff --git a/dev/Kernel/KernelKit/User.h b/dev/Kernel/KernelKit/User.h index 41cf57e2..76493224 100644 --- a/dev/Kernel/KernelKit/User.h +++ b/dev/Kernel/KernelKit/User.h @@ -37,6 +37,7 @@ namespace NeOS }; typedef Char* UserPublicKey; + typedef Char UserPublicKeyType; /// @brief User class. class User final diff --git a/dev/Kernel/NetworkKit/NetworkDevice.h b/dev/Kernel/NetworkKit/NetworkDevice.h index c90addf1..c95573f3 100644 --- a/dev/Kernel/NetworkKit/NetworkDevice.h +++ b/dev/Kernel/NetworkKit/NetworkDevice.h @@ -23,8 +23,8 @@ namespace NeOS class NetworkDevice final : public IDeviceObject<NetworkDeviceCommand> { public: - NetworkDevice(void (*out)(NetworkDeviceCommand), - void (*in)(NetworkDeviceCommand), + NetworkDevice(void (*out)(IDeviceObject<NetworkDeviceCommand>*, NetworkDeviceCommand), + void (*in)(IDeviceObject<NetworkDeviceCommand>*, NetworkDeviceCommand), void (*onCleanup)(void) = nullptr); ~NetworkDevice() override; diff --git a/dev/Kernel/NetworkKit/NetworkDevice.inl b/dev/Kernel/NetworkKit/NetworkDevice.inl index 74298a22..dceae66e 100644 --- a/dev/Kernel/NetworkKit/NetworkDevice.inl +++ b/dev/Kernel/NetworkKit/NetworkDevice.inl @@ -10,8 +10,8 @@ namespace NeOS { - NetworkDevice::NetworkDevice(void (*out)(NetworkDeviceCommand), - void (*in)(NetworkDeviceCommand), + NetworkDevice::NetworkDevice(void (*out)(IDeviceObject<NetworkDeviceCommand>*, NetworkDeviceCommand), + void (*in)(IDeviceObject<NetworkDeviceCommand>*, NetworkDeviceCommand), void (*on_cleanup)(void)) : IDeviceObject<NetworkDeviceCommand>(out, in), fCleanup(on_cleanup) { diff --git a/dev/Kernel/StorageKit/AHCI.h b/dev/Kernel/StorageKit/AHCI.h index 6adab614..13edf524 100644 --- a/dev/Kernel/StorageKit/AHCI.h +++ b/dev/Kernel/StorageKit/AHCI.h @@ -15,11 +15,11 @@ namespace NeOS class AHCIDeviceInterface NE_DEVICE<MountpointInterface*> { public: - explicit AHCIDeviceInterface(void (*Out)(MountpointInterface* outpacket), - void (*In)(MountpointInterface* inpacket), - void (*Cleanup)(void)); + explicit AHCIDeviceInterface(void (*out)(IDeviceObject* self, MountpointInterface* out), + void (*in)(IDeviceObject* self, MountpointInterface* in), + void (*cleanup)(void)); - virtual ~AHCIDeviceInterface(); + virtual ~AHCIDeviceInterface() override; public: AHCIDeviceInterface& operator=(const AHCIDeviceInterface&) = default; @@ -27,7 +27,20 @@ namespace NeOS const Char* Name() const override; + const UInt16& GetPi() { return this->fPortsImplemented; } + + Void SetPi(const UInt16& pi) { MUST_PASS(pi > 0); this->fPortsImplemented = pi; } + + private: + Void (*fCleanup)(Void) = {nullptr}; + private: - void (*fCleanup)(void) = {nullptr}; + UInt16 fPortsImplemented{0U}; + + public: + UInt32 fDriveIndex{0U}; + }; + + AHCIDeviceInterface sk_acquire_ahci_device(Int32 drv_index); } // namespace NeOS diff --git a/dev/Kernel/StorageKit/ATA.h b/dev/Kernel/StorageKit/ATA.h index 0de90897..5698fe85 100644 --- a/dev/Kernel/StorageKit/ATA.h +++ b/dev/Kernel/StorageKit/ATA.h @@ -17,8 +17,8 @@ namespace NeOS class ATADeviceInterface : public IDeviceObject<MountpointInterface*> { public: - explicit ATADeviceInterface(void (*Out)(MountpointInterface* outpacket), - void (*In)(MountpointInterface* inpacket), + explicit ATADeviceInterface(void (*Out)(IDeviceObject*, MountpointInterface* outpacket), + void (*In)(IDeviceObject*, MountpointInterface* inpacket), void (*Cleanup)(void)); virtual ~ATADeviceInterface(); diff --git a/dev/Kernel/StorageKit/NVME.h b/dev/Kernel/StorageKit/NVME.h index 6b7cc1fd..22300726 100644 --- a/dev/Kernel/StorageKit/NVME.h +++ b/dev/Kernel/StorageKit/NVME.h @@ -14,8 +14,8 @@ namespace NeOS class NVMEDeviceInterface final NE_DEVICE<MountpointInterface*> { public: - explicit NVMEDeviceInterface(Void (*out)(MountpointInterface* out_packet), - Void (*in)(MountpointInterface* in_packet), + explicit NVMEDeviceInterface(Void (*out)(IDeviceObject*, MountpointInterface* out_packet), + Void (*in)(IDeviceObject*, MountpointInterface* in_packet), Void (*cleanup)(Void)); ~NVMEDeviceInterface() override; diff --git a/dev/Kernel/src/Storage/AHCIDeviceInterface.cc b/dev/Kernel/src/Storage/AHCIDeviceInterface.cc index a6f36731..ff348f57 100644 --- a/dev/Kernel/src/Storage/AHCIDeviceInterface.cc +++ b/dev/Kernel/src/Storage/AHCIDeviceInterface.cc @@ -12,10 +12,10 @@ using namespace NeOS; /// @param Out Drive output /// @param In Drive input /// @param Cleanup Drive cleanup. -AHCIDeviceInterface::AHCIDeviceInterface(void (*Out)(MountpointInterface* outpacket), - void (*In)(MountpointInterface* inpacket), - void (*Cleanup)(void)) - : IDeviceObject(Out, In), fCleanup(Cleanup) +AHCIDeviceInterface::AHCIDeviceInterface(void (*out)(IDeviceObject* self, MountpointInterface* outpacket), + void (*in)(IDeviceObject* self, MountpointInterface* inpacket), + void (*cleanup)(void)) + : IDeviceObject(out, in), fCleanup(cleanup) { } @@ -23,6 +23,7 @@ AHCIDeviceInterface::AHCIDeviceInterface(void (*Out)(MountpointInterface* outpac AHCIDeviceInterface::~AHCIDeviceInterface() { MUST_PASS(fCleanup); + if (fCleanup) fCleanup(); } @@ -31,5 +32,5 @@ AHCIDeviceInterface::~AHCIDeviceInterface() /// @return it's name as a string. const Char* AHCIDeviceInterface::Name() const { - return "AHCIDeviceInterface"; + return "/dev/sda{}"; } diff --git a/dev/Kernel/src/Storage/ATADeviceInterface.cc b/dev/Kernel/src/Storage/ATADeviceInterface.cc index 4223e9f9..9f1a0068 100644 --- a/dev/Kernel/src/Storage/ATADeviceInterface.cc +++ b/dev/Kernel/src/Storage/ATADeviceInterface.cc @@ -13,8 +13,8 @@ using namespace NeOS; /// @param In Drive input /// @param Cleanup Drive cleanup. ATADeviceInterface::ATADeviceInterface( - void (*Out)(MountpointInterface* outpacket), - void (*In)(MountpointInterface* inpacket), + void (*Out)(IDeviceObject*, MountpointInterface* outpacket), + void (*In)(IDeviceObject*, MountpointInterface* inpacket), void (*Cleanup)(void)) : IDeviceObject(Out, In), fCleanup(Cleanup) { @@ -32,7 +32,7 @@ ATADeviceInterface::~ATADeviceInterface() /// @return it's name as a string. const Char* ATADeviceInterface::Name() const { - return "ATADeviceInterface"; + return "/dev/hda{}"; } /// @brief Output operator. diff --git a/dev/Kernel/src/Storage/NVMEDeviceInterface.cc b/dev/Kernel/src/Storage/NVMEDeviceInterface.cc index 7884ce99..3e2c2c53 100644 --- a/dev/Kernel/src/Storage/NVMEDeviceInterface.cc +++ b/dev/Kernel/src/Storage/NVMEDeviceInterface.cc @@ -8,8 +8,8 @@ namespace NeOS { - NVMEDeviceInterface::NVMEDeviceInterface(void (*out)(MountpointInterface* outpacket), - void (*in)(MountpointInterface* inpacket), + NVMEDeviceInterface::NVMEDeviceInterface(void (*out)(IDeviceObject*, MountpointInterface* outpacket), + void (*in)(IDeviceObject*, MountpointInterface* inpacket), void (*cleanup)(void)) : IDeviceObject(out, in), fCleanup(cleanup) { @@ -23,6 +23,6 @@ namespace NeOS const Char* NVMEDeviceInterface::Name() const { - return ("NVMEDeviceInterface"); + return ("/dev/nvme{}"); } } // namespace NeOS diff --git a/dev/Kernel/src/User.cc b/dev/Kernel/src/User.cc index 0dfc410e..5bf6ec79 100644 --- a/dev/Kernel/src/User.cc +++ b/dev/Kernel/src/User.cc @@ -57,20 +57,20 @@ namespace NeOS //////////////////////////////////////////////////////////// /// @brief User ring constructor. //////////////////////////////////////////////////////////// - User::User(const Int32& sel, const Char* userName) + User::User(const Int32& sel, const Char* user_name) : mUserRing((UserRingKind)sel) { MUST_PASS(sel >= 0); - rt_copy_memory((VoidPtr)userName, this->mUserName, rt_string_len(userName)); + rt_copy_memory((VoidPtr)user_name, this->mUserName, rt_string_len(user_name)); } //////////////////////////////////////////////////////////// /// @brief User ring constructor. //////////////////////////////////////////////////////////// - User::User(const UserRingKind& ringKind, const Char* userName) - : mUserRing(ringKind) + User::User(const UserRingKind& ring_kind, const Char* user_name) + : mUserRing(ring_kind) { - rt_copy_memory((VoidPtr)userName, this->mUserName, rt_string_len(userName)); + rt_copy_memory((VoidPtr)user_name, this->mUserName, rt_string_len(user_name)); } //////////////////////////////////////////////////////////// @@ -86,9 +86,12 @@ namespace NeOS SizeT len = rt_string_len(password_to_fill); - Char* password = new Char[len]; + UserPublicKey password = new UserPublicKeyType[len]; + MUST_PASS(password); + rt_set_memory(password, 0, len); + // fill data first, generate hash. // return false on error. @@ -161,7 +164,9 @@ namespace NeOS return lhs.mUserRing != this->mUserRing; } + //////////////////////////////////////////////////////////// /// @brief Returns the user's name. + //////////////////////////////////////////////////////////// Char* User::Name() noexcept { |
