X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fefs%2Fnamei.c;h=ed4a207fe22a4e6d822e019db3c6a1bc05356a96;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=e6c7210f0a68ada54d23302af2d8153e5a14f7f3;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/fs/efs/namei.c b/fs/efs/namei.c index e6c7210f0..ed4a207fe 100644 --- a/fs/efs/namei.c +++ b/fs/efs/namei.c @@ -75,3 +75,36 @@ struct dentry *efs_lookup(struct inode *dir, struct dentry *dentry, struct namei return NULL; } +struct dentry *efs_get_parent(struct dentry *child) +{ + struct dentry *parent; + struct inode *inode; + efs_ino_t ino; + int error; + + lock_kernel(); + + error = -ENOENT; + ino = efs_find_entry(child->d_inode, "..", 2); + if (!ino) + goto fail; + + error = -EACCES; + inode = iget(child->d_inode->i_sb, ino); + if (!inode) + goto fail; + + error = -ENOMEM; + parent = d_alloc_anon(inode); + if (!parent) + goto fail_iput; + + unlock_kernel(); + return parent; + + fail_iput: + iput(inode); + fail: + unlock_kernel(); + return ERR_PTR(error); +}