summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordzwdz2022-07-08 18:36:12 +0200
committerdzwdz2022-07-08 18:36:12 +0200
commit2f520b5e0101a3cb9404371e1152affc934e40b2 (patch)
tree50cd7f19e5d2a28787e6f08bfa0acb5f11449da9 /src
parent29f0f35e4f0af5e662b799186019ba496ab93219 (diff)
kernel/fsroot: use req_preprocess to calculate offsets everywhere
Diffstat (limited to 'src')
-rw-r--r--src/kernel/arch/i386/driver/fsroot.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/kernel/arch/i386/driver/fsroot.c b/src/kernel/arch/i386/driver/fsroot.c
index e16dd80..d22cde7 100644
--- a/src/kernel/arch/i386/driver/fsroot.c
+++ b/src/kernel/arch/i386/driver/fsroot.c
@@ -74,11 +74,10 @@ static int handle(struct vfs_request *req) {
"com1\0"
"ps2\0"
"ata/";
- int len = min((size_t) req->output.len, sizeof(src));
- if (req->offset > len) return 0;
+ req_preprocess(req, sizeof src);
virt_cpy_to(req->caller->pages, req->output.buf,
- src + req->offset, len - req->offset);
- return len;
+ src + req->offset, req->output.len);
+ return req->output.len;
}
case HANDLE_VGA: {
char *vga = (void*)0xB8000;
@@ -88,7 +87,6 @@ static int handle(struct vfs_request *req) {
return req->output.len;
}
case HANDLE_ATA_ROOT: {
- // TODO offset
char list[8] = {};
size_t len = 0;
for (int i = 0; i < 4; i++) {
@@ -97,9 +95,10 @@ static int handle(struct vfs_request *req) {
len += 2;
}
}
- len = min((size_t) req->output.len, len);
- virt_cpy_to(req->caller->pages, req->output.buf, list, len);
- return len;
+ req_preprocess(req, len);
+ virt_cpy_to(req->caller->pages, req->output.buf,
+ list + req->offset, req->output.len);
+ return req->output.len;
}
case HANDLE_ATA: case HANDLE_ATA+1:
case HANDLE_ATA+2: case HANDLE_ATA+3: {