summaryrefslogtreecommitdiffstats
path: root/fs/affs/namei.c
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2017-02-27 17:27:49 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-27 21:43:45 -0500
commited4433d72394131244276d6e7590a7b24a2c9f64 (patch)
tree6f49befa6f76a3b1e4d64a1d8c2cdb5ccaf8ba71 /fs/affs/namei.c
parentd5de9fd594eba1b94f0ef701c044f567f605bc9e (diff)
fs/affs: make affs exportable
Add standard functions making AFFS work with NFS. Functions based on ext4 implementation. Tested on loop device. Link: http://lkml.kernel.org/r/20170109191208.6085-4-fabf@skynet.be Signed-off-by: Fabian Frederick <fabf@skynet.be> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/affs/namei.c')
-rw-r--r--fs/affs/namei.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index 29186d29a3b6..04c3156ff411 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11#include "affs.h" 11#include "affs.h"
12#include <linux/exportfs.h>
12 13
13typedef int (*toupper_t)(int); 14typedef int (*toupper_t)(int);
14 15
@@ -465,3 +466,42 @@ done:
465 affs_brelse(bh); 466 affs_brelse(bh);
466 return retval; 467 return retval;
467} 468}
469
470static struct inode *affs_nfs_get_inode(struct super_block *sb, u64 ino,
471 u32 generation)
472{
473 struct inode *inode;
474
475 if (!affs_validblock(sb, ino))
476 return ERR_PTR(-ESTALE);
477
478 inode = affs_iget(sb, ino);
479 if (IS_ERR(inode))
480 return ERR_CAST(inode);
481
482 if (generation && inode->i_generation != generation) {
483 iput(inode);
484 return ERR_PTR(-ESTALE);
485 }
486
487 return inode;
488}
489
490static struct dentry *affs_fh_to_dentry(struct super_block *sb, struct fid *fid,
491 int fh_len, int fh_type)
492{
493 return generic_fh_to_dentry(sb, fid, fh_len, fh_type,
494 affs_nfs_get_inode);
495}
496
497static struct dentry *affs_fh_to_parent(struct super_block *sb, struct fid *fid,
498 int fh_len, int fh_type)
499{
500 return generic_fh_to_parent(sb, fid, fh_len, fh_type,
501 affs_nfs_get_inode);
502}
503
504const struct export_operations affs_export_ops = {
505 .fh_to_dentry = affs_fh_to_dentry,
506 .fh_to_parent = affs_fh_to_parent,
507};