From 7ea0ddc733285cfa25d6535954de4784b054902a Mon Sep 17 00:00:00 2001 From: dzwdz Date: Mon, 26 Dec 2022 23:22:03 +0100 Subject: amd64/ata: write support --- src/kernel/arch/amd64/driver/pata.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/kernel/arch/amd64/driver') 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) { -- cgit v1.2.3