blob: 381f20a4668d59a8cdbc02cdfe6548ceedb12498 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include <errno.h>
#include <kernel/con.h>
#include <kernel/fs.h>
#include <kernel/kernel.h>
#include <kernel/sched.h>
#include <kernel/tty.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
/* master file table */
static struct file ftable[NRFILE];
ssize_t sys_read(int fd, void *buf, size_t len) {
if(fd == STDIN_FILENO)
return tty_read(ctask->ctty, buf, len);
return -EINVAL;
}
ssize_t sys_write(int fd, void *buf, size_t len) {
if(fd == STDOUT_FILENO || fd == STDERR_FILENO)
return tty_write(ctask->ctty, buf, len);
return -EINVAL;
}
void fs_init(void) {
memset(&sblocks, 0, sizeof(sblocks));
memset(&ftable, 0, sizeof(ftable));
buffer_init();
/* hd_init(); */
mount_root();
}
|