Rename dirs

This commit is contained in:
2026-10-19 19:57:05 +02:00
parent 299ee1dfa8
commit 4384d36246
41 changed files with 13 additions and 20 deletions
+47
View File
@@ -0,0 +1,47 @@
#include <zinnia/console.h>
#include <zinnia/init.h>
#include <zinnia/print.h>
#include <zinnia/spin.h>
static struct console* registered = nullptr;
static struct spinlock console_lock;
void console_write(const char* buf, size_t len) {
spin_lock(&console_lock);
for (struct console* con = registered; con; con = con->next)
con->write(con, buf, len);
spin_unlock(&console_lock);
}
static void console_replay_write(void* ctx, const char* buf, size_t len) {
struct console* con = ctx;
con->write(con, buf, len);
}
bool console_register(struct console* con) {
if (!con->init(con))
return false;
con->write(con, "\ec", 2);
log_replay(console_replay_write, con);
spin_lock(&console_lock);
con->next = registered;
registered = con;
spin_unlock(&console_lock);
log("console: Registered console \"%s\"\n", con->name);
return true;
}
void console_unregister(struct console* con) {
spin_lock(&console_lock);
for (struct console** link = &registered; *link; link = &(*link)->next) {
if (*link == con) {
*link = con->next;
break;
}
}
spin_unlock(&console_lock);
}
INIT_TASK(console_stage, "core.console");