summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--target/linux/patches/2.6.36/yaffs2.patch22259
1 files changed, 12050 insertions, 10209 deletions
diff --git a/target/linux/patches/2.6.36/yaffs2.patch b/target/linux/patches/2.6.36/yaffs2.patch
index 5d0d7ba6f..ab8924e0f 100644
--- a/target/linux/patches/2.6.36/yaffs2.patch
+++ b/target/linux/patches/2.6.36/yaffs2.patch
@@ -1,361 +1,26 @@
-diff -Nur linux-2.6.34.orig/fs/Kconfig linux-2.6.34/fs/Kconfig
---- linux-2.6.34.orig/fs/Kconfig 2010-05-16 23:17:36.000000000 +0200
-+++ linux-2.6.34/fs/Kconfig 2010-05-20 20:16:22.261614078 +0200
-@@ -174,6 +174,10 @@
+diff -Nur linux-2.6.36.orig/fs/Kconfig linux-2.6.36/fs/Kconfig
+--- linux-2.6.36.orig/fs/Kconfig 2010-10-20 22:30:22.000000000 +0200
++++ linux-2.6.36/fs/Kconfig 2010-11-18 18:15:51.000000000 +0100
+@@ -174,6 +174,7 @@
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.34.orig/fs/Makefile linux-2.6.34/fs/Makefile
---- linux-2.6.34.orig/fs/Makefile 2010-05-16 23:17:36.000000000 +0200
-+++ linux-2.6.34/fs/Makefile 2010-05-20 20:16:56.351613526 +0200
-@@ -124,5 +124,6 @@
- obj-$(CONFIG_OCFS2_FS) += ocfs2/
- obj-$(CONFIG_BTRFS_FS) += btrfs/
+diff -Nur linux-2.6.36.orig/fs/Makefile linux-2.6.36/fs/Makefile
+--- linux-2.6.36.orig/fs/Makefile 2010-10-20 22:30:22.000000000 +0200
++++ linux-2.6.36/fs/Makefile 2010-11-18 18:15:51.000000000 +0100
+@@ -126,3 +126,4 @@
obj-$(CONFIG_GFS2_FS) += gfs2/
-+obj-$(CONFIG_YAFFS_FS) += yaffs2/
obj-$(CONFIG_EXOFS_FS) += exofs/
obj-$(CONFIG_CEPH_FS) += ceph/
-diff -Nur linux-2.6.34.orig/fs/Makefile.pre.yaffs linux-2.6.34/fs/Makefile.pre.yaffs
---- linux-2.6.34.orig/fs/Makefile.pre.yaffs 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.34/fs/Makefile.pre.yaffs 2010-05-20 20:16:22.271612558 +0200
-@@ -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.34.orig/fs/yaffs2/devextras.h linux-2.6.34/fs/yaffs2/devextras.h
---- linux-2.6.34.orig/fs/yaffs2/devextras.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.34/fs/yaffs2/devextras.h 2010-05-20 20:16:22.271612558 +0200
-@@ -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.34.orig/fs/yaffs2/Kconfig linux-2.6.34/fs/yaffs2/Kconfig
---- linux-2.6.34.orig/fs/yaffs2/Kconfig 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.34/fs/yaffs2/Kconfig 2010-05-20 20:16:22.271612558 +0200
-@@ -0,0 +1,156 @@
++obj-$(CONFIG_YAFFS_FS) += yaffs2/
+diff -Nur linux-2.6.36.orig/fs/yaffs2/Kconfig linux-2.6.36/fs/yaffs2/Kconfig
+--- linux-2.6.36.orig/fs/yaffs2/Kconfig 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.36/fs/yaffs2/Kconfig 2010-11-18 18:15:51.000000000 +0100
+@@ -0,0 +1,161 @@
+#
+# YAFFS file system configurations
+#
@@ -448,39 +113,15 @@ diff -Nur linux-2.6.34.orig/fs/yaffs2/Kconfig linux-2.6.34/fs/yaffs2/Kconfig
+
+ If unsure, say Y.
+
-+config YAFFS_DISABLE_LAZY_LOAD
-+ bool "Disable lazy loading"
-+ depends on YAFFS_YAFFS2
++config YAFFS_DISABLE_TAGS_ECC
++ bool "Disable YAFFS from doing ECC on tags by default"
++ depends on YAFFS_FS && 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.
++ This defaults Yaffs to using its own ECC calculations on tags instead of
++ just relying on the MTD.
++ This behavior can also be overridden with tags_ecc_on and
++ tags_ecc_off mount options.
+
+ If unsure, say N.
+
@@ -502,38 +143,74 @@ diff -Nur linux-2.6.34.orig/fs/yaffs2/Kconfig linux-2.6.34/fs/yaffs2/Kconfig
+
+ If unsure, say Y.
+
-+config YAFFS_SHORT_NAMES_IN_RAM
-+ bool "Cache short names in RAM"
++config YAFFS_EMPTY_LOST_AND_FOUND
++ bool "Empty lost and found on boot"
+ depends on YAFFS_FS
-+ default y
++ default n
+ 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 this is enabled then the contents of lost and found is
++ automatically dumped at mount.
+
-+ If unsure, say Y.
-diff -Nur linux-2.6.34.orig/fs/yaffs2/Makefile linux-2.6.34/fs/yaffs2/Makefile
---- linux-2.6.34.orig/fs/yaffs2/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.34/fs/yaffs2/Makefile 2010-05-20 20:16:22.271612558 +0200
-@@ -0,0 +1,10 @@
++ If unsure, say N.
++
++config YAFFS_DISABLE_BLOCK_REFRESHING
++ bool "Disable yaffs2 block refreshing"
++ depends on YAFFS_FS
++ default n
++ help
++ If this is set, then block refreshing is disabled.
++ Block refreshing infrequently refreshes the oldest block in
++ a yaffs2 file system. This mechanism helps to refresh flash to
++ mitigate against data loss. This is particularly useful for MLC.
++
++ If unsure, say N.
++
++config YAFFS_DISABLE_BACKGROUND
++ bool "Disable yaffs2 background processing"
++ depends on YAFFS_FS
++ default n
++ help
++ If this is set, then background processing is disabled.
++ Background processing makes many foreground activities faster.
++
++ If unsure, say N.
++
++config YAFFS_XATTR
++ bool "Enable yaffs2 xattr support"
++ depends on YAFFS_FS
++ default y
++ help
++ If this is set then yaffs2 will provide xattr support.
++ If unsure, say Y.
+diff -Nur linux-2.6.36.orig/fs/yaffs2/Makefile linux-2.6.36/fs/yaffs2/Makefile
+--- linux-2.6.36.orig/fs/yaffs2/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.36/fs/yaffs2/Makefile 2010-11-18 18:15:51.000000000 +0100
+@@ -0,0 +1,17 @@
+#
+# 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_ecc.o yaffs_vfs.o yaffs_guts.o yaffs_checkptrw.o
++yaffs-y += yaffs_packedtags1.o yaffs_packedtags2.o yaffs_nand.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.34.orig/fs/yaffs2/moduleconfig.h linux-2.6.34/fs/yaffs2/moduleconfig.h
---- linux-2.6.34.orig/fs/yaffs2/moduleconfig.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.34/fs/yaffs2/moduleconfig.h 2010-05-20 20:16:22.281614392 +0200
-@@ -0,0 +1,65 @@
++yaffs-y += yaffs_nameval.o yaffs_attribs.o
++yaffs-y += yaffs_allocator.o
++yaffs-y += yaffs_yaffs1.o
++yaffs-y += yaffs_yaffs2.o
++yaffs-y += yaffs_bitmap.o
++yaffs-y += yaffs_verify.o
++
+diff -Nur linux-2.6.36.orig/fs/yaffs2/moduleconfig.h linux-2.6.36/fs/yaffs2/moduleconfig.h
+--- linux-2.6.36.orig/fs/yaffs2/moduleconfig.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.36/fs/yaffs2/moduleconfig.h 2010-11-18 18:49:02.000000000 +0100
+@@ -0,0 +1,81 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
+ *
-+ * Copyright (C) 2002-2007 Aleph One Ltd.
++ * Copyright (C) 2002-2010 Aleph One Ltd.
+ * for Toby Churchill Ltd and Brightstar Engineering
+ *
+ * Created by Martin Fouts <Martin.Fouts@palmsource.com>
@@ -561,25 +238,41 @@ diff -Nur linux-2.6.34.orig/fs/yaffs2/moduleconfig.h linux-2.6.34/fs/yaffs2/modu
+/* Meaning: Yaffs does its own ECC, rather than using MTD ECC */
+/* #define CONFIG_YAFFS_DOES_ECC */
+
++/* Default: Selected */
++/* Meaning: Yaffs does its own ECC on tags for packed tags rather than use mtd */
++#define CONFIG_YAFFS_DOES_TAGS_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: Not selected */
++/* Meaning: Always test whether chunks are erased before writing to them.
++ Use during mtd debugging and init. */
++/* #define CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED */
+
-+/* Default: Selected */
-+/* Meaning: Cache short names, taking more RAM, but faster look-ups */
-+#define CONFIG_YAFFS_SHORT_NAMES_IN_RAM
++/* Default: Not Selected */
++/* Meaning: At mount automatically empty all files from lost and found. */
++/* This is done to fix an old problem where rmdir was not checking for an */
++/* empty directory. This can also be achieved with a mount option. */
++#define CONFIG_YAFFS_EMPTY_LOST_AND_FOUND
++
++/* Default: Unselected */
++/* Meaning: Select to disable block refreshing. */
++/* Block Refreshing periodically rewrites the oldest block. */
++/* #define CONFIG_DISABLE_BLOCK_REFRESHING */
+
-+/* Default: 10 */
-+/* Meaning: set the count of blocks to reserve for checkpointing */
-+#define CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS 10
++/* Default: Unselected */
++/* Meaning: Select to disable background processing */
++/* #define CONFIG_DISABLE_BACKGROUND */
++
++/* Default: Selected */
++/* Meaning: Enable XATTR support */
++#define CONFIG_YAFFS_XATTR
+
+/*
-+Older-style on-NAND data format has a "pageStatus" byte to record
++Older-style on-NAND data format has a "page_status" 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
@@ -589,20 +282,20 @@ diff -Nur linux-2.6.34.orig/fs/yaffs2/moduleconfig.h linux-2.6.34/fs/yaffs2/modu
+MTD versions in yaffs_mtdif1.c.
+*/
+/* Default: Not selected */
-+/* Meaning: Use older-style on-NAND data format with pageStatus byte */
++/* Meaning: Use older-style on-NAND data format with page_status byte */
+/* #define CONFIG_YAFFS_9BYTE_TAGS */
+
+#endif /* YAFFS_OUT_OF_TREE */
+
+#endif /* __YAFFS_CONFIG_H__ */
-diff -Nur linux-2.6.34.orig/fs/yaffs2/yaffs_checkptrw.c linux-2.6.34/fs/yaffs2/yaffs_checkptrw.c
---- linux-2.6.34.orig/fs/yaffs2/yaffs_checkptrw.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.34/fs/yaffs2/yaffs_checkptrw.c 2010-05-20 20:16:22.281614392 +0200
-@@ -0,0 +1,394 @@
+diff -Nur linux-2.6.36.orig/fs/yaffs2/yaffs_allocator.c linux-2.6.36/fs/yaffs2/yaffs_allocator.c
+--- linux-2.6.36.orig/fs/yaffs2/yaffs_allocator.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.36/fs/yaffs2/yaffs_allocator.c 2010-11-18 18:15:51.000000000 +0100
+@@ -0,0 +1,397 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
+ *
-+ * Copyright (C) 2002-2007 Aleph One Ltd.
++ * Copyright (C) 2002-2010 Aleph One Ltd.
+ * for Toby Churchill Ltd and Brightstar Engineering
+ *
+ * Created by Charles Manning <charles@aleph1.co.uk>
@@ -612,395 +305,1161 @@ diff -Nur linux-2.6.34.orig/fs/yaffs2/yaffs_checkptrw.c linux-2.6.34/fs/yaffs2/y
+ * 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_allocator.h"
++#include "yaffs_guts.h"
++#include "yaffs_trace.h"
++#include "yportenv.h"
++
++#ifdef CONFIG_YAFFS_YMALLOC_ALLOCATOR
++
++void yaffs_deinit_raw_tnodes_and_objs(struct yaffs_dev *dev)
++{
++ dev = dev;
++}
++
++void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev)
++{
++ dev = dev;
++}
++
++struct yaffs_tnode *yaffs_alloc_raw_tnode(struct yaffs_dev *dev)
++{
++ return (struct yaffs_tnode *)YMALLOC(dev->tnode_size);
++}
++
++void yaffs_free_raw_tnode(struct yaffs_dev *dev, struct yaffs_tnode *tn)
++{
++ dev = dev;
++ YFREE(tn);
++}
++
++void yaffs_init_raw_objs(struct yaffs_dev *dev)
++{
++ dev = dev;
++}
++
++void yaffs_deinit_raw_objs(struct yaffs_dev *dev)
++{
++ dev = dev;
++}
++
++struct yaffs_obj *yaffs_alloc_raw_obj(struct yaffs_dev *dev)
++{
++ dev = dev;
++ return (struct yaffs_obj *)YMALLOC(sizeof(struct yaffs_obj));
++}
++
++void yaffs_free_raw_obj(struct yaffs_dev *dev, struct yaffs_obj *obj)
++{
++
++ dev = dev;
++ YFREE(obj);
++}
++
++#else
++
++struct yaffs_tnode_list {
++ struct yaffs_tnode_list *next;
++ struct yaffs_tnode *tnodes;
++};
++
++struct yaffs_obj_list {
++ struct yaffs_obj_list *next;
++ struct yaffs_obj *objects;
++};
++
++struct yaffs_allocator {
++ int n_tnodes_created;
++ struct yaffs_tnode *free_tnodes;
++ int n_free_tnodes;
++ struct yaffs_tnode_list *alloc_tnode_list;
++
++ int n_obj_created;
++ struct yaffs_obj *free_objs;
++ int n_free_objects;
++
++ struct yaffs_obj_list *allocated_obj_list;
++};
++
++static void yaffs_deinit_raw_tnodes(struct yaffs_dev *dev)
++{
++
++ struct yaffs_allocator *allocator =
++ (struct yaffs_allocator *)dev->allocator;
++
++ struct yaffs_tnode_list *tmp;
++
++ if (!allocator) {
++ YBUG();
++ return;
++ }
++
++ while (allocator->alloc_tnode_list) {
++ tmp = allocator->alloc_tnode_list->next;
++
++ YFREE(allocator->alloc_tnode_list->tnodes);
++ YFREE(allocator->alloc_tnode_list);
++ allocator->alloc_tnode_list = tmp;
++
++ }
++
++ allocator->free_tnodes = NULL;
++ allocator->n_free_tnodes = 0;
++ allocator->n_tnodes_created = 0;
++}
++
++static void yaffs_init_raw_tnodes(struct yaffs_dev *dev)
++{
++ struct yaffs_allocator *allocator = dev->allocator;
++
++ if (allocator) {
++ allocator->alloc_tnode_list = NULL;
++ allocator->free_tnodes = NULL;
++ allocator->n_free_tnodes = 0;
++ allocator->n_tnodes_created = 0;
++ } else {
++ YBUG();
++ }
++}
++
++static int yaffs_create_tnodes(struct yaffs_dev *dev, int n_tnodes)
++{
++ struct yaffs_allocator *allocator =
++ (struct yaffs_allocator *)dev->allocator;
++ int i;
++ struct yaffs_tnode *new_tnodes;
++ u8 *mem;
++ struct yaffs_tnode *curr;
++ struct yaffs_tnode *next;
++ struct yaffs_tnode_list *tnl;
++
++ if (!allocator) {
++ YBUG();
++ return YAFFS_FAIL;
++ }
++
++ if (n_tnodes < 1)
++ return YAFFS_OK;
++
++ /* make these things */
++
++ new_tnodes = YMALLOC(n_tnodes * dev->tnode_size);
++ mem = (u8 *) new_tnodes;
++
++ if (!new_tnodes) {
++ T(YAFFS_TRACE_ERROR,
++ (TSTR("yaffs: Could not allocate Tnodes" TENDSTR)));
++ return YAFFS_FAIL;
++ }
++
++ /* New hookup for wide tnodes */
++ for (i = 0; i < n_tnodes - 1; i++) {
++ curr = (struct yaffs_tnode *)&mem[i * dev->tnode_size];
++ next = (struct yaffs_tnode *)&mem[(i + 1) * dev->tnode_size];
++ curr->internal[0] = next;
++ }
++
++ curr = (struct yaffs_tnode *)&mem[(n_tnodes - 1) * dev->tnode_size];
++ curr->internal[0] = allocator->free_tnodes;
++ allocator->free_tnodes = (struct yaffs_tnode *)mem;
++
++ allocator->n_free_tnodes += n_tnodes;
++ allocator->n_tnodes_created += n_tnodes;
++
++ /* Now add this bunch of tnodes to a list for freeing up.
++ * NB If we can't add this to the management list it isn't fatal
++ * but it just means we can't free this bunch of tnodes later.
++ */
++
++ tnl = YMALLOC(sizeof(struct yaffs_tnode_list));
++ if (!tnl) {
++ T(YAFFS_TRACE_ERROR,
++ (TSTR
++ ("yaffs: Could not add tnodes to management list" TENDSTR)));
++ return YAFFS_FAIL;
++ } else {
++ tnl->tnodes = new_tnodes;
++ tnl->next = allocator->alloc_tnode_list;
++ allocator->alloc_tnode_list = tnl;
++ }
++
++ T(YAFFS_TRACE_ALLOCATE, (TSTR("yaffs: Tnodes added" TENDSTR)));
++
++ return YAFFS_OK;
++}
++
++struct yaffs_tnode *yaffs_alloc_raw_tnode(struct yaffs_dev *dev)
++{
++ struct yaffs_allocator *allocator =
++ (struct yaffs_allocator *)dev->allocator;
++ struct yaffs_tnode *tn = NULL;
++
++ if (!allocator) {
++ YBUG();
++ return NULL;
++ }
++
++ /* If there are none left make more */
++ if (!allocator->free_tnodes)
++ yaffs_create_tnodes(dev, YAFFS_ALLOCATION_NTNODES);
++
++ if (allocator->free_tnodes) {
++ tn = allocator->free_tnodes;
++ allocator->free_tnodes = allocator->free_tnodes->internal[0];
++ allocator->n_free_tnodes--;
++ }
++
++ return tn;
++}
++
++/* FreeTnode frees up a tnode and puts it back on the free list */
++void yaffs_free_raw_tnode(struct yaffs_dev *dev, struct yaffs_tnode *tn)
++{
++ struct yaffs_allocator *allocator = dev->allocator;
++
++ if (!allocator) {
++ YBUG();
++ return;
++ }
++
++ if (tn) {
++ tn->internal[0] = allocator->free_tnodes;
++ allocator->free_tnodes = tn;
++ allocator->n_free_tnodes++;
++ }
++ dev->checkpoint_blocks_required = 0; /* force recalculation */
++}
++
++static void yaffs_init_raw_objs(struct yaffs_dev *dev)
++{
++ struct yaffs_allocator *allocator = dev->allocator;
++
++ if (allocator) {
++ allocator->allocated_obj_list = NULL;
++ allocator->free_objs = NULL;
++ allocator->n_free_objects = 0;
++ } else {
++ YBUG();
++ }
++}
++
++static void yaffs_deinit_raw_objs(struct yaffs_dev *dev)
++{
++ struct yaffs_allocator *allocator = dev->allocator;
++ struct yaffs_obj_list *tmp;
++
++ if (!allocator) {
++ YBUG();
++ return;
++ }
++
++ while (allocator->allocated_obj_list) {
++ tmp = allocator->allocated_obj_list->next;
++ YFREE(allocator->allocated_obj_list->objects);
++ YFREE(allocator->allocated_obj_list);
++
++ allocator->allocated_obj_list = tmp;
++ }
++
++ allocator->free_objs = NULL;
++ allocator->n_free_objects = 0;
++ allocator->n_obj_created = 0;
++}
++
++static int yaffs_create_free_objs(struct yaffs_dev *dev, int n_obj)
++{
++ struct yaffs_allocator *allocator = dev->allocator;
++
++ int i;
++ struct yaffs_obj *new_objs;
++ struct yaffs_obj_list *list;
++
++ if (!allocator) {
++ YBUG();
++ return YAFFS_FAIL;
++ }
++
++ if (n_obj < 1)
++ return YAFFS_OK;
++
++ /* make these things */
++ new_objs = YMALLOC(n_obj * sizeof(struct yaffs_obj));
++ list = YMALLOC(sizeof(struct yaffs_obj_list));
++
++ if (!new_objs || !list) {
++ if (new_objs) {
++ YFREE(new_objs);
++ new_objs = NULL;
++ }
++ if (list) {
++ YFREE(list);
++ list = NULL;
++ }
++ T(YAFFS_TRACE_ALLOCATE,
++ (TSTR("yaffs: Could not allocate more objects" TENDSTR)));
++ return YAFFS_FAIL;
++ }
++
++ /* Hook them into the free list */
++ for (i = 0; i < n_obj - 1; i++) {
++ new_objs[i].siblings.next =
++ (struct list_head *)(&new_objs[i + 1]);
++ }
++
++ new_objs[n_obj - 1].siblings.next = (void *)allocator->free_objs;
++ allocator->free_objs = new_objs;
++ allocator->n_free_objects += n_obj;
++ allocator->n_obj_created += n_obj;
++
++ /* Now add this bunch of Objects to a list for freeing up. */
++
++ list->objects = new_objs;
++ list->next = allocator->allocated_obj_list;
++ allocator->allocated_obj_list = list;
++
++ return YAFFS_OK;
++}
++
++struct yaffs_obj *yaffs_alloc_raw_obj(struct yaffs_dev *dev)
++{
++ struct yaffs_obj *obj = NULL;
++ struct yaffs_allocator *allocator = dev->allocator;
++
++ if (!allocator) {
++ YBUG();
++ return obj;
++ }
++
++ /* If there are none left make more */
++ if (!allocator->free_objs)
++ yaffs_create_free_objs(dev, YAFFS_ALLOCATION_NOBJECTS);
++
++ if (allocator->free_objs) {
++ obj = allocator->free_objs;
++ allocator->free_objs =
++ (struct yaffs_obj *)(allocator->free_objs->siblings.next);
++ allocator->n_free_objects--;
++ }
++
++ return obj;
++}
++
++void yaffs_free_raw_obj(struct yaffs_dev *dev, struct yaffs_obj *obj)
++{
++
++ struct yaffs_allocator *allocator = dev->allocator;
++
++ if (!allocator)
++ YBUG();
++ else {
++ /* Link into the free list. */
++ obj->siblings.next = (struct list_head *)(allocator->free_objs);
++ allocator->free_objs = obj;
++ allocator->n_free_objects++;
++ }
++}
++
++void yaffs_deinit_raw_tnodes_and_objs(struct yaffs_dev *dev)
++{
++ if (dev->allocator) {
++ yaffs_deinit_raw_tnodes(dev);
++ yaffs_deinit_raw_objs(dev);
++
++ YFREE(dev->allocator);
++ dev->allocator = NULL;
++ } else {
++ YBUG();
++ }
++}
++
++void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev)
++{
++ struct yaffs_allocator *allocator;
++
++ if (!dev->allocator) {
++ allocator = YMALLOC(sizeof(struct yaffs_allocator));
++ if (allocator) {
++ dev->allocator = allocator;
++ yaffs_init_raw_tnodes(dev);
++ yaffs_init_raw_objs(dev);
++ }
++ } else {
++ YBUG();
++ }
++}
++
++#endif
+diff -Nur linux-2.6.36.orig/fs/yaffs2/yaffs_allocator.h linux-2.6.36/fs/yaffs2/yaffs_allocator.h
+--- linux-2.6.36.orig/fs/yaffs2/yaffs_allocator.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.36/fs/yaffs2/yaffs_allocator.h 2010-11-18 18:15:51.000000000 +0100
+@@ -0,0 +1,30 @@
++/*
++ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
++ *
++ * Copyright (C) 2002-2010 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_ALLOCATOR_H__
++#define __YAFFS_ALLOCATOR_H__
++
++#include "yaffs_guts.h"
++
++void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev);
++void yaffs_deinit_raw_tnodes_and_objs(struct yaffs_dev *dev);
++
++struct yaffs_tnode *yaffs_alloc_raw_tnode(struct yaffs_dev *dev);
++void yaffs_free_raw_tnode(struct yaffs_dev *dev, struct yaffs_tnode *tn);
++
++struct yaffs_obj *yaffs_alloc_raw_obj(struct yaffs_dev *dev);
++void yaffs_free_raw_obj(struct yaffs_dev *dev, struct yaffs_obj *obj);
++
++#endif
+diff -Nur linux-2.6.36.orig/fs/yaffs2/yaffs_attribs.c linux-2.6.36/fs/yaffs2/yaffs_attribs.c
+--- linux-2.6.36.orig/fs/yaffs2/yaffs_attribs.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.36/fs/yaffs2/yaffs_attribs.c 2010-11-18 18:15:51.000000000 +0100
+@@ -0,0 +1,124 @@
++/*
++ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
++ *
++ * Copyright (C) 2002-2010 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.
++ */
++
++#include "yaffs_guts.h"
++#include "yaffs_attribs.h"
++
++void yaffs_load_attribs(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh)
++{
++ obj->yst_uid = oh->yst_uid;
++ obj->yst_gid = oh->yst_gid;
++ obj->yst_atime = oh->yst_atime;
++ obj->yst_mtime = oh->yst_mtime;
++ obj->yst_ctime = oh->yst_ctime;
++ obj->yst_rdev = oh->yst_rdev;
++}
++
++void yaffs_load_attribs_oh(struct yaffs_obj_hdr *oh, struct yaffs_obj *obj)
++{
++ oh->yst_uid = obj->yst_uid;
++ oh->yst_gid = obj->yst_gid;
++ oh->yst_atime = obj->yst_atime;
++ oh->yst_mtime = obj->yst_mtime;
++ oh->yst_ctime = obj->yst_ctime;
++ oh->yst_rdev = obj->yst_rdev;
++
++}
++
++void yaffs_load_current_time(struct yaffs_obj *obj, int do_a, int do_c)
++{
++ obj->yst_mtime = Y_CURRENT_TIME;
++ if (do_a)
++ obj->yst_atime = obj->yst_atime;
++ if (do_c)
++ obj->yst_ctime = obj->yst_atime;
++}
++
++void yaffs_attribs_init(struct yaffs_obj *obj, u32 gid, u32 uid, u32 rdev)
++{
++ yaffs_load_current_time(obj, 1, 1);
++ obj->yst_rdev = rdev;
++ obj->yst_uid = uid;
++ obj->yst_gid = gid;
++}
++
++loff_t yaffs_get_file_size(struct yaffs_obj *obj)
++{
++ YCHAR *alias = NULL;
++ obj = yaffs_get_equivalent_obj(obj);
++
++ switch (obj->variant_type) {
++ case YAFFS_OBJECT_TYPE_FILE:
++ return obj->variant.file_variant.file_size;
++ case YAFFS_OBJECT_TYPE_SYMLINK:
++ alias = obj->variant.symlink_variant.alias;
++ if (!alias)
++ return 0;
++ return yaffs_strnlen(alias, YAFFS_MAX_ALIAS_LENGTH);
++ default:
++ return 0;
++ }
++}
++
++int yaffs_set_attribs(struct yaffs_obj *obj, struct iattr *attr)
++{
++ unsigned int valid = attr->ia_valid;
++
++ if (valid & ATTR_MODE)
++ obj->yst_mode = attr->ia_mode;
++ if (valid & ATTR_UID)
++ obj->yst_uid = attr->ia_uid;
++ if (valid & ATTR_GID)
++ obj->yst_gid = attr->ia_gid;
++
++ if (valid & ATTR_ATIME)
++ obj->yst_atime = Y_TIME_CONVERT(attr->ia_atime);
++ if (valid & ATTR_CTIME)
++ obj->yst_ctime = Y_TIME_CONVERT(attr->ia_ctime);
++ if (valid & ATTR_MTIME)
++ obj->yst_mtime = Y_TIME_CONVERT(attr->ia_mtime);
++
++ if (valid & ATTR_SIZE)
++ yaffs_resize_file(obj, attr->ia_size);
++
++ yaffs_update_oh(obj, NULL, 1, 0, 0, NULL);
++
++ return YAFFS_OK;
++
++}
++
++int yaffs_get_attribs(struct yaffs_obj *obj, struct iattr *attr)
++{
++ unsigned int valid = 0;
++
++ attr->ia_mode = obj->yst_mode;
++ valid |= ATTR_MODE;
++ attr->ia_uid = obj->yst_uid;
++ valid |= ATTR_UID;
++ attr->ia_gid = obj->yst_gid;
++ valid |= ATTR_GID;
++
++ Y_TIME_CONVERT(attr->ia_atime) = obj->yst_atime;
++ valid |= ATTR_ATIME;
++ Y_TIME_CONVERT(attr->ia_ctime) = obj->yst_ctime;
++ valid |= ATTR_CTIME;
++ Y_TIME_CONVERT(attr->ia_mtime) = obj->yst_mtime;
++ valid |= ATTR_MTIME;
++
++ attr->ia_size = yaffs_get_file_size(obj);
++ valid |= ATTR_SIZE;
++
++ attr->ia_valid = valid;
++
++ return YAFFS_OK;
++}
+diff -Nur linux-2.6.36.orig/fs/yaffs2/yaffs_attribs.h linux-2.6.36/fs/yaffs2/yaffs_attribs.h
+--- linux-2.6.36.orig/fs/yaffs2/yaffs_attribs.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.36/fs/yaffs2/yaffs_attribs.h 2010-11-18 18:15:51.000000000 +0100
+@@ -0,0 +1,28 @@
++/*
++ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
++ *
++ * Copyright (C) 2002-2010