summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/driver
diff options
context:
space:
mode:
authordzwdz2022-08-28 13:33:09 +0200
committerdzwdz2022-08-28 13:33:09 +0200
commita8e0cd702f97ffc74dd29f4b873e8813b7e9f27c (patch)
tree197f8a0563f6dc070809073ecfd572cec4a63abb /src/kernel/arch/amd64/driver
parentf0bda71fe2a4df4201c6195be1fe46cf895c134d (diff)
kernel/vfs: minor vfs_request / vfs_root_register rework
* changed vfs_root_register's name because the _mount didn't add anything * removed the old pointless vfs_backend_tryaccept calls from drivers * because of that, i could remove the vfs_backend globals * replaced the horrible BACKEND_KERN macro * all vfs_backends are now stored on the heap
Diffstat (limited to 'src/kernel/arch/amd64/driver')
-rw-r--r--src/kernel/arch/amd64/driver/fsroot.c4
-rw-r--r--src/kernel/arch/amd64/driver/pata.c5
-rw-r--r--src/kernel/arch/amd64/driver/ps2.c6
-rw-r--r--src/kernel/arch/amd64/driver/rtl8139.c4
-rw-r--r--src/kernel/arch/amd64/driver/serial.c6
-rw-r--r--src/kernel/arch/amd64/driver/util.c1
-rw-r--r--src/kernel/arch/amd64/driver/video.c4
7 files changed, 13 insertions, 17 deletions
diff --git a/src/kernel/arch/amd64/driver/fsroot.c b/src/kernel/arch/amd64/driver/fsroot.c
index 2344205..6217e29 100644
--- a/src/kernel/arch/amd64/driver/fsroot.c
+++ b/src/kernel/arch/amd64/driver/fsroot.c
@@ -3,6 +3,7 @@
#include <kernel/arch/amd64/driver/fsroot.h>
#include <kernel/arch/amd64/driver/util.h>
#include <kernel/panic.h>
+#include <kernel/proc.h>
#include <kernel/util.h>
#include <kernel/vfs/request.h>
#include <shared/mem.h>
@@ -34,5 +35,4 @@ static void accept(struct vfs_request *req) {
vfsreq_finish_short(req, handle(req));
}
-static struct vfs_backend backend = BACKEND_KERN(accept);
-void vfs_root_init(void) { vfs_mount_root_register("", &backend); }
+void vfs_root_init(void) { vfs_root_register("", accept); }
diff --git a/src/kernel/arch/amd64/driver/pata.c b/src/kernel/arch/amd64/driver/pata.c
index 1193add..b6ed05e 100644
--- a/src/kernel/arch/amd64/driver/pata.c
+++ b/src/kernel/arch/amd64/driver/pata.c
@@ -5,17 +5,16 @@
#include <kernel/arch/amd64/driver/util.h>
#include <kernel/mem/virt.h>
#include <kernel/panic.h>
+#include <kernel/proc.h>
#include <kernel/vfs/request.h>
#include <shared/mem.h>
static const int root_id = 100;
static void accept(struct vfs_request *req);
-static struct vfs_backend backend = BACKEND_KERN(accept);
-
void pata_init(void) {
ata_init();
- vfs_mount_root_register("/ata", &backend);
+ vfs_root_register("/ata", accept);
}
diff --git a/src/kernel/arch/amd64/driver/ps2.c b/src/kernel/arch/amd64/driver/ps2.c
index 9148c98..899f325 100644
--- a/src/kernel/arch/amd64/driver/ps2.c
+++ b/src/kernel/arch/amd64/driver/ps2.c
@@ -3,6 +3,7 @@
#include <kernel/arch/amd64/interrupts/irq.h>
#include <kernel/arch/amd64/port_io.h>
#include <kernel/panic.h>
+#include <kernel/proc.h>
#include <kernel/ring.h>
#include <kernel/vfs/request.h>
#include <shared/mem.h>
@@ -19,7 +20,6 @@ static void accept(struct vfs_request *req);
static struct vfs_request *kb_queue = NULL;
static struct vfs_request *mouse_queue = NULL;
-static struct vfs_backend backend = BACKEND_KERN(accept);
static void wait_out(void) {
uint8_t status;
@@ -36,7 +36,7 @@ static void wait_in(void) {
}
void ps2_init(void) {
- vfs_mount_root_register("/ps2", &backend);
+ vfs_root_register("/ps2", accept);
uint8_t compaq, ack;
wait_out();
@@ -71,14 +71,12 @@ void ps2_irq(void) {
if (mouse_queue) {
accept(mouse_queue);
mouse_queue = mouse_queue->postqueue_next;
- vfs_backend_tryaccept(&backend);
}
} else {
ring_put1b((void*)&kb_backlog, port_in8(PS2));
if (kb_queue) {
accept(kb_queue);
kb_queue = kb_queue->postqueue_next;
- vfs_backend_tryaccept(&backend);
}
}
}
diff --git a/src/kernel/arch/amd64/driver/rtl8139.c b/src/kernel/arch/amd64/driver/rtl8139.c
index fd7717f..05a0f70 100644
--- a/src/kernel/arch/amd64/driver/rtl8139.c
+++ b/src/kernel/arch/amd64/driver/rtl8139.c
@@ -3,13 +3,13 @@
#include <kernel/arch/amd64/port_io.h>
#include <kernel/mem/virt.h>
#include <kernel/panic.h>
+#include <kernel/proc.h>
#include <kernel/vfs/request.h>
#include <stdbool.h>
#define WAIT -1000
static void accept(struct vfs_request *req);
-static struct vfs_backend backend = BACKEND_KERN(accept);
static struct vfs_request *blocked_on = NULL;
@@ -80,7 +80,7 @@ void rtl8139_init(uint32_t bdf) {
uint64_t mac = (((uint64_t)port_in32(iobase + MAC + 4) & 0xFFFF) << 32) + port_in32(iobase + MAC);
kprintf("rtl8139 mac %012x\n", mac);
- vfs_mount_root_register("/eth", &backend);
+ vfs_root_register("/eth", accept);
}
void rtl8139_irq(void) {
diff --git a/src/kernel/arch/amd64/driver/serial.c b/src/kernel/arch/amd64/driver/serial.c
index cf21b61..9ddb355 100644
--- a/src/kernel/arch/amd64/driver/serial.c
+++ b/src/kernel/arch/amd64/driver/serial.c
@@ -4,6 +4,7 @@
#include <kernel/mem/virt.h>
#include <kernel/ring.h>
#include <kernel/panic.h>
+#include <kernel/proc.h>
#include <stdint.h>
static volatile uint8_t backlog_buf[64];
@@ -12,10 +13,8 @@ static volatile ring_t backlog = {(void*)backlog_buf, sizeof backlog_buf, 0, 0};
static const int COM1 = 0x3f8;
static void accept(struct vfs_request *req);
-
static struct vfs_request *blocked_on = NULL;
-static struct vfs_backend backend = BACKEND_KERN(accept);
-void serial_init(void) { vfs_mount_root_register("/com1", &backend); }
+void serial_init(void) { vfs_root_register("/com1", accept); }
static void serial_selftest(void) {
@@ -47,7 +46,6 @@ void serial_irq(void) {
if (blocked_on) {
accept(blocked_on);
blocked_on = blocked_on->postqueue_next;
- vfs_backend_tryaccept(&backend);
}
}
diff --git a/src/kernel/arch/amd64/driver/util.c b/src/kernel/arch/amd64/driver/util.c
index b03e582..11aecca 100644
--- a/src/kernel/arch/amd64/driver/util.c
+++ b/src/kernel/arch/amd64/driver/util.c
@@ -2,6 +2,7 @@
#include <kernel/arch/amd64/driver/util.h>
#include <kernel/mem/virt.h>
#include <kernel/panic.h>
+#include <kernel/proc.h>
#include <kernel/vfs/request.h>
int req_readcopy(struct vfs_request *req, const void *buf, size_t len) {
diff --git a/src/kernel/arch/amd64/driver/video.c b/src/kernel/arch/amd64/driver/video.c
index c1aabe1..945d5b4 100644
--- a/src/kernel/arch/amd64/driver/video.c
+++ b/src/kernel/arch/amd64/driver/video.c
@@ -4,6 +4,7 @@
#include <kernel/arch/amd64/driver/video.h>
#include <kernel/mem/virt.h>
#include <kernel/panic.h>
+#include <kernel/proc.h>
#include <kernel/vfs/request.h>
#include <shared/mem.h>
#include <shared/printf.h>
@@ -64,10 +65,9 @@ static void accept(struct vfs_request *req) {
}
}
-static struct vfs_backend backend = BACKEND_KERN(accept);
void video_init(struct fb_info fb_) {
fb = fb_;
snprintf(namebuf, sizeof namebuf, "%ux%ux%u", fb.width, fb.height, fb.bpp);
namelen = strlen(namebuf);
- vfs_mount_root_register("/video", &backend);
+ vfs_root_register("/video", accept);
}