From e8f1c287a63f0f71fe463f7271834538b45f8c05 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 2 May 2020 18:17:35 +0200 Subject: Some work in the vfs --- src/kernel/syscall/actions/sys_fork.c | 1 + src/kernel/syscall/actions/sys_read.c | 8 ++++---- src/kernel/syscall/actions/sys_write.c | 9 +++++---- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src/kernel/syscall/actions') diff --git a/src/kernel/syscall/actions/sys_fork.c b/src/kernel/syscall/actions/sys_fork.c index af64ff9..5e2ee80 100644 --- a/src/kernel/syscall/actions/sys_fork.c +++ b/src/kernel/syscall/actions/sys_fork.c @@ -3,6 +3,7 @@ #include #include #include +#include uint32_t sys_fork(struct regs *r) { diff --git a/src/kernel/syscall/actions/sys_read.c b/src/kernel/syscall/actions/sys_read.c index a954f56..8931ede 100644 --- a/src/kernel/syscall/actions/sys_read.c +++ b/src/kernel/syscall/actions/sys_read.c @@ -8,15 +8,15 @@ uint32_t sys_read(char *path, uint32_t offset, uint32_t count, char *buf) { struct fs_node *node = (struct fs_node *)umalloc(sizeof(struct fs_node)); strcpy(node->name, path); - ext2_root->open(node); + fs_open(node); if (node->inode != 0) { uint32_t size = ((struct ext2_file *)node->impl)->inode.size; - ext2_root->read(node, 0, size, buf); + fs_read(node, 0, size, buf); buf[size - 1] = '\0'; - ext2_root->close(node); + fs_close(node); return size; } else { - ext2_root->close(node); + fs_close(node); return -1; } } \ 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 d79ef37..28a5929 100644 --- a/src/kernel/syscall/actions/sys_write.c +++ b/src/kernel/syscall/actions/sys_write.c @@ -3,20 +3,21 @@ #include #include #include +#include uint32_t sys_write(char *path, uint32_t offset, uint32_t count, char *buf) { struct fs_node *node = (struct fs_node *)umalloc(sizeof(struct fs_node)); strcpy(node->name, path); - ext2_root->open(node); + fs_open(node); if (node->inode != 0) { uint32_t size = ((struct ext2_file *)node->impl)->inode.size; - ext2_root->write(node, 0, size, buf); + fs_write(node, 0, size, buf); buf[size - 1] = '\0'; - ext2_root->close(node); + fs_close(node); return size; } else { - ext2_root->close(node); + fs_close(node); return -1; } } \ No newline at end of file -- cgit v1.2.3