summaryrefslogtreecommitdiffhomepage
path: root/dev/ZKAKit/src
diff options
context:
space:
mode:
authorAmlal <amlalelmahrouss@icloud.com>2024-12-12 09:01:44 +0100
committerAmlal <amlalelmahrouss@icloud.com>2024-12-12 09:03:35 +0100
commit71ea4e60ed0b30590a48fde31a74b05e3dd14196 (patch)
treecdfccef70e20622ef1e5219e2c58fa6a2f5b30d9 /dev/ZKAKit/src
parent5bd5a930755550d4fa7cb48c51aa8f9b9f3e5bae (diff)
NeFS.h: Add new fork types in NeFS specifications.
User.h/User.cc: Did code refactors in the User class. Heap.cc: Also refactored the heap structure. Signed-off-by: Amlal <amlalelmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKAKit/src')
-rw-r--r--dev/ZKAKit/src/FS/NeFS.cc10
-rw-r--r--dev/ZKAKit/src/Heap.cc42
-rw-r--r--dev/ZKAKit/src/User.cc26
-rw-r--r--dev/ZKAKit/src/UserProcessTeam.cc12
4 files changed, 45 insertions, 45 deletions
diff --git a/dev/ZKAKit/src/FS/NeFS.cc b/dev/ZKAKit/src/FS/NeFS.cc
index f959aa45..2e0e700c 100644
--- a/dev/ZKAKit/src/FS/NeFS.cc
+++ b/dev/ZKAKit/src/FS/NeFS.cc
@@ -61,7 +61,7 @@ STATIC MountpointInterface kDiskMountpoint;
/// @return the fork
/***********************************************************************************/
_Output NFS_FORK_STRUCT* NeFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* catalog,
- _Input NFS_FORK_STRUCT& the_fork)
+ _Input NFS_FORK_STRUCT& the_fork)
{
if (catalog && the_fork.ForkName[0] != 0 &&
the_fork.DataSize <= kNeFSForkDataSz)
@@ -170,8 +170,8 @@ _Output NFS_FORK_STRUCT* NeFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* catal
/// @return the fork.
/***********************************************************************************/
_Output NFS_FORK_STRUCT* NeFSParser::FindFork(_Input NFS_CATALOG_STRUCT* catalog,
- _Input const Char* name,
- Boolean isDataFork)
+ _Input const Char* name,
+ Boolean isDataFork)
{
auto drv = kDiskMountpoint.A();
NFS_FORK_STRUCT* the_fork = nullptr;
@@ -236,7 +236,7 @@ _Output NFS_CATALOG_STRUCT* NeFSParser::CreateCatalog(_Input const Char* name)
/// @param kind the catalog kind.
/// @return catalog pointer.
/***********************************************************************************/
-_Output NFS_CATALOG_STRUCT* NeFSParser::CreateCatalog(_Input const Char* name,
+_Output NFS_CATALOG_STRUCT* NeFSParser::CreateCatalog(_Input const Char* name,
_Input const Int32& flags,
_Input const Int32& kind)
{
@@ -936,7 +936,7 @@ Boolean NeFSParser::RemoveCatalog(_Input const Char* catalogName)
VoidPtr NeFSParser::ReadCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog,
_Input Bool is_rsrc_fork,
_Input SizeT dataSz,
- _Input const Char* forkName)
+ _Input const Char* forkName)
{
if (!catalog)
{
diff --git a/dev/ZKAKit/src/Heap.cc b/dev/ZKAKit/src/Heap.cc
index 0ac0dab1..2073027e 100644
--- a/dev/ZKAKit/src/Heap.cc
+++ b/dev/ZKAKit/src/Heap.cc
@@ -46,13 +46,13 @@ namespace Kernel
Boolean fPresent : 1;
/// @brief Is this valued owned by the user?
- Boolean fWr : 1;
+ Boolean fWriteRead : 1;
/// @brief Is this valued owned by the user?
Boolean fUser : 1;
/// @brief Is this a page pointer?
- Boolean fPage : 1;
+ Boolean fPagePtr : 1;
/// @brief 32-bit CRC checksum.
UInt32 fCRC32;
@@ -134,14 +134,14 @@ namespace Kernel
reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>(
wrapper.VirtualAddress() + sizeof(Detail::HEAP_INFORMATION_BLOCK));
- heap_info_ptr->fHeapSize = sz_fix;
- heap_info_ptr->fMagic = kKernelHeapMagic;
- heap_info_ptr->fCRC32 = No; // dont fill it for now.
- heap_info_ptr->fHeapPtr = reinterpret_cast<UIntPtr>(heap_info_ptr) + sizeof(Detail::HEAP_INFORMATION_BLOCK);
- heap_info_ptr->fPage = No;
- heap_info_ptr->fWr = wr;
- heap_info_ptr->fUser = user;
- heap_info_ptr->fPresent = Yes;
+ heap_info_ptr->fHeapSize = sz_fix;
+ heap_info_ptr->fMagic = kKernelHeapMagic;
+ heap_info_ptr->fCRC32 = No; // dont fill it for now.
+ heap_info_ptr->fHeapPtr = reinterpret_cast<UIntPtr>(heap_info_ptr) + sizeof(Detail::HEAP_INFORMATION_BLOCK);
+ heap_info_ptr->fPagePtr = No;
+ heap_info_ptr->fWriteRead = wr;
+ heap_info_ptr->fUser = user;
+ heap_info_ptr->fPresent = Yes;
rt_set_memory(heap_info_ptr->fPadding, 0, kKernelHeapAlignSz);
@@ -164,10 +164,10 @@ namespace Kernel
reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>(
(UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK));
- if (!heap_ptr)
+ if (!heap_info_ptr)
return kErrorHeapNotPresent;
- heap_info_ptr->fPage = true;
+ heap_info_ptr->fPagePtr = true;
kcout << "Created page address: " << hex_number(reinterpret_cast<UIntPtr>(heap_info_ptr)) << endl;
@@ -186,7 +186,7 @@ namespace Kernel
reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>(
(UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK));
- if (!heap_ptr)
+ if (!heap_info_ptr)
return kErrorHeapNotPresent;
heap_info_ptr->fFlags = flags;
@@ -202,7 +202,7 @@ namespace Kernel
reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>(
(UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK));
- if (!heap_ptr)
+ if (!heap_info_ptr)
return kErrorHeapNotPresent;
return heap_info_ptr->fFlags;
@@ -240,13 +240,13 @@ namespace Kernel
}
}
- heap_info_ptr->fHeapSize = 0UL;
- heap_info_ptr->fPresent = No;
- heap_info_ptr->fHeapPtr = 0;
- heap_info_ptr->fCRC32 = 0;
- heap_info_ptr->fWr = No;
- heap_info_ptr->fUser = No;
- heap_info_ptr->fMagic = 0;
+ heap_info_ptr->fHeapSize = 0UL;
+ heap_info_ptr->fPresent = No;
+ heap_info_ptr->fHeapPtr = 0;
+ heap_info_ptr->fCRC32 = 0;
+ heap_info_ptr->fWriteRead = No;
+ heap_info_ptr->fUser = No;
+ heap_info_ptr->fMagic = 0;
PTEWrapper pageWrapper(No, No, No, reinterpret_cast<UIntPtr>(heap_info_ptr) - sizeof(Detail::HEAP_INFORMATION_BLOCK));
Ref<PTEWrapper> pteAddress{pageWrapper};
diff --git a/dev/ZKAKit/src/User.cc b/dev/ZKAKit/src/User.cc
index c00048c3..6c4c2a32 100644
--- a/dev/ZKAKit/src/User.cc
+++ b/dev/ZKAKit/src/User.cc
@@ -46,7 +46,7 @@ namespace Kernel
password[i_pass] = cur_chr | (user->IsStdUser() ? kStdUserType : kSuperUserType);
}
- kcout << "Done hashing user password!\r";
+ kcout << "DONE: hashed user password.\r";
return 0;
}
@@ -54,23 +54,23 @@ namespace Kernel
/// @brief User ring constructor.
User::User(const Int32& sel, const Char* userName)
- : fRing((UserRingKind)sel)
+ : mUserRing((UserRingKind)sel)
{
MUST_PASS(sel >= 0);
- rt_copy_memory((VoidPtr)userName, this->fUserName, rt_string_len(userName));
+ rt_copy_memory((VoidPtr)userName, this->mUserName, rt_string_len(userName));
}
/// @brief User ring constructor.
User::User(const UserRingKind& ringKind, const Char* userName)
- : fRing(ringKind)
+ : mUserRing(ringKind)
{
- rt_copy_memory((VoidPtr)userName, this->fUserName, rt_string_len(userName));
+ rt_copy_memory((VoidPtr)userName, this->mUserName, rt_string_len(userName));
}
/// @brief User destructor class.
User::~User() = default;
- Bool User::Save(const UserPublicKey password_to_fill) noexcept
+ Bool User::Save(const usr_public_key_kind password_to_fill) noexcept
{
if (!password_to_fill ||
*password_to_fill == 0)
@@ -96,7 +96,7 @@ namespace Kernel
// then store password.
- rt_copy_memory(password, this->fUserToken, rt_string_len(password_to_fill));
+ rt_copy_memory(password, this->mUserToken, rt_string_len(password_to_fill));
delete[] password;
password = nullptr;
@@ -106,7 +106,7 @@ namespace Kernel
return Yes;
}
- Bool User::Matches(const UserPublicKey password_to_fill) noexcept
+ Bool User::Matches(const usr_public_key_kind password_to_fill) noexcept
{
if (!password_to_fill ||
*password_to_fill)
@@ -133,7 +133,7 @@ namespace Kernel
kcout << "Validating hashed passwords...\r";
// now check if the password matches.
- if (rt_string_cmp(password, this->fUserToken, rt_string_len(this->fUserToken)) == 0)
+ if (rt_string_cmp(password, this->mUserToken, rt_string_len(this->mUserToken)) == 0)
{
kcout << "Password is valid.\r";
return Yes;
@@ -145,24 +145,24 @@ namespace Kernel
Bool User::operator==(const User& lhs)
{
- return lhs.fRing == this->fRing;
+ return lhs.mUserRing == this->mUserRing;
}
Bool User::operator!=(const User& lhs)
{
- return lhs.fRing != this->fRing;
+ return lhs.mUserRing != this->mUserRing;
}
Char* User::Name() noexcept
{
- return this->fUserName;
+ return this->mUserName;
}
/// @brief Returns the user's ring.
/// @return The king of ring the user is attached to.
const UserRingKind& User::Ring() noexcept
{
- return this->fRing;
+ return this->mUserRing;
}
Bool User::IsStdUser() noexcept
diff --git a/dev/ZKAKit/src/UserProcessTeam.cc b/dev/ZKAKit/src/UserProcessTeam.cc
index be28b93d..d7f7d966 100644
--- a/dev/ZKAKit/src/UserProcessTeam.cc
+++ b/dev/ZKAKit/src/UserProcessTeam.cc
@@ -6,7 +6,7 @@
/***********************************************************************************/
/// @file UserProcessTeam.cc
-/// @brief UserProcess teams implementation.
+/// @brief Process teams implementation.
/***********************************************************************************/
#include <KernelKit/UserProcessScheduler.h>
@@ -15,9 +15,9 @@ namespace Kernel
{
UserProcessTeam::UserProcessTeam()
{
- for (SizeT i = 0U; i < mProcessList.Count(); ++i)
+ for (SizeT i = 0U; i < this->mProcessList.Count(); ++i)
{
- mProcessList[i] = nullptr;
+ this->mProcessList[i] = nullptr;
}
}
@@ -28,7 +28,7 @@ namespace Kernel
Array<UserProcess*, kSchedProcessLimitPerTeam>& UserProcessTeam::AsArray()
{
- return mProcessList;
+ return this->mProcessList;
}
/***********************************************************************************/
@@ -38,7 +38,7 @@ namespace Kernel
ProcessID& UserProcessTeam::Id() noexcept
{
- return mTeamId;
+ return this->mTeamId;
}
/***********************************************************************************/
@@ -48,7 +48,7 @@ namespace Kernel
Ref<UserProcess>& UserProcessTeam::AsRef()
{
- return mCurrentProcess;
+ return this->mCurrentProcess;
}
} // namespace Kernel