From: Gabor Juhos Date: Tue, 30 Oct 2012 21:16:21 +0000 (+0000) Subject: generic: rename yaffs patches X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9a8ccc1a080938cc00ca9c4bb343a61c7521f58f;p=openwrt%2Fstaging%2Fluka.git generic: rename yaffs patches Signed-off-by: Gabor Juhos SVN-Revision: 34019 --- diff --git a/target/linux/generic/patches-3.3/500-yaffs-Kbuild-integration.patch b/target/linux/generic/patches-3.3/500-yaffs-Kbuild-integration.patch new file mode 100644 index 0000000000..7776dcfb90 --- /dev/null +++ b/target/linux/generic/patches-3.3/500-yaffs-Kbuild-integration.patch @@ -0,0 +1,18 @@ +--- a/fs/Kconfig ++++ b/fs/Kconfig +@@ -35,6 +35,7 @@ source "fs/gfs2/Kconfig" + source "fs/ocfs2/Kconfig" + source "fs/btrfs/Kconfig" + source "fs/nilfs2/Kconfig" ++source "fs/yaffs2/Kconfig" + + endif # BLOCK + +--- a/fs/Makefile ++++ b/fs/Makefile +@@ -125,3 +125,5 @@ obj-$(CONFIG_GFS2_FS) += gfs2/ + obj-y += exofs/ # Multiple modules + obj-$(CONFIG_CEPH_FS) += ceph/ + obj-$(CONFIG_PSTORE) += pstore/ ++obj-$(CONFIG_YAFFS_FS) += yaffs2/ ++ diff --git a/target/linux/generic/patches-3.3/500-yaffs_support.patch b/target/linux/generic/patches-3.3/500-yaffs_support.patch deleted file mode 100644 index 7776dcfb90..0000000000 --- a/target/linux/generic/patches-3.3/500-yaffs_support.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/fs/Kconfig -+++ b/fs/Kconfig -@@ -35,6 +35,7 @@ source "fs/gfs2/Kconfig" - source "fs/ocfs2/Kconfig" - source "fs/btrfs/Kconfig" - source "fs/nilfs2/Kconfig" -+source "fs/yaffs2/Kconfig" - - endif # BLOCK - ---- a/fs/Makefile -+++ b/fs/Makefile -@@ -125,3 +125,5 @@ obj-$(CONFIG_GFS2_FS) += gfs2/ - obj-y += exofs/ # Multiple modules - obj-$(CONFIG_CEPH_FS) += ceph/ - obj-$(CONFIG_PSTORE) += pstore/ -+obj-$(CONFIG_YAFFS_FS) += yaffs2/ -+ diff --git a/target/linux/generic/patches-3.3/501-yaffs-fix-symlink-bug.patch b/target/linux/generic/patches-3.3/501-yaffs-fix-symlink-bug.patch new file mode 100644 index 0000000000..dabf2871bf --- /dev/null +++ b/target/linux/generic/patches-3.3/501-yaffs-fix-symlink-bug.patch @@ -0,0 +1,17 @@ +--- a/fs/yaffs2/yaffs_guts.c ++++ b/fs/yaffs2/yaffs_guts.c +@@ -1709,11 +1709,11 @@ static int yaffs_change_obj_name(yaffs_o + } + + /* TODO: Do we need this different handling for YAFFS2 and YAFFS1?? */ +- if (obj->my_dev->param.is_yaffs2) ++ // if (obj->my_dev->param.is_yaffs2) + unlinkOp = (new_dir == obj->my_dev->unlinked_dir); +- else ++ /* else + unlinkOp = (new_dir == obj->my_dev->unlinked_dir +- && obj->variant_type == YAFFS_OBJECT_TYPE_FILE); ++ && obj->variant_type == YAFFS_OBJECT_TYPE_FILE); */ + + deleteOp = (new_dir == obj->my_dev->del_dir); + diff --git a/target/linux/generic/patches-3.3/502-yaffs-mutex-fix.patch b/target/linux/generic/patches-3.3/502-yaffs-mutex-fix.patch new file mode 100644 index 0000000000..b34b12f785 --- /dev/null +++ b/target/linux/generic/patches-3.3/502-yaffs-mutex-fix.patch @@ -0,0 +1,20 @@ +--- a/fs/yaffs2/yaffs_vfs_glue.c ++++ b/fs/yaffs2/yaffs_vfs_glue.c +@@ -3036,7 +3036,7 @@ static struct super_block *yaffs_interna + YINIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->searchContexts)); + param->remove_obj_fn = yaffs_remove_obj_callback; + +- init_MUTEX(&(yaffs_dev_to_lc(dev)->grossLock)); ++ sema_init(&(yaffs_dev_to_lc(dev)->grossLock), 1); + + yaffs_gross_lock(dev); + +@@ -3494,7 +3494,7 @@ static int __init init_yaffs_fs(void) + + + +- init_MUTEX(&yaffs_context_lock); ++ sema_init((&yaffs_context_lock), 1); + + /* Install the proc_fs entries */ + my_proc_entry = create_proc_entry("yaffs", diff --git a/target/linux/generic/patches-3.3/503-yaffs-2.6.39-fix.patch b/target/linux/generic/patches-3.3/503-yaffs-2.6.39-fix.patch new file mode 100644 index 0000000000..5108f7be3f --- /dev/null +++ b/target/linux/generic/patches-3.3/503-yaffs-2.6.39-fix.patch @@ -0,0 +1,147 @@ +--- a/fs/yaffs2/yaffs_vfs_glue.c ++++ b/fs/yaffs2/yaffs_vfs_glue.c +@@ -72,7 +72,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -97,6 +97,8 @@ + + #include + ++static DEFINE_MUTEX(yaffs_mutex); ++ + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + + #include +@@ -1538,7 +1540,7 @@ static loff_t yaffs_dir_llseek(struct fi + { + long long retval; + +- lock_kernel(); ++ mutex_lock(&yaffs_mutex); + + switch (origin){ + case 2: +@@ -1555,7 +1557,7 @@ static loff_t yaffs_dir_llseek(struct fi + + retval = offset; + } +- unlock_kernel(); ++ mutex_unlock(&yaffs_mutex); + return retval; + } + +@@ -3087,98 +3089,52 @@ static struct super_block *yaffs_interna + return sb; + } + +- +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_internal_read_super_mtd(struct super_block *sb, void *data, + int silent) + { + return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL; + } + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) +-static int yaffs_read_super(struct file_system_type *fs, ++static struct dentry *yaffs_read_super(struct file_system_type *fs, + int flags, const char *dev_name, +- void *data, struct vfsmount *mnt) +-{ +- +- return get_sb_bdev(fs, flags, dev_name, data, +- yaffs_internal_read_super_mtd, mnt); +-} +-#else +-static struct super_block *yaffs_read_super(struct file_system_type *fs, +- int flags, const char *dev_name, +- void *data) ++ void *data) + { + +- return get_sb_bdev(fs, flags, dev_name, data, ++ return mount_bdev(fs, flags, dev_name, data, + yaffs_internal_read_super_mtd); + } +-#endif + + static struct file_system_type yaffs_fs_type = { + .owner = THIS_MODULE, + .name = "yaffs", +- .get_sb = yaffs_read_super, ++ .mount = yaffs_read_super, + .kill_sb = kill_block_super, + .fs_flags = FS_REQUIRES_DEV, + }; +-#else +-static struct super_block *yaffs_read_super(struct super_block *sb, void *data, +- int silent) +-{ +- return yaffs_internal_read_super(1, sb, data, silent); +-} +- +-static DECLARE_FSTYPE(yaffs_fs_type, "yaffs", yaffs_read_super, +- FS_REQUIRES_DEV); +-#endif +- + + #ifdef CONFIG_YAFFS_YAFFS2 + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data, + int silent) + { + return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL; + } + +-#if (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) ++static struct dentry *yaffs2_read_super(struct file_system_type *fs, ++ int flags, const char *dev_name, ++ void *data) + { +- return get_sb_bdev(fs, flags, dev_name, data, +- yaffs2_internal_read_super_mtd, mnt); ++ return mount_bdev(fs, flags, dev_name, data, ++ yaffs_internal_read_super_mtd); + } +-#else +-static struct super_block *yaffs2_read_super(struct file_system_type *fs, +- int flags, const char *dev_name, +- void *data) +-{ +- +- return get_sb_bdev(fs, flags, dev_name, data, +- yaffs2_internal_read_super_mtd); +-} +-#endif + + static struct file_system_type yaffs2_fs_type = { + .owner = THIS_MODULE, + .name = "yaffs2", +- .get_sb = yaffs2_read_super, ++ .mount = yaffs2_read_super, + .kill_sb = kill_block_super, + .fs_flags = FS_REQUIRES_DEV, + }; +-#else +-static struct super_block *yaffs2_read_super(struct super_block *sb, +- void *data, int silent) +-{ +- return yaffs_internal_read_super(2, sb, data, silent); +-} +- +-static DECLARE_FSTYPE(yaffs2_fs_type, "yaffs2", yaffs2_read_super, +- FS_REQUIRES_DEV); +-#endif + + #endif /* CONFIG_YAFFS_YAFFS2 */ + diff --git a/target/linux/generic/patches-3.3/503-yaffs_symlink_bug.patch b/target/linux/generic/patches-3.3/503-yaffs_symlink_bug.patch deleted file mode 100644 index dabf2871bf..0000000000 --- a/target/linux/generic/patches-3.3/503-yaffs_symlink_bug.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/fs/yaffs2/yaffs_guts.c -+++ b/fs/yaffs2/yaffs_guts.c -@@ -1709,11 +1709,11 @@ static int yaffs_change_obj_name(yaffs_o - } - - /* TODO: Do we need this different handling for YAFFS2 and YAFFS1?? */ -- if (obj->my_dev->param.is_yaffs2) -+ // if (obj->my_dev->param.is_yaffs2) - unlinkOp = (new_dir == obj->my_dev->unlinked_dir); -- else -+ /* else - unlinkOp = (new_dir == obj->my_dev->unlinked_dir -- && obj->variant_type == YAFFS_OBJECT_TYPE_FILE); -+ && obj->variant_type == YAFFS_OBJECT_TYPE_FILE); */ - - deleteOp = (new_dir == obj->my_dev->del_dir); - diff --git a/target/linux/generic/patches-3.3/504-yaffs-3.2_fix.patch b/target/linux/generic/patches-3.3/504-yaffs-3.2_fix.patch new file mode 100644 index 0000000000..f84332ab29 --- /dev/null +++ b/target/linux/generic/patches-3.3/504-yaffs-3.2_fix.patch @@ -0,0 +1,289 @@ +--- a/fs/yaffs2/yaffs_vfs_glue.c ++++ b/fs/yaffs2/yaffs_vfs_glue.c +@@ -220,11 +220,34 @@ static struct inode *yaffs_iget(struct s + #define yaffs_SuperToDevice(sb) ((yaffs_dev_t *)sb->u.generic_sbp) + #endif + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) ++static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink) ++{ ++ set_nlink(inode, nlink); ++} ++ ++static inline void yaffs_dec_link_count(struct inode *inode) ++{ ++ inode_dec_link_count(inode); ++} ++#else ++static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink) ++{ ++ inode->i_nlink = nlink; ++} ++ ++static inline void yaffs_dec_link_count(struct inode *inode) ++{ ++ inode->i_nlink--; ++ mark_inode_dirty(inode) ++} ++#endif ++ + + #define update_dir_time(dir) do {\ + (dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \ + } while(0) +- ++ + static void yaffs_put_super(struct super_block *sb); + + static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n, +@@ -238,7 +261,10 @@ static int yaffs_file_flush(struct file + static int yaffs_file_flush(struct file *file); + #endif + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) ++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, +@@ -513,7 +539,7 @@ static unsigned yaffs_gc_control_callbac + { + return yaffs_gc_control; + } +- ++ + static void yaffs_gross_lock(yaffs_dev_t *dev) + { + T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current)); +@@ -1362,7 +1388,7 @@ static void yaffs_fill_inode_from_obj(st + inode->i_size = yaffs_get_obj_length(obj); + inode->i_blocks = (inode->i_size + 511) >> 9; + +- inode->i_nlink = yaffs_get_obj_link_count(obj); ++ yaffs_set_nlink(inode, yaffs_get_obj_link_count(obj)); + + T(YAFFS_TRACE_OS, + (TSTR("yaffs_fill_inode mode %x uid %d gid %d size %d count %d\n"), +@@ -1810,10 +1836,9 @@ static int yaffs_unlink(struct inode *di + retVal = yaffs_unlinker(obj, dentry->d_name.name); + + if (retVal == YAFFS_OK) { +- dentry->d_inode->i_nlink--; ++ yaffs_dec_link_count(dentry->d_inode); + dir->i_version++; + yaffs_gross_unlock(dev); +- mark_inode_dirty(dentry->d_inode); + update_dir_time(dir); + return 0; + } +@@ -1844,7 +1869,8 @@ static int yaffs_link(struct dentry *old + obj); + + if (link) { +- old_dentry->d_inode->i_nlink = yaffs_get_obj_link_count(obj); ++ yaffs_set_nlink(old_dentry->d_inode, ++ yaffs_get_obj_link_count(obj)); + d_instantiate(dentry, old_dentry->d_inode); + atomic_inc(&old_dentry->d_inode->i_count); + T(YAFFS_TRACE_OS, +@@ -1894,7 +1920,10 @@ static int yaffs_symlink(struct inode *d + return -ENOMEM; + } + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) ++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, +@@ -1961,11 +1990,9 @@ static int yaffs_rename(struct inode *ol + yaffs_gross_unlock(dev); + + if (retVal == YAFFS_OK) { +- if (target) { +- new_dentry->d_inode->i_nlink--; +- mark_inode_dirty(new_dentry->d_inode); +- } +- ++ if (target) ++ yaffs_dec_link_count(new_dentry->d_inode); ++ + update_dir_time(old_dir); + if(old_dir != new_dir) + update_dir_time(new_dir); +@@ -1985,7 +2012,7 @@ static int yaffs_setattr(struct dentry * + (TSTR("yaffs_setattr of object %d\n"), + yaffs_InodeToObject(inode)->obj_id)); + +- /* Fail if a requested resize >= 2GB */ ++ /* Fail if a requested resize >= 2GB */ + if (attr->ia_valid & ATTR_SIZE && + (attr->ia_size >> 31)) + error = -EINVAL; +@@ -2216,7 +2243,7 @@ static void yaffs_flush_inodes(struct su + { + struct inode *iptr; + yaffs_obj_t *obj; +- ++ + list_for_each_entry(iptr,&sb->s_inodes, i_sb_list){ + obj = yaffs_InodeToObject(iptr); + if(obj){ +@@ -2230,10 +2257,10 @@ static void yaffs_flush_inodes(struct su + + static void yaffs_flush_super(struct super_block *sb, int do_checkpoint) + { +- yaffs_dev_t *dev = yaffs_SuperToDevice(sb); ++ yaffs_dev_t *dev = yaffs_SuperToDevice(sb); + if(!dev) + return; +- ++ + yaffs_flush_inodes(sb); + yaffs_update_dirty_dirs(dev); + yaffs_flush_whole_cache(dev); +@@ -2301,7 +2328,7 @@ static int yaffs_do_sync_fs(struct super + * yaffs_bg_start() launches the background thread. + * yaffs_bg_stop() cleans up the background thread. + * +- * NB: ++ * NB: + * The thread should only run after the yaffs is initialised + * The thread should be stopped before yaffs is unmounted. + * The thread should not do any writing while the fs is in read only. +@@ -2872,7 +2899,7 @@ static struct super_block *yaffs_interna + + dev = kmalloc(sizeof(yaffs_dev_t), GFP_KERNEL); + context = kmalloc(sizeof(struct yaffs_LinuxContext),GFP_KERNEL); +- ++ + if(!dev || !context ){ + if(dev) + kfree(dev); +@@ -2905,7 +2932,7 @@ static struct super_block *yaffs_interna + #else + sb->u.generic_sbp = dev; + #endif +- ++ + dev->driver_context = mtd; + param->name = mtd->name; + +@@ -3005,7 +3032,7 @@ static struct super_block *yaffs_interna + param->gc_control = yaffs_gc_control_callback; + + yaffs_dev_to_lc(dev)->superBlock= sb; +- ++ + + #ifndef CONFIG_YAFFS_DOES_ECC + param->use_nand_ecc = 1; +@@ -3047,10 +3074,10 @@ static struct super_block *yaffs_interna + T(YAFFS_TRACE_OS, + (TSTR("yaffs_read_super: guts initialised %s\n"), + (err == YAFFS_OK) ? "OK" : "FAILED")); +- ++ + if(err == YAFFS_OK) + yaffs_bg_start(dev); +- ++ + if(!context->bgThread) + param->defered_dir_update = 0; + +@@ -3125,7 +3152,7 @@ static struct dentry *yaffs2_read_super( + void *data) + { + return mount_bdev(fs, flags, dev_name, data, +- yaffs_internal_read_super_mtd); ++ yaffs2_internal_read_super_mtd); + } + + static struct file_system_type yaffs2_fs_type = { +@@ -3223,7 +3250,7 @@ static int yaffs_proc_read(char *page, + buf += sprintf(buf,"\n"); + else { + step-=2; +- ++ + down(&yaffs_context_lock); + + /* Locate and print the Nth entry. Order N-squared but N is small. */ +@@ -3240,7 +3267,7 @@ static int yaffs_proc_read(char *page, + buf = yaffs_dump_dev_part0(buf, dev); + } else + buf = yaffs_dump_dev_part1(buf, dev); +- ++ + break; + } + up(&yaffs_context_lock); +@@ -3267,7 +3294,7 @@ static int yaffs_stats_proc_read(char *p + int erasedChunks; + + erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block; +- ++ + buf += sprintf(buf,"%d, %d, %d, %u, %u, %u, %u\n", + n, dev->n_free_chunks, erasedChunks, + dev->bg_gcs, dev->oldest_dirty_gc_count, +--- a/fs/yaffs2/yaffs_mtdif1.c ++++ b/fs/yaffs2/yaffs_mtdif1.c +@@ -34,6 +34,7 @@ + #include "linux/version.h" + #include "linux/types.h" + #include "linux/mtd/mtd.h" ++#include "mtd/mtd-abi.h" + + /* Don't compile this module if we don't have MTD's mtd_oob_ops interface */ + #if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) +@@ -127,7 +128,7 @@ int nandmtd1_WriteChunkWithTagsToNAND(ya + #endif + + memset(&ops, 0, sizeof(ops)); +- ops.mode = MTD_OOB_AUTO; ++ ops.mode = MTD_OPS_AUTO_OOB; + ops.len = (data) ? chunkBytes : 0; + ops.ooblen = YTAG1_SIZE; + ops.datbuf = (__u8 *)data; +@@ -179,7 +180,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y + int deleted; + + memset(&ops, 0, sizeof(ops)); +- ops.mode = MTD_OOB_AUTO; ++ ops.mode = MTD_OPS_AUTO_OOB; + ops.len = (data) ? chunkBytes : 0; + ops.ooblen = YTAG1_SIZE; + ops.datbuf = data; +--- a/fs/yaffs2/yaffs_mtdif2.c ++++ b/fs/yaffs2/yaffs_mtdif2.c +@@ -21,6 +21,7 @@ + #include "linux/mtd/mtd.h" + #include "linux/types.h" + #include "linux/time.h" ++#include "mtd/mtd-abi.h" + + #include "yaffs_packedtags2.h" + +@@ -71,7 +72,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya + yaffs_PackTags2(&pt, tags, !dev->param.no_tags_ecc); + + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) +- ops.mode = MTD_OOB_AUTO; ++ ops.mode = MTD_OPS_AUTO_OOB; + ops.ooblen = (dev->param.inband_tags) ? 0 : packed_tags_size; + ops.len = dev->param.total_bytes_per_chunk; + ops.ooboffs = 0; +@@ -136,7 +137,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y + retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk, + &dummy, data); + else if (tags) { +- ops.mode = MTD_OOB_AUTO; ++ ops.mode = MTD_OPS_AUTO_OOB; + ops.ooblen = packed_tags_size; + ops.len = data ? dev->data_bytes_per_chunk : packed_tags_size; + ops.ooboffs = 0; diff --git a/target/linux/generic/patches-3.3/504-yaffs_mutex_fix.patch b/target/linux/generic/patches-3.3/504-yaffs_mutex_fix.patch deleted file mode 100644 index b34b12f785..0000000000 --- a/target/linux/generic/patches-3.3/504-yaffs_mutex_fix.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/fs/yaffs2/yaffs_vfs_glue.c -+++ b/fs/yaffs2/yaffs_vfs_glue.c -@@ -3036,7 +3036,7 @@ static struct super_block *yaffs_interna - YINIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->searchContexts)); - param->remove_obj_fn = yaffs_remove_obj_callback; - -- init_MUTEX(&(yaffs_dev_to_lc(dev)->grossLock)); -+ sema_init(&(yaffs_dev_to_lc(dev)->grossLock), 1); - - yaffs_gross_lock(dev); - -@@ -3494,7 +3494,7 @@ static int __init init_yaffs_fs(void) - - - -- init_MUTEX(&yaffs_context_lock); -+ sema_init((&yaffs_context_lock), 1); - - /* Install the proc_fs entries */ - my_proc_entry = create_proc_entry("yaffs", diff --git a/target/linux/generic/patches-3.3/505-2.6.39_fix.patch b/target/linux/generic/patches-3.3/505-2.6.39_fix.patch deleted file mode 100644 index 5108f7be3f..0000000000 --- a/target/linux/generic/patches-3.3/505-2.6.39_fix.patch +++ /dev/null @@ -1,147 +0,0 @@ ---- a/fs/yaffs2/yaffs_vfs_glue.c -+++ b/fs/yaffs2/yaffs_vfs_glue.c -@@ -72,7 +72,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -@@ -97,6 +97,8 @@ - - #include - -+static DEFINE_MUTEX(yaffs_mutex); -+ - #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) - - #include -@@ -1538,7 +1540,7 @@ static loff_t yaffs_dir_llseek(struct fi - { - long long retval; - -- lock_kernel(); -+ mutex_lock(&yaffs_mutex); - - switch (origin){ - case 2: -@@ -1555,7 +1557,7 @@ static loff_t yaffs_dir_llseek(struct fi - - retval = offset; - } -- unlock_kernel(); -+ mutex_unlock(&yaffs_mutex); - return retval; - } - -@@ -3087,98 +3089,52 @@ static struct super_block *yaffs_interna - return sb; - } - -- --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) - static int yaffs_internal_read_super_mtd(struct super_block *sb, void *data, - int silent) - { - return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL; - } - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) --static int yaffs_read_super(struct file_system_type *fs, -+static struct dentry *yaffs_read_super(struct file_system_type *fs, - int flags, const char *dev_name, -- void *data, struct vfsmount *mnt) --{ -- -- return get_sb_bdev(fs, flags, dev_name, data, -- yaffs_internal_read_super_mtd, mnt); --} --#else --static struct super_block *yaffs_read_super(struct file_system_type *fs, -- int flags, const char *dev_name, -- void *data) -+ void *data) - { - -- return get_sb_bdev(fs, flags, dev_name, data, -+ return mount_bdev(fs, flags, dev_name, data, - yaffs_internal_read_super_mtd); - } --#endif - - static struct file_system_type yaffs_fs_type = { - .owner = THIS_MODULE, - .name = "yaffs", -- .get_sb = yaffs_read_super, -+ .mount = yaffs_read_super, - .kill_sb = kill_block_super, - .fs_flags = FS_REQUIRES_DEV, - }; --#else --static struct super_block *yaffs_read_super(struct super_block *sb, void *data, -- int silent) --{ -- return yaffs_internal_read_super(1, sb, data, silent); --} -- --static DECLARE_FSTYPE(yaffs_fs_type, "yaffs", yaffs_read_super, -- FS_REQUIRES_DEV); --#endif -- - - #ifdef CONFIG_YAFFS_YAFFS2 - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) - static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data, - int silent) - { - return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL; - } - --#if (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) -+static struct dentry *yaffs2_read_super(struct file_system_type *fs, -+ int flags, const char *dev_name, -+ void *data) - { -- return get_sb_bdev(fs, flags, dev_name, data, -- yaffs2_internal_read_super_mtd, mnt); -+ return mount_bdev(fs, flags, dev_name, data, -+ yaffs_internal_read_super_mtd); - } --#else --static struct super_block *yaffs2_read_super(struct file_system_type *fs, -- int flags, const char *dev_name, -- void *data) --{ -- -- return get_sb_bdev(fs, flags, dev_name, data, -- yaffs2_internal_read_super_mtd); --} --#endif - - static struct file_system_type yaffs2_fs_type = { - .owner = THIS_MODULE, - .name = "yaffs2", -- .get_sb = yaffs2_read_super, -+ .mount = yaffs2_read_super, - .kill_sb = kill_block_super, - .fs_flags = FS_REQUIRES_DEV, - }; --#else --static struct super_block *yaffs2_read_super(struct super_block *sb, -- void *data, int silent) --{ -- return yaffs_internal_read_super(2, sb, data, silent); --} -- --static DECLARE_FSTYPE(yaffs2_fs_type, "yaffs2", yaffs2_read_super, -- FS_REQUIRES_DEV); --#endif - - #endif /* CONFIG_YAFFS_YAFFS2 */ - diff --git a/target/linux/generic/patches-3.3/505-yaffs-3.3_fix.patch b/target/linux/generic/patches-3.3/505-yaffs-3.3_fix.patch new file mode 100644 index 0000000000..a269dc2567 --- /dev/null +++ b/target/linux/generic/patches-3.3/505-yaffs-3.3_fix.patch @@ -0,0 +1,71 @@ +--- a/fs/yaffs2/yaffs_vfs_glue.c ++++ b/fs/yaffs2/yaffs_vfs_glue.c +@@ -274,8 +274,13 @@ static int yaffs_sync_object(struct file + static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir); + + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) ++static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode, ++ struct nameidata *n); ++#else + static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode, + struct nameidata *n); ++#endif + static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry, + struct nameidata *n); + #else +@@ -287,9 +292,17 @@ static int yaffs_link(struct dentry *old + static int yaffs_unlink(struct inode *dir, struct dentry *dentry); + static int yaffs_symlink(struct inode *dir, struct dentry *dentry, + const char *symname); ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) ++static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); ++#else + static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode); ++#endif + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) ++static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, ++ dev_t dev); ++#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, + dev_t dev); + #else +@@ -1708,7 +1721,10 @@ out: + #define YCRED(x) (x->cred) + #endif + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) ++static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, ++ dev_t rdev) ++#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, + dev_t rdev) + #else +@@ -1798,7 +1814,11 @@ static int yaffs_mknod(struct inode *dir + return error; + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) ++static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ++#else + static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode) ++#endif + { + int retVal; + T(YAFFS_TRACE_OS, (TSTR("yaffs_mkdir\n"))); +@@ -1806,7 +1826,10 @@ static int yaffs_mkdir(struct inode *dir + return retVal; + } + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) ++static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode, ++ struct nameidata *n) ++#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode, + struct nameidata *n) + #else diff --git a/target/linux/generic/patches-3.3/506-yaffs2-3.2_fix.patch b/target/linux/generic/patches-3.3/506-yaffs2-3.2_fix.patch deleted file mode 100644 index f84332ab29..0000000000 --- a/target/linux/generic/patches-3.3/506-yaffs2-3.2_fix.patch +++ /dev/null @@ -1,289 +0,0 @@ ---- a/fs/yaffs2/yaffs_vfs_glue.c -+++ b/fs/yaffs2/yaffs_vfs_glue.c -@@ -220,11 +220,34 @@ static struct inode *yaffs_iget(struct s - #define yaffs_SuperToDevice(sb) ((yaffs_dev_t *)sb->u.generic_sbp) - #endif - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) -+static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink) -+{ -+ set_nlink(inode, nlink); -+} -+ -+static inline void yaffs_dec_link_count(struct inode *inode) -+{ -+ inode_dec_link_count(inode); -+} -+#else -+static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink) -+{ -+ inode->i_nlink = nlink; -+} -+ -+static inline void yaffs_dec_link_count(struct inode *inode) -+{ -+ inode->i_nlink--; -+ mark_inode_dirty(inode) -+} -+#endif -+ - - #define update_dir_time(dir) do {\ - (dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \ - } while(0) -- -+ - static void yaffs_put_super(struct super_block *sb); - - static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n, -@@ -238,7 +261,10 @@ static int yaffs_file_flush(struct file - static int yaffs_file_flush(struct file *file); - #endif - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)) -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) -+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, -@@ -513,7 +539,7 @@ static unsigned yaffs_gc_control_callbac - { - return yaffs_gc_control; - } -- -+ - static void yaffs_gross_lock(yaffs_dev_t *dev) - { - T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current)); -@@ -1362,7 +1388,7 @@ static void yaffs_fill_inode_from_obj(st - inode->i_size = yaffs_get_obj_length(obj); - inode->i_blocks = (inode->i_size + 511) >> 9; - -- inode->i_nlink = yaffs_get_obj_link_count(obj); -+ yaffs_set_nlink(inode, yaffs_get_obj_link_count(obj)); - - T(YAFFS_TRACE_OS, - (TSTR("yaffs_fill_inode mode %x uid %d gid %d size %d count %d\n"), -@@ -1810,10 +1836,9 @@ static int yaffs_unlink(struct inode *di - retVal = yaffs_unlinker(obj, dentry->d_name.name); - - if (retVal == YAFFS_OK) { -- dentry->d_inode->i_nlink--; -+ yaffs_dec_link_count(dentry->d_inode); - dir->i_version++; - yaffs_gross_unlock(dev); -- mark_inode_dirty(dentry->d_inode); - update_dir_time(dir); - return 0; - } -@@ -1844,7 +1869,8 @@ static int yaffs_link(struct dentry *old - obj); - - if (link) { -- old_dentry->d_inode->i_nlink = yaffs_get_obj_link_count(obj); -+ yaffs_set_nlink(old_dentry->d_inode, -+ yaffs_get_obj_link_count(obj)); - d_instantiate(dentry, old_dentry->d_inode); - atomic_inc(&old_dentry->d_inode->i_count); - T(YAFFS_TRACE_OS, -@@ -1894,7 +1920,10 @@ static int yaffs_symlink(struct inode *d - return -ENOMEM; - } - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)) -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) -+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, -@@ -1961,11 +1990,9 @@ static int yaffs_rename(struct inode *ol - yaffs_gross_unlock(dev); - - if (retVal == YAFFS_OK) { -- if (target) { -- new_dentry->d_inode->i_nlink--; -- mark_inode_dirty(new_dentry->d_inode); -- } -- -+ if (target) -+ yaffs_dec_link_count(new_dentry->d_inode); -+ - update_dir_time(old_dir); - if(old_dir != new_dir) - update_dir_time(new_dir); -@@ -1985,7 +2012,7 @@ static int yaffs_setattr(struct dentry * - (TSTR("yaffs_setattr of object %d\n"), - yaffs_InodeToObject(inode)->obj_id)); - -- /* Fail if a requested resize >= 2GB */ -+ /* Fail if a requested resize >= 2GB */ - if (attr->ia_valid & ATTR_SIZE && - (attr->ia_size >> 31)) - error = -EINVAL; -@@ -2216,7 +2243,7 @@ static void yaffs_flush_inodes(struct su - { - struct inode *iptr; - yaffs_obj_t *obj; -- -+ - list_for_each_entry(iptr,&sb->s_inodes, i_sb_list){ - obj = yaffs_InodeToObject(iptr); - if(obj){ -@@ -2230,10 +2257,10 @@ static void yaffs_flush_inodes(struct su - - static void yaffs_flush_super(struct super_block *sb, int do_checkpoint) - { -- yaffs_dev_t *dev = yaffs_SuperToDevice(sb); -+ yaffs_dev_t *dev = yaffs_SuperToDevice(sb); - if(!dev) - return; -- -+ - yaffs_flush_inodes(sb); - yaffs_update_dirty_dirs(dev); - yaffs_flush_whole_cache(dev); -@@ -2301,7 +2328,7 @@ static int yaffs_do_sync_fs(struct super - * yaffs_bg_start() launches the background thread. - * yaffs_bg_stop() cleans up the background thread. - * -- * NB: -+ * NB: - * The thread should only run after the yaffs is initialised - * The thread should be stopped before yaffs is unmounted. - * The thread should not do any writing while the fs is in read only. -@@ -2872,7 +2899,7 @@ static struct super_block *yaffs_interna - - dev = kmalloc(sizeof(yaffs_dev_t), GFP_KERNEL); - context = kmalloc(sizeof(struct yaffs_LinuxContext),GFP_KERNEL); -- -+ - if(!dev || !context ){ - if(dev) - kfree(dev); -@@ -2905,7 +2932,7 @@ static struct super_block *yaffs_interna - #else - sb->u.generic_sbp = dev; - #endif -- -+ - dev->driver_context = mtd; - param->name = mtd->name; - -@@ -3005,7 +3032,7 @@ static struct super_block *yaffs_interna - param->gc_control = yaffs_gc_control_callback; - - yaffs_dev_to_lc(dev)->superBlock= sb; -- -+ - - #ifndef CONFIG_YAFFS_DOES_ECC - param->use_nand_ecc = 1; -@@ -3047,10 +3074,10 @@ static struct super_block *yaffs_interna - T(YAFFS_TRACE_OS, - (TSTR("yaffs_read_super: guts initialised %s\n"), - (err == YAFFS_OK) ? "OK" : "FAILED")); -- -+ - if(err == YAFFS_OK) - yaffs_bg_start(dev); -- -+ - if(!context->bgThread) - param->defered_dir_update = 0; - -@@ -3125,7 +3152,7 @@ static struct dentry *yaffs2_read_super( - void *data) - { - return mount_bdev(fs, flags, dev_name, data, -- yaffs_internal_read_super_mtd); -+ yaffs2_internal_read_super_mtd); - } - - static struct file_system_type yaffs2_fs_type = { -@@ -3223,7 +3250,7 @@ static int yaffs_proc_read(char *page, - buf += sprintf(buf,"\n"); - else { - step-=2; -- -+ - down(&yaffs_context_lock); - - /* Locate and print the Nth entry. Order N-squared but N is small. */ -@@ -3240,7 +3267,7 @@ static int yaffs_proc_read(char *page, - buf = yaffs_dump_dev_part0(buf, dev); - } else - buf = yaffs_dump_dev_part1(buf, dev); -- -+ - break; - } - up(&yaffs_context_lock); -@@ -3267,7 +3294,7 @@ static int yaffs_stats_proc_read(char *p - int erasedChunks; - - erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block; -- -+ - buf += sprintf(buf,"%d, %d, %d, %u, %u, %u, %u\n", - n, dev->n_free_chunks, erasedChunks, - dev->bg_gcs, dev->oldest_dirty_gc_count, ---- a/fs/yaffs2/yaffs_mtdif1.c -+++ b/fs/yaffs2/yaffs_mtdif1.c -@@ -34,6 +34,7 @@ - #include "linux/version.h" - #include "linux/types.h" - #include "linux/mtd/mtd.h" -+#include "mtd/mtd-abi.h" - - /* Don't compile this module if we don't have MTD's mtd_oob_ops interface */ - #if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) -@@ -127,7 +128,7 @@ int nandmtd1_WriteChunkWithTagsToNAND(ya - #endif - - memset(&ops, 0, sizeof(ops)); -- ops.mode = MTD_OOB_AUTO; -+ ops.mode = MTD_OPS_AUTO_OOB; - ops.len = (data) ? chunkBytes : 0; - ops.ooblen = YTAG1_SIZE; - ops.datbuf = (__u8 *)data; -@@ -179,7 +180,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y - int deleted; - - memset(&ops, 0, sizeof(ops)); -- ops.mode = MTD_OOB_AUTO; -+ ops.mode = MTD_OPS_AUTO_OOB; - ops.len = (data) ? chunkBytes : 0; - ops.ooblen = YTAG1_SIZE; - ops.datbuf = data; ---- a/fs/yaffs2/yaffs_mtdif2.c -+++ b/fs/yaffs2/yaffs_mtdif2.c -@@ -21,6 +21,7 @@ - #include "linux/mtd/mtd.h" - #include "linux/types.h" - #include "linux/time.h" -+#include "mtd/mtd-abi.h" - - #include "yaffs_packedtags2.h" - -@@ -71,7 +72,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya - yaffs_PackTags2(&pt, tags, !dev->param.no_tags_ecc); - - #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) -- ops.mode = MTD_OOB_AUTO; -+ ops.mode = MTD_OPS_AUTO_OOB; - ops.ooblen = (dev->param.inband_tags) ? 0 : packed_tags_size; - ops.len = dev->param.total_bytes_per_chunk; - ops.ooboffs = 0; -@@ -136,7 +137,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y - retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk, - &dummy, data); - else if (tags) { -- ops.mode = MTD_OOB_AUTO; -+ ops.mode = MTD_OPS_AUTO_OOB; - ops.ooblen = packed_tags_size; - ops.len = data ? dev->data_bytes_per_chunk : packed_tags_size; - ops.ooboffs = 0; diff --git a/target/linux/generic/patches-3.3/507-yaffs2-3.3_fix.patch b/target/linux/generic/patches-3.3/507-yaffs2-3.3_fix.patch deleted file mode 100644 index a269dc2567..0000000000 --- a/target/linux/generic/patches-3.3/507-yaffs2-3.3_fix.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/fs/yaffs2/yaffs_vfs_glue.c -+++ b/fs/yaffs2/yaffs_vfs_glue.c -@@ -274,8 +274,13 @@ static int yaffs_sync_object(struct file - static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir); - - #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) -+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode, -+ struct nameidata *n); -+#else - static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode, - struct nameidata *n); -+#endif - static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry, - struct nameidata *n); - #else -@@ -287,9 +292,17 @@ static int yaffs_link(struct dentry *old - static int yaffs_unlink(struct inode *dir, struct dentry *dentry); - static int yaffs_symlink(struct inode *dir, struct dentry *dentry, - const char *symname); -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) -+static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); -+#else - static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode); -+#endif - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) -+static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, -+ dev_t dev); -+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) - static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, - dev_t dev); - #else -@@ -1708,7 +1721,10 @@ out: - #define YCRED(x) (x->cred) - #endif - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) -+static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, -+ dev_t rdev) -+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) - static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, - dev_t rdev) - #else -@@ -1798,7 +1814,11 @@ static int yaffs_mknod(struct inode *dir - return error; - } - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) -+static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) -+#else - static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode) -+#endif - { - int retVal; - T(YAFFS_TRACE_OS, (TSTR("yaffs_mkdir\n"))); -@@ -1806,7 +1826,10 @@ static int yaffs_mkdir(struct inode *dir - return retVal; - } - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) -+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode, -+ struct nameidata *n) -+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) - static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode, - struct nameidata *n) - #else diff --git a/target/linux/generic/patches-3.6/500-yaffs-Kbuild-integration.patch b/target/linux/generic/patches-3.6/500-yaffs-Kbuild-integration.patch new file mode 100644 index 0000000000..9efe3ecc6c --- /dev/null +++ b/target/linux/generic/patches-3.6/500-yaffs-Kbuild-integration.patch @@ -0,0 +1,18 @@ +--- a/fs/Kconfig ++++ b/fs/Kconfig +@@ -39,6 +39,7 @@ source "fs/gfs2/Kconfig" + source "fs/ocfs2/Kconfig" + source "fs/btrfs/Kconfig" + source "fs/nilfs2/Kconfig" ++source "fs/yaffs2/Kconfig" + + endif # BLOCK + +--- a/fs/Makefile ++++ b/fs/Makefile +@@ -126,3 +126,5 @@ obj-$(CONFIG_GFS2_FS) += gfs2/ + obj-y += exofs/ # Multiple modules + obj-$(CONFIG_CEPH_FS) += ceph/ + obj-$(CONFIG_PSTORE) += pstore/ ++obj-$(CONFIG_YAFFS_FS) += yaffs2/ ++ diff --git a/target/linux/generic/patches-3.6/500-yaffs_support.patch b/target/linux/generic/patches-3.6/500-yaffs_support.patch deleted file mode 100644 index 9efe3ecc6c..0000000000 --- a/target/linux/generic/patches-3.6/500-yaffs_support.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/fs/Kconfig -+++ b/fs/Kconfig -@@ -39,6 +39,7 @@ source "fs/gfs2/Kconfig" - source "fs/ocfs2/Kconfig" - source "fs/btrfs/Kconfig" - source "fs/nilfs2/Kconfig" -+source "fs/yaffs2/Kconfig" - - endif # BLOCK - ---- a/fs/Makefile -+++ b/fs/Makefile -@@ -126,3 +126,5 @@ obj-$(CONFIG_GFS2_FS) += gfs2/ - obj-y += exofs/ # Multiple modules - obj-$(CONFIG_CEPH_FS) += ceph/ - obj-$(CONFIG_PSTORE) += pstore/ -+obj-$(CONFIG_YAFFS_FS) += yaffs2/ -+ diff --git a/target/linux/generic/patches-3.6/501-yaffs-fix-symlink-bug.patch b/target/linux/generic/patches-3.6/501-yaffs-fix-symlink-bug.patch new file mode 100644 index 0000000000..dabf2871bf --- /dev/null +++ b/target/linux/generic/patches-3.6/501-yaffs-fix-symlink-bug.patch @@ -0,0 +1,17 @@ +--- a/fs/yaffs2/yaffs_guts.c ++++ b/fs/yaffs2/yaffs_guts.c +@@ -1709,11 +1709,11 @@ static int yaffs_change_obj_name(yaffs_o + } + + /* TODO: Do we need this different handling for YAFFS2 and YAFFS1?? */ +- if (obj->my_dev->param.is_yaffs2) ++ // if (obj->my_dev->param.is_yaffs2) + unlinkOp = (new_dir == obj->my_dev->unlinked_dir); +- else ++ /* else + unlinkOp = (new_dir == obj->my_dev->unlinked_dir +- && obj->variant_type == YAFFS_OBJECT_TYPE_FILE); ++ && obj->variant_type == YAFFS_OBJECT_TYPE_FILE); */ + + deleteOp = (new_dir == obj->my_dev->del_dir); + diff --git a/target/linux/generic/patches-3.6/502-yaffs-mutex-fix.patch b/target/linux/generic/patches-3.6/502-yaffs-mutex-fix.patch new file mode 100644 index 0000000000..b34b12f785 --- /dev/null +++ b/target/linux/generic/patches-3.6/502-yaffs-mutex-fix.patch @@ -0,0 +1,20 @@ +--- a/fs/yaffs2/yaffs_vfs_glue.c ++++ b/fs/yaffs2/yaffs_vfs_glue.c +@@ -3036,7 +3036,7 @@ static struct super_block *yaffs_interna + YINIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->searchContexts)); + param->remove_obj_fn = yaffs_remove_obj_callback; + +- init_MUTEX(&(yaffs_dev_to_lc(dev)->grossLock)); ++ sema_init(&(yaffs_dev_to_lc(dev)->grossLock), 1); + + yaffs_gross_lock(dev); + +@@ -3494,7 +3494,7 @@ static int __init init_yaffs_fs(void) + + + +- init_MUTEX(&yaffs_context_lock); ++ sema_init((&yaffs_context_lock), 1); + + /* Install the proc_fs entries */ + my_proc_entry = create_proc_entry("yaffs", diff --git a/target/linux/generic/patches-3.6/503-yaffs-2.6.39-fix.patch b/target/linux/generic/patches-3.6/503-yaffs-2.6.39-fix.patch new file mode 100644 index 0000000000..5108f7be3f --- /dev/null +++ b/target/linux/generic/patches-3.6/503-yaffs-2.6.39-fix.patch @@ -0,0 +1,147 @@ +--- a/fs/yaffs2/yaffs_vfs_glue.c ++++ b/fs/yaffs2/yaffs_vfs_glue.c +@@ -72,7 +72,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -97,6 +97,8 @@ + + #include + ++static DEFINE_MUTEX(yaffs_mutex); ++ + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + + #include +@@ -1538,7 +1540,7 @@ static loff_t yaffs_dir_llseek(struct fi + { + long long retval; + +- lock_kernel(); ++ mutex_lock(&yaffs_mutex); + + switch (origin){ + case 2: +@@ -1555,7 +1557,7 @@ static loff_t yaffs_dir_llseek(struct fi + + retval = offset; + } +- unlock_kernel(); ++ mutex_unlock(&yaffs_mutex); + return retval; + } + +@@ -3087,98 +3089,52 @@ static struct super_block *yaffs_interna + return sb; + } + +- +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_internal_read_super_mtd(struct super_block *sb, void *data, + int silent) + { + return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL; + } + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) +-static int yaffs_read_super(struct file_system_type *fs, ++static struct dentry *yaffs_read_super(struct file_system_type *fs, + int flags, const char *dev_name, +- void *data, struct vfsmount *mnt) +-{ +- +- return get_sb_bdev(fs, flags, dev_name, data, +- yaffs_internal_read_super_mtd, mnt); +-} +-#else +-static struct super_block *yaffs_read_super(struct file_system_type *fs, +- int flags, const char *dev_name, +- void *data) ++ void *data) + { + +- return get_sb_bdev(fs, flags, dev_name, data, ++ return mount_bdev(fs, flags, dev_name, data, + yaffs_internal_read_super_mtd); + } +-#endif + + static struct file_system_type yaffs_fs_type = { + .owner = THIS_MODULE, + .name = "yaffs", +- .get_sb = yaffs_read_super, ++ .mount = yaffs_read_super, + .kill_sb = kill_block_super, + .fs_flags = FS_REQUIRES_DEV, + }; +-#else +-static struct super_block *yaffs_read_super(struct super_block *sb, void *data, +- int silent) +-{ +- return yaffs_internal_read_super(1, sb, data, silent); +-} +- +-static DECLARE_FSTYPE(yaffs_fs_type, "yaffs", yaffs_read_super, +- FS_REQUIRES_DEV); +-#endif +- + + #ifdef CONFIG_YAFFS_YAFFS2 + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data, + int silent) + { + return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL; + } + +-#if (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) ++static struct dentry *yaffs2_read_super(struct file_system_type *fs, ++ int flags, const char *dev_name, ++ void *data) + { +- return get_sb_bdev(fs, flags, dev_name, data, +- yaffs2_internal_read_super_mtd, mnt); ++ return mount_bdev(fs, flags, dev_name, data, ++ yaffs_internal_read_super_mtd); + } +-#else +-static struct super_block *yaffs2_read_super(struct file_system_type *fs, +- int flags, const char *dev_name, +- void *data) +-{ +- +- return get_sb_bdev(fs, flags, dev_name, data, +- yaffs2_internal_read_super_mtd); +-} +-#endif + + static struct file_system_type yaffs2_fs_type = { + .owner = THIS_MODULE, + .name = "yaffs2", +- .get_sb = yaffs2_read_super, ++ .mount = yaffs2_read_super, + .kill_sb = kill_block_super, + .fs_flags = FS_REQUIRES_DEV, + }; +-#else +-static struct super_block *yaffs2_read_super(struct super_block *sb, +- void *data, int silent) +-{ +- return yaffs_internal_read_super(2, sb, data, silent); +-} +- +-static DECLARE_FSTYPE(yaffs2_fs_type, "yaffs2", yaffs2_read_super, +- FS_REQUIRES_DEV); +-#endif + + #endif /* CONFIG_YAFFS_YAFFS2 */ + diff --git a/target/linux/generic/patches-3.6/503-yaffs_symlink_bug.patch b/target/linux/generic/patches-3.6/503-yaffs_symlink_bug.patch deleted file mode 100644 index dabf2871bf..0000000000 --- a/target/linux/generic/patches-3.6/503-yaffs_symlink_bug.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/fs/yaffs2/yaffs_guts.c -+++ b/fs/yaffs2/yaffs_guts.c -@@ -1709,11 +1709,11 @@ static int yaffs_change_obj_name(yaffs_o - } - - /* TODO: Do we need this different handling for YAFFS2 and YAFFS1?? */ -- if (obj->my_dev->param.is_yaffs2) -+ // if (obj->my_dev->param.is_yaffs2) - unlinkOp = (new_dir == obj->my_dev->unlinked_dir); -- else -+ /* else - unlinkOp = (new_dir == obj->my_dev->unlinked_dir -- && obj->variant_type == YAFFS_OBJECT_TYPE_FILE); -+ && obj->variant_type == YAFFS_OBJECT_TYPE_FILE); */ - - deleteOp = (new_dir == obj->my_dev->del_dir); - diff --git a/target/linux/generic/patches-3.6/504-yaffs-3.2_fix.patch b/target/linux/generic/patches-3.6/504-yaffs-3.2_fix.patch new file mode 100644 index 0000000000..f84332ab29 --- /dev/null +++ b/target/linux/generic/patches-3.6/504-yaffs-3.2_fix.patch @@ -0,0 +1,289 @@ +--- a/fs/yaffs2/yaffs_vfs_glue.c ++++ b/fs/yaffs2/yaffs_vfs_glue.c +@@ -220,11 +220,34 @@ static struct inode *yaffs_iget(struct s + #define yaffs_SuperToDevice(sb) ((yaffs_dev_t *)sb->u.generic_sbp) + #endif + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) ++static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink) ++{ ++ set_nlink(inode, nlink); ++} ++ ++static inline void yaffs_dec_link_count(struct inode *inode) ++{ ++ inode_dec_link_count(inode); ++} ++#else ++static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink) ++{ ++ inode->i_nlink = nlink; ++} ++ ++static inline void yaffs_dec_link_count(struct inode *inode) ++{ ++ inode->i_nlink--; ++ mark_inode_dirty(inode) ++} ++#endif ++ + + #define update_dir_time(dir) do {\ + (dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \ + } while(0) +- ++ + static void yaffs_put_super(struct super_block *sb); + + static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n, +@@ -238,7 +261,10 @@ static int yaffs_file_flush(struct file + static int yaffs_file_flush(struct file *file); + #endif + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) ++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, +@@ -513,7 +539,7 @@ static unsigned yaffs_gc_control_callbac + { + return yaffs_gc_control; + } +- ++ + static void yaffs_gross_lock(yaffs_dev_t *dev) + { + T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current)); +@@ -1362,7 +1388,7 @@ static void yaffs_fill_inode_from_obj(st + inode->i_size = yaffs_get_obj_length(obj); + inode->i_blocks = (inode->i_size + 511) >> 9; + +- inode->i_nlink = yaffs_get_obj_link_count(obj); ++ yaffs_set_nlink(inode, yaffs_get_obj_link_count(obj)); + + T(YAFFS_TRACE_OS, + (TSTR("yaffs_fill_inode mode %x uid %d gid %d size %d count %d\n"), +@@ -1810,10 +1836,9 @@ static int yaffs_unlink(struct inode *di + retVal = yaffs_unlinker(obj, dentry->d_name.name); + + if (retVal == YAFFS_OK) { +- dentry->d_inode->i_nlink--; ++ yaffs_dec_link_count(dentry->d_inode); + dir->i_version++; + yaffs_gross_unlock(dev); +- mark_inode_dirty(dentry->d_inode); + update_dir_time(dir); + return 0; + } +@@ -1844,7 +1869,8 @@ static int yaffs_link(struct dentry *old + obj); + + if (link) { +- old_dentry->d_inode->i_nlink = yaffs_get_obj_link_count(obj); ++ yaffs_set_nlink(old_dentry->d_inode, ++ yaffs_get_obj_link_count(obj)); + d_instantiate(dentry, old_dentry->d_inode); + atomic_inc(&old_dentry->d_inode->i_count); + T(YAFFS_TRACE_OS, +@@ -1894,7 +1920,10 @@ static int yaffs_symlink(struct inode *d + return -ENOMEM; + } + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) ++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, +@@ -1961,11 +1990,9 @@ static int yaffs_rename(struct inode *ol + yaffs_gross_unlock(dev); + + if (retVal == YAFFS_OK) { +- if (target) { +- new_dentry->d_inode->i_nlink--; +- mark_inode_dirty(new_dentry->d_inode); +- } +- ++ if (target) ++ yaffs_dec_link_count(new_dentry->d_inode); ++ + update_dir_time(old_dir); + if(old_dir != new_dir) + update_dir_time(new_dir); +@@ -1985,7 +2012,7 @@ static int yaffs_setattr(struct dentry * + (TSTR("yaffs_setattr of object %d\n"), + yaffs_InodeToObject(inode)->obj_id)); + +- /* Fail if a requested resize >= 2GB */ ++ /* Fail if a requested resize >= 2GB */ + if (attr->ia_valid & ATTR_SIZE && + (attr->ia_size >> 31)) + error = -EINVAL; +@@ -2216,7 +2243,7 @@ static void yaffs_flush_inodes(struct su + { + struct inode *iptr; + yaffs_obj_t *obj; +- ++ + list_for_each_entry(iptr,&sb->s_inodes, i_sb_list){ + obj = yaffs_InodeToObject(iptr); + if(obj){ +@@ -2230,10 +2257,10 @@ static void yaffs_flush_inodes(struct su + + static void yaffs_flush_super(struct super_block *sb, int do_checkpoint) + { +- yaffs_dev_t *dev = yaffs_SuperToDevice(sb); ++ yaffs_dev_t *dev = yaffs_SuperToDevice(sb); + if(!dev) + return; +- ++ + yaffs_flush_inodes(sb); + yaffs_update_dirty_dirs(dev); + yaffs_flush_whole_cache(dev); +@@ -2301,7 +2328,7 @@ static int yaffs_do_sync_fs(struct super + * yaffs_bg_start() launches the background thread. + * yaffs_bg_stop() cleans up the background thread. + * +- * NB: ++ * NB: + * The thread should only run after the yaffs is initialised + * The thread should be stopped before yaffs is unmounted. + * The thread should not do any writing while the fs is in read only. +@@ -2872,7 +2899,7 @@ static struct super_block *yaffs_interna + + dev = kmalloc(sizeof(yaffs_dev_t), GFP_KERNEL); + context = kmalloc(sizeof(struct yaffs_LinuxContext),GFP_KERNEL); +- ++ + if(!dev || !context ){ + if(dev) + kfree(dev); +@@ -2905,7 +2932,7 @@ static struct super_block *yaffs_interna + #else + sb->u.generic_sbp = dev; + #endif +- ++ + dev->driver_context = mtd; + param->name = mtd->name; + +@@ -3005,7 +3032,7 @@ static struct super_block *yaffs_interna + param->gc_control = yaffs_gc_control_callback; + + yaffs_dev_to_lc(dev)->superBlock= sb; +- ++ + + #ifndef CONFIG_YAFFS_DOES_ECC + param->use_nand_ecc = 1; +@@ -3047,10 +3074,10 @@ static struct super_block *yaffs_interna + T(YAFFS_TRACE_OS, + (TSTR("yaffs_read_super: guts initialised %s\n"), + (err == YAFFS_OK) ? "OK" : "FAILED")); +- ++ + if(err == YAFFS_OK) + yaffs_bg_start(dev); +- ++ + if(!context->bgThread) + param->defered_dir_update = 0; + +@@ -3125,7 +3152,7 @@ static struct dentry *yaffs2_read_super( + void *data) + { + return mount_bdev(fs, flags, dev_name, data, +- yaffs_internal_read_super_mtd); ++ yaffs2_internal_read_super_mtd); + } + + static struct file_system_type yaffs2_fs_type = { +@@ -3223,7 +3250,7 @@ static int yaffs_proc_read(char *page, + buf += sprintf(buf,"\n"); + else { + step-=2; +- ++ + down(&yaffs_context_lock); + + /* Locate and print the Nth entry. Order N-squared but N is small. */ +@@ -3240,7 +3267,7 @@ static int yaffs_proc_read(char *page, + buf = yaffs_dump_dev_part0(buf, dev); + } else + buf = yaffs_dump_dev_part1(buf, dev); +- ++ + break; + } + up(&yaffs_context_lock); +@@ -3267,7 +3294,7 @@ static int yaffs_stats_proc_read(char *p + int erasedChunks; + + erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block; +- ++ + buf += sprintf(buf,"%d, %d, %d, %u, %u, %u, %u\n", + n, dev->n_free_chunks, erasedChunks, + dev->bg_gcs, dev->oldest_dirty_gc_count, +--- a/fs/yaffs2/yaffs_mtdif1.c ++++ b/fs/yaffs2/yaffs_mtdif1.c +@@ -34,6 +34,7 @@ + #include "linux/version.h" + #include "linux/types.h" + #include "linux/mtd/mtd.h" ++#include "mtd/mtd-abi.h" + + /* Don't compile this module if we don't have MTD's mtd_oob_ops interface */ + #if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) +@@ -127,7 +128,7 @@ int nandmtd1_WriteChunkWithTagsToNAND(ya + #endif + + memset(&ops, 0, sizeof(ops)); +- ops.mode = MTD_OOB_AUTO; ++ ops.mode = MTD_OPS_AUTO_OOB; + ops.len = (data) ? chunkBytes : 0; + ops.ooblen = YTAG1_SIZE; + ops.datbuf = (__u8 *)data; +@@ -179,7 +180,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y + int deleted; + + memset(&ops, 0, sizeof(ops)); +- ops.mode = MTD_OOB_AUTO; ++ ops.mode = MTD_OPS_AUTO_OOB; + ops.len = (data) ? chunkBytes : 0; + ops.ooblen = YTAG1_SIZE; + ops.datbuf = data; +--- a/fs/yaffs2/yaffs_mtdif2.c ++++ b/fs/yaffs2/yaffs_mtdif2.c +@@ -21,6 +21,7 @@ + #include "linux/mtd/mtd.h" + #include "linux/types.h" + #include "linux/time.h" ++#include "mtd/mtd-abi.h" + + #include "yaffs_packedtags2.h" + +@@ -71,7 +72,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya + yaffs_PackTags2(&pt, tags, !dev->param.no_tags_ecc); + + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) +- ops.mode = MTD_OOB_AUTO; ++ ops.mode = MTD_OPS_AUTO_OOB; + ops.ooblen = (dev->param.inband_tags) ? 0 : packed_tags_size; + ops.len = dev->param.total_bytes_per_chunk; + ops.ooboffs = 0; +@@ -136,7 +137,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y + retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk, + &dummy, data); + else if (tags) { +- ops.mode = MTD_OOB_AUTO; ++ ops.mode = MTD_OPS_AUTO_OOB; + ops.ooblen = packed_tags_size; + ops.len = data ? dev->data_bytes_per_chunk : packed_tags_size; + ops.ooboffs = 0; diff --git a/target/linux/generic/patches-3.6/504-yaffs_mutex_fix.patch b/target/linux/generic/patches-3.6/504-yaffs_mutex_fix.patch deleted file mode 100644 index b34b12f785..0000000000 --- a/target/linux/generic/patches-3.6/504-yaffs_mutex_fix.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/fs/yaffs2/yaffs_vfs_glue.c -+++ b/fs/yaffs2/yaffs_vfs_glue.c -@@ -3036,7 +3036,7 @@ static struct super_block *yaffs_interna - YINIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->searchContexts)); - param->remove_obj_fn = yaffs_remove_obj_callback; - -- init_MUTEX(&(yaffs_dev_to_lc(dev)->grossLock)); -+ sema_init(&(yaffs_dev_to_lc(dev)->grossLock), 1); - - yaffs_gross_lock(dev); - -@@ -3494,7 +3494,7 @@ static int __init init_yaffs_fs(void) - - - -- init_MUTEX(&yaffs_context_lock); -+ sema_init((&yaffs_context_lock), 1); - - /* Install the proc_fs entries */ - my_proc_entry = create_proc_entry("yaffs", diff --git a/target/linux/generic/patches-3.6/505-2.6.39_fix.patch b/target/linux/generic/patches-3.6/505-2.6.39_fix.patch deleted file mode 100644 index 5108f7be3f..0000000000 --- a/target/linux/generic/patches-3.6/505-2.6.39_fix.patch +++ /dev/null @@ -1,147 +0,0 @@ ---- a/fs/yaffs2/yaffs_vfs_glue.c -+++ b/fs/yaffs2/yaffs_vfs_glue.c -@@ -72,7 +72,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -@@ -97,6 +97,8 @@ - - #include - -+static DEFINE_MUTEX(yaffs_mutex); -+ - #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) - - #include -@@ -1538,7 +1540,7 @@ static loff_t yaffs_dir_llseek(struct fi - { - long long retval; - -- lock_kernel(); -+ mutex_lock(&yaffs_mutex); - - switch (origin){ - case 2: -@@ -1555,7 +1557,7 @@ static loff_t yaffs_dir_llseek(struct fi - - retval = offset; - } -- unlock_kernel(); -+ mutex_unlock(&yaffs_mutex); - return retval; - } - -@@ -3087,98 +3089,52 @@ static struct super_block *yaffs_interna - return sb; - } - -- --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) - static int yaffs_internal_read_super_mtd(struct super_block *sb, void *data, - int silent) - { - return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL; - } - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) --static int yaffs_read_super(struct file_system_type *fs, -+static struct dentry *yaffs_read_super(struct file_system_type *fs, - int flags, const char *dev_name, -- void *data, struct vfsmount *mnt) --{ -- -- return get_sb_bdev(fs, flags, dev_name, data, -- yaffs_internal_read_super_mtd, mnt); --} --#else --static struct super_block *yaffs_read_super(struct file_system_type *fs, -- int flags, const char *dev_name, -- void *data) -+ void *data) - { - -- return get_sb_bdev(fs, flags, dev_name, data, -+ return mount_bdev(fs, flags, dev_name, data, - yaffs_internal_read_super_mtd); - } --#endif - - static struct file_system_type yaffs_fs_type = { - .owner = THIS_MODULE, - .name = "yaffs", -- .get_sb = yaffs_read_super, -+ .mount = yaffs_read_super, - .kill_sb = kill_block_super, - .fs_flags = FS_REQUIRES_DEV, - }; --#else --static struct super_block *yaffs_read_super(struct super_block *sb, void *data, -- int silent) --{ -- return yaffs_internal_read_super(1, sb, data, silent); --} -- --static DECLARE_FSTYPE(yaffs_fs_type, "yaffs", yaffs_read_super, -- FS_REQUIRES_DEV); --#endif -- - - #ifdef CONFIG_YAFFS_YAFFS2 - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) - static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data, - int silent) - { - return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL; - } - --#if (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) -+static struct dentry *yaffs2_read_super(struct file_system_type *fs, -+ int flags, const char *dev_name, -+ void *data) - { -- return get_sb_bdev(fs, flags, dev_name, data, -- yaffs2_internal_read_super_mtd, mnt); -+ return mount_bdev(fs, flags, dev_name, data, -+ yaffs_internal_read_super_mtd); - } --#else --static struct super_block *yaffs2_read_super(struct file_system_type *fs, -- int flags, const char *dev_name, -- void *data) --{ -- -- return get_sb_bdev(fs, flags, dev_name, data, -- yaffs2_internal_read_super_mtd); --} --#endif - - static struct file_system_type yaffs2_fs_type = { - .owner = THIS_MODULE, - .name = "yaffs2", -- .get_sb = yaffs2_read_super, -+ .mount = yaffs2_read_super, - .kill_sb = kill_block_super, - .fs_flags = FS_REQUIRES_DEV, - }; --#else --static struct super_block *yaffs2_read_super(struct super_block *sb, -- void *data, int silent) --{ -- return yaffs_internal_read_super(2, sb, data, silent); --} -- --static DECLARE_FSTYPE(yaffs2_fs_type, "yaffs2", yaffs2_read_super, -- FS_REQUIRES_DEV); --#endif - - #endif /* CONFIG_YAFFS_YAFFS2 */ - diff --git a/target/linux/generic/patches-3.6/505-yaffs-3.3_fix.patch b/target/linux/generic/patches-3.6/505-yaffs-3.3_fix.patch new file mode 100644 index 0000000000..a269dc2567 --- /dev/null +++ b/target/linux/generic/patches-3.6/505-yaffs-3.3_fix.patch @@ -0,0 +1,71 @@ +--- a/fs/yaffs2/yaffs_vfs_glue.c ++++ b/fs/yaffs2/yaffs_vfs_glue.c +@@ -274,8 +274,13 @@ static int yaffs_sync_object(struct file + static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir); + + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) ++static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode, ++ struct nameidata *n); ++#else + static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode, + struct nameidata *n); ++#endif + static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry, + struct nameidata *n); + #else +@@ -287,9 +292,17 @@ static int yaffs_link(struct dentry *old + static int yaffs_unlink(struct inode *dir, struct dentry *dentry); + static int yaffs_symlink(struct inode *dir, struct dentry *dentry, + const char *symname); ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) ++static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); ++#else + static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode); ++#endif + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) ++static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, ++ dev_t dev); ++#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, + dev_t dev); + #else +@@ -1708,7 +1721,10 @@ out: + #define YCRED(x) (x->cred) + #endif + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) ++static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, ++ dev_t rdev) ++#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, + dev_t rdev) + #else +@@ -1798,7 +1814,11 @@ static int yaffs_mknod(struct inode *dir + return error; + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) ++static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ++#else + static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode) ++#endif + { + int retVal; + T(YAFFS_TRACE_OS, (TSTR("yaffs_mkdir\n"))); +@@ -1806,7 +1826,10 @@ static int yaffs_mkdir(struct inode *dir + return retVal; + } + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) ++static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode, ++ struct nameidata *n) ++#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode, + struct nameidata *n) + #else diff --git a/target/linux/generic/patches-3.6/506-yaffs2-3.2_fix.patch b/target/linux/generic/patches-3.6/506-yaffs2-3.2_fix.patch deleted file mode 100644 index f84332ab29..0000000000 --- a/target/linux/generic/patches-3.6/506-yaffs2-3.2_fix.patch +++ /dev/null @@ -1,289 +0,0 @@ ---- a/fs/yaffs2/yaffs_vfs_glue.c -+++ b/fs/yaffs2/yaffs_vfs_glue.c -@@ -220,11 +220,34 @@ static struct inode *yaffs_iget(struct s - #define yaffs_SuperToDevice(sb) ((yaffs_dev_t *)sb->u.generic_sbp) - #endif - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) -+static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink) -+{ -+ set_nlink(inode, nlink); -+} -+ -+static inline void yaffs_dec_link_count(struct inode *inode) -+{ -+ inode_dec_link_count(inode); -+} -+#else -+static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink) -+{ -+ inode->i_nlink = nlink; -+} -+ -+static inline void yaffs_dec_link_count(struct inode *inode) -+{ -+ inode->i_nlink--; -+ mark_inode_dirty(inode) -+} -+#endif -+ - - #define update_dir_time(dir) do {\ - (dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \ - } while(0) -- -+ - static void yaffs_put_super(struct super_block *sb); - - static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n, -@@ -238,7 +261,10 @@ static int yaffs_file_flush(struct file - static int yaffs_file_flush(struct file *file); - #endif - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)) -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) -+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, -@@ -513,7 +539,7 @@ static unsigned yaffs_gc_control_callbac - { - return yaffs_gc_control; - } -- -+ - static void yaffs_gross_lock(yaffs_dev_t *dev) - { - T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current)); -@@ -1362,7 +1388,7 @@ static void yaffs_fill_inode_from_obj(st - inode->i_size = yaffs_get_obj_length(obj); - inode->i_blocks = (inode->i_size + 511) >> 9; - -- inode->i_nlink = yaffs_get_obj_link_count(obj); -+ yaffs_set_nlink(inode, yaffs_get_obj_link_count(obj)); - - T(YAFFS_TRACE_OS, - (TSTR("yaffs_fill_inode mode %x uid %d gid %d size %d count %d\n"), -@@ -1810,10 +1836,9 @@ static int yaffs_unlink(struct inode *di - retVal = yaffs_unlinker(obj, dentry->d_name.name); - - if (retVal == YAFFS_OK) { -- dentry->d_inode->i_nlink--; -+ yaffs_dec_link_count(dentry->d_inode); - dir->i_version++; - yaffs_gross_unlock(dev); -- mark_inode_dirty(dentry->d_inode); - update_dir_time(dir); - return 0; - } -@@ -1844,7 +1869,8 @@ static int yaffs_link(struct dentry *old - obj); - - if (link) { -- old_dentry->d_inode->i_nlink = yaffs_get_obj_link_count(obj); -+ yaffs_set_nlink(old_dentry->d_inode, -+ yaffs_get_obj_link_count(obj)); - d_instantiate(dentry, old_dentry->d_inode); - atomic_inc(&old_dentry->d_inode->i_count); - T(YAFFS_TRACE_OS, -@@ -1894,7 +1920,10 @@ static int yaffs_symlink(struct inode *d - return -ENOMEM; - } - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)) -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) -+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, -@@ -1961,11 +1990,9 @@ static int yaffs_rename(struct inode *ol - yaffs_gross_unlock(dev); - - if (retVal == YAFFS_OK) { -- if (target) { -- new_dentry->d_inode->i_nlink--; -- mark_inode_dirty(new_dentry->d_inode); -- } -- -+ if (target) -+ yaffs_dec_link_count(new_dentry->d_inode); -+ - update_dir_time(old_dir); - if(old_dir != new_dir) - update_dir_time(new_dir); -@@ -1985,7 +2012,7 @@ static int yaffs_setattr(struct dentry * - (TSTR("yaffs_setattr of object %d\n"), - yaffs_InodeToObject(inode)->obj_id)); - -- /* Fail if a requested resize >= 2GB */ -+ /* Fail if a requested resize >= 2GB */ - if (attr->ia_valid & ATTR_SIZE && - (attr->ia_size >> 31)) - error = -EINVAL; -@@ -2216,7 +2243,7 @@ static void yaffs_flush_inodes(struct su - { - struct inode *iptr; - yaffs_obj_t *obj; -- -+ - list_for_each_entry(iptr,&sb->s_inodes, i_sb_list){ - obj = yaffs_InodeToObject(iptr); - if(obj){ -@@ -2230,10 +2257,10 @@ static void yaffs_flush_inodes(struct su - - static void yaffs_flush_super(struct super_block *sb, int do_checkpoint) - { -- yaffs_dev_t *dev = yaffs_SuperToDevice(sb); -+ yaffs_dev_t *dev = yaffs_SuperToDevice(sb); - if(!dev) - return; -- -+ - yaffs_flush_inodes(sb); - yaffs_update_dirty_dirs(dev); - yaffs_flush_whole_cache(dev); -@@ -2301,7 +2328,7 @@ static int yaffs_do_sync_fs(struct super - * yaffs_bg_start() launches the background thread. - * yaffs_bg_stop() cleans up the background thread. - * -- * NB: -+ * NB: - * The thread should only run after the yaffs is initialised - * The thread should be stopped before yaffs is unmounted. - * The thread should not do any writing while the fs is in read only. -@@ -2872,7 +2899,7 @@ static struct super_block *yaffs_interna - - dev = kmalloc(sizeof(yaffs_dev_t), GFP_KERNEL); - context = kmalloc(sizeof(struct yaffs_LinuxContext),GFP_KERNEL); -- -+ - if(!dev || !context ){ - if(dev) - kfree(dev); -@@ -2905,7 +2932,7 @@ static struct super_block *yaffs_interna - #else - sb->u.generic_sbp = dev; - #endif -- -+ - dev->driver_context = mtd; - param->name = mtd->name; - -@@ -3005,7 +3032,7 @@ static struct super_block *yaffs_interna - param->gc_control = yaffs_gc_control_callback; - - yaffs_dev_to_lc(dev)->superBlock= sb; -- -+ - - #ifndef CONFIG_YAFFS_DOES_ECC - param->use_nand_ecc = 1; -@@ -3047,10 +3074,10 @@ static struct super_block *yaffs_interna - T(YAFFS_TRACE_OS, - (TSTR("yaffs_read_super: guts initialised %s\n"), - (err == YAFFS_OK) ? "OK" : "FAILED")); -- -+ - if(err == YAFFS_OK) - yaffs_bg_start(dev); -- -+ - if(!context->bgThread) - param->defered_dir_update = 0; - -@@ -3125,7 +3152,7 @@ static struct dentry *yaffs2_read_super( - void *data) - { - return mount_bdev(fs, flags, dev_name, data, -- yaffs_internal_read_super_mtd); -+ yaffs2_internal_read_super_mtd); - } - - static struct file_system_type yaffs2_fs_type = { -@@ -3223,7 +3250,7 @@ static int yaffs_proc_read(char *page, - buf += sprintf(buf,"\n"); - else { - step-=2; -- -+ - down(&yaffs_context_lock); - - /* Locate and print the Nth entry. Order N-squared but N is small. */ -@@ -3240,7 +3267,7 @@ static int yaffs_proc_read(char *page, - buf = yaffs_dump_dev_part0(buf, dev); - } else - buf = yaffs_dump_dev_part1(buf, dev); -- -+ - break; - } - up(&yaffs_context_lock); -@@ -3267,7 +3294,7 @@ static int yaffs_stats_proc_read(char *p - int erasedChunks; - - erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block; -- -+ - buf += sprintf(buf,"%d, %d, %d, %u, %u, %u, %u\n", - n, dev->n_free_chunks, erasedChunks, - dev->bg_gcs, dev->oldest_dirty_gc_count, ---- a/fs/yaffs2/yaffs_mtdif1.c -+++ b/fs/yaffs2/yaffs_mtdif1.c -@@ -34,6 +34,7 @@ - #include "linux/version.h" - #include "linux/types.h" - #include "linux/mtd/mtd.h" -+#include "mtd/mtd-abi.h" - - /* Don't compile this module if we don't have MTD's mtd_oob_ops interface */ - #if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) -@@ -127,7 +128,7 @@ int nandmtd1_WriteChunkWithTagsToNAND(ya - #endif - - memset(&ops, 0, sizeof(ops)); -- ops.mode = MTD_OOB_AUTO; -+ ops.mode = MTD_OPS_AUTO_OOB; - ops.len = (data) ? chunkBytes : 0; - ops.ooblen = YTAG1_SIZE; - ops.datbuf = (__u8 *)data; -@@ -179,7 +180,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y - int deleted; - - memset(&ops, 0, sizeof(ops)); -- ops.mode = MTD_OOB_AUTO; -+ ops.mode = MTD_OPS_AUTO_OOB; - ops.len = (data) ? chunkBytes : 0; - ops.ooblen = YTAG1_SIZE; - ops.datbuf = data; ---- a/fs/yaffs2/yaffs_mtdif2.c -+++ b/fs/yaffs2/yaffs_mtdif2.c -@@ -21,6 +21,7 @@ - #include "linux/mtd/mtd.h" - #include "linux/types.h" - #include "linux/time.h" -+#include "mtd/mtd-abi.h" - - #include "yaffs_packedtags2.h" - -@@ -71,7 +72,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya - yaffs_PackTags2(&pt, tags, !dev->param.no_tags_ecc); - - #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) -- ops.mode = MTD_OOB_AUTO; -+ ops.mode = MTD_OPS_AUTO_OOB; - ops.ooblen = (dev->param.inband_tags) ? 0 : packed_tags_size; - ops.len = dev->param.total_bytes_per_chunk; - ops.ooboffs = 0; -@@ -136,7 +137,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y - retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk, - &dummy, data); - else if (tags) { -- ops.mode = MTD_OOB_AUTO; -+ ops.mode = MTD_OPS_AUTO_OOB; - ops.ooblen = packed_tags_size; - ops.len = data ? dev->data_bytes_per_chunk : packed_tags_size; - ops.ooboffs = 0; diff --git a/target/linux/generic/patches-3.6/507-yaffs2-3.3_fix.patch b/target/linux/generic/patches-3.6/507-yaffs2-3.3_fix.patch deleted file mode 100644 index a269dc2567..0000000000 --- a/target/linux/generic/patches-3.6/507-yaffs2-3.3_fix.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/fs/yaffs2/yaffs_vfs_glue.c -+++ b/fs/yaffs2/yaffs_vfs_glue.c -@@ -274,8 +274,13 @@ static int yaffs_sync_object(struct file - static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir); - - #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) -+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode, -+ struct nameidata *n); -+#else - static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode, - struct nameidata *n); -+#endif - static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry, - struct nameidata *n); - #else -@@ -287,9 +292,17 @@ static int yaffs_link(struct dentry *old - static int yaffs_unlink(struct inode *dir, struct dentry *dentry); - static int yaffs_symlink(struct inode *dir, struct dentry *dentry, - const char *symname); -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) -+static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); -+#else - static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode); -+#endif - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) -+static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, -+ dev_t dev); -+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) - static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, - dev_t dev); - #else -@@ -1708,7 +1721,10 @@ out: - #define YCRED(x) (x->cred) - #endif - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) -+static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, -+ dev_t rdev) -+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) - static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, - dev_t rdev) - #else -@@ -1798,7 +1814,11 @@ static int yaffs_mknod(struct inode *dir - return error; - } - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) -+static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) -+#else - static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode) -+#endif - { - int retVal; - T(YAFFS_TRACE_OS, (TSTR("yaffs_mkdir\n"))); -@@ -1806,7 +1826,10 @@ static int yaffs_mkdir(struct inode *dir - return retVal; - } - --#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) -+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode, -+ struct nameidata *n) -+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) - static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode, - struct nameidata *n) - #else