diff options
author | dzwdz | 2022-06-29 21:52:15 +0200 |
---|---|---|
committer | dzwdz | 2022-06-29 21:52:15 +0200 |
commit | bf4cbc830d78774ac00d9501c45e8b84d0ae9ae7 (patch) | |
tree | f302f92badf74dade9e724e37f85d1ee2dd99833 /src/kernel/arch/i386 | |
parent | 43de6a4d8ead1e609828ef34ad1957d34c94ee6a (diff) |
kernel/vfs: add the OPEN_CREATE flag
Diffstat (limited to 'src/kernel/arch/i386')
-rw-r--r-- | src/kernel/arch/i386/driver/fsroot.c | 2 | ||||
-rw-r--r-- | src/kernel/arch/i386/driver/ps2.c | 5 | ||||
-rw-r--r-- | src/kernel/arch/i386/driver/serial.c | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/kernel/arch/i386/driver/fsroot.c b/src/kernel/arch/i386/driver/fsroot.c index e6e53cd..4207541 100644 --- a/src/kernel/arch/i386/driver/fsroot.c +++ b/src/kernel/arch/i386/driver/fsroot.c @@ -47,6 +47,8 @@ static int handle(struct vfs_request *req) { assert(req->caller); switch (req->type) { case VFSOP_OPEN: + if (req->flags & OPEN_CREATE) return -1; + if (exacteq(req, "/")) return HANDLE_ROOT; if (exacteq(req, "/vga")) return HANDLE_VGA; diff --git a/src/kernel/arch/i386/driver/ps2.c b/src/kernel/arch/i386/driver/ps2.c index b7e82eb..e1e97c0 100644 --- a/src/kernel/arch/i386/driver/ps2.c +++ b/src/kernel/arch/i386/driver/ps2.c @@ -31,10 +31,11 @@ static void accept(struct vfs_request *req) { // when you fix something here go also fix it in the COM1 driver static uint8_t buf[32]; // pretty damn stupid int ret; + bool valid; switch (req->type) { case VFSOP_OPEN: - ret = req->input.len == 0 ? 0 : -1; - vfsreq_finish(req, 0); + valid = req->input.len == 0 && !(req->flags & OPEN_CREATE); + vfsreq_finish(req, valid ? 0 : -1); break; case VFSOP_READ: if (ring_size((void*)&backlog) == 0) { diff --git a/src/kernel/arch/i386/driver/serial.c b/src/kernel/arch/i386/driver/serial.c index cda016c..b776d0c 100644 --- a/src/kernel/arch/i386/driver/serial.c +++ b/src/kernel/arch/i386/driver/serial.c @@ -69,10 +69,11 @@ void serial_write(const char *buf, size_t len) { static void accept(struct vfs_request *req) { static char buf[32]; int ret; + bool valid; switch (req->type) { case VFSOP_OPEN: - ret = req->input.len == 0 ? 0 : -1; - vfsreq_finish(req, 0); + valid = req->input.len == 0 && !(req->flags & OPEN_CREATE); + vfsreq_finish(req, valid ? 0 : -1); break; case VFSOP_READ: if (ring_size((void*)&backlog) == 0) { |