diff options
| -rw-r--r-- | fs/efs/namei.c | 33 | ||||
| -rw-r--r-- | fs/efs/super.c | 5 | ||||
| -rw-r--r-- | include/linux/efs_fs.h | 1 |
3 files changed, 39 insertions, 0 deletions
diff --git a/fs/efs/namei.c b/fs/efs/namei.c index e6c7210f0a68..ed4a207fe22a 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); +} diff --git a/fs/efs/super.c b/fs/efs/super.c index 467e34b41f5c..af4d01e2730a 100644 --- a/fs/efs/super.c +++ b/fs/efs/super.c @@ -95,6 +95,10 @@ static struct super_operations efs_superblock_operations = { .remount_fs = efs_remount, }; +static struct export_operations efs_export_ops = { + .get_parent = efs_get_parent, +}; + static int __init init_efs_fs(void) { int err; printk("EFS: "EFS_VERSION" - http://aeschi.ch.eu.org/efs/\n"); @@ -278,6 +282,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) s->s_flags |= MS_RDONLY; } s->s_op = &efs_superblock_operations; + s->s_export_op = &efs_export_ops; root = iget(s, EFS_ROOTINODE); s->s_root = d_alloc_root(root); diff --git a/include/linux/efs_fs.h b/include/linux/efs_fs.h index f7c8446239ac..28f368c526fb 100644 --- a/include/linux/efs_fs.h +++ b/include/linux/efs_fs.h @@ -45,6 +45,7 @@ extern efs_block_t efs_map_block(struct inode *, efs_block_t); extern int efs_get_block(struct inode *, sector_t, struct buffer_head *, int); extern struct dentry *efs_lookup(struct inode *, struct dentry *, struct nameidata *); +extern struct dentry *efs_get_parent(struct dentry *); extern int efs_bmap(struct inode *, int); #endif /* __EFS_FS_H__ */ |
