From: Charles Manning Date: Sun, 14 Aug 2011 23:40:30 +0000 (+1200) Subject: Mods for Linux 3.0 and fix a typo X-Git-Tag: pre-driver-refactoring~41^2~2 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=a7b5dcf904ba6f7890e4b77ce1f56388b855d0f6;hp=ffb9a41a909210075adf0c529becca54109b2d80 Mods for Linux 3.0 and fix a typo Roll in NCB's patch and some other changes for Linux 3.0. Also fix a dumb type retired_writes->retried_writes Signed-off-by: Charles Manning --- diff --git a/patch-ker.sh b/patch-ker.sh index 44152c8..ed54d53 100755 --- a/patch-ker.sh +++ b/patch-ker.sh @@ -92,7 +92,7 @@ PATCHLEVEL=`grep -s PATCHLEVEL <$LINUXDIR/Makefile | head -n 1 | sed s/'PATCHLEV SUBLEVEL=`grep -s SUBLEVEL <$LINUXDIR/Makefile | head -n 1 | sed s/'SUBLEVEL = '//` # Can we handle this version? -if [ $VERSION -ne 2 -o $PATCHLEVEL -lt 6 ] +if [ $VERSION$PATCHLEVEL -lt 26 ] then echo "Cannot patch kernel version $VERSION.$PATCHLEVEL.$SUBLEVEL, must be 2.6.x or higher" exit 1; diff --git a/yaffs_guts.c b/yaffs_guts.c index d72aa5b..9ade09b 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -598,7 +598,7 @@ static int yaffs_write_new_chunk(struct yaffs_dev *dev, yaffs_trace(YAFFS_TRACE_ERROR, "**>> yaffs write required %d attempts", attempts); - dev->n_retired_writes += (attempts - 1); + dev->n_retried_writes += (attempts - 1); } return chunk; @@ -4878,7 +4878,7 @@ int yaffs_guts_initialise(struct yaffs_dev *dev) dev->n_page_writes = 0; dev->n_erasures = 0; dev->n_gc_copies = 0; - dev->n_retired_writes = 0; + dev->n_retried_writes = 0; dev->n_retired_blocks = 0; diff --git a/yaffs_guts.h b/yaffs_guts.h index 6ec8a47..490122a 100644 --- a/yaffs_guts.h +++ b/yaffs_guts.h @@ -744,7 +744,7 @@ struct yaffs_dev { u32 oldest_dirty_gc_count; u32 n_gc_blocks; u32 bg_gcs; - u32 n_retired_writes; + u32 n_retried_writes; u32 n_retired_blocks; u32 n_ecc_fixed; u32 n_ecc_unfixed; diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c index 966df48..b8e5124 100644 --- a/yaffs_vfs_multi.c +++ b/yaffs_vfs_multi.c @@ -72,7 +72,9 @@ #include #include #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)) #include +#endif #include #include #include @@ -237,7 +239,9 @@ static int yaffs_file_flush(struct file *file, fl_owner_t id); static int yaffs_file_flush(struct file *file); #endif -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) +static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync); +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)) static int yaffs_sync_object(struct file *file, int datasync); #else static int yaffs_sync_object(struct file *file, struct dentry *dentry, @@ -1826,7 +1830,9 @@ static int yaffs_symlink(struct inode *dir, struct dentry *dentry, return -ENOMEM; } -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) +static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync) +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)) static int yaffs_sync_object(struct file *file, int datasync) #else static int yaffs_sync_object(struct file *file, struct dentry *dentry, @@ -2973,7 +2979,13 @@ static int yaffs_internal_read_super_mtd(struct super_block *sb, void *data, return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL; } -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) +static struct dentry *yaffs_mount(struct file_system_type *fs_type, int flags, + const char *dev_name, void *data) +{ + return mount_bdev(fs_type, flags, dev_name, data, yaffs_internal_read_super_mtd); +} +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) static int yaffs_read_super(struct file_system_type *fs, int flags, const char *dev_name, void *data, struct vfsmount *mnt) @@ -2996,8 +3008,12 @@ static struct super_block *yaffs_read_super(struct file_system_type *fs, static struct file_system_type yaffs_fs_type = { .owner = THIS_MODULE, .name = "yaffs", - .get_sb = yaffs_read_super, - .kill_sb = kill_block_super, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) + .mount = yaffs_mount, +#else + .get_sb = yaffs_read_super, +#endif + .kill_sb = kill_block_super, .fs_flags = FS_REQUIRES_DEV, }; #else @@ -3019,7 +3035,13 @@ static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data, return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL; } -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) +static struct dentry *yaffs2_mount(struct file_system_type *fs_type, int flags, + const char *dev_name, void *data) +{ + return mount_bdev(fs_type, flags, dev_name, data, yaffs2_internal_read_super_mtd); +} +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) static int yaffs2_read_super(struct file_system_type *fs, int flags, const char *dev_name, void *data, struct vfsmount *mnt) @@ -3041,8 +3063,12 @@ static struct super_block *yaffs2_read_super(struct file_system_type *fs, static struct file_system_type yaffs2_fs_type = { .owner = THIS_MODULE, .name = "yaffs2", - .get_sb = yaffs2_read_super, - .kill_sb = kill_block_super, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) + .mount = yaffs2_mount, +#else + .get_sb = yaffs2_read_super, +#endif + .kill_sb = kill_block_super, .fs_flags = FS_REQUIRES_DEV, }; #else @@ -3112,8 +3138,8 @@ static char *yaffs_dump_dev_part1(char *buf, struct yaffs_dev *dev) dev->oldest_dirty_gc_count); buf += sprintf(buf, "n_gc_blocks.......... %u\n", dev->n_gc_blocks); buf += sprintf(buf, "bg_gcs............... %u\n", dev->bg_gcs); - buf += sprintf(buf, "n_retired_writes..... %u\n", - dev->n_retired_writes); + buf += sprintf(buf, "n_retried_writes..... %u\n", + dev->n_retried_writes); buf += sprintf(buf, "n_retired_blocks..... %u\n", dev->n_retired_blocks); buf += sprintf(buf, "n_ecc_fixed.......... %u\n", dev->n_ecc_fixed); diff --git a/yaffs_vfs_single.c b/yaffs_vfs_single.c index 64e590c..f822845 100644 --- a/yaffs_vfs_single.c +++ b/yaffs_vfs_single.c @@ -2391,7 +2391,7 @@ static char *yaffs_dump_dev_part1(char *buf, struct yaffs_dev *dev) buf += sprintf(buf, "n_gc_blocks........... %u\n", dev->n_gc_blocks); buf += sprintf(buf, "bg_gcs................ %u\n", dev->bg_gcs); buf += - sprintf(buf, "n_retired_writes...... %u\n", dev->n_retired_writes); + sprintf(buf, "n_retried_writes...... %u\n", dev->n_retried_writes); buf += sprintf(buf, "n_retired_blocks...... %u\n", dev->n_retired_blocks); buf += sprintf(buf, "n_ecc_fixed........... %u\n", dev->n_ecc_fixed);