Re: [Yaffs] [YAFFS] NFS export with YAFFS2 (continued)

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: Jean-Loup Sabatier
Date:  
To: yaffs
Subject: Re: [Yaffs] [YAFFS] NFS export with YAFFS2 (continued)
Hello again,



For information: I tried adding the needed callbacks, deriving them from the generic implementations, and so far, it seems to be mostly working.



i.e. I added the code included below this mail in the file yaffs_fs.c



Please let me know what you think of this fix and/or if you'd have a better one...



Thanks for your reading,



Best wishes,



Jean-Loup



PS: Here is the added code to yaffs_fs.c



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,


    // .get_parent = yaffs2_get_parent,


    } ;


#endif



________________________________

De : Jean-Loup Sabatier
Envoyé : mardi 1 juillet 2008 17:28
À :
Objet : [YAFFS] NFS export with YAFFS2



Good morning, all,



I'd need some advice and information about a problem I've got with NFS and YAFFS2...



We are trying to export a YAFFS2 partition through an NFS export...



When you try to do so with a standard YAFFS2 on a Linux version greater than 2.6, you get the following error message:



            "exp_export: export of invalid fs type."




To allow the NFS export, with Linux 2.6.16, you only had to make 2 minor changes in yaffs_fs.c :



1) Add an empty struct :



    #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 ;


    #endif




2) And to make sure that the superblock points at it by adding a line into "yaffs_internal_read_super"



    #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,9))


        sb->s_export_op = &yaffs_export_ops;


    #endif






However, on a kernel 2.6.25, it gets tricky: We need to define 3 callback functions in the struct export_operations:



    #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,


        .get_parent = yaffs2_get_parent


        } ;


    #endif




The generic implementation of the callback functions (.fh_to_dentry, .fh_to_parent, .get_parent) does not work.



Anyone has an idea about how to implement these functions?



Thank you very much for your reading and thanks in advance for your advices,



Regards,



Jean-Loup Sabatier