rework VFS structure

This commit is contained in:
Babz 2021-09-24 19:18:42 +02:00
parent 054c12130f
commit 73e630f55f
1 changed files with 14 additions and 5 deletions

View File

@ -83,7 +83,7 @@ static void vfs_debug_tree(void) {
}
static int shandle;
static void populate_vfs(const char *path, vfs_entry_t *dir) {
static void populate_vfs_fls(const char *path, vfs_entry_t *dir) {
char glob[64];
strcpy(glob, path);
strcat(glob, "\\*");
@ -119,7 +119,7 @@ static void populate_vfs(const char *path, vfs_entry_t *dir) {
char new_path[64];
sprintf(new_path, "%s\\%s", path, child->name);
populate_vfs(new_path, child);
populate_vfs_fls(new_path, child);
}
child = child->next;
@ -130,18 +130,27 @@ void vfs_init(void) {
vfs_root = vfs_alloc_entry("");
vfs_root->parent = NULL;
vfs_root->type = vfs_dir;
vfs_root->driver = 0;
vfs_root->driver = vfs_drv_builtin;
vfs_root->childs = NULL;
vfs_root->next = NULL;
vfs_new_dir("sys", vfs_root);
vfs_entry_t* sysfs = vfs_new_dir("sys", vfs_root);
sysfs->driver = vfs_drv_sysfs;
vfs_entry_t *media = vfs_new_dir("media", vfs_root);
vfs_entry_t *fls0 = vfs_new_dir("fls0", media);
fls0->driver = vfs_drv_fls;
cpu_atomic_start();
populate_vfs("\\\\fls0", fls0);
populate_vfs_fls("\\\\fls0", fls0);
cpu_atomic_end();
vfs_entry_t *res = vfs_new_dir("res", media);
res->driver = vfs_drv_res;
vfs_debug_tree();
}