linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] ufs: NFS support
@ 2009-10-29 10:17 Alexey Dobriyan
  2009-10-29 20:13 ` Evgeniy Dushistov
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Dobriyan @ 2009-10-29 10:17 UTC (permalink / raw)
  To: dushistov, akpm; +Cc: linux-kernel, linux-fsdevel

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 fs/ufs/super.c |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -66,6 +66,7 @@
  */
 
 
+#include <linux/exportfs.h>
 #include <linux/module.h>
 #include <linux/bitops.h>
 
@@ -96,6 +97,56 @@
 #include "swab.h"
 #include "util.h"
 
+static struct inode *ufs_nfs_get_inode(struct super_block *sb, u64 ino, u32 generation)
+{
+	struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
+	struct inode *inode;
+
+	if (ino < UFS_ROOTINO || ino > uspi->s_ncg * uspi->s_ipg)
+		return ERR_PTR(-ESTALE);
+
+	inode = ufs_iget(sb, ino);
+	if (IS_ERR(inode))
+		return ERR_CAST(inode);
+	if (generation && inode->i_generation != generation) {
+		iput(inode);
+		return ERR_PTR(-ESTALE);
+	}
+	return inode;
+}
+
+static struct dentry *ufs_fh_to_dentry(struct super_block *sb, struct fid *fid,
+				       int fh_len, int fh_type)
+{
+	return generic_fh_to_dentry(sb, fid, fh_len, fh_type, ufs_nfs_get_inode);
+}
+
+static struct dentry *ufs_fh_to_parent(struct super_block *sb, struct fid *fid,
+				       int fh_len, int fh_type)
+{
+	return generic_fh_to_parent(sb, fid, fh_len, fh_type, ufs_nfs_get_inode);
+}
+
+static struct dentry *ufs_get_parent(struct dentry *child)
+{
+	struct qstr dot_dot = {
+		.name	= "..",
+		.len	= 2,
+	};
+	ino_t ino;
+
+	ino = ufs_inode_by_name(child->d_inode, &dot_dot);
+	if (!ino)
+		return ERR_PTR(-ENOENT);
+	return d_obtain_alias(ufs_iget(child->d_inode->i_sb, ino));
+}
+
+static const struct export_operations ufs_export_ops = {
+	.fh_to_dentry	= ufs_fh_to_dentry,
+	.fh_to_parent	= ufs_fh_to_parent,
+	.get_parent	= ufs_get_parent,
+};
+
 #ifdef CONFIG_UFS_DEBUG
 /*
  * Print contents of ufs_super_block, useful for debugging
@@ -990,6 +1041,7 @@ magic_found:
 	 * Read ufs_super_block into internal data structures
 	 */
 	sb->s_op = &ufs_super_ops;
+	sb->s_export_op = &ufs_export_ops;
 	sb->dq_op = NULL; /***/
 	sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic);
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] ufs: NFS support
  2009-10-29 10:17 [PATCH 2/2] ufs: NFS support Alexey Dobriyan
@ 2009-10-29 20:13 ` Evgeniy Dushistov
  0 siblings, 0 replies; 2+ messages in thread
From: Evgeniy Dushistov @ 2009-10-29 20:13 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: akpm, linux-kernel, linux-fsdevel

On Thu, Oct 29, 2009 at 01:17:18PM +0300, Alexey Dobriyan wrote:
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
> 
>  fs/ufs/super.c |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
> 
> --- a/fs/ufs/super.c
> +++ b/fs/ufs/super.c
> @@ -66,6 +66,7 @@
>   */
>  
>  
> +#include <linux/exportfs.h>
>  	sb->s_op = &ufs_super_ops;
...
> +	sb->s_export_op = &ufs_export_ops;
>  	sb->dq_op = NULL; /***/
>  	sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic);
>  

I created the similar patch a couple of years ago, for one
person, but have no enough energy to fully test it, before
pushing into mainline.

Acked-by: Evgeniy Dushistov <dushistov@mail.ru>

-- 
/Evgeniy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-29 20:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-29 10:17 [PATCH 2/2] ufs: NFS support Alexey Dobriyan
2009-10-29 20:13 ` Evgeniy Dushistov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).