summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/driver/pata.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/arch/amd64/driver/pata.c')
-rw-r--r--src/kernel/arch/amd64/driver/pata.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/kernel/arch/amd64/driver/pata.c b/src/kernel/arch/amd64/driver/pata.c
index 77b654c..3d5e3c6 100644
--- a/src/kernel/arch/amd64/driver/pata.c
+++ b/src/kernel/arch/amd64/driver/pata.c
@@ -56,7 +56,18 @@ static void accept(struct vfs_request *req) {
break;
case VFSOP_WRITE:
- panic_unimplemented();
+ if (id == root_id) {
+ vfsreq_finish_short(req, -EACCES);
+ break;
+ }
+ fs_normslice(&req->offset, &req->input.len, ata_size(id), false);
+ len = min(req->input.len, sizeof wbuf);
+ if (len != 0) {
+ virt_cpy_from(req->caller->pages, wbuf, req->input.buf, len);
+ ata_write(id, wbuf, len, req->offset);
+ }
+ vfsreq_finish_short(req, len);
+ break;
case VFSOP_GETSIZE:
if (id == root_id) {