summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/driver
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/arch/amd64/driver')
-rw-r--r--src/kernel/arch/amd64/driver/pata.c12
-rw-r--r--src/kernel/arch/amd64/driver/rtl8139.c5
-rw-r--r--src/kernel/arch/amd64/driver/serial.c6
-rw-r--r--src/kernel/arch/amd64/driver/time.c5
-rw-r--r--src/kernel/arch/amd64/driver/util.c6
-rw-r--r--src/kernel/arch/amd64/driver/util.h4
-rw-r--r--src/kernel/arch/amd64/driver/video.c14
7 files changed, 24 insertions, 28 deletions
diff --git a/src/kernel/arch/amd64/driver/pata.c b/src/kernel/arch/amd64/driver/pata.c
index cc6645d..59a43c3 100644
--- a/src/kernel/arch/amd64/driver/pata.c
+++ b/src/kernel/arch/amd64/driver/pata.c
@@ -47,10 +47,10 @@ static void accept(VfsReq *req) {
vfsreq_finish_short(req, req_readcopy(req, list, len));
break;
}
- fs_normslice(&req->offset, &req->output.len, ata_size(id), false);
- len = min(req->output.len, sizeof wbuf);
+ fs_normslice(&req->offset, &req->outlen, ata_size(id), false);
+ len = min(req->outlen, sizeof wbuf);
ata_read(id, wbuf, len, req->offset);
- pcpy_to(req->caller, req->output.buf, wbuf, len);
+ pcpy_to(req->caller, req->out, wbuf, len);
vfsreq_finish_short(req, len);
break;
@@ -59,10 +59,10 @@ static void accept(VfsReq *req) {
vfsreq_finish_short(req, -EACCES);
break;
}
- fs_normslice(&req->offset, &req->input.len, ata_size(id), false);
- len = min(req->input.len, sizeof wbuf);
+ fs_normslice(&req->offset, &req->uinlen, ata_size(id), false);
+ len = min(req->uinlen, sizeof wbuf);
if (len != 0) {
- len = pcpy_from(req->caller, wbuf, req->input.buf, len);
+ len = pcpy_from(req->caller, wbuf, req->uin, len);
ata_write(id, wbuf, len, req->offset);
}
vfsreq_finish_short(req, len);
diff --git a/src/kernel/arch/amd64/driver/rtl8139.c b/src/kernel/arch/amd64/driver/rtl8139.c
index c952d8a..c739527 100644
--- a/src/kernel/arch/amd64/driver/rtl8139.c
+++ b/src/kernel/arch/amd64/driver/rtl8139.c
@@ -204,7 +204,7 @@ static void accept(VfsReq *req) {
ret = req_readcopy(req, data, sizeof data);
vfsreq_finish_short(req, ret);
} else if (id == HandleNet) {
- ret = try_rx(req->caller, req->output.buf, req->output.len);
+ ret = try_rx(req->caller, req->out, req->outlen);
if (ret == WAIT) {
reqqueue_join(&blocked_on, req);
rx_irq_enable(true);
@@ -218,8 +218,7 @@ static void accept(VfsReq *req) {
break;
case VFSOP_WRITE:
if (id == HandleNet) {
- assert(!req->input.kern);
- vfsreq_finish_short(req, try_tx(req->caller, req->input.buf, req->input.len));
+ vfsreq_finish_short(req, try_tx(req->caller, req->uin, req->uinlen));
} else {
vfsreq_finish_short(req, -ENOSYS);
}
diff --git a/src/kernel/arch/amd64/driver/serial.c b/src/kernel/arch/amd64/driver/serial.c
index 76ec33b..bd3966d 100644
--- a/src/kernel/arch/amd64/driver/serial.c
+++ b/src/kernel/arch/amd64/driver/serial.c
@@ -77,7 +77,7 @@ static void accept(VfsReq *req) {
bool valid;
switch (req->type) {
case VFSOP_OPEN:
- valid = req->input.len == 0;
+ valid = req->kinlen == 0;
vfsreq_finish_short(req, valid ? 0 : -1);
break;
case VFSOP_READ:
@@ -87,8 +87,8 @@ static void accept(VfsReq *req) {
case VFSOP_WRITE:
if (req->caller && !req->flags) {
char buf[4096];
- size_t len = min(sizeof buf, req->input.len);
- len = pcpy_from(req->caller, buf, req->input.buf, len);
+ size_t len = min(sizeof buf, req->uinlen);
+ len = pcpy_from(req->caller, buf, req->uin, len);
serial_write(buf, len);
ret = len;
} else {
diff --git a/src/kernel/arch/amd64/driver/time.c b/src/kernel/arch/amd64/driver/time.c
index f47cb74..5ec28b9 100644
--- a/src/kernel/arch/amd64/driver/time.c
+++ b/src/kernel/arch/amd64/driver/time.c
@@ -52,9 +52,8 @@ handle(VfsReq *req)
case VFSOP_GETSIZE:
return 8;
case VFSOP_WRITE:
- if (req->input.len == 8) {
- assert(!req->input.kern);
- if (pcpy_from(req->caller, u.buf, req->input.buf, sizeof u.buf) != sizeof(u.buf)) {
+ if (req->uinlen == 8) {
+ if (pcpy_from(req->caller, u.buf, req->uin, sizeof u.buf) != sizeof(u.buf)) {
return -EGENERIC;
}
h->base = now - u.t;
diff --git a/src/kernel/arch/amd64/driver/util.c b/src/kernel/arch/amd64/driver/util.c
index f02c4e2..c55e36e 100644
--- a/src/kernel/arch/amd64/driver/util.c
+++ b/src/kernel/arch/amd64/driver/util.c
@@ -7,10 +7,10 @@
int req_readcopy(VfsReq *req, const void *buf, size_t len) {
if (!req->caller) return -1;
assert(req->type == VFSOP_READ);
- fs_normslice(&req->offset, &req->output.len, len, false);
+ fs_normslice(&req->offset, &req->outlen, len, false);
/* read errors are ignored. TODO write a spec */
- pcpy_to(req->caller, req->output.buf, buf + req->offset, req->output.len);
- return req->output.len;
+ pcpy_to(req->caller, req->out, buf + req->offset, req->outlen);
+ return req->outlen;
}
size_t ring_to_virt(ring_t *r, Proc *proc, void __user *ubuf, size_t max) {
diff --git a/src/kernel/arch/amd64/driver/util.h b/src/kernel/arch/amd64/driver/util.h
index 898875a..44d5728 100644
--- a/src/kernel/arch/amd64/driver/util.h
+++ b/src/kernel/arch/amd64/driver/util.h
@@ -11,8 +11,6 @@ int req_readcopy(VfsReq *req, const void *buf, size_t len);
/* compare request path. path MUST be a static string */
#define reqpathcmp(req, path) _reqpathcmp(req, ""path"", sizeof(path) - 1)
#define _reqpathcmp(req, path, plen) \
- (req->input.kern && \
- req->input.len == plen && \
- memcmp(req->input.buf_kern, path, plen) == 0)
+ (req->kin && req->kinlen == plen && memcmp(req->kin, path, plen) == 0)
size_t ring_to_virt(ring_t *r, Proc *proc, void __user *ubuf, size_t max);
diff --git a/src/kernel/arch/amd64/driver/video.c b/src/kernel/arch/amd64/driver/video.c
index 5ce9a30..4ce1657 100644
--- a/src/kernel/arch/amd64/driver/video.c
+++ b/src/kernel/arch/amd64/driver/video.c
@@ -20,10 +20,10 @@ enum {
static int handle(VfsReq *req) {
switch (req->type) {
case VFSOP_OPEN:
- if (!req->input.kern) panic_invalid_state();
- if (req->input.len == 0) {
+ assert(req->kin != NULL);
+ if (req->kinlen == 0) {
return H_ROOT;
- } else if (req->input.len == namelen && !memcmp(req->input.buf_kern, namebuf, namelen)) {
+ } else if (req->kinlen == namelen && !memcmp(req->kin, namebuf, namelen)) {
return H_FB;
} else {
return -1;
@@ -40,10 +40,10 @@ static int handle(VfsReq *req) {
if ((long __force)req->id != H_FB) {
return -1;
}
- fs_normslice(&req->offset, &req->input.len, fb.size, false);
- /* parial writes ignored */
- pcpy_from(req->caller, fb.b + req->offset, req->input.buf, req->input.len);
- return req->input.len;
+ fs_normslice(&req->offset, &req->uinlen, fb.size, false);
+ /* partial writes ignored */
+ pcpy_from(req->caller, fb.b + req->offset, req->uin, req->uinlen);
+ return req->uinlen;
case VFSOP_GETSIZE:
return fb.size;