incomplete changes for sys_write/sys_close

This commit is contained in:
Bahadir Balban
2008-02-20 22:47:22 +00:00
parent f078116901
commit 2a5cdf80b5
4 changed files with 51 additions and 7 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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)