From patchwork Sun May 21 20:20:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 9739367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 53E526034C for ; Sun, 21 May 2017 20:22:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43F7E1FFB9 for ; Sun, 21 May 2017 20:22:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 379DB28680; Sun, 21 May 2017 20:22:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1C4E285DB for ; Sun, 21 May 2017 20:22:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757128AbdEUUVZ (ORCPT ); Sun, 21 May 2017 16:21:25 -0400 Received: from mail.sigma-star.at ([95.130.255.111]:46001 "EHLO mail.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757074AbdEUUVV (ORCPT ); Sun, 21 May 2017 16:21:21 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.sigma-star.at (Postfix) with ESMTP id AECE824E0008; Sun, 21 May 2017 22:21:16 +0200 (CEST) Received: from linux.site (richard.vpn.sigmapriv.at [10.3.0.5]) by mail.sigma-star.at (Postfix) with ESMTPSA id A53A424E0002; Sun, 21 May 2017 22:21:15 +0200 (CEST) From: Richard Weinberger 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 Subject: [PATCH 5/6] ubifs: Implement export_operations Date: Sun, 21 May 2017 22:20:50 +0200 Message-Id: <1495398051-4604-6-git-send-email-richard@nod.at> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1495398051-4604-1-git-send-email-richard@nod.at> References: <1495398051-4604-1-git-send-email-richard@nod.at> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Richard Weinberger --- 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 #include +#include #include "ubifs-media.h" /* Version of this UBIFS implementation */