kbd: use a better get_key method
[thunix.git] / fs / super.c
blobcb3ebe3b0de95a81430b0185ada63ddeef2127ee
1 #include <stdio.h>
2 #include <string.h>
3 #include <malloc.h>
4 #include <err.h>
5 #include <fs.h>
6 #include <tfs.h>
7 #include <cache.h>
9 struct fs * current_root_fs;
11 struct fs_type fs_types [] = {
12 {tfs_mount, tfs_get_blk_shift},
13 {NULL, NULL}
16 struct fs *fs_init(void)
18 struct fs *fs = malloc(sizeof(*fs));
19 struct fs_type *fs_type;
21 printk("fs system initialiaztion...");
23 fs_type = fs_types;
24 while (fs_type->mount) {
25 fs->sb = fs_type->mount();
26 if (fs->sb)
27 break;
28 fs_type++;
30 if (!fs_type->mount)
31 return NULL;
32 fs->block_shift = fs_type->get_blk_shift(fs->sb);
33 fs->sector_shift = 9;
34 current_root_fs = fs;
36 cache_init(fs);
38 fs->root = tfs_iget_root(fs);
39 fs->pwd = fs->root;
41 strcpy(fs->cwd, "/");
44 * ZERO the fd table, since we currently do not support process, we just have
45 * one set of fd table. So, init it here.
47 memset(fds, 0, 32);
49 printk("\t\t%s\n", "[OK]");
50 return fs;