#include <linux/crc32.h>
#include <linux/statfs.h>
#include <linux/mount.h>
+#include <linux/exportfs.h>
static struct super_operations lafs_sops;
+static const struct export_operations lafs_export_ops;
/*---------------------------------------------------------------------
* Write out state and super blocks
dv->stateaddr[j] = le64_to_cpu(dv->devblk->stateaddr[j]);
dv->sb->s_op = &lafs_sops;
+ dv->sb->s_export_op = &lafs_export_ops;
dv->sb->s_root = NULL;
}
return fs;
lafs_ihash_free();
}
+static struct inode *lafs_nfs_get_inode(struct super_block *sb,
+ u64 ino, u32 generation)
+{
+ struct inode *inode;
+
+ inode = lafs_iget(sb, ino, SYNC);
+ 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 *lafs_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,
+ lafs_nfs_get_inode);
+}
+
+static struct dentry *lafs_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,
+ lafs_nfs_get_inode);
+}
+
+static struct dentry *lafs_get_parent(struct dentry *child)
+{
+ ino_t inum = LAFSI(child->d_inode)->md.file.parent;
+ struct inode *inode = lafs_iget(child->d_inode->i_sb, inum, SYNC);
+ struct dentry *parent;
+ if (IS_ERR(inode))
+ return ERR_CAST(inode);
+ parent = d_alloc_anon(inode);
+ if (!parent) {
+ iput(inode);
+ parent = ERR_PTR(-ENOMEM);
+ }
+ return parent;
+}
+
+static const struct export_operations lafs_export_ops = {
+ .fh_to_dentry = lafs_fh_to_dentry,
+ .fh_to_parent = lafs_fh_to_parent,
+ .get_parent = lafs_get_parent,
+};
+
static struct inode *lafs_alloc_inode(struct super_block *sb)
{
struct lafs_inode *li;