From 0c389afa8f660baa3d6ac21443290dc63272e84f Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Fri, 24 Apr 2020 00:12:12 +0200 Subject: [PATCH] Harmonize kthread func naming --- core/kthread.c | 16 ++++++++-------- core/kthread.h | 8 ++++---- core/main.c | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core/kthread.c b/core/kthread.c index d645e0f..69fb4c7 100644 --- a/core/kthread.c +++ b/core/kthread.c @@ -7,13 +7,13 @@ static struct kthread *currentThread; -void kthread_exit(){ +void kthreadExit(){ struct kthread *current = currentThread; - struct kthread *next = selectNextKthread(); + struct kthread *next = kthreadSelectNext(); if (next == current) assert("cannot exit thread"); currentThread = next; - cpu_context_exit_to(next->cpuState, (cpu_kstate_function_arg1_t *)deleteKthread, (uint32_t)current); + cpu_context_exit_to(next->cpuState, (cpu_kstate_function_arg1_t *)kthreadDelete, (uint32_t)current); return; } @@ -28,7 +28,7 @@ int kthreadSetup(vaddr_t mainStack, size_t mainStackSize){ return 0; } -struct kthread *createKthread(const char *name, cpu_kstate_function_arg1_t func, +struct kthread *kthreadCreate(const char *name, cpu_kstate_function_arg1_t func, void *args) { struct kthread *thread = (struct kthread *)malloc(sizeof(struct kthread)); @@ -48,7 +48,7 @@ struct kthread *createKthread(const char *name, cpu_kstate_function_arg1_t func, if(cpu_kstate_init(&thread->cpuState, (cpu_kstate_function_arg1_t *)func, (vaddr_t)args, thread->stackAddr, thread->stackSize, - (cpu_kstate_function_arg1_t *)kthread_exit, 0)) + (cpu_kstate_function_arg1_t *)kthreadExit, 0)) goto free_mem; list_add_tail(currentThread, thread); @@ -59,21 +59,21 @@ free_mem: return NULL; } -void deleteKthread(struct kthread *thread){ +void kthreadDelete(struct kthread *thread){ list_delete(currentThread, thread); free((void *)thread->stackAddr); free((void *)thread); } -struct kthread *selectNextKthread(){ +struct kthread *kthreadSelectNext(){ struct kthread *nextThread = currentThread->next; return nextThread; } struct cpu_state *switchKthread(struct cpu_state *prevCpu){ currentThread->cpuState = prevCpu; - struct kthread *nextThread = selectNextKthread(); + struct kthread *nextThread = kthreadSelectNext(); printStringDetails(nextThread->name, RED, BLACK, 40, VGA_HEIGHT - 1); currentThread = nextThread; return nextThread->cpuState; diff --git a/core/kthread.h b/core/kthread.h index 8313c34..60183f7 100644 --- a/core/kthread.h +++ b/core/kthread.h @@ -17,12 +17,12 @@ struct kthread { int kthreadSetup(vaddr_t mainStack, size_t mainStackSize); -void kthread_exit(); +void kthreadExit(); -struct kthread *createKthread(const char *name, cpu_kstate_function_arg1_t func, +struct kthread *kthreadCreate(const char *name, cpu_kstate_function_arg1_t func, void *args); -void deleteKthread(struct kthread *thread); +void kthreadDelete(struct kthread *thread); -struct kthread *selectNextKthread(); +struct kthread *kthreadSelectNext(); struct cpu_state *switchKthread(struct cpu_state *prevCpu); diff --git a/core/main.c b/core/main.c index 74666e4..ed22239 100644 --- a/core/main.c +++ b/core/main.c @@ -119,7 +119,7 @@ void kmain(unsigned long magic, unsigned long addr) serialSetup(115200); allocInit(); kthreadSetup(_stack_bottom, (_stack_top - _stack_bottom + 1)); - createKthread("idle", idleThread, NULL); + kthreadCreate("idle", idleThread, NULL); irqSetRoutine(IRQ_TIMER, pit_handler); #ifdef RUN_TEST run_test(); @@ -128,5 +128,5 @@ void kmain(unsigned long magic, unsigned long addr) // There is no real caller behind this point // So finish this by ourself - kthread_exit(); + kthreadExit(); }