diff options
author | Marvin Borner | 2020-05-06 18:16:47 +0200 |
---|---|---|
committer | Marvin Borner | 2020-05-06 18:16:47 +0200 |
commit | 1a8563a05608b5b5e27eada44cf4790926001c68 (patch) | |
tree | 3e25e3168dd260bb66d22ac1b559bcefd4c405ed /src/kernel/syscall/actions | |
parent | 476af3bcc2f2a072d32db0523c382af99a9d2b5b (diff) |
Removed vfs - ext2 ftw!
I should really start thinking before I implement features. Now I did
and I have quite a good plan for the future of Melvix (hint: not
unix/posix-compliant!).
Diffstat (limited to 'src/kernel/syscall/actions')
-rw-r--r-- | src/kernel/syscall/actions/sys_read.c | 21 | ||||
-rw-r--r-- | src/kernel/syscall/actions/sys_write.c | 22 |
2 files changed, 6 insertions, 37 deletions
diff --git a/src/kernel/syscall/actions/sys_read.c b/src/kernel/syscall/actions/sys_read.c index 8931ede..492e5fd 100644 --- a/src/kernel/syscall/actions/sys_read.c +++ b/src/kernel/syscall/actions/sys_read.c @@ -1,22 +1,7 @@ #include <stdint.h> -#include <kernel/fs/vfs.h> -#include <kernel/fs/ext2.h> -#include <kernel/lib/stdlib.h> -#include <kernel/memory/alloc.h> +#include <kernel/fs/fs.h> -uint32_t sys_read(char *path, uint32_t offset, uint32_t count, char *buf) +uint32_t sys_read(char *path, uint32_t offset, uint32_t count, uint8_t *buf) { - struct fs_node *node = (struct fs_node *)umalloc(sizeof(struct fs_node)); - strcpy(node->name, path); - fs_open(node); - if (node->inode != 0) { - uint32_t size = ((struct ext2_file *)node->impl)->inode.size; - fs_read(node, 0, size, buf); - buf[size - 1] = '\0'; - fs_close(node); - return size; - } else { - fs_close(node); - return -1; - } + return read(path, offset, count, buf); }
\ No newline at end of file diff --git a/src/kernel/syscall/actions/sys_write.c b/src/kernel/syscall/actions/sys_write.c index 28a5929..b9b30f3 100644 --- a/src/kernel/syscall/actions/sys_write.c +++ b/src/kernel/syscall/actions/sys_write.c @@ -1,23 +1,7 @@ #include <stdint.h> -#include <kernel/fs/vfs.h> -#include <kernel/fs/ext2.h> -#include <kernel/lib/stdlib.h> -#include <kernel/memory/alloc.h> -#include <kernel/system.h> +#include <kernel/fs/fs.h> -uint32_t sys_write(char *path, uint32_t offset, uint32_t count, char *buf) +uint32_t sys_write(char *path, uint32_t offset, uint32_t count, uint8_t *buf) { - struct fs_node *node = (struct fs_node *)umalloc(sizeof(struct fs_node)); - strcpy(node->name, path); - fs_open(node); - if (node->inode != 0) { - uint32_t size = ((struct ext2_file *)node->impl)->inode.size; - fs_write(node, 0, size, buf); - buf[size - 1] = '\0'; - fs_close(node); - return size; - } else { - fs_close(node); - return -1; - } + return write(path, offset, count, buf); }
\ No newline at end of file |