mirror of
https://github.com/drasko/codezero.git
synced 2026-03-06 12:33:14 +01:00
incomplete changes for sys_write/sys_close
This commit is contained in:
@@ -254,6 +254,10 @@ int memfs_vnode_mknod(struct vnode *v, char *dirname, unsigned int mode)
|
||||
strncpy((char *)memfsd->name, dirname, MEMFS_DNAME_MAX);
|
||||
memfsd->name[MEMFS_DNAME_MAX - 1] = '\0';
|
||||
|
||||
BUG(); /* FIXME: Fix this issue. */
|
||||
/* Write the updated directory buffer back to disk */
|
||||
v->fops.write(v, 0, 1, v->dirbuf.buffer);
|
||||
|
||||
/* Update parent vnode */
|
||||
v->size += sizeof(*memfsd);
|
||||
|
||||
|
||||
@@ -111,6 +111,19 @@ int sys_open(l4id_t sender, const char *pathname, int flags, unsigned int mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sys_close(l4id_t sender, int fd)
|
||||
{
|
||||
struct vnode *v;
|
||||
|
||||
/* Get the task */
|
||||
BUG_ON(!(task = find_task(sender)));
|
||||
|
||||
/* Lookup vnode */
|
||||
if (!(v = vfs_lookup_byvnum(vfs_root.pivot->sb, vnum)))
|
||||
return -EINVAL; /* No such vnode */
|
||||
|
||||
}
|
||||
|
||||
int sys_mkdir(l4id_t sender, const char *pathname, unsigned int mode)
|
||||
{
|
||||
struct tcb *task;
|
||||
|
||||
@@ -59,16 +59,24 @@ struct vnode *vfs_lookup_byvnum(struct superblock *sb, unsigned long vnum)
|
||||
*/
|
||||
struct vnode *vfs_lookup_bypath(struct tcb *task, char *path)
|
||||
{
|
||||
/* If it's the root or current dir, we already got it. */
|
||||
struct vnode *vnstart;
|
||||
|
||||
/* Is it the root or current directory? If so, we already got it. */
|
||||
if (!strcmp(path, "/"))
|
||||
return task->rootdir;
|
||||
if (!strcmp(path, "."))
|
||||
return task->curdir;
|
||||
|
||||
/* Do we start from root or curdir? */
|
||||
if (path[0] == '/')
|
||||
vnstart = task->rootdir;
|
||||
else
|
||||
vnstart = task->curdir;
|
||||
|
||||
/*
|
||||
* This does vfs cache + fs lookup.
|
||||
*/
|
||||
return generic_vnode_lookup(task->rootdir, path);
|
||||
return generic_vnode_lookup(vnstart, path);
|
||||
}
|
||||
|
||||
int vfs_mount_root(struct superblock *sb)
|
||||
|
||||
Reference in New Issue
Block a user