mirror of
https://github.com/drasko/codezero.git
synced 2026-01-17 13:23:16 +01:00
Towards working mkdir.
This commit is contained in:
@@ -31,6 +31,10 @@ char *splitpath(char **str, char sep)
|
||||
char *cursor = *str;
|
||||
char *end;
|
||||
|
||||
/* Root is the special case, return it as is. */
|
||||
if (strcmp(*str, "/"))
|
||||
return *str;
|
||||
|
||||
/* Move forward until no seperator */
|
||||
while (*cursor == sep) {
|
||||
*cursor = '\0';
|
||||
@@ -67,6 +71,9 @@ char *splitpath_end(char **path, char sep)
|
||||
/* Reverse the rest back to original. */
|
||||
strreverse(*path);
|
||||
|
||||
/* Reverse component back to original */
|
||||
strreverse(component);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ struct vnode *generic_vnode_lookup(struct vnode *thisnode, char *path)
|
||||
}
|
||||
|
||||
/* Not found, return nothing */
|
||||
return 0;
|
||||
return PTR_ERR(-ENOENT);
|
||||
}
|
||||
|
||||
int generic_dentry_compare(struct dentry *d, char *name)
|
||||
|
||||
@@ -228,6 +228,8 @@ int memfs_vnode_mknod(struct vnode *v, char *dirname, unsigned int mode)
|
||||
BUG_ON(parent->vref.next != &v->dentries);
|
||||
BUG_ON(!vfs_isdir(v));
|
||||
|
||||
printf("Parent name: %s\n", parent->name);
|
||||
|
||||
/* Populate the children */
|
||||
if ((err = v->ops.readdir(v)) < 0)
|
||||
return err;
|
||||
|
||||
@@ -127,7 +127,8 @@ int sys_mkdir(l4id_t sender, const char *pathname, unsigned int mode)
|
||||
/* Get the task */
|
||||
BUG_ON(!(task = find_task(sender)));
|
||||
|
||||
return vfs_create(task, pathname, mode);
|
||||
l4_ipc_return(vfs_create(task, pathname, mode));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sys_chdir(l4id_t sender, const char *pathname)
|
||||
@@ -284,7 +285,6 @@ int sys_readdir(l4id_t sender, int fd, void *buf, int count)
|
||||
if (count < dirent_size)
|
||||
return 0;
|
||||
|
||||
printf("%s: Filling in . (curdir)\n", __TASKNAME__);
|
||||
fill_dirent(buf, v->vnum, nbytes, ".");
|
||||
nbytes += dirent_size;
|
||||
buf += dirent_size;
|
||||
@@ -293,13 +293,11 @@ int sys_readdir(l4id_t sender, int fd, void *buf, int count)
|
||||
if (count < dirent_size)
|
||||
return 0;
|
||||
|
||||
printf("%s: Filling in .. (pardir)\n", __TASKNAME__);
|
||||
fill_dirent(buf, d->parent->vnode->vnum, nbytes, "..");
|
||||
nbytes += dirent_size;
|
||||
buf += dirent_size;
|
||||
count -= dirent_size;
|
||||
|
||||
printf("%s: Filling in other dir contents\n", __TASKNAME__);
|
||||
/* Copy fs-specific dir to buf in struct dirent format */
|
||||
if ((total = v->ops.filldir(buf, v, count)) < 0) {
|
||||
l4_ipc_return(total);
|
||||
|
||||
@@ -101,8 +101,8 @@ struct task_data_head *receive_pager_taskdata(void)
|
||||
}
|
||||
|
||||
/* Data is expected in the utcb page */
|
||||
printf("%s: %d Total tasks.\n", __FUNCTION__,
|
||||
((struct task_data_head *)utcb_page)->total);
|
||||
// printf("%s: %d Total tasks.\n", __FUNCTION__,
|
||||
// ((struct task_data_head *)utcb_page)->total);
|
||||
|
||||
return (struct task_data_head *)utcb_page;
|
||||
}
|
||||
@@ -141,8 +141,8 @@ int task_utcb_attach(struct tcb *t)
|
||||
if ((unsigned long)shmaddr != t->utcb_address)
|
||||
return -EINVAL;
|
||||
|
||||
printf("%s: Mapped utcb of task %d @ 0x%x\n",
|
||||
__TASKNAME__, t->tid, shmaddr);
|
||||
// printf("%s: Mapped utcb of task %d @ 0x%x\n",
|
||||
// __TASKNAME__, t->tid, shmaddr);
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user