string: reword strtok
This commit is contained in:
parent
25a828437a
commit
08b54c22f5
6 changed files with 24 additions and 24 deletions
20
fs/vfs.c
20
fs/vfs.c
|
|
@ -7,31 +7,37 @@
|
|||
|
||||
#include <fs/vfs.h>
|
||||
|
||||
struct rbtree *kfd;
|
||||
static struct rbtree *kfd;
|
||||
static struct fs *rootfs;
|
||||
|
||||
typedef struct fs *(*vfs_init_t)(struct block_device *);
|
||||
|
||||
void vfs_init(const char *rootfs)
|
||||
void vfs_init(const char *rootdev_name)
|
||||
{
|
||||
kfd = kzalloc(sizeof(struct rbtree), ALLOC_DMA);
|
||||
|
||||
/* mount root */
|
||||
struct block_device *rootdev = block_get_device(rootfs);
|
||||
struct block_device *rootdev = block_get_device(rootdev_name);
|
||||
if (!rootdev) {
|
||||
kprintf(LOG_ERROR "Failed to find root device %s\n", rootfs);
|
||||
kprintf(LOG_ERROR "Failed to find root device %s\n", rootdev_name);
|
||||
return;
|
||||
} else {
|
||||
kprintf(LOG_DEBUG "Found root device %s\n", rootfs);
|
||||
kprintf(LOG_DEBUG "Found root device %s\n", rootdev_name);
|
||||
|
||||
/* TODO: detect filesystem type */
|
||||
/* for now, assume ext2 */
|
||||
struct fs *fs = ext2_init_fs(rootdev);
|
||||
if (!fs) {
|
||||
kprintf(LOG_ERROR "Failed to mount root device %s\n", rootfs);
|
||||
kprintf(LOG_ERROR "Failed to mount root device %s\n", rootdev_name);
|
||||
return;
|
||||
} else {
|
||||
kprintf(LOG_DEBUG "Mounted root device %s\n", rootfs);
|
||||
kprintf(LOG_DEBUG "Mounted root device %s\n", rootdev_name);
|
||||
}
|
||||
|
||||
fs->mount_point = kzalloc(2, ALLOC_KERN);
|
||||
fs->mount_point[0] = '/';
|
||||
|
||||
rootfs = fs;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue