Good morning, all,
I didn't find out any glitches with the changes I made to YAFFS2 for the
NFS export. So, I reproduced them below (and included them as an
attached file) in the form of a patch...
Regards,
Jean-Loup
Index: yaffs_fs.c
===================================================================
--- yaffs_fs.c (revision 298)
+++ yaffs_fs.c (copie de travail)
@@ -84,6 +84,7 @@
#define WRITE_SIZE(mtd) (mtd)->oobblock
#endif
+#include <linux/exportfs.h>
#include <asm/uaccess.h>
#include "yportenv.h"
@@ -296,6 +297,33 @@
.write_super = yaffs_write_super,
};
+static struct inode *
+ yaffs2_nfs_get_inode(struct super_block *sb, uint64_t ino, uint32_t
generation)
+ {
+ return yaffs_iget(sb, ino);
+ }
+static struct dentry *
+ yaffs2_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,
yaffs2_nfs_get_inode) ;
+ }
+static struct dentry *
+ yaffs2_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,
yaffs2_nfs_get_inode);
+ }
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,9))
+/* Just declare a zero structure as a NULL value implies
+ * using the default functions of expfs.
+ */
+static struct export_operations yaffs_export_ops =
+ {
+ .fh_to_dentry = yaffs2_fh_to_dentry,
+ .fh_to_parent = yaffs2_fh_to_parent,
+ } ;
+#endif
+
static void yaffs_GrossLock(yaffs_Device * dev)
{
T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs locking\n"));
@@ -1644,11 +1675,14 @@
struct mtd_info *mtd;
int err;
char *data_str = (char *)data;
-
yaffs_options options;
sb->s_magic = YAFFS_MAGIC;
sb->s_op = &yaffs_super_ops;
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,9))
+ sb->s_export_op = &yaffs_export_ops;
+#endif
+
if (!sb)
printk(KERN_INFO "yaffs: sb is NULL\n");
Index: yaffs_fs.c
===================================================================
--- yaffs_fs.c (revision 298)
+++ yaffs_fs.c (copie de travail)
@@ -84,6 +84,7 @@
#define WRITE_SIZE(mtd) (mtd)->oobblock
#endif
+#include <linux/exportfs.h>
#include <asm/uaccess.h>
#include "yportenv.h"
@@ -296,6 +297,33 @@
.write_super = yaffs_write_super,
};
+static struct inode *
+ yaffs2_nfs_get_inode(struct super_block *sb, uint64_t ino, uint32_t generation)
+ {
+ return yaffs_iget(sb, ino);
+ }
+static struct dentry *
+ yaffs2_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, yaffs2_nfs_get_inode) ;
+ }
+static struct dentry *
+ yaffs2_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, yaffs2_nfs_get_inode);
+ }
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,9))
+/* Just declare a zero structure as a NULL value implies
+ * using the default functions of expfs.
+ */
+static struct export_operations yaffs_export_ops =
+ {
+ .fh_to_dentry = yaffs2_fh_to_dentry,
+ .fh_to_parent = yaffs2_fh_to_parent,
+ } ;
+#endif
+
static void yaffs_GrossLock(yaffs_Device * dev)
{
T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs locking\n"));
@@ -1644,11 +1675,14 @@
struct mtd_info *mtd;
int err;
char *data_str = (char *)data;
-
yaffs_options options;
sb->s_magic = YAFFS_MAGIC;
sb->s_op = &yaffs_super_ops;
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,9))
+ sb->s_export_op = &yaffs_export_ops;
+#endif
+
if (!sb)
printk(KERN_INFO "yaffs: sb is NULL\n");