From e722ee01156bff8eddc2ea859a4c6e6b98dd1b72 Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Wed, 16 Apr 2008 00:20:59 +0100 Subject: [PATCH] Root was a child of itself, removed that relationship. Root is only a parent of itself, it shouldn't show up in its children. --- tasks/fs0/src/lookup.c | 2 -- tasks/fs0/src/memfs/memfs.c | 11 ++++++----- tasks/fs0/src/syscalls.c | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tasks/fs0/src/lookup.c b/tasks/fs0/src/lookup.c index 489bf7a..abca41b 100644 --- a/tasks/fs0/src/lookup.c +++ b/tasks/fs0/src/lookup.c @@ -46,10 +46,8 @@ struct vnode *generic_vnode_lookup(struct vnode *thisnode, struct vnode *found; int err; - printf("looking up: %s\n", component); /* Does this path component match with any of this vnode's dentries? */ list_for_each_entry(d, &thisnode->dentries, vref) { - printf("comparing dentry %s with %s\n", d->name, component); if (d->ops.compare(d, component)) { /* Is this a directory? */ if (vfs_isdir(thisnode)) { diff --git a/tasks/fs0/src/memfs/memfs.c b/tasks/fs0/src/memfs/memfs.c index 71c5eda..4ce5c8d 100644 --- a/tasks/fs0/src/memfs/memfs.c +++ b/tasks/fs0/src/memfs/memfs.c @@ -136,8 +136,12 @@ int memfs_init_rootdir(struct superblock *sb) return -ENOMEM; /* - * Initialise it. - * NOTE: On root, parent is itself. + * Initialise root dentry. + * + * NOTE: Root's parent is itself. + * Here's how it looks like in structures: + * root's parent is root. But root's child is not root. + * * NOTE: Root has no name. This helps since splitpath * cuts out the '/' and "" is left for root name search. */ @@ -149,9 +153,6 @@ int memfs_init_rootdir(struct superblock *sb) /* Associate dentry with its vnode */ list_add(&d->vref, &d->vnode->dentries); - /* Associate dentry with its parent */ - list_add(&d->child, &d->children); - /* Add both vnode and dentry to their flat caches */ list_add(&d->cache_list, &dentry_cache); list_add(&v->cache_list, &vnode_cache); diff --git a/tasks/fs0/src/syscalls.c b/tasks/fs0/src/syscalls.c index 52af532..19fd1aa 100644 --- a/tasks/fs0/src/syscalls.c +++ b/tasks/fs0/src/syscalls.c @@ -48,7 +48,7 @@ void print_vnode(struct vnode *v) { struct dentry *d, *c; - printf("Vnode name:\n"); + printf("Vnode names:\n"); list_for_each_entry(d, &v->dentries, vref) { printf("%s\n", d->name); printf("Children dentries:\n"); @@ -79,7 +79,7 @@ int vfs_create(struct tcb *task, struct pathdata *pdata, unsigned int mode) if ((err = vparent->ops.mknod(vparent, nodename, mode)) < 0) return err; - // print_vnode(vparent); + print_vnode(vparent); return 0; }