aboutsummaryrefslogtreecommitdiff
path: root/common/tcb.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-04-10 15:39:41 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-04-10 15:42:04 +0300
commit8aa17b12f29536ea9c8b6ca22c7f153e8d90fa3b (patch)
treee7dba9b6b9cdcd1d04cba639c8f76e9685ac549f /common/tcb.c
parent4760462d9b3bf2aba8664c57be85f4adbfa164a2 (diff)
downloadkmi-8aa17b12f29536ea9c8b6ca22c7f153e8d90fa3b.tar.gz
kmi-8aa17b12f29536ea9c8b6ca22c7f153e8d90fa3b.zip
add clang format and run it
Diffstat (limited to 'common/tcb.c')
-rw-r--r--common/tcb.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/common/tcb.c b/common/tcb.c
index 8fea188..cd946bd 100644
--- a/common/tcb.c
+++ b/common/tcb.c
@@ -3,15 +3,14 @@
#include <apos/sp_tree.h>
#include <arch/cpu.h>
-static struct sp_root t_root = (struct sp_root){0};
-static struct tcb *__tcb_cache[MAX_CPUS] = {0};
+static struct sp_root t_root = (struct sp_root){ 0 };
+static struct tcb *__tcb_cache[MAX_CPUS] = { 0 };
-#define tcb_container(x) \
- container_of(x, struct tcb, sp_n)
+#define tcb_container(x) container_of(x, struct tcb, sp_n)
stat_t threads_insert(struct tcb *t)
{
- if(!sp_root(t_root)){
+ if (!sp_root(t_root)) {
sp_root(t_root) = &t->sp_n;
return OK;
}
@@ -19,11 +18,11 @@ stat_t threads_insert(struct tcb *t)
struct sp_node *n = sp_root(t_root), *p = NULL;
enum sp_dir d = LEFT;
- while(n){
+ while (n) {
struct tcb *tc = tcb_container(n);
p = n;
- if(t->tid < tc->tid){
+ if (t->tid < tc->tid) {
n = sp_left(n);
d = LEFT;
}
@@ -42,13 +41,13 @@ struct tcb *threads_find(id_t tid)
{
struct sp_node *n = sp_root(t_root);
- while(n){
+ while (n) {
struct tcb *t = tcb_container(n);
- if(t->tid == tid)
+ if (t->tid == tid)
return t;
- if(t->tid < tid)
+ if (t->tid < tid)
n = sp_left(n);
else
n = sp_right(n);