|
18 | 18 | #include <linux/parser.h>
|
19 | 19 | #include <linux/namei.h>
|
20 | 20 | #include <linux/sched.h>
|
| 21 | +#include <linux/exportfs.h> |
21 | 22 |
|
22 | 23 | #include "befs.h"
|
23 | 24 | #include "btree.h"
|
@@ -52,6 +53,10 @@ static void befs_put_super(struct super_block *);
|
52 | 53 | static int befs_remount(struct super_block *, int *, char *);
|
53 | 54 | static int befs_statfs(struct dentry *, struct kstatfs *);
|
54 | 55 | static int parse_options(char *, struct befs_mount_options *);
|
| 56 | +static struct dentry *befs_fh_to_dentry(struct super_block *sb, |
| 57 | + struct fid *fid, int fh_len, int fh_type); |
| 58 | +static struct dentry *befs_fh_to_parent(struct super_block *sb, |
| 59 | + struct fid *fid, int fh_len, int fh_type); |
55 | 60 |
|
56 | 61 | static const struct super_operations befs_sops = {
|
57 | 62 | .alloc_inode = befs_alloc_inode, /* allocate a new inode */
|
@@ -84,6 +89,11 @@ static const struct address_space_operations befs_symlink_aops = {
|
84 | 89 | .readpage = befs_symlink_readpage,
|
85 | 90 | };
|
86 | 91 |
|
| 92 | +static const struct export_operations befs_export_operations = { |
| 93 | + .fh_to_dentry = befs_fh_to_dentry, |
| 94 | + .fh_to_parent = befs_fh_to_parent, |
| 95 | +}; |
| 96 | + |
87 | 97 | /*
|
88 | 98 | * Called by generic_file_read() to read a page of data
|
89 | 99 | *
|
@@ -629,6 +639,33 @@ befs_nls2utf(struct super_block *sb, const char *in,
|
629 | 639 | return -EILSEQ;
|
630 | 640 | }
|
631 | 641 |
|
| 642 | +static struct inode *befs_nfs_get_inode(struct super_block *sb, uint64_t ino, |
| 643 | + uint32_t generation) |
| 644 | +{ |
| 645 | + /* No need to handle i_generation */ |
| 646 | + return befs_iget(sb, ino); |
| 647 | +} |
| 648 | + |
| 649 | +/* |
| 650 | + * Map a NFS file handle to a corresponding dentry |
| 651 | + */ |
| 652 | +static struct dentry *befs_fh_to_dentry(struct super_block *sb, |
| 653 | + struct fid *fid, int fh_len, int fh_type) |
| 654 | +{ |
| 655 | + return generic_fh_to_dentry(sb, fid, fh_len, fh_type, |
| 656 | + befs_nfs_get_inode); |
| 657 | +} |
| 658 | + |
| 659 | +/* |
| 660 | + * Find the parent for a file specified by NFS handle |
| 661 | + */ |
| 662 | +static struct dentry *befs_fh_to_parent(struct super_block *sb, |
| 663 | + struct fid *fid, int fh_len, int fh_type) |
| 664 | +{ |
| 665 | + return generic_fh_to_parent(sb, fid, fh_len, fh_type, |
| 666 | + befs_nfs_get_inode); |
| 667 | +} |
| 668 | + |
632 | 669 | enum {
|
633 | 670 | Opt_uid, Opt_gid, Opt_charset, Opt_debug, Opt_err,
|
634 | 671 | };
|
@@ -829,6 +866,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
|
829 | 866 | /* Set real blocksize of fs */
|
830 | 867 | sb_set_blocksize(sb, (ulong) befs_sb->block_size);
|
831 | 868 | sb->s_op = &befs_sops;
|
| 869 | + sb->s_export_op = &befs_export_operations; |
832 | 870 | root = befs_iget(sb, iaddr2blockno(sb, &(befs_sb->root_dir)));
|
833 | 871 | if (IS_ERR(root)) {
|
834 | 872 | ret = PTR_ERR(root);
|
|
0 commit comments