summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/KernelKit
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/KernelKit')
-rw-r--r--src/kernel/KernelKit/FileMgr.h1
-rw-r--r--src/kernel/KernelKit/Semaphore.h40
-rw-r--r--src/kernel/KernelKit/ThreadLocalStorage.inl2
3 files changed, 21 insertions, 22 deletions
diff --git a/src/kernel/KernelKit/FileMgr.h b/src/kernel/KernelKit/FileMgr.h
index 9aebe1e9..5d3ab581 100644
--- a/src/kernel/KernelKit/FileMgr.h
+++ b/src/kernel/KernelKit/FileMgr.h
@@ -265,6 +265,7 @@ class HeFileSystemMgr final : public IFilesystemMgr {
private:
HeFileSystemParser* mParser{nullptr};
+ DriveTrait mDriveTrait;
};
#endif // ifdef __FSKIT_INCLUDES_OPENHEFS__
diff --git a/src/kernel/KernelKit/Semaphore.h b/src/kernel/KernelKit/Semaphore.h
index 1cbc08c0..20965d91 100644
--- a/src/kernel/KernelKit/Semaphore.h
+++ b/src/kernel/KernelKit/Semaphore.h
@@ -25,37 +25,37 @@
namespace Kernel {
/// @brief Semaphore structure used for synchronization.
-typedef UInt64 SemaphoreArr[kSemaphoreCount];
+using SemaphoreArr = UInt64[kSemaphoreCount];
/// @brief Checks if the semaphore is valid.
-inline BOOL rtl_sem_is_valid(const SemaphoreArr& sem, UInt64 owner = 0) {
+inline bool rtl_sem_is_valid(const SemaphoreArr& sem, UInt64 owner = 0) {
return sem[kSemaphoreOwnerIndex] == owner && sem[kSemaphoreCountIndex] > 0;
}
/// @brief Releases the semaphore, resetting its owner and count.
/// @param sem
/// @return
-inline BOOL rtl_sem_release(SemaphoreArr& sem) {
+inline bool rtl_sem_release(SemaphoreArr& sem) {
sem[kSemaphoreOwnerIndex] = 0;
sem[kSemaphoreCountIndex] = 0;
- return TRUE;
+ return true;
}
/// @brief Initializes the semaphore with an owner and a count of zero.
/// @param sem the semaphore array to use.
/// @param owner the owner to set, could be anything identifitable.
/// @return
-inline BOOL rtl_sem_acquire(SemaphoreArr& sem, UInt64 owner) {
+inline bool rtl_sem_acquire(SemaphoreArr& sem, const UInt64 owner) {
if (!owner) {
err_global_get() = kErrorInvalidData;
- return FALSE; // Invalid owner
+ return false; // Invalid owner
}
sem[kSemaphoreOwnerIndex] = owner;
sem[kSemaphoreCountIndex] = 0;
- return TRUE;
+ return true;
}
/// @brief Waits for the semaphore to be available, blocking until it is.
@@ -63,50 +63,50 @@ inline BOOL rtl_sem_acquire(SemaphoreArr& sem, UInt64 owner) {
/// @param timeout
/// @param condition condition pointer.
/// @return
-inline BOOL rtl_sem_wait(SemaphoreArr& sem, UInt64 owner, UInt64 timeout,
- BOOL* condition = nullptr) {
+inline bool rtl_sem_wait(SemaphoreArr& sem, const UInt64 owner, const UInt64 timeout,
+ bool& condition) {
if (!rtl_sem_is_valid(sem, owner)) {
- return FALSE;
+ return false;
}
- if (timeout <= 0) {
+ if (timeout < 1) {
err_global_get() = kErrorTimeout;
- return FALSE;
+ return false;
}
- if (!condition || *condition) {
+ if (!condition) {
if (sem[kSemaphoreCountIndex] == 0) {
err_global_get() = kErrorUnavailable;
- return FALSE;
+ return false;
}
err_global_get() = kErrorSuccess;
sem[kSemaphoreCountIndex]--;
- return TRUE;
+ return true;
}
HardwareTimer timer(timeout);
- BOOL ret = timer.Wait();
+ bool ret = timer.Wait();
if (ret) {
- if (!condition || *condition) {
+ if (!condition) {
if (sem[kSemaphoreCountIndex] == 0) {
err_global_get() = kErrorUnavailable;
- return FALSE;
+ return false;
}
err_global_get() = kErrorSuccess;
sem[kSemaphoreCountIndex]--;
- return TRUE;
+ return true;
}
}
err_global_get() = kErrorTimeout;
- return FALSE; // Failed to acquire semaphore
+ return false; // Failed to acquire semaphore
}
} // namespace Kernel
diff --git a/src/kernel/KernelKit/ThreadLocalStorage.inl b/src/kernel/KernelKit/ThreadLocalStorage.inl
index 8e33cff3..dff2de30 100644
--- a/src/kernel/KernelKit/ThreadLocalStorage.inl
+++ b/src/kernel/KernelKit/ThreadLocalStorage.inl
@@ -16,7 +16,6 @@ inline T* tls_new_ptr(void) {
using namespace Kernel;
auto ref_process = UserProcessScheduler::The().TheCurrentProcess();
- MUST_PASS(ref_process);
auto pointer = ref_process.Leak().New(sizeof(T));
@@ -34,7 +33,6 @@ inline Kernel::Bool tls_delete_ptr(T* obj) {
if (!obj) return No;
auto ref_process = UserProcessScheduler::The().TheCurrentProcess();
- MUST_PASS(ref_process);
ErrorOr<T*> obj_wrapped{obj};