diff options
author | Marvin Borner | 2021-02-25 20:45:10 +0100 |
---|---|---|
committer | Marvin Borner | 2021-02-25 20:45:10 +0100 |
commit | a9710cb73cc9ecadaff241428a39a26935cb5c0a (patch) | |
tree | 68f509407bc49a4da43ccadfd9115b9e6f7eb413 /kernel/features | |
parent | 26587adae4f5ec61d03fd7075805a24b29107fe3 (diff) |
Applied even more warning flags!
Fixing all the warnings wasn't that easy actually..
Diffstat (limited to 'kernel/features')
-rw-r--r-- | kernel/features/fs.c | 8 | ||||
-rw-r--r-- | kernel/features/load.c | 2 | ||||
-rw-r--r-- | kernel/features/net.c | 2 | ||||
-rw-r--r-- | kernel/features/proc.c | 27 | ||||
-rw-r--r-- | kernel/features/syscall.c | 2 |
5 files changed, 21 insertions, 20 deletions
diff --git a/kernel/features/fs.c b/kernel/features/fs.c index 9ea5458..c7aacd0 100644 --- a/kernel/features/fs.c +++ b/kernel/features/fs.c @@ -186,7 +186,7 @@ s32 vfs_stat(const char *path, struct stat *buf) return m->dev->vfs->stat(path, buf, m->dev); } -s32 vfs_wait(const char *path, s32 (*func)()) +s32 vfs_wait(const char *path, u32 func_ptr) { while (*path == ' ') path++; @@ -196,7 +196,7 @@ s32 vfs_wait(const char *path, s32 (*func)()) // Default wait if (!m->dev->vfs->wait) { - proc_wait_for(vfs_find_dev(path)->id, PROC_WAIT_DEV, func); + proc_wait_for(vfs_find_dev(path)->id, PROC_WAIT_DEV, func_ptr); return 1; } @@ -204,7 +204,7 @@ s32 vfs_wait(const char *path, s32 (*func)()) if (len > 1) path += len; - return m->dev->vfs->wait(path, func, m->dev); + return m->dev->vfs->wait(path, func_ptr, m->dev); } s32 vfs_poll(const char **files) @@ -217,7 +217,7 @@ s32 vfs_poll(const char **files) return p - files; for (const char **p = files; *p && **p; p++) - vfs_wait(*p, vfs_poll); + vfs_wait(*p, (u32)vfs_poll); return PROC_MAX_WAIT_IDS + 1; } diff --git a/kernel/features/load.c b/kernel/features/load.c index 3e1ea8e..f79e6b4 100644 --- a/kernel/features/load.c +++ b/kernel/features/load.c @@ -14,7 +14,7 @@ void proc_load(struct proc *proc, void *data) proc->regs.eip = (u32)data; } -int bin_load(char *path, struct proc *proc) +int bin_load(const char *path, struct proc *proc) { // TODO: Remove hardcoded filesize struct stat s = { 0 }; diff --git a/kernel/features/net.c b/kernel/features/net.c index be36f14..104538f 100644 --- a/kernel/features/net.c +++ b/kernel/features/net.c @@ -817,7 +817,7 @@ int net_receive(struct socket *socket, void *buf, u32 len) * Install */ -int net_installed() +int net_installed(void) { return rtl8139_installed() != 0; } diff --git a/kernel/features/proc.c b/kernel/features/proc.c index c21ffcc..48bde72 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -74,7 +74,7 @@ void scheduler(struct regs *regs) /* printf("{%d}", ((struct proc *)current->data)->pid); */ } -static void kernel_idle() +static void kernel_idle(void) { while (1) ; @@ -121,7 +121,7 @@ struct proc *proc_from_pid(u32 pid) return NULL; } -void proc_clear_quantum() +void proc_clear_quantum(void) { quantum = 0; } @@ -179,9 +179,10 @@ void proc_enable_waiting(u32 id, enum proc_wait_type type) if (w->ids[i].magic == PROC_WAIT_MAGIC && w->ids[i].id == id && w->ids[i].type == type) { struct regs *r = &p->regs; - if (w->ids[i].func) - r->eax = (u32)w->ids[i].func((char *)r->ebx, (void *)r->ecx, - r->edx, r->esi); + u32 (*func)(u32, u32, u32, u32) = + (u32(*)(u32, u32, u32, u32))w->ids[i].func_ptr; + if (w->ids[i].func_ptr) + r->eax = func(r->ebx, r->ecx, r->edx, r->esi); memset(&w->ids[i], 0, sizeof(w->ids[i])); p->wait.id_cnt--; p->state = PROC_RUNNING; @@ -196,7 +197,7 @@ void proc_enable_waiting(u32 id, enum proc_wait_type type) current = list_first_data(proc_list, proc_bak); } -void proc_wait_for(u32 id, enum proc_wait_type type, s32 (*func)()) +void proc_wait_for(u32 id, enum proc_wait_type type, u32 func_ptr) { u8 already_exists = 0; struct proc *p = proc_current(); @@ -204,7 +205,7 @@ void proc_wait_for(u32 id, enum proc_wait_type type, s32 (*func)()) // Check if already exists for (u32 i = 0; i < p->wait.id_cnt; i++) { if (p->wait.ids[i].id == id && p->wait.ids[i].type == type) { - assert(p->wait.ids[i].func == func); + assert(p->wait.ids[i].func_ptr == func_ptr); already_exists = 1; } } @@ -227,7 +228,7 @@ void proc_wait_for(u32 id, enum proc_wait_type type, s32 (*func)()) slot->magic = PROC_WAIT_MAGIC; slot->id = id; slot->type = type; - slot->func = func; + slot->func_ptr = func_ptr; p->wait.id_cnt++; end: @@ -369,7 +370,7 @@ static s32 procfs_read(const char *path, void *buf, u32 offset, u32 count, struc return -1; } -static s32 procfs_wait(const char *path, s32 (*func)(), struct device *dev) +static s32 procfs_wait(const char *path, u32 func_ptr, struct device *dev) { u32 pid = 0; procfs_parse_path(&path, &pid); @@ -381,10 +382,10 @@ static s32 procfs_wait(const char *path, s32 (*func)(), struct device *dev) path++; if (!memcmp(path, "msg", 4)) { - proc_wait_for(pid, PROC_WAIT_MSG, func); + proc_wait_for(pid, PROC_WAIT_MSG, func_ptr); return 1; } else { - proc_wait_for(dev->id, PROC_WAIT_DEV, func); + proc_wait_for(dev->id, PROC_WAIT_DEV, func_ptr); return 1; } } @@ -461,14 +462,14 @@ void proc_init(void) // Idle proc struct proc *kernel_proc = proc_make(); - void (*func)() = kernel_idle; + void (*func)(void) = kernel_idle; proc_load(kernel_proc, *(void **)&func); strcpy(kernel_proc->name, "idle"); kernel_proc->state = PROC_SLEEPING; idle_proc = list_add(proc_list, kernel_proc); struct node *new = list_add(proc_list, proc_make()); - bin_load((char *)"/bin/init", new->data); + bin_load("/bin/init", new->data); current = new; _eip = ((struct proc *)new->data)->regs.eip; diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c index 538fd59..61c7479 100644 --- a/kernel/features/syscall.c +++ b/kernel/features/syscall.c @@ -41,7 +41,7 @@ static void syscall_handler(struct regs *r) if (vfs_ready((char *)r->ebx)) { r->eax = (u32)vfs_read((char *)r->ebx, (void *)r->ecx, r->edx, r->esi); } else { - if (vfs_wait((char *)r->ebx, vfs_read) < 0) + if (vfs_wait((char *)r->ebx, (u32)vfs_read) < 0) r->eax = -1; else proc_yield(r); |