summaryrefslogtreecommitdiff
path: root/src/kernel/execbuf.c
diff options
context:
space:
mode:
authordzwdz2023-01-25 20:16:22 +0100
committerdzwdz2023-01-25 20:16:22 +0100
commit17bfb0ef0a48330b1d54e61fe3c30d83528d2d90 (patch)
treeb3d4aed1f408edcb17fe5c86fccaeacaa2a5a48a /src/kernel/execbuf.c
parent2ad6ee8ed15d1bf898645a16dbc06991a3c1425e (diff)
style: typedef structs, shorter namespaces
I've wanted to do this for a while, and since I've just had a relatively large refactor commit (pcpy), this is as good of a time as any. Typedefing structs was mostly inspired by Plan 9's coding style. It makes some lines of code much shorter at basically no expense. Everything related to userland kept old-style struct definitions, so as not to force that style onto other people. I also considered changing SCREAMING_ENUM_FIELDS to NicerLookingCamelcase, but I didn't, just in case that'd be confusing.
Diffstat (limited to 'src/kernel/execbuf.c')
-rw-r--r--src/kernel/execbuf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/kernel/execbuf.c b/src/kernel/execbuf.c
index 7170de2..8f7e22e 100644
--- a/src/kernel/execbuf.c
+++ b/src/kernel/execbuf.c
@@ -5,13 +5,13 @@
#include <kernel/panic.h>
#include <shared/mem.h>
-_Noreturn static void halt(struct process *proc) {
+_Noreturn static void halt(Proc *proc) {
kfree(proc->execbuf.buf);
proc->execbuf.buf = NULL;
- process_switch_any();
+ proc_switch_any();
}
-static void try_fetch(struct process *proc, uint64_t *buf, size_t amt) {
+static void try_fetch(Proc *proc, uint64_t *buf, size_t amt) {
size_t bytes = amt * sizeof(uint64_t);
if (proc->execbuf.pos + bytes > proc->execbuf.len)
halt(proc);
@@ -19,10 +19,10 @@ static void try_fetch(struct process *proc, uint64_t *buf, size_t amt) {
proc->execbuf.pos += bytes;
}
-_Noreturn void execbuf_run(struct process *proc) {
+_Noreturn void execbuf_run(Proc *proc) {
uint64_t buf[6];
- assert(proc == process_current); // idiotic, but needed because of _syscall.
+ assert(proc == proc_cur); // idiotic, but needed because of _syscall.
assert(proc->state == PS_RUNNING);
assert(proc->execbuf.buf);
@@ -31,7 +31,7 @@ _Noreturn void execbuf_run(struct process *proc) {
case EXECBUF_SYSCALL:
try_fetch(proc, buf, 6);
_syscall(buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
- process_switch_any();
+ proc_switch_any();
case EXECBUF_JMP:
try_fetch(proc, buf, 1);