diff options
author | dzwdz | 2022-08-08 00:45:46 +0200 |
---|---|---|
committer | dzwdz | 2022-08-08 00:45:46 +0200 |
commit | b99d66ce12b4a1a0dd452d8a38006eede0c05cf2 (patch) | |
tree | 386aeeda170b8e8ed94dadeb0749a5c441995936 /src | |
parent | b0addbe14d2353e9c33f7f4d8a0b4ba8b24b2bd9 (diff) |
kernel/backend: remove the kern.ready() method
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel/arch/amd64/driver/fsroot.c | 6 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/ps2.c | 7 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/serial.c | 7 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/video.c | 7 | ||||
-rw-r--r-- | src/kernel/vfs/request.c | 10 | ||||
-rw-r--r-- | src/kernel/vfs/request.h | 5 |
6 files changed, 7 insertions, 35 deletions
diff --git a/src/kernel/arch/amd64/driver/fsroot.c b/src/kernel/arch/amd64/driver/fsroot.c index 98880fe..ea9fa7d 100644 --- a/src/kernel/arch/amd64/driver/fsroot.c +++ b/src/kernel/arch/amd64/driver/fsroot.c @@ -91,9 +91,5 @@ static void accept(struct vfs_request *req) { } } -static bool is_ready(struct vfs_backend __attribute__((unused)) *self) { - return true; -} - -static struct vfs_backend backend = BACKEND_KERN(is_ready, accept); +static struct vfs_backend backend = BACKEND_KERN(accept); void vfs_root_init(void) { vfs_mount_root_register("", &backend); } diff --git a/src/kernel/arch/amd64/driver/ps2.c b/src/kernel/arch/amd64/driver/ps2.c index 1ddd27a..35165d9 100644 --- a/src/kernel/arch/amd64/driver/ps2.c +++ b/src/kernel/arch/amd64/driver/ps2.c @@ -16,11 +16,10 @@ static volatile uint8_t mouse_buf[64]; static volatile ring_t mouse_backlog = {(void*)mouse_buf, sizeof mouse_buf, 0, 0}; static void accept(struct vfs_request *req); -static bool is_ready(struct vfs_backend *self); static struct vfs_request *kb_queue = NULL; static struct vfs_request *mouse_queue = NULL; -static struct vfs_backend backend = BACKEND_KERN(is_ready, accept); +static struct vfs_backend backend = BACKEND_KERN(accept); static void wait_out(void) { uint8_t status; @@ -139,7 +138,3 @@ static void accept(struct vfs_request *req) { break; } } - -static bool is_ready(struct vfs_backend __attribute__((unused)) *self) { - return true; -} diff --git a/src/kernel/arch/amd64/driver/serial.c b/src/kernel/arch/amd64/driver/serial.c index 921e140..b3bfe29 100644 --- a/src/kernel/arch/amd64/driver/serial.c +++ b/src/kernel/arch/amd64/driver/serial.c @@ -12,10 +12,9 @@ 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 bool is_ready(struct vfs_backend *self); static struct vfs_request *blocked_on = NULL; -static struct vfs_backend backend = BACKEND_KERN(is_ready, accept); +static struct vfs_backend backend = BACKEND_KERN(accept); void serial_init(void) { vfs_mount_root_register("/com1", &backend); } @@ -103,7 +102,3 @@ static void accept(struct vfs_request *req) { break; } } - -static bool is_ready(struct vfs_backend __attribute__((unused)) *self) { - return true; -} diff --git a/src/kernel/arch/amd64/driver/video.c b/src/kernel/arch/amd64/driver/video.c index d22adc4..ed4b971 100644 --- a/src/kernel/arch/amd64/driver/video.c +++ b/src/kernel/arch/amd64/driver/video.c @@ -64,12 +64,7 @@ static void accept(struct vfs_request *req) { } } -static bool is_ready(struct vfs_backend *self) { - (void)self; - return true; -} - -static struct vfs_backend backend = BACKEND_KERN(is_ready, accept); +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); diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c index 6883faa..82f4731 100644 --- a/src/kernel/vfs/request.c +++ b/src/kernel/vfs/request.c @@ -86,17 +86,9 @@ void vfsreq_finish(struct vfs_request *req, char __user *stored, long ret, void vfs_backend_tryaccept(struct vfs_backend *backend) { struct vfs_request *req = backend->queue; if (!req) return; - - /* ensure backend is ready to accept request */ - if (backend->is_user) { - if (!backend->user.handler) return; - } else { - assert(backend->kern.ready); - if (!backend->kern.ready(backend)) return; - } + if (backend->is_user && !backend->user.handler) return; backend->queue = req->queue_next; - if (backend->is_user) { vfs_backend_user_accept(req); } else { diff --git a/src/kernel/vfs/request.h b/src/kernel/vfs/request.h index ee33623..7c991f4 100644 --- a/src/kernel/vfs/request.h +++ b/src/kernel/vfs/request.h @@ -25,7 +25,6 @@ struct vfs_backend { struct process *handler; } user; struct { - bool (*ready)(struct vfs_backend *); void (*accept)(struct vfs_request *); } kern; }; @@ -77,9 +76,9 @@ void vfs_backend_user_accept(struct vfs_request *req); void vfs_backend_refdown(struct vfs_backend *); -#define BACKEND_KERN(ready, accept) ((struct vfs_backend){\ +#define BACKEND_KERN(accept) ((struct vfs_backend){\ .is_user = false, \ .heap = false, \ .potential_handlers = 1, \ .refcount = 1, \ - .kern = {ready, accept}}) + .kern.accept = accept}) |