linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: linux-mtd@lists.infradead.org
Cc: david@sigma-star.at, dedekind1@gmail.com,
	adrian.hunter@intel.com, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, adilger.kernel@dilger.ca,
	akpm@linux-foundation.org, linux-ext4@vger.kernel.org,
	bfields@redhat.com, marcus.folkesson@gmail.com,
	hyc.lee@gmail.com, rockdotlee@gmail.com, leon.pollak@gmail.com,
	Richard Weinberger <richard@nod.at>
Subject: [PATCH 5/6] ubifs: Implement export_operations
Date: Sun, 21 May 2017 22:20:50 +0200	[thread overview]
Message-ID: <1495398051-4604-6-git-send-email-richard@nod.at> (raw)
In-Reply-To: <1495398051-4604-1-git-send-email-richard@nod.at>

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 fs/ubifs/super.c | 35 +++++++++++++++++++++++++++++++++++
 fs/ubifs/ubifs.h |  1 +
 2 files changed, 36 insertions(+)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 7560071534bf..4788420162b8 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2005,6 +2005,41 @@ const struct fscrypt_operations ubifs_crypt_operations = {
 };
 #endif
 
+static struct dentry *ubifs_get_parent(struct dentry *child)
+{
+	struct ubifs_inode *ui = ubifs_inode(d_inode(child));
+
+	return d_obtain_alias(ubifs_iget(child->d_sb, ui->parent_inum));
+}
+
+static struct inode *ubifs_nfs_get_inode(struct super_block *sb, uint64_t ino,
+					 uint32_t generation)
+{
+	return ubifs_iget(sb, ino);
+}
+
+static struct dentry *ubifs_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,
+				    ubifs_nfs_get_inode);
+}
+
+static struct dentry *ubifs_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,
+				    ubifs_nfs_get_inode);
+}
+
+static const struct export_operations ubifs_export_ops = {
+	.get_parent = ubifs_get_parent,
+	.fh_to_dentry = ubifs_fh_to_dentry,
+	.fh_to_parent = ubifs_fh_to_parent,
+};
+
 static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
 {
 	struct ubifs_info *c = sb->s_fs_info;
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 3c64481f4032..a728d6e3eb47 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -45,6 +45,7 @@
 #endif
 #include <linux/random.h>
 #include <linux/compat.h>
+#include <linux/exportfs.h>
 #include "ubifs-media.h"
 
 /* Version of this UBIFS implementation */
-- 
2.12.0

  parent reply	other threads:[~2017-05-21 20:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-21 20:20 [PATCH 0/6] UBIFS NFS export support v2 Richard Weinberger
2017-05-21 20:20 ` [PATCH 1/6] ext4: Move is_32bit_api() to generic code Richard Weinberger
2017-05-23  8:36   ` Christoph Hellwig
2017-05-21 20:20 ` [PATCH 2/6] ubifs: Provide a custom llseek for directories Richard Weinberger
2017-05-21 20:20 ` [PATCH 3/6] ubifs: Use 64bit readdir cookies Richard Weinberger
2017-05-21 20:20 ` [PATCH 4/6] ubifs: Maintain a parent pointer Richard Weinberger
2017-05-22  4:30   ` Hyunchul Lee
2017-05-22  8:45     ` Richard Weinberger
2017-05-22 23:50       ` Hyunchul Lee
2017-05-23  7:16         ` Richard Weinberger
2017-05-23  8:37   ` Christoph Hellwig
2017-05-23  8:42     ` Richard Weinberger
2017-05-21 20:20 ` Richard Weinberger [this message]
2017-05-23  8:39   ` [PATCH 5/6] ubifs: Implement export_operations Christoph Hellwig
2017-05-23  8:41     ` Richard Weinberger
2017-05-23  8:48       ` Christoph Hellwig
2017-05-23  8:50         ` Richard Weinberger
2017-05-21 20:20 ` [PATCH 6/6] ubifs: Wire up NFS support Richard Weinberger
  -- strict thread matches above, loose matches on Subject: below --
2016-12-01 22:02 [PATCH 0/6] UBIFS NFS export support Richard Weinberger
2016-12-01 22:02 ` [PATCH 5/6] ubifs: Implement export_operations Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495398051-4604-6-git-send-email-richard@nod.at \
    --to=richard@nod.at \
    --cc=adilger.kernel@dilger.ca \
    --cc=adrian.hunter@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bfields@redhat.com \
    --cc=david@sigma-star.at \
    --cc=dedekind1@gmail.com \
    --cc=hyc.lee@gmail.com \
    --cc=leon.pollak@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marcus.folkesson@gmail.com \
    --cc=rockdotlee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).