YAFFS2 migration to Kernel linux-4.4.16 modified records __linux

Source: Internet
Author: User

The YAFFS2 update is slower and can not keep up with the kernel's update speed. So you just have to make some changes.

Just beginning to download from the official website of the direct patching will appear a series of errors. as follows:

**fs/yaffs2/yaffs_vfs.c:in function ' Yaffs_readpage_nolock ': fs/yaffs2/yaffs_vfs.c:286:34:error: ' struct file ' has no
                                  Member named ' f_dentry ' obj = yaffs_dentry_to_obj (f->f_dentry);  ^ fs/yaffs2/yaffs_vfs.c:in function ' Yaffs_hold_space ': fs/yaffs2/yaffs_vfs.c:484:34:error: ' struct file ' has no member
                                  Named ' f_dentry ' obj = yaffs_dentry_to_obj (f->f_dentry); ^ fs/yaffs2/yaffs_vfs.c:in function ' Yaffs_release_space ': fs/yaffs2/yaffs_vfs.c:502:34:error: ' struct file ' has no mem
                                  ber named ' f_dentry ' obj = yaffs_dentry_to_obj (f->f_dentry);  ^ fs/yaffs2/yaffs_vfs.c:in function ' Yaffs_file_write ': fs/yaffs2/yaffs_vfs.c:594:34:error: ' struct file ' has no member
                                  Named ' f_dentry ' obj = yaffs_dentry_to_obj (f->f_dentry); ^ fs/yaffs2/yaffs_vfs.c:606:11:error: ' struct file ' has no member named ' f_dentry ' inode = F->f_dentry->d_inode;  ^ fs/yaffs2/yaffs_vfs.c:in function ' Yaffs_file_flush ': fs/yaffs2/yaffs_vfs.c:730:55:error: ' struct file ' has no member


         Named ' f_dentry ' struct yaffs_obj *obj = yaffs_dentry_to_obj (file->f_dentry); ^ Fs/yaffs2/yaffs_vfs.c:at top level:fs/yaffs2/yaffs_vfs.c:780:10:error: "New_sync_read ' undeclared Here" (not in a Func  tion). Read = New_sync_read, ^ fs/yaffs2/yaffs_vfs.c:781:11:error: ' New_sync_write ' undeclared here function). Write = new_sync_write, ^ fs/yaffs2/yaffs_vfs.c:in function ' Yaffs_follow_link ': fs/yaffs2/yaffs _vfs.c:1078:2: error:implicit declaration of function ' Nd_set_link ' [-werror=implicit-function-declaration] nd_set_
  Link (nd, alias); ^ Fs/yaffs2/yaffs_vfs.c:at top level:fs/yaffs2/yaffs_vfs.c:1118:17:warning:initialization from incompatible pointer t ype. Follow_link = Yaffs_follow_link, ^ fs/yaffs2/yaffs_vfs.c:1118:17:warning: (Near initialization fo R ' Yaffs_symlink_inode_opErations.follow_link ') fs/yaffs2/yaffs_vfs.c:1120:14:warning:initialization from incompatible pointer type. put_link = Yaffs_put_link, ^ fs/yaffs2/yaffs_vfs.c:1120:14:warning: (Near initialization for ' Yaffs_symlink_inode_op Erations.put_link ') fs/yaffs2/yaffs_vfs.c:in function ' yaffs_iterate ': fs/yaffs2/yaffs_vfs.c:1730:34:error: ' struct
                                  File ' has no member named ' f_dentry ' obj = yaffs_dentry_to_obj (f->f_dentry); 
^ Cc1:some warnings being treated as errors make[4]: * * * [FS/YAFFS2/YAFFS_VFS.O] Error 1 Make[3]: * * * [FS/YAFFS2] Error 2 MAKE[2]: * * * [FS] Error 2 make[2]: * * * waiting for unfinished jobs ... make[1]: * * * [/home/anzyelay/downloads/buildroot-2 016.05/output/build/linux-4.4.16/.stamp_built] Error 2 Make: * * * [_all] Error 2**

There are three questions to resolve 1:error: ' struct file ' has no member named ' F_dentry ' 2:error: ' New_sync_read/write ' undeclared here 3:error : implicit declaration of function ' Nd_set_link ' 1 ' struct file ' has no member named ' F_dentry '

The first is because the file structure of the new kernel has changed, putting the Dentry member in the path structure, as long as it changes.

struct File {
    union {
        struct llist_node   fu_llist;
        struct Rcu_head     fu_rcuhead;
    } F_u;
    struct path     f_path;
struct path {
    struct vfsmount *mnt;
    struct Dentry *dentry;

Add the following definitions directly to the yaffs_vfs.c , or replace them all

#define F_dentry f_path.dentry
#define F_VFSMNT f_path.mnt
2 ' new_sync_read/write ' undeclared here

For the 2nd problem is that the new kernel does not have the "new_sync_read/write" of these two exported functions, changed to

    . Read = __vfs_read,//new_sync_read
    . Write = __vfs_write,  //new_sync_write
3 error:implicit declaration of function ' Nd_set_link '

To the Linux website query found that the 4.4.16 kernel has not nd_set_link this function,
So you want to modify the place where you use this function. The main thing is to yaffs_follow_link this function, Yaffs_follow_link's definition mainly refers to your include/linux/fs.h struct inode_ Operations.follow_link to define.
The previous alias was saved in the Nd->saved_names, and now this member has been deleted, returned directly through the function return value, and is saved in the *cookie

@@ -1053,7 +1062,11 @@} #if (Yaffs_new_follow_link = 1) + #if Linux_version_code < Kernel_ VERSION (4, 4) static void *yaffs_follow_link (struct dentry *dentry, struct nameidata *nd) + #else +static const char *
 Yaffs_follow_link (struct dentry *dentry,void **cookie) + #endif {void *ret;
    #else @@ -1075,7 +1088,11 @@ -1075,7 out;
#if (Yaffs_new_follow_link = 1) + #if Linux_version_code < Kernel_version (4, 4,) Nd_set_link (ND, alias);
+ #else + *cookie = alias;
 + #endif ret = alias; Out:if (ret_int) @@ -1107,10 +1124,17 @@ -1107,10 #if (yaffs_new_follow_link = 1) + #if Linux_version_code < KERN
 El_version (4, 4,) void Yaffs_put_link (struct dentry *dentry, struct nameidata *nd, void *alias) {kfree (alias); + #else +void yaffs_put_link (struct inode *inode,void *alias) +{+ kfree (alias); +} + #endif #endif static const STRU CT inode_operations yaffs_symlink_inode_operations = {
Second step

The following error occurs at compile time when the above modifications are completed:

In file included from fs/yaffs2/yaffs_nameval.c:28:0: fs/yaffs2/yaffs_nameval.h:21:21:warning: ' struct Yaffs_dev '
                     Declared inside parameter list int Nval_del (struct Yaffs_dev *dev, char *xb, int xb_size, const YCHAR * name); ^ Fs/yaffs2/yaffs_nameval.h:21:21:warning:its Scope is only this definition or declaration, which is PROBABL Y not what want fs/yaffs2/yaffs_nameval.h:24:7: Warning: ' struct Yaffs_dev ' declared inside list int
       bsize, int flags);
       ^ fs/yaffs2/yaffs_nameval.h:27:7: Warning: ' struct Yaffs_dev ' declared inside list int parameter); ^ Fs/yaffs2/yaffs_nameval.h:29:8: Warning: ' struct Yaffs_dev ' declared inside parameter list const char *XB, int x
        B_size, char *buf, int bsize); ^ fs/yaffs2/yaffs_nameval.h:30:27:warning: ' struct Yaffs_dev ' declared inside parameter list int nval_hasvalues (struct y
                           Affs_dev *dev, const char *XB, int xb_size); ^ Fs/yaffs2/yaffs_naMeval.c:82:5: error:conflicting types for ' nval_del ' int nval_del (struct Yaffs_dev *dev, char *xb, int xb_size, const YC HAR *name) ^ in file included from fs/yaffs2/yaffs_nameval.c:28:0: fs/yaffs2/yaffs_nameval.h:21:5: note:previous Dec
     Laration of ' Nval_del ' is here int nval_del (struct Yaffs_dev *dev, char *xb, int xb_size, const YCHAR * name); ^ Fs/yaffs2/yaffs_nameval.c:100:5: error:conflicting types for ' nval_set ' int nval_set (struct Yaffs_dev *dev, ^ in File included from fs/yaffs2/yaffs_nameval.c:28:0: fs/yaffs2/yaffs_nameval.h:22:5: note:previous declaration of ' Nval_ Set ' is here int nval_set (struct Yaffs_dev *dev, ^ fs/yaffs2/yaffs_nameval.c:145:5: error:conflicting types for ' n Val_get ' int nval_get (struct Yaffs_dev *dev, ^ in file included from fs/yaffs2/yaffs_nameval.c:28:0: Fs/yaffs2/yaffs _nameval.h:25:5: note:previous declaration of ' Nval_get ' is here int nval_get (struct Yaffs_dev-*dev, ^ fs/yaffs2/y Affs_nameval.c:185:5: Error:conflicting types for ' nval_list ' int nval_list (struct Yaffs_dev *dev, const char *XB, int xb_size, char *buf, int bsize) ^ in file included from fs/yaffs2/yaffs_nameval.c:28:0: fs/yaffs2/yaffs_nameval.h:28:5: note:previous Declaration of ' Nval_list ' is here int nval_list (struct Yaffs_dev *dev, ^ fs/yaffs2/yaffs_nameval.c:227:5: error:conflicting Type s for ' nval_hasvalues ' int nval_hasvalues (struct Yaffs_dev *dev, const char *XB, int xb_size) ^ in file included fro M fs/yaffs2/yaffs_nameval.c:28:0: Fs/yaffs2/yaffs_nameval.h:30:5: note:previous declaration of ' Nval_hasvalues ' was
     here int nval_hasvalues (struct Yaffs_dev *dev, const char *XB, int xb_size);  ^ Make[4]: * * * * [FS/YAFFS2/YAFFS_NAMEVAL.O] Error 1 Make[3]: * * * [FS/YAFFS2] Error 2 make[2]: * * * [FS] Error 2 make[2]: * * * Waiting for unfinished jobs ... make[1]: * * * * * [/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/. Stamp_built] Error 2 Make: * * * [_all] Error 2

Explanation: error:conflicting types for ' Nval_del ', see the Nval_del several functions, here I do not see any type of conflict error, the Internet search was mainly the first warning there caused.
In yaffs_nameval.h, the definition of a struct struct yaffs_dev appears in the argument list, which is not defined before, which causes the function to not recognize the structure to raise the error above, query the next struct Yaffs_dev in "yaffs_ Guts.h "is defined, so in yaffs_nameval.h file include" Yaffs_guts.h "is ok third step

You may also encounter the following two errors after two modifications: error:unknown type name ' y_loff_t '

In file included from fs/yaffs2/yaffs_guts.c:18:0:
fs/yaffs2/yaffs_endian.h:32:86:error:unknown type name ' Y_loff _t '
 static inline y_loff_t swap_loff_t (y_loff_t lval)
                                                                                      ^
Fs/yaffs2/yaffs_endian.h:32:107:error:unknown Type name ' y_loff_t '
 static inline y_loff_t swap_loff_t (y_loff_t lval)
                                                                                                           ^
Make[4]: * * * [Fs/yaffs2/yaffs_  GUTS.O] Error 1
make[3]: * * * [FS/YAFFS2] Error 2
make[2]: * * * [FS] Error 2
make[2]: * * Waiting for unfinished Jobs ...
.. MAKE[1]: * * * [/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/.stamp_built] Error 2 make
: * * * [_all] Error 2

This is a good solution, adding the following definition to the Yaffs_endian.h:

#ifndef y_loff_t
#define y_loff_t loff_t               
#endif
yaffs_guts.c:line:undefined reference to function
fs/built-in.o:in function ' yaffs_check_obj_details_loaded ':/home/anzyelay/downloads/buildroot-2016.05/output/ build/linux-4.4.16/fs/yaffs2/yaffs_guts.c:3254:undefined reference to ' Yaffs_do_endian_oh ' fs/built-in.o:in function ' Yaffs_oh_size_load ':/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/ yaffs_guts.c:5165:undefined reference to ' yaffs_do_endian_u32 '/home/anzyelay/downloads/buildroot-2016.05/output/ build/linux-4.4.16/fs/yaffs2/yaffs_guts.c:5166:undefined reference to ' yaffs_do_endian_u32 ' fs/built-in.o:in function ' Yaffs_update_oh ':/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs _guts.c:3401:undefined reference to ' Yaffs_do_endian_oh ' fs/built-in.o:in function ' yaffs_guts_initialise ':/home/ anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_guts.c:4912:undefined Reference To ' yaffs_endian_config ' fs/built-in.o:in function ' yaffs_oh_size_load ':/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_guts.c:5165:undefined reference to ' yaffs_do_endian_u32 '/ home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_guts.c:5166:undefined Reference to ' yaffs_do_endian_u32 ' fs/built-in.o:in function ' yaffs_oh_to_size ':/home/anzyelay/downloads/ buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_guts.c:5181:undefined reference to ' Yaffs_do_endian_ U32 '/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_guts.c:5182:undefined Reference to ' yaffs_do_endian_u32 '/HOME/ANZYELAY/DOWNLOADS/BUILDROOT-2016.05/OUTPUT/BUILD/LINUX-4.4.16/FS/YAFFS2 /yaffs_guts.c:5190:undefined reference to ' yaffs_do_endian_u32 ' fs/built-in.o:in function ' Yaffs_pack_tags2_tags_ Only ':/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_packedtags2.c:111: Undefined reference to ' YAFFS_DO_ENDIAN_PACKED_TAGS2 '/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_packedtags2.c:111:undefined reference to ' YAFFS_DO_ENDIAN_PACKED_TAGS2 ' fs/ built-in.o:in function ' yaffs_unpack_tags2_tags_only ':/home/anzyelay/downloads/buildroot-2016.05/output/build/ linux-4.4.16/fs/yaffs2/yaffs_packedtags2.c:137:undefined reference to ' YAFFS_DO_ENDIAN_PACKED_TAGS2 ' FS/BUILT-IN.O : in function ' Yaffs_load_tags_to_spare ':/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/ yaffs2/yaffs_tagscompat.c:92:undefined reference to ' yaffs_do_endian_u32 '/home/anzyelay/downloads/ buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_tagscompat.c:93:undefined reference to ' Yaffs_do_ Endian_u32 ' fs/built-in.o:in function ' yaffs_get_tags_from_spare ':/home/anzyelay/downloads/buildroot-2016.05/ output/build/linux-4.4.16/fs/yaffs2/yaffs_tagscompat.c:122:undefined reference to ' yaffs_do_endian_u32 '/home/ anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_tagscompat.c:123:undefined Reference to ' Yaffs_do_endian_u32 ' fs/built-in.o:in function ' nval_used ':/home/anzyelay/downloads/buildroot-2016.05/output/ build/linux-4.4.16/fs/yaffs2/yaffs_nameval.c:69:undefined reference to ' Yaffs_do_endian_s32 '/home/anzyelay/ downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_nameval.c:75:undefined reference to ' Yaffs_ Do_endian_s32 ' fs/built-in.o:in function ' nval_find ':/home/anzyelay/downloads/buildroot-2016.05/output/build/ linux-4.4.16/fs/yaffs2/yaffs_nameval.c:41:undefined reference to ' Yaffs_do_endian_s32 '/home/anzyelay/downloads/ buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_nameval.c:53:undefined reference to ' Yaffs_do_endian_ S32 ' fs/built-in.o:in function ' Nval_del ':/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs /yaffs2/yaffs_nameval.c:93:undefined reference to ' Yaffs_do_endian_s32 ' fs/built-in.o:/home/anzyelay/downloads/ Buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_nameval.c:136:more undefined referenceS to ' yaffs_do_endian_s32 ' follow fs/built-in.o:in function ' Yaffs2_checkpt_tnode_worker ':/home/anzyelay/downloads/ buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_yaffs2.c:599:undefined reference to ' Yaffs_do_endian_ U32 ' fs/built-in.o:in function ' yaffs2_wr_checkpt_sum ':/home/anzyelay/downloads/buildroot-2016.05/output/build/ linux-4.4.16/fs/yaffs2/yaffs_yaffs2.c:811:undefined reference to ' yaffs_do_endian_u32 ' fs/built-in.o:in function ' Yaffs2_rd_checkpt_tnodes ':/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs _yaffs2.c:647:undefined reference to ' yaffs_do_endian_u32 '/home/anzyelay/downloads/buildroot-2016.05/output/build /linux-4.4.16/fs/yaffs2/yaffs_yaffs2.c:671:undefined reference to ' yaffs_do_endian_u32 ' fs/built-in.o:in function ' Yaffs2_rd_checkpt_sum ':/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_ yaffs2.c:835:undefined reference to ' yaffs_do_endian_u32 ' fs/built-in.o:in function ' YAffs2_scan_chunk ':/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/fs/yaffs2/yaffs_ yaffs2.c:1302:undefined reference to ' Yaffs_do_endian_oh '/home/anzyelay/downloads/buildroot-2016.05/output/build/
linux-4.4.16/fs/yaffs2/yaffs_yaffs2.c:1302:undefined reference to ' Yaffs_do_endian_oh ' make[2]: * * * [vmlinux] Error 1 MAKE[1]: * * * [/home/anzyelay/downloads/buildroot-2016.05/output/build/linux-4.4.16/.stamp_built] Error 2 Make: * * *  All] Error 2 anzyelay@ubuntu:buildroot-2016.05$

This looked at clearly these functions have a definition of how the implementation is not recognized?? Header file These are also wrapped in letters, on the Internet to find that the compiler did not compile to the 譔 file can cause other function references unrecognized, I looked at the compilation, the other. c files are compiled into. O, and then open makefile a look did not add in, yaffs really don't worry, Add the following in the Makefile.kernel:

Yaffs-y + + YAFFS_ENDIAN.O

There is no such thing as a wicked mistake. After the compilation is OK, as for the start of any other cause of the error is unknown.

Yaffs's patch file is as follows:

Diff-nur Yaffs2/makefile.kernel Yaffs2.anzyelay/makefile.kern

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.