I recently used the yaffs filesystem on the 5.10 kernel and after using David Russell's suggestion it worked fine. Signed-off-by: tianyu2 --- yaffs_vfs_multi.c | 26 +++++++++++++++++--------- yportenv_multi.h | 13 +++++++------ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c index a08e071..d387aaa 100644 --- a/yaffs_vfs_multi.c +++ b/yaffs_vfs_multi.c @@ -88,7 +88,9 @@ #include #include #include - +#if (LINUX_VERSION_CODE > KERNEL_VERSION(4, 19, 0)) +#include +#endif #if (YAFFS_NEW_FOLLOW_LINK == 1) #include #endif @@ -264,18 +266,24 @@ MODULE_PARM(yaffs_gc_control, "i"); #define page_cache_release put_page #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) #define update_dir_time(dir) do {\ (dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \ } while (0) -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4,18,0)) +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)) #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(<ime); \ + (dir)->i_ctime = (dir)->i_mtime = ltime; \ + } while (0) #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)) @@ -2737,12 +2745,12 @@ static int yaffs_remount_fs(struct super_block *sb, int *flags, char *data) 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; @@ -2914,9 +2922,9 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, 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; @@ -2994,7 +3002,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, 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); diff --git a/yportenv_multi.h b/yportenv_multi.h index fa5601b..3c3e0a1 100644 --- a/yportenv_multi.h +++ b/yportenv_multi.h @@ -63,18 +63,19 @@ #define YAFFS_LOSTNFOUND_MODE 0700 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,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 ltime; \ + ktime_get_coarse_real_ts64(<ime); \ + ltime.tv_sec; }) #endif #define Y_TIME_CONVERT(x) (x).tv_sec #else -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)) #define Y_CURRENT_TIME CURRENT_TIME -#else -#define Y_CURRENT_TIME current_kernel_time() -#endif #define Y_TIME_CONVERT(x) (x) #endif -- 2.25.1