Re: [Yaffs] What's the latest kernel version supported by ya…

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: David Russell
CC: R Y, yaffs
Subject: Re: [Yaffs] What's the latest kernel version supported by yaffs2?
The latest kernel I have built with is 4.15 or so.
I am in the middle of some 64-bit time changes for the core Yaffs code too
and those should be integrated later this month.

If someone wants to test and submit a patch for 5.x (or any no longer
compiling 4.x) they are more than welcome.

Thanks

Regards

Charles



On Thu, Aug 5, 2021 at 12:01 AM David Russell <>
wrote:

> Assuming you are referring to the Linux kernel, I ran into the same
> problem when trying to migrate an old project to 5.10; there was a change
> made around 4.20 mainline to the kernel time getting mechanism and also a
> rename of a #define. I was able to make the following changes and it seems
> to work okay for me. (Note: this is obviously not official, just trying to
> be helpful.)
>
> Dave
>
>
> @@ -11244,6 +11244,9 @@ diff -Naur
> ../../../../../archive/linux-omap/fs/yaffs2/yaffs_vfs.c fs/yaffs2/yaf
> #include <linux/interrupt.h>
> #include <linux/string.h>
> #include <linux/ctype.h>
> +#if (LINUX_VERSION_CODE > KERNEL_VERSION(4, 19, 0))
> +#include <linux/blkdev.h>
> +#endif
>
>  #if (YAFFS_NEW_FOLLOW_LINK == 1)
>  #include <linux/namei.h>
> @@ -11428,10 +11431,16 @@ diff -Naur
> ../../../../../archive/linux-omap/fs/yaffs2/yaffs_vfs.c fs/yaffs2/yaf
>  #define update_dir_time(dir) do {\
>                 (dir)->i_ctime = (dir)->i_mtime = current_kernel_time(); \
>         } while (0)
> -#else
> +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0))
>  #define update_dir_time(dir) do {\
>                 (dir)->i_ctime = (dir)->i_mtime = current_kernel_time64();
> \
>         } while (0)
> +#else
> +#define update_dir_time(dir) do {\
> +               struct timespec64 ltime; \
> +               ktime_get_coarse_real_ts64(&ltime); \
> +               (dir)->i_ctime = (dir)->i_mtime = ltime; \
> +       } while (0)
>  #endif

>
>  #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0))
> @@ -13202,7 +13211,17 @@ diff -Naur
> ../../../../../archive/linux-omap/fs/yaffs2/yaffs_vfs.c fs/yaffs2/yaf
>  #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
>                 inode->i_blksize = inode->i_sb->s_blocksize;
>  #endif
> -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
> +#if (LINUX_VERSION_CODE > KERNEL_VERSION(4, 19, 0))
> +
> +               inode->i_rdev = old_decode_dev(obj->yst_rdev);
> +               inode->i_atime.tv_sec = (time64_t) (obj->yst_atime);
> +               inode->i_atime.tv_nsec = 0;
> +               inode->i_mtime.tv_sec = (time64_t) obj->yst_mtime;
> +               inode->i_mtime.tv_nsec = 0;
> +               inode->i_ctime.tv_sec = (time64_t) obj->yst_ctime;
> +               inode->i_ctime.tv_nsec = 0;
> +
> +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))

>
>                 inode->i_rdev = old_decode_dev(obj->yst_rdev);
>                 inode->i_atime.tv_sec = (time_t) (obj->yst_atime);
> @@ -13894,12 +13914,12 @@ diff -Naur
> ../../../../../archive/linux-omap/fs/yaffs2/yaffs_vfs.c fs/yaffs2/yaf
>                 return 1;
>         }

>
> -       read_only = ((*flags & MS_RDONLY) != 0);
> +       read_only = ((*flags & SB_RDONLY) != 0);
>         if (!read_only && !(mtd->flags & MTD_WRITEABLE)) {
>                 read_only = 1;
>                 printk(KERN_INFO
>                         "yaffs: mtd is read only, setting superblock read
> only");
> -               *flags |= MS_RDONLY;
> +               *flags |= SB_RDONLY;
>         }

>
>         dev = sb->s_fs_info;
> @@ -14061,9 +14081,9 @@ diff -Naur
> ../../../../../archive/linux-omap/fs/yaffs2/yaffs_vfs.c fs/yaffs2/yaf

>
>         sb->s_magic = YAFFS_MAGIC;
>         sb->s_op = &yaffs_super_ops;
> -       sb->s_flags |= MS_NOATIME;
> +       sb->s_flags |= SB_NOATIME;

>
> -       read_only = ((sb->s_flags & MS_RDONLY) != 0);
> +       read_only = ((sb->s_flags & SB_RDONLY) != 0);

>
>  #ifdef YAFFS_COMPILE_EXPORTFS
>         sb->s_export_op = &yaffs_export_ops;
> @@ -14141,7 +14161,7 @@ diff -Naur
> ../../../../../archive/linux-omap/fs/yaffs2/yaffs_vfs.c fs/yaffs2/yaf
>                 printk(KERN_INFO
>                        "yaffs: mtd is read only, setting superblock read
> only\n"
>                 );
> -               sb->s_flags |= MS_RDONLY;
> +               sb->s_flags |= SB_RDONLY;
>         }

>
>         dev = kmalloc(sizeof(struct yaffs_dev), GFP_KERNEL);
> @@ -17228,8 +17248,10 @@ diff -Naur
> ../../../../../archive/linux-omap/fs/yaffs2/yportenv.h fs/yaffs2/ypor
>  #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
>  #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0))
>  #define Y_CURRENT_TIME CURRENT_TIME.tv_sec
> -#else
> +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0))
>  #define Y_CURRENT_TIME current_kernel_time().tv_sec
> +#else
> +#define Y_CURRENT_TIME ({struct timespec64 retval;
> ktime_get_coarse_real_ts64(&retval); retval.tv_sec;})
>  #endif
>  #define Y_TIME_CONVERT(x) (x).tv_sec
>  #else

>
>
>
>
>
>
> > On Aug 3, 2021, at 11:12 PM, R Y <> wrote:
> >
> > I have been following the Building Yaffs into Linux tutorial to try to
> integrate yaffs2 into linux kernel 5.10. However, I have encountered
> multiple errors during compilation. It seems some break changes in newer
> kernels (>5.0 and especially >5.6) cause these errors. To name a few, the
> current_kernel_time64 function is deprecated and we should use SB_* instead
> of MS_* (MS_RDONLY, MS_NOATIME, etc.)
> >
> > I am wondering what's the latest version of kernel supported by yaffs2?
> Am I missing something?
> >
> > Thanks!
> > _______________________________________________
> > yaffs mailing list
> >
> > http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs
>
>
> _______________________________________________
> yaffs mailing list
>
> http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs
>