summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/kernel/arch/i386/driver/fsroot.c4
-rw-r--r--src/kernel/arch/i386/driver/ps2.c8
-rw-r--r--src/kernel/arch/i386/driver/serial.c10
-rw-r--r--src/kernel/proc.c4
-rw-r--r--src/kernel/vfs/request.c2
-rw-r--r--src/kernel/vfs/request.h4
6 files changed, 18 insertions, 14 deletions
diff --git a/src/kernel/arch/i386/driver/fsroot.c b/src/kernel/arch/i386/driver/fsroot.c
index 10cf3bc..ccba0b6 100644
--- a/src/kernel/arch/i386/driver/fsroot.c
+++ b/src/kernel/arch/i386/driver/fsroot.c
@@ -134,9 +134,9 @@ static int handle(struct vfs_request *req) {
static void accept(struct vfs_request *req) {
if (req->caller) {
- vfsreq_finish(req, handle(req), 0, NULL);
+ vfsreq_finish_short(req, handle(req));
} else {
- vfsreq_finish(req, -1, 0, NULL);
+ vfsreq_finish_short(req, -1);
}
}
diff --git a/src/kernel/arch/i386/driver/ps2.c b/src/kernel/arch/i386/driver/ps2.c
index 36c1b92..ef45810 100644
--- a/src/kernel/arch/i386/driver/ps2.c
+++ b/src/kernel/arch/i386/driver/ps2.c
@@ -35,7 +35,7 @@ static void accept(struct vfs_request *req) {
switch (req->type) {
case VFSOP_OPEN:
valid = req->input.len == 0 && !(req->flags & OPEN_CREATE);
- vfsreq_finish(req, valid ? 0 : -1, 0, NULL);
+ vfsreq_finish_short(req, valid ? 0 : -1);
break;
case VFSOP_READ:
if (ring_size((void*)&backlog) == 0) {
@@ -45,13 +45,13 @@ static void accept(struct vfs_request *req) {
ret = clamp(0, req->output.len, sizeof buf);
ret = ring_get((void*)&backlog, buf, ret);
virt_cpy_to(req->caller->pages, req->output.buf, buf, ret);
- vfsreq_finish(req, ret, 0, NULL);
+ vfsreq_finish_short(req, ret);
} else {
- vfsreq_finish(req, -1, 0, NULL);
+ vfsreq_finish_short(req, -1);
}
break;
default:
- vfsreq_finish(req, -1, 0, NULL);
+ vfsreq_finish_short(req, -1);
break;
}
}
diff --git a/src/kernel/arch/i386/driver/serial.c b/src/kernel/arch/i386/driver/serial.c
index a5285e4..7a727a8 100644
--- a/src/kernel/arch/i386/driver/serial.c
+++ b/src/kernel/arch/i386/driver/serial.c
@@ -73,7 +73,7 @@ static void accept(struct vfs_request *req) {
switch (req->type) {
case VFSOP_OPEN:
valid = req->input.len == 0 && !(req->flags & OPEN_CREATE);
- vfsreq_finish(req, valid ? 0 : -1, 0, NULL);
+ vfsreq_finish_short(req, valid ? 0 : -1);
break;
case VFSOP_READ:
if (ring_size((void*)&backlog) == 0) {
@@ -83,9 +83,9 @@ static void accept(struct vfs_request *req) {
ret = clamp(0, req->output.len, sizeof buf);
ret = ring_get((void*)&backlog, buf, ret);
virt_cpy_to(req->caller->pages, req->output.buf, buf, ret);
- vfsreq_finish(req, ret, 0, NULL);
+ vfsreq_finish_short(req, ret);
} else {
- vfsreq_finish(req, -1, 0, NULL);
+ vfsreq_finish_short(req, -1);
}
break;
case VFSOP_WRITE:
@@ -97,10 +97,10 @@ static void accept(struct vfs_request *req) {
serial_write(iter.frag, iter.frag_len);
ret = iter.prior;
} else ret = -1;
- vfsreq_finish(req, ret, 0, NULL);
+ vfsreq_finish_short(req, ret);
break;
default:
- vfsreq_finish(req, -1, 0, NULL);
+ vfsreq_finish_short(req, -1);
break;
}
}
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
index 331e019..b9eb48e 100644
--- a/src/kernel/proc.c
+++ b/src/kernel/proc.c
@@ -86,7 +86,7 @@ struct process *process_fork(struct process *parent, int flags) {
void process_kill(struct process *p, int ret) {
if (p->state != PS_DEAD) {
if (p->handled_req) {
- vfsreq_finish(p->handled_req, -1, 0, NULL);
+ vfsreq_finish_short(p->handled_req, -1);
p->handled_req = NULL;
}
@@ -99,7 +99,7 @@ void process_kill(struct process *p, int ret) {
struct vfs_request *q = p->controlled->queue;
while (q) {
struct vfs_request *q2 = q->queue_next;
- vfsreq_finish(q, -1, 0, NULL);
+ vfsreq_finish_short(q, -1);
q = q2;
}
p->controlled->queue = NULL;
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c
index 1729ca1..dfbd5cd 100644
--- a/src/kernel/vfs/request.c
+++ b/src/kernel/vfs/request.c
@@ -19,7 +19,7 @@ void vfsreq_create(struct vfs_request req_) {
}
if (!req->backend || !req->backend->potential_handlers)
- vfsreq_finish(req, -1, 0, NULL);
+ vfsreq_finish_short(req, -1);
struct vfs_request **iter = &req->backend->queue;
while (*iter != NULL) // find free spot in queue
diff --git a/src/kernel/vfs/request.h b/src/kernel/vfs/request.h
index 35173ca..7d36a5d 100644
--- a/src/kernel/vfs/request.h
+++ b/src/kernel/vfs/request.h
@@ -61,6 +61,10 @@ struct vfs_request {
void vfsreq_create(struct vfs_request);
void vfsreq_finish(struct vfs_request*, int ret, int flags, struct process *handler);
+static inline void vfsreq_finish_short(struct vfs_request *req, int ret) {
+ vfsreq_finish(req, ret, 0, NULL);
+}
+
/** Try to accept an enqueued request */
void vfs_backend_tryaccept(struct vfs_backend *);
void vfs_backend_user_accept(struct vfs_request *req);