kernel: don't use typedef for enums or non-opaque structs

This commit is contained in:
2023-04-12 20:17:11 +01:00
parent 0d75e347e9
commit b6f8c1ccaa
51 changed files with 663 additions and 665 deletions

View File

@@ -3,15 +3,15 @@
#include <socks/locks.h>
#include <socks/libc/string.h>
static queue_t consoles;
static struct queue consoles;
static spin_lock_t consoles_lock = SPIN_LOCK_INIT;
kern_status_t console_register(console_t *con)
kern_status_t console_register(struct console *con)
{
unsigned long flags;
spin_lock_irqsave(&consoles_lock, &flags);
queue_foreach (console_t, cur, &consoles, c_list) {
queue_foreach (struct console, cur, &consoles, c_list) {
if (!strcmp(cur->c_name, con->c_name)) {
spin_unlock_irqrestore(&consoles_lock, flags);
return KERN_NAME_EXISTS;
@@ -23,7 +23,7 @@ kern_status_t console_register(console_t *con)
return KERN_OK;
}
kern_status_t console_unregister(console_t *con)
kern_status_t console_unregister(struct console *con)
{
unsigned long flags;
spin_lock_irqsave(&consoles_lock, &flags);
@@ -34,14 +34,14 @@ kern_status_t console_unregister(console_t *con)
return KERN_OK;
}
void console_write(console_t *con, const char *s, unsigned int len)
void console_write(struct console *con, const char *s, unsigned int len)
{
if (con->c_write) {
con->c_write(con, s, len);
}
}
int console_read(console_t *con, char *s, unsigned int len)
int console_read(struct console *con, char *s, unsigned int len)
{
int ret = -1;
if (con->c_read) {

View File

@@ -5,14 +5,14 @@
DECLARE_BITMAP(cpu_available, CPU_MAX);
DECLARE_BITMAP(cpu_online, CPU_MAX);
DEFINE_PERCPU_VAR(cpu_data_t, cpu_data);
DEFINE_PERCPU_VAR(struct cpu_data, cpu_data);
cpu_data_t *get_this_cpu(void)
struct cpu_data *get_this_cpu(void)
{
return percpu_get(&cpu_data);
}
void put_cpu(cpu_data_t *cpu)
void put_cpu(struct cpu_data *cpu)
{
percpu_put(cpu);
}
@@ -38,7 +38,7 @@ void cpu_set_online(unsigned int cpu_id)
void preempt_disable(void)
{
ml_cpu_block *ml_cpu = ml_this_cpu();
cpu_data_t *cpu_data = ml_cpu_block_get_data(ml_cpu);
struct cpu_data *cpu_data = ml_cpu_block_get_data(ml_cpu);
if (!cpu_data) {
return;
}
@@ -51,7 +51,7 @@ void preempt_disable(void)
void preempt_enable(void)
{
ml_cpu_block *ml_cpu = ml_this_cpu();
cpu_data_t *cpu_data = ml_cpu_block_get_data(ml_cpu);
struct cpu_data *cpu_data = ml_cpu_block_get_data(ml_cpu);
if (!cpu_data) {
return;
}

View File

@@ -18,8 +18,8 @@ void panic(const char *fmt, ...)
printk("---[ kernel panic: %s", buf);
printk("kernel: " BUILD_ID ", compiler version: " __VERSION__);
task_t *task = current_task();
thread_t *thr = current_thread();
struct task *task = current_task();
struct thread *thr = current_thread();
if (task && thr) {
printk("task: %s (id: %d, thread: %d)", task->t_name, task->t_id, thr->tr_id);

View File

@@ -7,7 +7,7 @@
#define LOG_BUFFER_SIZE 0x40000
#define LOG_MSG_SIZE 0x100
static console_t *early_console = NULL;
static struct console *early_console = NULL;
static spin_lock_t log_buffer_lock = SPIN_LOCK_INIT;
@@ -46,7 +46,7 @@ static void save_log_message(const char *msg)
}
}
void early_printk_init(console_t *con)
void early_printk_init(struct console *con)
{
early_console = con;
}

View File

@@ -2,12 +2,12 @@
#include <socks/locks.h>
#include <socks/queue.h>
int tty_read(tty_t *tty, char *s, unsigned long len)
int tty_read(struct tty *tty, char *s, unsigned long len)
{
return 0;
}
int tty_write(tty_t *tty, const char *s, unsigned long len)
int tty_write(struct tty *tty, const char *s, unsigned long len)
{
return 0;
}