
From: Christoph Hellwig <hch@lst.de>


Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/efs/namei.c         |   33 +++++++++++++++++++++++++++++++++
 25-akpm/fs/efs/super.c         |    5 +++++
 25-akpm/include/linux/efs_fs.h |    1 +
 3 files changed, 39 insertions(+)

diff -puN fs/efs/namei.c~allow-nfs-exports-of-efs-filesystems fs/efs/namei.c
--- 25/fs/efs/namei.c~allow-nfs-exports-of-efs-filesystems	2004-11-16 00:30:11.945414760 -0800
+++ 25-akpm/fs/efs/namei.c	2004-11-16 00:30:11.951413848 -0800
@@ -75,3 +75,36 @@ struct dentry *efs_lookup(struct inode *
 	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 -puN fs/efs/super.c~allow-nfs-exports-of-efs-filesystems fs/efs/super.c
--- 25/fs/efs/super.c~allow-nfs-exports-of-efs-filesystems	2004-11-16 00:30:11.946414608 -0800
+++ 25-akpm/fs/efs/super.c	2004-11-16 00:30:11.952413696 -0800
@@ -95,6 +95,10 @@ static struct super_operations efs_super
 	.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_b
 		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 -puN include/linux/efs_fs.h~allow-nfs-exports-of-efs-filesystems include/linux/efs_fs.h
--- 25/include/linux/efs_fs.h~allow-nfs-exports-of-efs-filesystems	2004-11-16 00:30:11.948414304 -0800
+++ 25-akpm/include/linux/efs_fs.h	2004-11-16 00:30:11.952413696 -0800
@@ -45,6 +45,7 @@ extern efs_block_t efs_map_block(struct 
 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__ */
_
