diff options
Diffstat (limited to 'target/linux/patches/2.6.32/yaffs2.patch')
-rw-r--r-- | target/linux/patches/2.6.32/yaffs2.patch | 15066 |
1 files changed, 0 insertions, 15066 deletions
diff --git a/target/linux/patches/2.6.32/yaffs2.patch b/target/linux/patches/2.6.32/yaffs2.patch deleted file mode 100644 index d23ad0161..000000000 --- a/target/linux/patches/2.6.32/yaffs2.patch +++ /dev/null @@ -1,15066 +0,0 @@ -diff -Nur linux-2.6.32.orig/fs/Kconfig linux-2.6.32/fs/Kconfig ---- linux-2.6.32.orig/fs/Kconfig 2009-12-03 04:51:21.000000000 +0100 -+++ linux-2.6.32/fs/Kconfig 2010-01-30 20:35:00.921899692 +0100 -@@ -174,6 +174,10 @@ - source "fs/befs/Kconfig" - source "fs/bfs/Kconfig" - source "fs/efs/Kconfig" -+ -+# Patched by YAFFS -+source "fs/yaffs2/Kconfig" -+ - source "fs/jffs2/Kconfig" - # UBIFS File system configuration - source "fs/ubifs/Kconfig" -diff -Nur linux-2.6.32.orig/fs/Makefile linux-2.6.32/fs/Makefile ---- linux-2.6.32.orig/fs/Makefile 2009-12-03 04:51:21.000000000 +0100 -+++ linux-2.6.32/fs/Makefile 2010-01-30 20:35:00.933084814 +0100 -@@ -124,3 +124,4 @@ - obj-$(CONFIG_BTRFS_FS) += btrfs/ - obj-$(CONFIG_GFS2_FS) += gfs2/ - obj-$(CONFIG_EXOFS_FS) += exofs/ -+obj-$(CONFIG_YAFFS_FS) += yaffs2/ -diff -Nur linux-2.6.32.orig/fs/Makefile.pre.yaffs linux-2.6.32/fs/Makefile.pre.yaffs ---- linux-2.6.32.orig/fs/Makefile.pre.yaffs 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.32/fs/Makefile.pre.yaffs 2010-01-30 20:35:00.983076819 +0100 -@@ -0,0 +1,126 @@ -+# -+# Makefile for the Linux filesystems. -+# -+# 14 Sep 2000, Christoph Hellwig <hch@infradead.org> -+# Rewritten to use lists instead of if-statements. -+# -+ -+obj-y := open.o read_write.o file_table.o super.o \ -+ char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \ -+ ioctl.o readdir.o select.o fifo.o dcache.o inode.o \ -+ attr.o bad_inode.o file.o filesystems.o namespace.o \ -+ seq_file.o xattr.o libfs.o fs-writeback.o \ -+ pnode.o drop_caches.o splice.o sync.o utimes.o \ -+ stack.o -+ -+ifeq ($(CONFIG_BLOCK),y) -+obj-y += buffer.o bio.o block_dev.o direct-io.o mpage.o ioprio.o -+else -+obj-y += no-block.o -+endif -+ -+obj-$(CONFIG_BLK_DEV_INTEGRITY) += bio-integrity.o -+obj-y += notify/ -+obj-$(CONFIG_EPOLL) += eventpoll.o -+obj-$(CONFIG_ANON_INODES) += anon_inodes.o -+obj-$(CONFIG_SIGNALFD) += signalfd.o -+obj-$(CONFIG_TIMERFD) += timerfd.o -+obj-$(CONFIG_EVENTFD) += eventfd.o -+obj-$(CONFIG_AIO) += aio.o -+obj-$(CONFIG_FILE_LOCKING) += locks.o -+obj-$(CONFIG_COMPAT) += compat.o compat_ioctl.o -+ -+nfsd-$(CONFIG_NFSD) := nfsctl.o -+obj-y += $(nfsd-y) $(nfsd-m) -+ -+obj-$(CONFIG_BINFMT_AOUT) += binfmt_aout.o -+obj-$(CONFIG_BINFMT_EM86) += binfmt_em86.o -+obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o -+ -+# binfmt_script is always there -+obj-y += binfmt_script.o -+ -+obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o -+obj-$(CONFIG_COMPAT_BINFMT_ELF) += compat_binfmt_elf.o -+obj-$(CONFIG_BINFMT_ELF_FDPIC) += binfmt_elf_fdpic.o -+obj-$(CONFIG_BINFMT_SOM) += binfmt_som.o -+obj-$(CONFIG_BINFMT_FLAT) += binfmt_flat.o -+ -+obj-$(CONFIG_FS_MBCACHE) += mbcache.o -+obj-$(CONFIG_FS_POSIX_ACL) += posix_acl.o xattr_acl.o -+obj-$(CONFIG_NFS_COMMON) += nfs_common/ -+obj-$(CONFIG_GENERIC_ACL) += generic_acl.o -+ -+obj-$(CONFIG_QUOTA) += dquot.o -+obj-$(CONFIG_QFMT_V1) += quota_v1.o -+obj-$(CONFIG_QFMT_V2) += quota_v2.o -+obj-$(CONFIG_QUOTA_TREE) += quota_tree.o -+obj-$(CONFIG_QUOTACTL) += quota.o -+ -+obj-$(CONFIG_PROC_FS) += proc/ -+obj-y += partitions/ -+obj-$(CONFIG_SYSFS) += sysfs/ -+obj-$(CONFIG_CONFIGFS_FS) += configfs/ -+obj-y += devpts/ -+ -+obj-$(CONFIG_PROFILING) += dcookies.o -+obj-$(CONFIG_DLM) += dlm/ -+ -+# Do not add any filesystems before this line -+obj-$(CONFIG_REISERFS_FS) += reiserfs/ -+obj-$(CONFIG_EXT3_FS) += ext3/ # Before ext2 so root fs can be ext3 -+obj-$(CONFIG_EXT2_FS) += ext2/ -+# We place ext4 after ext2 so plain ext2 root fs's are mounted using ext2 -+# unless explicitly requested by rootfstype -+obj-$(CONFIG_EXT4_FS) += ext4/ -+obj-$(CONFIG_JBD) += jbd/ -+obj-$(CONFIG_JBD2) += jbd2/ -+obj-$(CONFIG_CRAMFS) += cramfs/ -+obj-$(CONFIG_SQUASHFS) += squashfs/ -+obj-y += ramfs/ -+obj-$(CONFIG_HUGETLBFS) += hugetlbfs/ -+obj-$(CONFIG_CODA_FS) += coda/ -+obj-$(CONFIG_MINIX_FS) += minix/ -+obj-$(CONFIG_FAT_FS) += fat/ -+obj-$(CONFIG_BFS_FS) += bfs/ -+obj-$(CONFIG_ISO9660_FS) += isofs/ -+obj-$(CONFIG_HFSPLUS_FS) += hfsplus/ # Before hfs to find wrapped HFS+ -+obj-$(CONFIG_HFS_FS) += hfs/ -+obj-$(CONFIG_ECRYPT_FS) += ecryptfs/ -+obj-$(CONFIG_VXFS_FS) += freevxfs/ -+obj-$(CONFIG_NFS_FS) += nfs/ -+obj-$(CONFIG_EXPORTFS) += exportfs/ -+obj-$(CONFIG_NFSD) += nfsd/ -+obj-$(CONFIG_LOCKD) += lockd/ -+obj-$(CONFIG_NLS) += nls/ -+obj-$(CONFIG_SYSV_FS) += sysv/ -+obj-$(CONFIG_SMB_FS) += smbfs/ -+obj-$(CONFIG_CIFS) += cifs/ -+obj-$(CONFIG_NCP_FS) += ncpfs/ -+obj-$(CONFIG_HPFS_FS) += hpfs/ -+obj-$(CONFIG_NTFS_FS) += ntfs/ -+obj-$(CONFIG_UFS_FS) += ufs/ -+obj-$(CONFIG_EFS_FS) += efs/ -+obj-$(CONFIG_JFFS2_FS) += jffs2/ -+obj-$(CONFIG_UBIFS_FS) += ubifs/ -+obj-$(CONFIG_AFFS_FS) += affs/ -+obj-$(CONFIG_ROMFS_FS) += romfs/ -+obj-$(CONFIG_QNX4FS_FS) += qnx4/ -+obj-$(CONFIG_AUTOFS_FS) += autofs/ -+obj-$(CONFIG_AUTOFS4_FS) += autofs4/ -+obj-$(CONFIG_ADFS_FS) += adfs/ -+obj-$(CONFIG_FUSE_FS) += fuse/ -+obj-$(CONFIG_UDF_FS) += udf/ -+obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/ -+obj-$(CONFIG_OMFS_FS) += omfs/ -+obj-$(CONFIG_JFS_FS) += jfs/ -+obj-$(CONFIG_XFS_FS) += xfs/ -+obj-$(CONFIG_9P_FS) += 9p/ -+obj-$(CONFIG_AFS_FS) += afs/ -+obj-$(CONFIG_BEFS_FS) += befs/ -+obj-$(CONFIG_HOSTFS) += hostfs/ -+obj-$(CONFIG_HPPFS) += hppfs/ -+obj-$(CONFIG_DEBUG_FS) += debugfs/ -+obj-$(CONFIG_OCFS2_FS) += ocfs2/ -+obj-$(CONFIG_BTRFS_FS) += btrfs/ -+obj-$(CONFIG_GFS2_FS) += gfs2/ -diff -Nur linux-2.6.32.orig/fs/yaffs2/devextras.h linux-2.6.32/fs/yaffs2/devextras.h ---- linux-2.6.32.orig/fs/yaffs2/devextras.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.32/fs/yaffs2/devextras.h 2010-01-30 20:35:01.021829008 +0100 -@@ -0,0 +1,196 @@ -+/* -+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system. -+ * -+ * Copyright (C) 2002-2007 Aleph One Ltd. -+ * for Toby Churchill Ltd and Brightstar Engineering -+ * -+ * Created by Charles Manning <charles@aleph1.co.uk> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License version 2.1 as -+ * published by the Free Software Foundation. -+ * -+ * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. -+ */ -+ -+/* -+ * This file is just holds extra declarations of macros that would normally -+ * be providesd in the Linux kernel. These macros have been written from -+ * scratch but are functionally equivalent to the Linux ones. -+ * -+ */ -+ -+#ifndef __EXTRAS_H__ -+#define __EXTRAS_H__ -+ -+ -+#if !(defined __KERNEL__) -+ -+/* Definition of types */ -+typedef unsigned char __u8; -+typedef unsigned short __u16; -+typedef unsigned __u32; -+ -+#endif -+ -+/* -+ * This is a simple doubly linked list implementation that matches the -+ * way the Linux kernel doubly linked list implementation works. -+ */ -+ -+struct ylist_head { -+ struct ylist_head *next; /* next in chain */ -+ struct ylist_head *prev; /* previous in chain */ -+}; -+ -+ -+/* Initialise a static list */ -+#define YLIST_HEAD(name) \ -+struct ylist_head name = { &(name), &(name)} -+ -+ -+ -+/* Initialise a list head to an empty list */ -+#define YINIT_LIST_HEAD(p) \ -+do { \ -+ (p)->next = (p);\ -+ (p)->prev = (p); \ -+} while (0) -+ -+ -+/* Add an element to a list */ -+static __inline__ void ylist_add(struct ylist_head *newEntry, -+ struct ylist_head *list) -+{ -+ struct ylist_head *listNext = list->next; -+ -+ list->next = newEntry; -+ newEntry->prev = list; -+ newEntry->next = listNext; -+ listNext->prev = newEntry; -+ -+} -+ -+static __inline__ void ylist_add_tail(struct ylist_head *newEntry, -+ struct ylist_head *list) -+{ -+ struct ylist_head *listPrev = list->prev; -+ -+ list->prev = newEntry; -+ newEntry->next = list; -+ newEntry->prev = listPrev; -+ listPrev->next = newEntry; -+ -+} -+ -+ -+/* Take an element out of its current list, with or without -+ * reinitialising the links.of the entry*/ -+static __inline__ void ylist_del(struct ylist_head *entry) -+{ -+ struct ylist_head *listNext = entry->next; -+ struct ylist_head *listPrev = entry->prev; -+ -+ listNext->prev = listPrev; -+ listPrev->next = listNext; -+ -+} -+ -+static __inline__ void ylist_del_init(struct ylist_head *entry) -+{ -+ ylist_del(entry); -+ entry->next = entry->prev = entry; -+} -+ -+ -+/* Test if the list is empty */ -+static __inline__ int ylist_empty(struct ylist_head *entry) -+{ -+ return (entry->next == entry); -+} -+ -+ -+/* ylist_entry takes a pointer to a list entry and offsets it to that -+ * we can find a pointer to the object it is embedded in. -+ */ -+ -+ -+#define ylist_entry(entry, type, member) \ -+ ((type *)((char *)(entry)-(unsigned long)(&((type *)NULL)->member))) -+ -+ -+/* ylist_for_each and list_for_each_safe iterate over lists. -+ * ylist_for_each_safe uses temporary storage to make the list delete safe -+ */ -+ -+#define ylist_for_each(itervar, list) \ -+ for (itervar = (list)->next; itervar != (list); itervar = itervar->next) -+ -+#define ylist_for_each_safe(itervar, saveVar, list) \ -+ for (itervar = (list)->next, saveVar = (list)->next->next; \ -+ itervar != (list); itervar = saveVar, saveVar = saveVar->next) -+ -+ -+#if !(defined __KERNEL__) -+ -+ -+#ifndef WIN32 -+#include <sys/stat.h> -+#endif -+ -+ -+#ifdef CONFIG_YAFFS_PROVIDE_DEFS -+/* File types */ -+ -+ -+#define DT_UNKNOWN 0 -+#define DT_FIFO 1 -+#define DT_CHR 2 -+#define DT_DIR 4 -+#define DT_BLK 6 -+#define DT_REG 8 -+#define DT_LNK 10 -+#define DT_SOCK 12 -+#define DT_WHT 14 -+ -+ -+#ifndef WIN32 -+#include <sys/stat.h> -+#endif -+ -+/* -+ * Attribute flags. These should be or-ed together to figure out what -+ * has been changed! -+ */ -+#define ATTR_MODE 1 -+#define ATTR_UID 2 -+#define ATTR_GID 4 -+#define ATTR_SIZE 8 -+#define ATTR_ATIME 16 -+#define ATTR_MTIME 32 -+#define ATTR_CTIME 64 -+ -+struct iattr { -+ unsigned int ia_valid; -+ unsigned ia_mode; -+ unsigned ia_uid; -+ unsigned ia_gid; -+ unsigned ia_size; -+ unsigned ia_atime; -+ unsigned ia_mtime; -+ unsigned ia_ctime; -+ unsigned int ia_attr_flags; -+}; -+ -+#endif -+ -+#else -+ -+#include <linux/types.h> -+#include <linux/fs.h> -+#include <linux/stat.h> -+ -+#endif -+ -+ -+#endif -diff -Nur linux-2.6.32.orig/fs/yaffs2/Kconfig linux-2.6.32/fs/yaffs2/Kconfig ---- linux-2.6.32.orig/fs/yaffs2/Kconfig 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.32/fs/yaffs2/Kconfig 2010-01-30 20:35:01.053081300 +0100 -@@ -0,0 +1,156 @@ -+# -+# YAFFS file system configurations -+# -+ -+config YAFFS_FS -+ tristate "YAFFS2 file system support" -+ default n -+ depends on MTD_BLOCK -+ select YAFFS_YAFFS1 -+ select YAFFS_YAFFS2 -+ help -+ YAFFS2, or Yet Another Flash Filing System, is a filing system -+ optimised for NAND Flash chips. -+ -+ To compile the YAFFS2 file system support as a module, choose M -+ here: the module will be called yaffs2. -+ -+ If unsure, say N. -+ -+ Further information on YAFFS2 is available at -+ <http://www.aleph1.co.uk/yaffs/>. -+ -+config YAFFS_YAFFS1 -+ bool "512 byte / page devices" -+ depends on YAFFS_FS -+ default y -+ help -+ Enable YAFFS1 support -- yaffs for 512 byte / page devices -+ -+ Not needed for 2K-page devices. -+ -+ If unsure, say Y. -+ -+config YAFFS_9BYTE_TAGS -+ bool "Use older-style on-NAND data format with pageStatus byte" -+ depends on YAFFS_YAFFS1 -+ default n -+ help -+ -+ Older-style on-NAND data format has a "pageStatus" byte to record -+ chunk/page state. This byte is zero when the page is discarded. -+ Choose this option if you have existing on-NAND data using this -+ format that you need to continue to support. New data written -+ also uses the older-style format. Note: Use of this option -+ generally requires that MTD's oob layout be adjusted to use the -+ older-style format. See notes on tags formats and MTD versions -+ in yaffs_mtdif1.c. -+ -+ If unsure, say N. -+ -+config YAFFS_DOES_ECC -+ bool "Lets Yaffs do its own ECC" -+ depends on YAFFS_FS && YAFFS_YAFFS1 && !YAFFS_9BYTE_TAGS -+ default n -+ help -+ This enables Yaffs to use its own ECC functions instead of using -+ the ones from the generic MTD-NAND driver. -+ -+ If unsure, say N. -+ -+config YAFFS_ECC_WRONG_ORDER -+ bool "Use the same ecc byte order as Steven Hill's nand_ecc.c" -+ depends on YAFFS_FS && YAFFS_DOES_ECC && !YAFFS_9BYTE_TAGS -+ default n -+ help -+ This makes yaffs_ecc.c use the same ecc byte order as Steven -+ Hill's nand_ecc.c. If not set, then you get the same ecc byte -+ order as SmartMedia. -+ -+ If unsure, say N. -+ -+config YAFFS_YAFFS2 -+ bool "2048 byte (or larger) / page devices" -+ depends on YAFFS_FS -+ default y -+ help -+ Enable YAFFS2 support -- yaffs for >= 2K bytes per page devices -+ -+ If unsure, say Y. -+ -+config YAFFS_AUTO_YAFFS2 -+ bool "Autoselect yaffs2 format" -+ depends on YAFFS_YAFFS2 -+ default y -+ help -+ Without this, you need to explicitely use yaffs2 as the file -+ system type. With this, you can say "yaffs" and yaffs or yaffs2 -+ will be used depending on the device page size (yaffs on -+ 512-byte page devices, yaffs2 on 2K page devices). -+ -+ If unsure, say Y. -+ -+config YAFFS_DISABLE_LAZY_LOAD -+ bool "Disable lazy loading" -+ depends on YAFFS_YAFFS2 -+ default n -+ help -+ "Lazy loading" defers loading file details until they are -+ required. This saves mount time, but makes the first look-up -+ a bit longer. -+ -+ Lazy loading will only happen if enabled by this option being 'n' -+ and if the appropriate tags are available, else yaffs2 will -+ automatically fall back to immediate loading and do the right -+ thing. -+ -+ Lazy laoding will be required by checkpointing. -+ -+ Setting this to 'y' will disable lazy loading. -+ -+ If unsure, say N. -+ -+ -+config YAFFS_DISABLE_WIDE_TNODES -+ bool "Turn off wide tnodes" -+ depends on YAFFS_FS -+ default n -+ help -+ Wide tnodes are only used for NAND arrays >=32MB for 512-byte -+ page devices and >=128MB for 2k page devices. They use slightly -+ more RAM but are faster since they eliminate chunk group -+ searching. -+ -+ Setting this to 'y' will force tnode width to 16 bits and save -+ memory but make large arrays slower. -+ -+ If unsure, say N. -+ -+config YAFFS_ALWAYS_CHECK_CHUNK_ERASED -+ bool "Force chunk erase check" -+ depends on YAFFS_FS -+ default n -+ help -+ Normally YAFFS only checks chunks before writing until an erased -+ chunk is found. This helps to detect any partially written -+ chunks that might have happened due to power loss. -+ -+ Enabling this forces on the test that chunks are erased in flash -+ before writing to them. This takes more time but is potentially -+ a bit more secure. -+ -+ Suggest setting Y during development and ironing out driver -+ issues etc. Suggest setting to N if you want faster writing. -+ -+ If unsure, say Y. -+ -+config YAFFS_SHORT_NAMES_IN_RAM -+ bool "Cache short names in RAM" -+ depends on YAFFS_FS -+ default y -+ help -+ If this config is set, then short names are stored with the -+ yaffs_Object. This costs an extra 16 bytes of RAM per object, -+ but makes look-ups faster. -+ -+ If unsure, say Y. -diff -Nur linux-2.6.32.orig/fs/yaffs2/Makefile linux-2.6.32/fs/yaffs2/Makefile ---- linux-2.6.32.orig/fs/yaffs2/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.32/fs/yaffs2/Makefile 2010-01-30 20:35:01.093074881 +0100 -@@ -0,0 +1,10 @@ -+# -+# Makefile for the linux YAFFS filesystem routines. -+# -+ -+obj-$(CONFIG_YAFFS_FS) += yaffs.o -+ -+yaffs-y := yaffs_ecc.o yaffs_fs.o yaffs_guts.o yaffs_checkptrw.o -+yaffs-y += yaffs_packedtags1.o yaffs_packedtags2.o yaffs_nand.o yaffs_qsort.o -+yaffs-y += yaffs_tagscompat.o yaffs_tagsvalidity.o -+yaffs-y += yaffs_mtdif.o yaffs_mtdif1.o yaffs_mtdif2.o -diff -Nur linux-2.6.32.orig/fs/yaffs2/moduleconfig.h linux-2.6.32/fs/yaffs2/moduleconfig.h ---- linux-2.6.32.orig/fs/yaffs2/moduleconfig.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.32/fs/yaffs2/moduleconfig.h 2010-01-30 20:35:01.131828051 +0100 -@@ -0,0 +1,65 @@ -+/* -+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system. -+ * -+ * Copyright (C) 2002-2007 Aleph One Ltd. -+ * for Toby Churchill Ltd and Brightstar Engineering -+ * -+ * Created by Martin Fouts <Martin.Fouts@palmsource.com> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License version 2.1 as -+ * published by the Free Software Foundation. -+ * -+ * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. -+ */ -+ -+#ifndef __YAFFS_CONFIG_H__ -+#define __YAFFS_CONFIG_H__ -+ -+#ifdef YAFFS_OUT_OF_TREE -+ -+/* DO NOT UNSET THESE THREE. YAFFS2 will not compile if you do. */ -+#define CONFIG_YAFFS_FS -+#define CONFIG_YAFFS_YAFFS1 -+#define CONFIG_YAFFS_YAFFS2 -+ -+/* These options are independent of each other. Select those that matter. */ -+ -+/* Default: Not selected */ -+/* Meaning: Yaffs does its own ECC, rather than using MTD ECC */ -+/* #define CONFIG_YAFFS_DOES_ECC */ -+ -+/* Default: Not selected */ -+/* Meaning: ECC byte order is 'wrong'. Only meaningful if */ -+/* CONFIG_YAFFS_DOES_ECC is set */ -+/* #define CONFIG_YAFFS_ECC_WRONG_ORDER */ -+ -+/* Default: Selected */ -+/* Meaning: Disables testing whether chunks are erased before writing to them*/ -+#define CONFIG_YAFFS_DISABLE_CHUNK_ERASED_CHECK -+ -+/* Default: Selected */ -+/* Meaning: Cache short names, taking more RAM, but faster look-ups */ -+#define CONFIG_YAFFS_SHORT_NAMES_IN_RAM -+ -+/* Default: 10 */ -+/* Meaning: set the count of blocks to reserve for checkpointing */ -+#define CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS 10 -+ -+/* -+Older-style on-NAND data format has a "pageStatus" byte to record -+chunk/page state. This byte is zeroed when the page is discarded. -+Choose this option if you have existing on-NAND data in this format -+that you need to continue to support. New data written also uses the -+older-style format. -+Note: Use of this option generally requires that MTD's oob layout be -+adjusted to use the older-style format. See notes on tags formats and -+MTD versions in yaffs_mtdif1.c. -+*/ -+/* Default: Not selected */ -+/* Meaning: Use older-style on-NAND data format with pageStatus byte */ -+/* #define CONFIG_YAFFS_9BYTE_TAGS */ -+ -+#endif /* YAFFS_OUT_OF_TREE */ -+ -+#endif /* __YAFFS_CONFIG_H__ */ -diff -Nur linux-2.6.32.orig/fs/yaffs2/yaffs_checkptrw.c linux-2.6.32/fs/yaffs2/yaffs_checkptrw.c ---- linux-2.6.32.orig/fs/yaffs2/yaffs_checkptrw.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.32/fs/yaffs2/yaffs_checkptrw.c 2010-01-30 20:35:01.171829690 +0100 -@@ -0,0 +1,394 @@ -+/* -+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system. -+ * -+ * Copyright (C) 2002-2007 Aleph One Ltd. -+ * for Toby Churchill Ltd and Brightstar Engineering -+ * -+ * Created by Charles Manning <charles@aleph1.co.uk> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+const char *yaffs_checkptrw_c_version = -+ "$Id: yaffs_checkptrw.c,v 1.18 2009-03-06 17:20:49 wookey Exp $"; -+ -+ -+#include "yaffs_checkptrw.h" -+#include "yaffs_getblockinfo.h" -+ -+static int yaffs_CheckpointSpaceOk(yaffs_Device *dev) -+{ -+ int blocksAvailable = dev->nErasedBlocks - dev->nReservedBlocks; -+ -+ T(YAFFS_TRACE_CHECKPOINT, -+ (TSTR("checkpt blocks available = %d" TENDSTR), -+ blocksAvailable)); -+ -+ return (blocksAvailable <= 0) ? 0 : 1; -+} -+ -+ -+static int yaffs_CheckpointErase(yaffs_Device *dev) -+{ -+ int i; -+ -+ if (!dev->eraseBlockInNAND) -+ return 0; -+ T(YAFFS_TRACE_CHECKPOINT, (TSTR("checking blocks %d to %d"TENDSTR), -+ dev->internalStartBlock, dev->internalEndBlock)); -+ -+ for (i = dev->internalStartBlock; i <= dev->internalEndBlock; i++) { -+ yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, i); -+ if (bi->blockState == YAFFS_BLOCK_STATE_CHECKPOINT) { -+ T(YAFFS_TRACE_CHECKPOINT, (TSTR("erasing checkpt block %d"TENDSTR), i)); -+ if (dev->eraseBlockInNAND(dev, i - dev->blockOffset /* realign */)) { -+ bi->blockState = YAFFS_BLOCK_STATE_EMPTY; -+ dev->nErasedBlocks++; -+ dev->nFreeChunks += dev->nChunksPerBlock; -+ } else { -+ dev->markNANDBlockBad(dev, i); -+ bi->blockState = YAFFS_BLOCK_STATE_DEAD; -+ } -+ } -+ } -+ -+ dev->blocksInCheckpoint = 0; -+ -+ return 1; -+} -+ -+ -+static void yaffs_CheckpointFindNextErasedBlock(yaffs_Device *dev) -+{ -+ int i; -+ int blocksAvailable = dev->nErasedBlocks - dev->nReservedBlocks; -+ T(YAFFS_TRACE_CHECKPOINT, -+ (TSTR("allocating checkpt block: erased %d reserved %d avail %d next %d "TENDSTR), -+ dev->nErasedBlocks, dev->nReservedBlocks, blocksAvailable, dev->checkpointNextBlock)); -+ -+ if (dev->checkpointNextBlock >= 0 && -+ dev->checkpointNextBlock <= dev->internalEndBlock && -+ blocksAvailable > 0) { -+ -+ for (i = dev->checkpointNextBlock; i <= dev->internalEndBlock; i++) { -+ yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, i); -+ if (bi->blockState == YAFFS_BLOCK_STATE_EMPTY) { -+ dev->checkpointNextBlock = i + 1; -+ dev->checkpointCurrentBlock = i; -+ T(YAFFS_TRACE_CHECKPOINT, (TSTR("allocating checkpt block %d"TENDSTR), i)); -+ return; -+ } -+ } -+ } -+ T(YAFFS_TRACE_CHECKPOINT, (TSTR("out of checkpt blocks"TENDSTR))); -+ -+ dev->checkpointNextBlock = -1; -+ dev->checkpointCurrentBlock = -1; -+} -+ -+static void yaffs_CheckpointFindNextCheckpointBlock(yaffs_Device *dev) -+{ -+ int i; -+ yaffs_ExtendedTags tags; -+ -+ T(YAFFS_TRACE_CHECKPOINT, (TSTR("find next checkpt block: start: blocks %d next %d" TENDSTR), -+ dev->blocksInCheckpoint, dev->checkpointNextBlock)); -+ -+ if (dev->blocksInCheckpoint < dev->checkpointMaxBlocks) -+ for (i = dev->checkpointNextBlock; i <= dev->internalEndBlock; i++) { -+ int chunk = i * dev->nChunksPerBlock; -+ int realignedChunk = chunk - dev->chunkOffset; -+ -+ dev->readChunkWithTagsFromNAND(dev, realignedChunk, -+ NULL, &tags); -+ T(YAFFS_TRACE_CHECKPOINT, (TSTR("find next checkpt block: search: block %d oid %d seq %d eccr %d" TENDSTR), -+ i, tags.objectId, tags.sequenceNumber, tags.eccResult)); -+ -+ if (tags.sequenceNumber == YAFFS_SEQUENCE_CHECKPOINT_DATA) { -+ /* Right kind of block */ -+ dev->checkpointNextBlock = tags.objectId; -+ dev->checkpointCurrentBlock = i; -+ dev->checkpointBlockList[dev->blocksInCheckpoint] = i; -+ dev->blocksInCheckpoint++; -+ T(YAFFS_TRACE_CHECKPOINT, (TSTR("found checkpt block %d"TENDSTR), i)); -+ return; -+ } -+ } -+ -+ T(YAFFS_TRACE_CHECKPOINT, (TSTR("found no more checkpt blocks"TENDSTR))); -+ -+ dev->checkpointNextBlock = -1; -+ dev->checkpointCurrentBlock = -1; -+} -+ -+ -+int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting) -+{ -+ -+ /* Got the functions we need? */ -+ if (!dev->writeChunkWithTagsToNAND || -+ !dev->readChunkWithTagsFromNAND || -+ !dev->eraseBlockInNAND || -+ !dev->markNANDBlockBad) -+ return 0; -+ -+ if (forWriting && !yaffs_CheckpointSpaceOk(dev)) -+ return 0; -+ -+ if (!dev->checkpointBuffer) -+ dev->checkpointBuffer = YMALLOC_DMA(dev->totalBytesPerChunk); -+ if (!dev->checkpointBuffer) -+ return 0; -+ -+ -+ dev->checkpointPageSequence = 0; -+ -+ dev->checkpointOpenForWrite = forWriting; -+ -+ dev->checkpointByteCount = 0; -+ dev->checkpointSum = 0; -+ dev->checkpointXor = 0; -+ dev->checkpointCurrentBlock = -1; -+ dev->checkpointCurrentChunk = -1; -+ dev->checkpointNextBlock = dev->internalStartBlock; -+ -+ /* Erase all the blocks in the checkpoint area */ -+ if (forWriting) { -+ memset(dev->checkpointBuffer, 0, dev->nDataBytesPerChunk); -+ dev->checkpointByteOffset = 0; -+ return yaffs_CheckpointErase(dev); -+ } else { -+ int i; -+ /* Set to a value that will kick off a read */ -+ dev->checkpointByteOffset = dev->nDataBytesPerChunk; -+ /* A checkpoint block list of 1 checkpoint block per 16 block is (hopefully) -+ * going to be way more than we need */ -+ dev->blocksInCheckpoint = 0; -+ dev->checkpointMaxBlocks = (dev->internalEndBlock - dev->internalStartBlock)/16 + 2; -+ dev->checkpointBlockList = YMALLOC(sizeof(int) * dev->checkpointMaxBlocks); -+ for (i = 0; i < dev->checkpointMaxBlocks; i++) -+ dev->checkpointBlockList[i] = -1; -+ } -+ -+ return 1; -+} -+ -+int yaffs_GetCheckpointSum(yaffs_Device *dev, __u32 *sum) -+{ -+ __u32 compositeSum; -+ compositeSum = (dev->checkpointSum << 8) | (dev->checkpointXor & 0xFF); -+ *sum = compositeSum; -+ return 1; -+} -+ -+static int yaffs_CheckpointFlushBuffer(yaffs_Device *dev) -+{ -+ int chunk; -+ int realignedChunk; -+ -+ yaffs_ExtendedTags tags; -+ -+ if (dev->checkpointCurrentBlock < 0) { -+ yaffs_CheckpointFindNextErasedBlock(dev); -+ dev->checkpointCurrentChunk = 0; -+ } -+ -+ if (dev->checkpointCurrentBlock < 0) -+ return 0; -+ -+ tags.chunkDeleted = 0; -+ tags.objectId = dev->checkpointNextBlock; /* Hint to next place to look */ -+ tags.chunkId = dev->checkpointPageSequence + 1; -+ tags.sequenceNumber = YAFFS_SEQUENCE_CHECKPOINT_DATA; -+ tags.byteCount = dev->nDataBytesPerChunk; -+ if (dev->checkpointCurrentChunk == 0) { -+ /* First chunk we write for the block? Set block state to -+ checkpoint */ -+ yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, dev->checkpointCurrentBlock); -+ bi->blockState = YAFFS_BLOCK_STATE_CHECKPOINT; -+ dev->blocksInCheckpoint++; -+ } -+ -+ chunk = dev->checkpointCurrentBlock * dev->nChunksPerBlock + dev->checkpointCurrentChunk; -+ -+ -+ T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint wite buffer nand %d(%d:%d) objid %d chId %d" TENDSTR), -+ chunk, dev->checkpointCurrentBlock, dev->checkpointCurrentChunk, tags.objectId, tags.chunkId)); -+ -+ realignedChunk = chunk - dev->chunkOffset; -+ -+ dev->writeChunkWithTagsToNAND(dev, realignedChunk, -+ dev->checkpointBuffer, &tags); -+ dev->checkpointByteOffset = 0; -+ dev->checkpointPageSequence++; -+ dev->checkpointCurrentChunk++; -+ if (dev->checkpointCurrentChunk >= dev->nChunksPerBlock) { -+ dev->checkpointCurrentChunk = 0; -+ dev->checkpointCurrentBlock = -1; -+ } -+ memset(dev->checkpointBuffer, 0, dev->nDataBytesPerChunk); -+ -+ return 1; -+} -+ -+ -+int yaffs_CheckpointWrite(yaffs_Device *dev, const void *data, int nBytes) -+{ -+ int i = 0; -+ int ok = 1; -+ -+ -+ __u8 * dataBytes = (__u8 *)data; -+ -+ -+ -+ if (!dev->checkpointBuffer) -+ return 0; -+ -+ if (!dev->checkpointOpenForWrite) -+ return -1; -+ -+ while (i < nBytes && ok) { -+ dev->checkpointBuffer[dev->checkpointByteOffset] = *dataBytes; -+ dev->checkpointSum += *dataBytes; -+ dev->checkpointXor ^= *dataBytes; -+ -+ dev->checkpointByteOffset++; -+ i++; -+ dataBytes++; -+ dev->checkpointByteCount++; -+ -+ -+ if (dev->checkpointByteOffset < 0 || -+ dev->checkpointByteOffset >= dev->nDataBytesPerChunk) -+ ok = yaffs_CheckpointFlushBuffer(dev); -+ } -+ -+ return i; -+} -+ -+int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes) -+{ -+ int i = 0; -+ int ok = 1; -+ yaffs_ExtendedTags tags; -+ -+ -+ int chunk; -+ int realignedChunk; -+ -+ __u8 *dataBytes = (__u8 *)data; -+ -+ if (!dev->checkpointBuffer) -+ return 0; -+ -+ if (dev->checkpointOpenForWrite) -+ return -1; -+ -+ while (i < nBytes && ok) { -+ -+ -+ if (dev->checkpointByteOffset < 0 || -+ dev->checkpointByteOffset >= dev->nDataBytesPerChunk) { -+ -+ if (dev->checkpointCurrentBlock < 0) { -+ yaffs_CheckpointFindNextCheckpointBlock(dev); -+ dev->checkpointCurrentChunk = 0; -+ } -+ -+ if (dev->checkpointCurrentBlock < 0) -+ ok = 0; -+ else { -+ chunk = dev->checkpointCurrentBlock * -+ dev->nChunksPerBlock + -+ dev->checkpointCurrentChunk; -+ -+ realignedChunk = chunk - dev->chunkOffset; -+ -+ /* read in the next chunk */ -+ /* printf("read checkpoint page %d\n",dev->checkpointPage); */ -+ dev->readChunkWithTagsFromNAND(dev, -+ realignedChunk, -+ dev->checkpointBuffer, -+ &tags); -+ -+ if (tags.chunkId != (dev->checkpointPageSequence + 1) || -+ tags.eccResult > YAFFS_ECC_RESULT_FIXED || -+ tags.sequenceNumber != YAFFS_SEQUENCE_CHECKPOINT_DATA) -+ ok = 0; -+ -+ dev->checkpointByteOffset = 0; -+ dev->checkpointPageSequence++; -+ dev->checkpointCurrentChunk++; -+ -+ if (dev->checkpointCurrentChunk >= dev->nChunksPerBlock) -+ dev->checkpointCurrentBlock = -1; -+ } -+ } -+ -+ if (ok) { -+ *dataBytes = dev->checkpointBuffer[dev->checkpointByteOffset]; -+ dev->checkpointSum += *dataBytes; -+ dev->checkpointXor ^= *dataBytes; -+ dev->checkpointByteOffset++; -+ i++; -+ dataBytes++; -+ dev->checkpointByteCount++; -+ } -+ } -+ -+ return i; -+} -+ -+int yaffs_CheckpointClose(yaffs_Device *dev) -+{ -+ -+ if (dev->checkpointOpenForWrite) { -+ if (dev->checkpointByteOffset != 0) -+ yaffs_CheckpointFlushBuffer(dev); -+ } else { -+ int i; -+ for (i = 0; i < dev->blocksInCheckpoint && dev->checkpointBlockList[i] >= 0; i++) { -+ yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, dev->checkpointBlockList[i]); -+ if (bi->blockState == YAFFS_BLOCK_STATE_EMPTY) -+ bi->blockState = YAFFS_BLOCK_STATE_CHECKPOINT; -+ else { -+ /* Todo this looks odd... */ -+ } -+ } -+ YFREE(dev->checkpointBlockList); -+ dev->checkpointBlockList = NULL; -+ } -+ -+ dev->nFreeChunks -= dev->blocksInCheckpoint * dev->nChunksPerBlock; -+ dev->nErasedBlocks -= dev->blocksInCheckpoint; -+ -+ -+ T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint byte count %d" TENDSTR), -+ dev->checkpointByteCount)); -+ -+ if (dev->checkpointBuffer) { -+ /* free the buffer */ -+ YFREE(dev->checkpointBuffer); -+ dev->checkpointBuffer = NULL; -+ return 1; -+ } else -+ return 0; -+} -+ -+int yaffs_CheckpointInvalidateStream(yaffs_Device *dev) -+{ -+ /* Erase the first checksum block */ -+ -+ T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint invalidate"TENDSTR))); -+ -+ if (!yaffs_CheckpointSpaceOk(dev)) -+ return 0; -+ -+ return yaffs_CheckpointErase(dev); -+} -+ -+ -+ -diff -Nur linux-2.6.32.orig/fs/yaffs2/yaffs_checkptrw.h linux-2.6.32/fs/yaffs2/yaffs_checkptrw.h ---- linux-2.6.32.orig/fs/yaffs2/yaffs_checkptrw.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.32/fs/yaffs2/yaffs_checkptrw.h 2010-01-30 20:35:01.213084831 +0100 -@@ -0,0 +1,35 @@ -+/* -+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system. -+ * -+ * Copyright (C) 2002-2007 Aleph One Ltd. -+ * for Toby Churchill Ltd and Brightstar Engineering -+ * -+ * Created by Charles Manning <charles@aleph1.co.uk> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License version 2.1 as -+ * published by the Free Software Foundation. -+ * -+ * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. -+ */ -+ -+#ifndef __YAFFS_CHECKPTRW_H__ -+#define __YAFFS_CHECKPTRW_H__ -+ -+#include "yaffs_guts.h" -+ -+int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting); -+ -+int yaffs_CheckpointWrite(yaffs_Device *dev, const void *data, int nBytes); -+ -+int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes); -+ -+int yaffs_GetCheckpointSum(yaffs_Device *dev, __u32 *sum); -+ -+int yaffs_CheckpointClose(yaffs_Device *dev); -+ -+int yaffs_CheckpointInvalidateStream(yaffs_Device *dev); -+ -+ -+#endif -+ -diff -Nur linux-2.6.32.orig/fs/yaffs2/yaffs_ecc.c linux-2.6.32/fs/yaffs2/yaffs_ecc.c ---- linux-2.6.32.orig/fs/yaffs2/yaffs_ecc.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.32/fs/yaffs2/yaffs_ecc.c 2010-01-30 20:35:01.251829837 +0100 -@@ -0,0 +1,326 @@ -+/* -+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system. -+ * -+ * Copyright (C) 2002-2007 Aleph One Ltd. -+ * for Toby Churchill Ltd and Brightstar Engineering -+ * -+ * Created by Charles Manning <charles@aleph1.co.uk> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+/* -+ * This code implements the ECC algorithm used in SmartMedia. -+ * -+ * The ECC comprises 22 bits of parity information and is stuffed into 3 bytes. -+ * The two unused bit are set to 1. -+ * The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC -+ * blocks are used on a 512-byte NAND page. -+ * -+ */ -+ -+/* Table generated by gen-ecc.c -+ * Using a table means we do not have to calculate p1..p4 and p1'..p4' -+ * for each byte of data. These are instead provided in a table in bits7..2. -+ * Bit 0 of each entry indicates whether the entry has an odd or even parity, and therefore -+ * this bytes influence on the line parity. -+ */ -+ -+const char *yaffs_ecc_c_version = -+ "$Id: yaffs_ecc.c,v 1.11 2009-03-06 17:20:50 wookey Exp $"; -+ -+#include "yportenv.h" -+ -+#include "yaffs_ecc.h" -+ -+static const unsigned char column_parity_table[] = { -+ 0x00, 0x55, 0x59, 0x0c, 0x65, 0x30, 0x3c, 0x69, -+ 0x69, 0x3c, 0x30, 0x65, 0x0c, 0x59, 0x55, 0x00, -+ 0x95, 0xc0, 0xcc, 0x99, 0xf0, 0xa5, 0xa9, 0xfc, -+ 0xfc, 0xa9, 0xa5, 0xf0, 0x99, 0xcc, 0xc0, 0x95, -+ 0x99, 0xcc, 0xc0, 0x95, 0xfc, 0xa9, 0xa5, 0xf0, -+ 0xf0, 0xa5, 0xa9, 0xfc, 0x95, 0xc0, 0xcc, 0x99, -+ 0x0c, 0x59, 0x55, 0x00, 0x69, 0x3c, 0x30, 0x65, -+ 0x65, 0x30, 0x3c, 0x69, 0x00, 0x55, 0x59, 0x0c, -+ 0xa5, 0xf0, 0xfc, 0xa9, 0xc0, 0x95, 0x99, 0xcc, -+ 0xcc, 0x99, 0x95, 0xc0, 0xa9, 0xfc, 0xf0, 0xa5, -+ 0x30, 0x65, 0x69, 0x3c, 0x55, 0x00, 0x0c, 0x59, -+ 0x59, 0x0c, 0x00, 0x55, 0x3c, 0x69, 0x65, 0x30, -+ 0x3c, 0x69, 0x65, 0x30, 0x59, 0x0c, 0x00, 0x55, -+ 0x55, 0x00, 0x0c, 0x59, 0x30, 0x65, 0x69, 0x3c, -+ 0xa9, 0xfc, 0xf0, 0xa5, 0xcc, 0x99, 0x95, 0xc0, -+ 0xc0, 0x95, 0x99, 0xcc, 0xa5, 0xf0, 0xfc, 0xa9, -+ 0xa9, 0xfc, 0xf0, 0xa5, 0xcc, 0x99, 0x95, 0xc0, -+ 0xc0, 0x95, 0x99, 0xcc, 0xa5, 0xf0, 0xfc, 0xa9, -+ 0x3c, 0x69, 0x65, 0x30, 0x59, 0x0c, 0x |