summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--target/linux/patches/3.18.14/yaffs2.patch972
1 files changed, 490 insertions, 482 deletions
diff --git a/target/linux/patches/3.18.14/yaffs2.patch b/target/linux/patches/3.18.14/yaffs2.patch
index bb244c7ca..2ade5bf7e 100644
--- a/target/linux/patches/3.18.14/yaffs2.patch
+++ b/target/linux/patches/3.18.14/yaffs2.patch
@@ -1,7 +1,7 @@
-diff -Nur linux-3.15-rc5.orig/fs/Kconfig linux-3.15-rc5/fs/Kconfig
---- linux-3.15-rc5.orig/fs/Kconfig 2014-05-09 22:10:52.000000000 +0200
-+++ linux-3.15-rc5/fs/Kconfig 2014-05-17 01:53:17.000000000 +0200
-@@ -190,6 +190,7 @@
+diff -Nur linux-3.18.14.orig/fs/Kconfig linux-3.18.14/fs/Kconfig
+--- linux-3.18.14.orig/fs/Kconfig 2015-05-20 17:04:50.000000000 +0200
++++ linux-3.18.14/fs/Kconfig 2015-06-14 21:22:55.000000000 +0200
+@@ -191,6 +191,7 @@
source "fs/befs/Kconfig"
source "fs/bfs/Kconfig"
source "fs/efs/Kconfig"
@@ -9,17 +9,17 @@ diff -Nur linux-3.15-rc5.orig/fs/Kconfig linux-3.15-rc5/fs/Kconfig
source "fs/jffs2/Kconfig"
# UBIFS File system configuration
source "fs/ubifs/Kconfig"
-diff -Nur linux-3.15-rc5.orig/fs/Makefile linux-3.15-rc5/fs/Makefile
---- linux-3.15-rc5.orig/fs/Makefile 2014-05-09 22:10:52.000000000 +0200
-+++ linux-3.15-rc5/fs/Makefile 2014-05-17 01:53:25.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/Makefile linux-3.18.14/fs/Makefile
+--- linux-3.18.14.orig/fs/Makefile 2015-05-20 17:04:50.000000000 +0200
++++ linux-3.18.14/fs/Makefile 2015-06-14 21:22:55.000000000 +0200
@@ -126,3 +126,4 @@
obj-$(CONFIG_CEPH_FS) += ceph/
obj-$(CONFIG_PSTORE) += pstore/
obj-$(CONFIG_EFIVAR_FS) += efivarfs/
+obj-$(CONFIG_YAFFS_FS) += yaffs2/
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/Kconfig linux-3.15-rc5/fs/yaffs2/Kconfig
---- linux-3.15-rc5.orig/fs/yaffs2/Kconfig 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/Kconfig 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/Kconfig linux-3.18.14/fs/yaffs2/Kconfig
+--- linux-3.18.14.orig/fs/yaffs2/Kconfig 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/Kconfig 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,171 @@
+#
+# yaffs file system configurations
@@ -192,9 +192,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/Kconfig linux-3.15-rc5/fs/yaffs2/Kconfig
+ help
+ If this is set then yaffs2 will provide xattr support.
+ If unsure, say Y.
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/Makefile linux-3.15-rc5/fs/yaffs2/Makefile
---- linux-3.15-rc5.orig/fs/yaffs2/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/Makefile 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/Makefile linux-3.18.14/fs/yaffs2/Makefile
+--- linux-3.18.14.orig/fs/yaffs2/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/Makefile 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,18 @@
+#
+# Makefile for the linux YAFFS filesystem routines.
@@ -214,9 +214,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/Makefile linux-3.15-rc5/fs/yaffs2/Makefi
+yaffs-y += yaffs_summary.o
+yaffs-y += yaffs_verify.o
+
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_allocator.c linux-3.15-rc5/fs/yaffs2/yaffs_allocator.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_allocator.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_allocator.c 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_allocator.c linux-3.18.14/fs/yaffs2/yaffs_allocator.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_allocator.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_allocator.c 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,357 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
@@ -575,9 +575,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_allocator.c linux-3.15-rc5/fs/yaff
+ }
+}
+
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_allocator.h linux-3.15-rc5/fs/yaffs2/yaffs_allocator.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_allocator.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_allocator.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_allocator.h linux-3.18.14/fs/yaffs2/yaffs_allocator.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_allocator.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_allocator.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,30 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -609,10 +609,10 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_allocator.h linux-3.15-rc5/fs/yaff
+void yaffs_free_raw_obj(struct yaffs_dev *dev, struct yaffs_obj *obj);
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_attribs.c linux-3.15-rc5/fs/yaffs2/yaffs_attribs.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_attribs.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_attribs.c 2014-05-17 01:53:27.000000000 +0200
-@@ -0,0 +1,166 @@
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_attribs.c linux-3.18.14/fs/yaffs2/yaffs_attribs.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_attribs.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_attribs.c 2015-06-14 21:23:22.000000000 +0200
+@@ -0,0 +1,132 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
+ *
@@ -629,46 +629,12 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_attribs.c linux-3.15-rc5/fs/yaffs2
+#include "yaffs_guts.h"
+#include "yaffs_attribs.h"
+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0))
-+static inline uid_t ia_uid_read(const struct iattr *iattr)
-+{
-+ return from_kuid(&init_user_ns, iattr->ia_uid);
-+}
-+
-+static inline gid_t ia_gid_read(const struct iattr *iattr)
-+{
-+ return from_kgid(&init_user_ns, iattr->ia_gid);
-+}
-+
-+static inline void ia_uid_write(struct iattr *iattr, uid_t uid)
-+{
-+ iattr->ia_uid = make_kuid(&init_user_ns, uid);
-+}
-+
-+static inline void ia_gid_write(struct iattr *iattr, gid_t gid)
-+{
-+ iattr->ia_gid = make_kgid(&init_user_ns, gid);
-+}
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
++#define IATTR_UID ia_uid
++#define IATTR_GID ia_gid
+#else
-+static inline uid_t ia_uid_read(const struct iattr *iattr)
-+{
-+ return iattr->ia_uid;
-+}
-+
-+static inline gid_t ia_gid_read(const struct iattr *inode)
-+{
-+ return iattr->ia_gid;
-+}
-+
-+static inline void ia_uid_write(struct iattr *iattr, uid_t uid)
-+{
-+ iattr->ia_uid = uid;
-+}
-+
-+static inline void ia_gid_write(struct iattr *iattr, gid_t gid)
-+{
-+ iattr->ia_gid = gid;
-+}
++#define IATTR_UID ia_uid.val
++#define IATTR_GID ia_gid.val
+#endif
+
+void yaffs_load_attribs(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh)
@@ -734,9 +700,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_attribs.c linux-3.15-rc5/fs/yaffs2
+ if (valid & ATTR_MODE)
+ obj->yst_mode = attr->ia_mode;
+ if (valid & ATTR_UID)
-+ obj->yst_uid = ia_uid_read(attr);
++ obj->yst_uid = attr->IATTR_UID;
+ if (valid & ATTR_GID)
-+ obj->yst_gid = ia_gid_read(attr);
++ obj->yst_gid = attr->IATTR_GID;
+
+ if (valid & ATTR_ATIME)
+ obj->yst_atime = Y_TIME_CONVERT(attr->ia_atime);
@@ -760,9 +726,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_attribs.c linux-3.15-rc5/fs/yaffs2
+
+ attr->ia_mode = obj->yst_mode;
+ valid |= ATTR_MODE;
-+ ia_uid_write(attr, obj->yst_uid);
++ attr->IATTR_UID = obj->yst_uid;
+ valid |= ATTR_UID;
-+ ia_gid_write(attr, obj->yst_gid);
++ attr->IATTR_GID = obj->yst_gid;
+ valid |= ATTR_GID;
+
+ Y_TIME_CONVERT(attr->ia_atime) = obj->yst_atime;
@@ -779,9 +745,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_attribs.c linux-3.15-rc5/fs/yaffs2
+
+ return YAFFS_OK;
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_attribs.h linux-3.15-rc5/fs/yaffs2/yaffs_attribs.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_attribs.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_attribs.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_attribs.h linux-3.18.14/fs/yaffs2/yaffs_attribs.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_attribs.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_attribs.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,28 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -811,9 +777,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_attribs.h linux-3.15-rc5/fs/yaffs2
+int yaffs_get_attribs(struct yaffs_obj *obj, struct iattr *attr);
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_bitmap.c linux-3.15-rc5/fs/yaffs2/yaffs_bitmap.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_bitmap.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_bitmap.c 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_bitmap.c linux-3.18.14/fs/yaffs2/yaffs_bitmap.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_bitmap.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_bitmap.c 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,97 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
@@ -912,9 +878,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_bitmap.c linux-3.15-rc5/fs/yaffs2/
+
+ return n;
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_bitmap.h linux-3.15-rc5/fs/yaffs2/yaffs_bitmap.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_bitmap.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_bitmap.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_bitmap.h linux-3.18.14/fs/yaffs2/yaffs_bitmap.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_bitmap.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_bitmap.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,33 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -949,10 +915,10 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_bitmap.h linux-3.15-rc5/fs/yaffs2/
+int yaffs_count_chunk_bits(struct yaffs_dev *dev, int blk);
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.c linux-3.15-rc5/fs/yaffs2/yaffs_checkptrw.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_checkptrw.c 2014-05-17 01:53:27.000000000 +0200
-@@ -0,0 +1,474 @@
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_checkptrw.c linux-3.18.14/fs/yaffs2/yaffs_checkptrw.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_checkptrw.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_checkptrw.c 2015-06-14 21:23:22.000000000 +0200
+@@ -0,0 +1,466 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
+ *
@@ -1192,8 +1158,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.c linux-3.15-rc5/fs/yaff
+ dev->blocks_in_checkpt = 0;
+ dev->checkpt_max_blocks =
+ (dev->internal_end_block - dev->internal_start_block) / 16 + 2;
-+ dev->checkpt_block_list =
-+ kmalloc(sizeof(int) * dev->checkpt_max_blocks, GFP_NOFS);
++ if (!dev->checkpt_block_list)
++ dev->checkpt_block_list =
++ kmalloc(sizeof(int) * dev->checkpt_max_blocks, GFP_NOFS);
+
+ if (!dev->checkpt_block_list)
+ return 0;
@@ -1303,7 +1270,6 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.c linux-3.15-rc5/fs/yaff
+int yaffs2_checkpt_rd(struct yaffs_dev *dev, void *data, int n_bytes)
+{
+ int i = 0;
-+ int ok = 1;
+ struct yaffs_ext_tags tags;
+ int chunk;
+ int offset_chunk;
@@ -1315,7 +1281,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.c linux-3.15-rc5/fs/yaff
+ if (dev->checkpt_open_write)
+ return -1;
+
-+ while (i < n_bytes && ok) {
++ while (i < n_bytes) {
+
+ if (dev->checkpt_byte_offs < 0 ||
+ dev->checkpt_byte_offs >= dev->data_bytes_per_chunk) {
@@ -1325,10 +1291,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.c linux-3.15-rc5/fs/yaff
+ dev->checkpt_cur_chunk = 0;
+ }
+
-+ if (dev->checkpt_cur_block < 0) {
-+ ok = 0;
++ /* Bail out if we can't find a checpoint block */
++ if (dev->checkpt_cur_block < 0)
+ break;
-+ }
+
+ chunk = dev->checkpt_cur_block *
+ dev->param.chunks_per_block +
@@ -1337,22 +1302,21 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.c linux-3.15-rc5/fs/yaff
+ offset_chunk = apply_chunk_offset(dev, chunk);
+ dev->n_page_reads++;
+
-+ /* read in the next chunk */
++ /* Read in the next chunk */
+ dev->tagger.read_chunk_tags_fn(dev,
+ offset_chunk,
+ dev->checkpt_buffer,
+ &tags);
+
++ /* Bail out if the chunk is corrupted. */
+ if (tags.chunk_id != (dev->checkpt_page_seq + 1) ||
+ tags.ecc_result > YAFFS_ECC_RESULT_FIXED ||
-+ tags.seq_number != YAFFS_SEQUENCE_CHECKPOINT_DATA) {
-+ ok = 0;
++ tags.seq_number != YAFFS_SEQUENCE_CHECKPOINT_DATA)
+ break;
-+ }
-+ if(!yaffs2_checkpt_check_chunk_hdr(dev)) {
-+ ok = 0;
++
++ /* Bail out if it is not a checkpoint chunk. */
++ if(!yaffs2_checkpt_check_chunk_hdr(dev))
+ break;
-+ }
+
+ dev->checkpt_page_seq++;
+ dev->checkpt_cur_chunk++;
@@ -1372,7 +1336,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.c linux-3.15-rc5/fs/yaff
+ dev->checkpt_byte_count++;
+ }
+
-+ return i;
++ return i; /* Number of bytes read */
+}
+
+int yaffs_checkpt_close(struct yaffs_dev *dev)
@@ -1396,8 +1360,6 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.c linux-3.15-rc5/fs/yaff
+ if (bi && bi->block_state == YAFFS_BLOCK_STATE_EMPTY)
+ bi->block_state = YAFFS_BLOCK_STATE_CHECKPOINT;
+ }
-+ kfree(dev->checkpt_block_list);
-+ dev->checkpt_block_list = NULL;
+ }
+
+ dev->n_free_chunks -=
@@ -1407,14 +1369,10 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.c linux-3.15-rc5/fs/yaff
+ yaffs_trace(YAFFS_TRACE_CHECKPOINT, "checkpoint byte count %d",
+ dev->checkpt_byte_count);
+
-+ if (dev->checkpt_buffer) {
-+ /* free the buffer */
-+ kfree(dev->checkpt_buffer);
-+ dev->checkpt_buffer = NULL;
++ if (dev->checkpt_buffer)
+ return 1;
-+ } else {
++ else
+ return 0;
-+ }
+}
+
+int yaffs2_checkpt_invalidate_stream(struct yaffs_dev *dev)
@@ -1427,9 +1385,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.c linux-3.15-rc5/fs/yaff
+
+ return yaffs_checkpt_erase(dev);
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.h linux-3.15-rc5/fs/yaffs2/yaffs_checkptrw.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_checkptrw.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_checkptrw.h linux-3.18.14/fs/yaffs2/yaffs_checkptrw.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_checkptrw.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_checkptrw.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,33 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -1464,9 +1422,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_checkptrw.h linux-3.15-rc5/fs/yaff
+int yaffs2_checkpt_invalidate_stream(struct yaffs_dev *dev);
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_ecc.c linux-3.15-rc5/fs/yaffs2/yaffs_ecc.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_ecc.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_ecc.c 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_ecc.c linux-3.18.14/fs/yaffs2/yaffs_ecc.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_ecc.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_ecc.c 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,281 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
@@ -1749,9 +1707,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_ecc.c linux-3.15-rc5/fs/yaffs2/yaf
+
+ return -1;
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_ecc.h linux-3.15-rc5/fs/yaffs2/yaffs_ecc.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_ecc.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_ecc.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_ecc.h linux-3.18.14/fs/yaffs2/yaffs_ecc.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_ecc.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_ecc.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,44 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -1797,9 +1755,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_ecc.h linux-3.15-rc5/fs/yaffs2/yaf
+ struct yaffs_ecc_other *read_ecc,
+ const struct yaffs_ecc_other *test_ecc);
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_getblockinfo.h linux-3.15-rc5/fs/yaffs2/yaffs_getblockinfo.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_getblockinfo.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_getblockinfo.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_getblockinfo.h linux-3.18.14/fs/yaffs2/yaffs_getblockinfo.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_getblockinfo.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_getblockinfo.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,35 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -1836,10 +1794,10 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_getblockinfo.h linux-3.15-rc5/fs/y
+}
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.c linux-3.15-rc5/fs/yaffs2/yaffs_guts.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_guts.c 2014-05-17 01:53:27.000000000 +0200
-@@ -0,0 +1,5146 @@
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_guts.c linux-3.18.14/fs/yaffs2/yaffs_guts.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_guts.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_guts.c 2015-06-14 21:23:22.000000000 +0200
+@@ -0,0 +1,5140 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
+ *
@@ -2473,6 +2431,78 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.c linux-3.15-rc5/fs/yaffs2/ya
+
+/*---------------- Name handling functions ------------*/
+
++static void yaffs_load_name_from_oh(struct yaffs_dev *dev, YCHAR *name,
++ const YCHAR *oh_name, int buff_size)
++{
++#ifdef CONFIG_YAFFS_AUTO_UNICODE
++ if (dev->param.auto_unicode) {
++ if (*oh_name) {
++ /* It is an ASCII name, do an ASCII to
++ * unicode conversion */
++ const char *ascii_oh_name = (const char *)oh_name;
++ int n = buff_size - 1;
++ while (n > 0 && *ascii_oh_name) {
++ *name = *ascii_oh_name;
++ name++;
++ ascii_oh_name++;
++ n--;
++ }
++ } else {
++ strncpy(name, oh_name + 1, buff_size - 1);
++ }
++ } else {
++#else
++ (void) dev;
++ {
++#endif
++ strncpy(name, oh_name, buff_size - 1);
++ }
++}
++
++static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR *oh_name,
++ const YCHAR *name)
++{
++#ifdef CONFIG_YAFFS_AUTO_UNICODE
++
++ int is_ascii;
++ const YCHAR *w;
++
++ if (dev->param.auto_unicode) {
++
++ is_ascii = 1;
++ w = name;
++
++ /* Figure out if the name will fit in ascii character set */
++ while (is_ascii && *w) {
++ if ((*w) & 0xff00)
++ is_ascii = 0;
++ w++;
++ }
++
++ if (is_ascii) {
++ /* It is an ASCII name, so convert unicode to ascii */
++ char *ascii_oh_name = (char *)oh_name;
++ int n = YAFFS_MAX_NAME_LENGTH - 1;
++ while (n > 0 && *name) {
++ *ascii_oh_name = *name;
++ name++;
++ ascii_oh_name++;
++ n--;
++ }
++ } else {
++ /* Unicode name, so save starting at the second YCHAR */
++ *oh_name = 0;
++ strncpy(oh_name + 1, name, YAFFS_MAX_NAME_LENGTH - 2);
++ }
++ } else {
++#else
++ dev = dev;
++ {
++#endif
++ strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
++ }
++}
++
+static u16 yaffs_calc_name_sum(const YCHAR *name)
+{
+ u16 sum = 0;
@@ -3219,56 +3249,49 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.c linux-3.15-rc5/fs/yaffs2/ya
+ return 0;
+}
+
-+static void yaffs_flush_file_cache(struct yaffs_obj *obj)
++static void yaffs_flush_single_cache(struct yaffs_cache *cache, int discard)
++{
++
++ if (!cache || cache->locked)
++ return;
++
++ /* Write it out and free it up if need be.*/
++ if (cache->dirty) {
++ yaffs_wr_data_obj(cache->object,
++ cache->chunk_id,
++ cache->data,
++ cache->n_bytes,
++ 1);
++
++ cache->dirty = 0;
++ }
++
++ if (discard)
++ cache->object = NULL;
++}
++
++static void yaffs_flush_file_cache(struct yaffs_obj *obj, int discard)
+{
+ struct yaffs_dev *dev = obj->my_dev;
-+ int lowest = -99; /* Stop compiler whining. */
+ int i;
+ struct yaffs_cache *cache;
-+ int chunk_written = 0;
+ int n_caches = obj->my_dev->param.n_caches;
+
+ if (n_caches < 1)
+ return;
-+ do {
-+ cache = NULL;
-+
-+ /* Find the lowest dirty chunk for this object */
-+ for (i = 0; i < n_caches; i++) {
-+ if (dev->cache[i].object == obj &&
-+ dev->cache[i].dirty) {
-+ if (!cache ||
-+ dev->cache[i].chunk_id < lowest) {
-+ cache = &dev->cache[i];
-+ lowest = cache->chunk_id;
-+ }
-+ }
-+ }
+
-+ if (cache && !cache->locked) {
-+ /* Write it out and free it up */
-+ chunk_written =
-+ yaffs_wr_data_obj(cache->object,
-+ cache->chunk_id,
-+ cache->data,
-+ cache->n_bytes, 1);
-+ cache->dirty = 0;
-+ cache->object = NULL;
-+ }
-+ } while (cache && chunk_written > 0);
+
-+ if (cache)
-+ /* Hoosterman, disk full while writing cache out. */
-+ yaffs_trace(YAFFS_TRACE_ERROR,
-+ "yaffs tragedy: no space during cache write");
++ /* Find the chunks for this object and flush them. */
++ for (i = 0; i < n_caches; i++) {
++ cache = &dev->cache[i];
++ if (cache->object == obj)
++ yaffs_flush_single_cache(cache, discard);
++ }
++
+}
+
-+/*yaffs_flush_whole_cache(dev)
-+ *
-+ *
-+ */
+
-+void yaffs_flush_whole_cache(struct yaffs_dev *dev)
++void yaffs_flush_whole_cache(struct yaffs_dev *dev, int discard)
+{
+ struct yaffs_obj *obj;
+ int n_caches = dev->param.n_caches;
@@ -3284,12 +3307,12 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.c linux-3.15-rc5/fs/yaffs2/ya
+ obj = dev->cache[i].object;
+ }
+ if (obj)
-+ yaffs_flush_file_cache(obj);
++ yaffs_flush_file_cache(obj, discard);
+ } while (obj);
+
+}
+
-+/* Grab us a cache chunk for use.
++/* Grab us an unused cache chunk for use.
+ * First look for an empty one.
+ * Then look for the least recently used non-dirty one.
+ * Then look for the least recently used dirty one...., flush and look again.
@@ -3304,56 +3327,50 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.c linux-3.15-rc5/fs/yaffs2/ya
+ return &dev->cache[i];
+ }
+ }
++
+ return NULL;
+}
+
+static struct yaffs_cache *yaffs_grab_chunk_cache(struct yaffs_dev *dev)
+{
+ struct yaffs_cache *cache;
-+ struct yaffs_obj *the_obj;
+ int usage;
+ int i;
-+ int pushout;
+
+ if (dev->param.n_caches < 1)
+ return NULL;
+
-+ /* Try find a non-dirty one... */
++ /* First look for an unused cache */
+
+ cache = yaffs_grab_chunk_worker(dev);
+
-+ if (!cache) {
-+ /* They were all dirty, find the LRU object and flush
-+ * its cache, then find again.
-+ * NB what's here is not very accurate,
-+ * we actually flush the object with the LRU chunk.
-+ */
++ if (cache)
++ return cache;
++
++ /*
++ * Thery were all in use.
++ * Find the LRU cache and flush it if it is dirty.
++ */
+
-+ /* With locking we can't assume we can use entry zero,
-+ * Set the_obj to a valid pointer for Coverity. */
-+ the_obj = dev->cache[0].object;
-+ usage = -1;
-+ cache = NULL;
-+ pushout = -1;
++ usage = -1;
++ cache = NULL;
+
-+ for (i = 0; i < dev->param.n_caches; i++) {
-+ if (dev->cache[i].object &&
-+ !dev->cache[i].locked &&
-+ (dev->cache[i].last_use < usage ||
-+ !cache)) {
++ for (i = 0; i < dev->param.n_caches; i++) {
++ if (dev->cache[i].object &&
++ !dev->cache[i].locked &&
++ (dev->cache[i].last_use < usage || !cache)) {
+ usage = dev->cache[i].last_use;
-+ the_obj = dev->cache[i].object;
+ cache = &dev->cache[i];
-+ pushout = i;
-+ }
-+ }
-+
-+ if (!cache || cache->dirty) {
-+ /* Flush and try again */
-+ yaffs_flush_file_cache(the_obj);
-+ cache = yaffs_grab_chunk_worker(dev);
+ }
+ }
++
++#if 1
++ yaffs_flush_single_cache(cache, 1);
++#else
++ yaffs_flush_file_cache(cache->object, 1);
++ cache = yaffs_grab_chunk_worker(dev);
++#endif
++
+ return cache;
+}
+
@@ -3705,21 +3722,18 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.c linux-3.15-rc5/fs/yaffs2/ya
+ struct list_head *i;
+ u32 n = (u32) bucket;
+
-+ /* Now find an object value that has not already been taken
-+ * by scanning the list.
++ /*
++ * Now find an object value that has not already been taken
++ * by scanning the list, incrementing each time by number of buckets.
+ */
-+
+ while (!found) {
+ found = 1;
+ n += YAFFS_NOBJECT_BUCKETS;
-+ if (1 || dev->obj_bucket[bucket].count > 0) {
-+ list_for_each(i, &dev->obj_bucket[bucket].list) {
-+ /* If there is already one in the list */
-+ if (i && list_entry(i, struct yaffs_obj,
-+ hash_link)->obj_id == n) {
-+ found = 0;
-+ }
-+ }
++ list_for_each(i, &dev->obj_bucket[bucket].list) {
++ /* Check if this value is already taken. */
++ if (i && list_entry(i, struct yaffs_obj,
++ hash_link)->obj_id == n)
++ found = 0;
+ }
+ }
+ return n;
@@ -5031,78 +5045,6 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.c linux-3.15-rc5/fs/yaffs2/ya
+ yaffs_release_temp_buffer(dev, buf);
+}
+
-+static void yaffs_load_name_from_oh(struct yaffs_dev *dev, YCHAR *name,
-+ const YCHAR *oh_name, int buff_size)
-+{
-+#ifdef CONFIG_YAFFS_AUTO_UNICODE
-+ if (dev->param.auto_unicode) {
-+ if (*oh_name) {
-+ /* It is an ASCII name, do an ASCII to
-+ * unicode conversion */
-+ const char *ascii_oh_name = (const char *)oh_name;
-+ int n = buff_size - 1;
-+ while (n > 0 && *ascii_oh_name) {
-+ *name = *ascii_oh_name;
-+ name++;
-+ ascii_oh_name++;
-+ n--;
-+ }
-+ } else {
-+ strncpy(name, oh_name + 1, buff_size - 1);
-+ }
-+ } else {
-+#else
-+ (void) dev;
-+ {
-+#endif
-+ strncpy(name, oh_name, buff_size - 1);
-+ }
-+}
-+
-+static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR *oh_name,
-+ const YCHAR *name)
-+{
-+#ifdef CONFIG_YAFFS_AUTO_UNICODE
-+
-+ int is_ascii;
-+ YCHAR *w;
-+
-+ if (dev->param.auto_unicode) {
-+
-+ is_ascii = 1;
-+ w = name;
-+
-+ /* Figure out if the name will fit in ascii character set */
-+ while (is_ascii && *w) {
-+ if ((*w) & 0xff00)
-+ is_ascii = 0;
-+ w++;
-+ }
-+
-+ if (is_ascii) {
-+ /* It is an ASCII name, so convert unicode to ascii */
-+ char *ascii_oh_name = (char *)oh_name;
-+ int n = YAFFS_MAX_NAME_LENGTH - 1;
-+ while (n > 0 && *name) {
-+ *ascii_oh_name = *name;
-+ name++;
-+ ascii_oh_name++;
-+ n--;
-+ }
-+ } else {
-+ /* Unicode name, so save starting at the second YCHAR */
-+ *oh_name = 0;
-+ strncpy(oh_name + 1, name, YAFFS_MAX_NAME_LENGTH - 2);
-+ }
-+ } else {
-+#else
-+ dev = dev;
-+ {
-+#endif
-+ strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
-+ }
-+}
-+
+/* UpdateObjectHeader updates the header on NAND for an object.
+ * If name is not NULL, then that new name is used.
+ */
@@ -5607,7 +5549,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.c linux-3.15-rc5/fs/yaffs2/ya
+ struct yaffs_dev *dev = in->my_dev;
+ loff_t old_size = in->variant.file_variant.file_size;
+
-+ yaffs_flush_file_cache(in);
++ yaffs_flush_file_cache(in, 1);
+ yaffs_invalidate_whole_cache(in);
+
+ yaffs_check_gc(dev, 0);
@@ -5640,12 +5582,15 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.c linux-3.15-rc5/fs/yaffs2/ya
+ return YAFFS_OK;
+}
+
-+int yaffs_flush_file(struct yaffs_obj *in, int update_time, int data_sync)
++int yaffs_flush_file(struct yaffs_obj *in,
++ int update_time,
++ int data_sync,
++ int discard_cache)
+{
+ if (!in->dirty)
+ return YAFFS_OK;
+
-+ yaffs_flush_file_cache(in);
++ yaffs_flush_file_cache(in, discard_cache);
+
+ if (data_sync)
+ return YAFFS_OK;
@@ -6874,8 +6819,15 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.c linux-3.15-rc5/fs/yaffs2/ya
+
+ kfree(dev->gc_cleanup_list);
+
-+ for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++)
++ for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++) {
+ kfree(dev->temp_buffer[i].buffer);
++ dev->temp_buffer[i].buffer = NULL;
++ }
++
++ kfree(dev->checkpt_buffer);
++ dev->checkpt_buffer = NULL;
++ kfree(dev->checkpt_block_list);
++ dev->checkpt_block_list = NULL;
+
+ dev->is_mounted = 0;
+
@@ -6986,10 +6938,10 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.c linux-3.15-rc5/fs/yaffs2/ya
+ bs[s]++;
+ }
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.h linux-3.15-rc5/fs/yaffs2/yaffs_guts.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_guts.h 2014-05-17 01:53:27.000000000 +0200
-@@ -0,0 +1,1007 @@
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_guts.h linux-3.18.14/fs/yaffs2/yaffs_guts.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_guts.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_guts.h 2015-06-14 21:23:22.000000000 +0200
+@@ -0,0 +1,1010 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
+ *
@@ -7868,10 +7820,13 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.h linux-3.15-rc5/fs/yaffs2/ya
+ const YCHAR *name, u32 mode, u32 uid,
+ u32 gid);
+
-+int yaffs_flush_file(struct yaffs_obj *obj, int update_time, int data_sync);
++int yaffs_flush_file(struct yaffs_obj *in,
++ int update_time,
++ int data_sync,
++ int discard_cache);
+
+/* Flushing and checkpointing */
-+void yaffs_flush_whole_cache(struct yaffs_dev *dev);
++void yaffs_flush_whole_cache(struct yaffs_dev *dev, int discard);
+
+int yaffs_checkpoint_save(struct yaffs_dev *dev);
+int yaffs_checkpoint_restore(struct yaffs_dev *dev);
@@ -7997,9 +7952,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_guts.h linux-3.15-rc5/fs/yaffs2/ya
+ struct yaffs_ext_tags *tags);
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_linux.h linux-3.15-rc5/fs/yaffs2/yaffs_linux.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_linux.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_linux.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_linux.h linux-3.18.14/fs/yaffs2/yaffs_linux.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_linux.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_linux.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,48 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -8049,10 +8004,10 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_linux.h linux-3.15-rc5/fs/yaffs2/y
+#endif
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_mtdif.c linux-3.15-rc5/fs/yaffs2/yaffs_mtdif.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_mtdif.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_mtdif.c 2014-05-17 01:53:27.000000000 +0200
-@@ -0,0 +1,309 @@
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_mtdif.c linux-3.18.14/fs/yaffs2/yaffs_mtdif.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_mtdif.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_mtdif.c 2015-06-14 21:23:22.000000000 +0200
+@@ -0,0 +1,310 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
+ *
@@ -8073,17 +8028,18 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_mtdif.c linux-3.15-rc5/fs/yaffs2/y
+#include "linux/mtd/mtd.h"
+#include "linux/types.h"
+#include "linux/time.h"
-+#include "linux/major.h"
+#include "linux/mtd/nand.h"
+#include "linux/kernel.h"
+#include "linux/version.h"
+#include "linux/types.h"
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
++#include "uapi/linux/major.h"
++#endif
+
+#include "yaffs_trace.h"
+#include "yaffs_guts.h"
+#include "yaffs_linux.h"
+
-+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0))
+#define MTD_OPS_AUTO_OOB MTD_OOB_AUTO
+#endif
@@ -8362,9 +8318,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_mtdif.c linux-3.15-rc5/fs/yaffs2/y
+ if(mtd)
+ put_mtd_device(mtd);
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_mtdif.h linux-3.15-rc5/fs/yaffs2/yaffs_mtdif.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_mtdif.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_mtdif.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_mtdif.h linux-3.18.14/fs/yaffs2/yaffs_mtdif.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_mtdif.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_mtdif.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,25 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -8391,9 +8347,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_mtdif.h linux-3.15-rc5/fs/yaffs2/y
+void yaffs_put_mtd_device(struct mtd_info *mtd);
+int yaffs_verify_mtd(struct mtd_info *mtd, int yaffs_version, int inband_tags);
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_nameval.c linux-3.15-rc5/fs/yaffs2/yaffs_nameval.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_nameval.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_nameval.c 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_nameval.c linux-3.18.14/fs/yaffs2/yaffs_nameval.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_nameval.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_nameval.c 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,208 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
@@ -8603,9 +8559,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_nameval.c linux-3.15-rc5/fs/yaffs2
+{
+ return nval_used(xb, xb_size) > 0;
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_nameval.h linux-3.15-rc5/fs/yaffs2/yaffs_nameval.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_nameval.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_nameval.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_nameval.h linux-3.18.14/fs/yaffs2/yaffs_nameval.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_nameval.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_nameval.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,28 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -8635,9 +8591,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_nameval.h linux-3.15-rc5/fs/yaffs2
+int nval_list(const char *xb, int xb_size, char *buf, int bsize);
+int nval_hasvalues(const char *xb, int xb_size);
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_nand.c linux-3.15-rc5/fs/yaffs2/yaffs_nand.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_nand.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_nand.c 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_nand.c linux-3.18.14/fs/yaffs2/yaffs_nand.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_nand.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_nand.c 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,122 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
@@ -8761,9 +8717,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_nand.c linux-3.15-rc5/fs/yaffs2/ya
+ return dev->drv.drv_deinitialise_fn(dev);
+ return YAFFS_OK;
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_nand.h linux-3.15-rc5/fs/yaffs2/yaffs_nand.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_nand.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_nand.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_nand.h linux-3.18.14/fs/yaffs2/yaffs_nand.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_nand.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_nand.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,39 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -8804,9 +8760,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_nand.h linux-3.15-rc5/fs/yaffs2/ya
+int yaffs_deinit_nand(struct yaffs_dev *dev);
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_packedtags1.c linux-3.15-rc5/fs/yaffs2/yaffs_packedtags1.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_packedtags1.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_packedtags1.c 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_packedtags1.c linux-3.18.14/fs/yaffs2/yaffs_packedtags1.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_packedtags1.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_packedtags1.c 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,56 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
@@ -8864,9 +8820,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_packedtags1.c linux-3.15-rc5/fs/ya
+ memset(t, 0, sizeof(struct yaffs_ext_tags));
+ }
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_packedtags1.h linux-3.15-rc5/fs/yaffs2/yaffs_packedtags1.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_packedtags1.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_packedtags1.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_packedtags1.h linux-3.18.14/fs/yaffs2/yaffs_packedtags1.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_packedtags1.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_packedtags1.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,39 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -8907,9 +8863,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_packedtags1.h linux-3.15-rc5/fs/ya
+void yaffs_unpack_tags1(struct yaffs_ext_tags *t,
+ const struct yaffs_packed_tags1 *pt);
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_packedtags2.c linux-3.15-rc5/fs/yaffs2/yaffs_packedtags2.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_packedtags2.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_packedtags2.c 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_packedtags2.c linux-3.18.14/fs/yaffs2/yaffs_packedtags2.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_packedtags2.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_packedtags2.c 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,197 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
@@ -9108,9 +9064,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_packedtags2.c linux-3.15-rc5/fs/ya
+ yaffs_dump_packed_tags2(pt);
+ yaffs_dump_tags2(t);
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_packedtags2.h linux-3.15-rc5/fs/yaffs2/yaffs_packedtags2.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_packedtags2.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_packedtags2.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_packedtags2.h linux-3.18.14/fs/yaffs2/yaffs_packedtags2.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_packedtags2.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_packedtags2.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,47 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -9159,9 +9115,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_packedtags2.h linux-3.15-rc5/fs/ya
+void yaffs_unpack_tags2_tags_only(struct yaffs_ext_tags *t,
+ struct yaffs_packed_tags2_tags_only *pt);
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_summary.c linux-3.15-rc5/fs/yaffs2/yaffs_summary.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_summary.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_summary.c 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_summary.c linux-3.18.14/fs/yaffs2/yaffs_summary.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_summary.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_summary.c 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,312 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
@@ -9475,9 +9431,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_summary.c linux-3.15-rc5/fs/yaffs2
+ }
+ }
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_summary.h linux-3.15-rc5/fs/yaffs2/yaffs_summary.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_summary.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_summary.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_summary.h linux-3.18.14/fs/yaffs2/yaffs_summary.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_summary.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_summary.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,37 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -9516,9 +9472,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_summary.h linux-3.15-rc5/fs/yaffs2
+
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_tagscompat.c linux-3.15-rc5/fs/yaffs2/yaffs_tagscompat.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_tagscompat.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_tagscompat.c 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_tagscompat.c linux-3.18.14/fs/yaffs2/yaffs_tagscompat.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_tagscompat.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_tagscompat.c 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,381 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
@@ -9901,9 +9857,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_tagscompat.c linux-3.15-rc5/fs/yaf
+ if(!dev->tagger.mark_bad_fn)
+ dev->tagger.mark_bad_fn = yaffs_tags_compat_mark_bad;
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_tagscompat.h linux-3.15-rc5/fs/yaffs2/yaffs_tagscompat.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_tagscompat.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_tagscompat.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_tagscompat.h linux-3.18.14/fs/yaffs2/yaffs_tagscompat.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_tagscompat.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_tagscompat.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,44 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -9949,9 +9905,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_tagscompat.h linux-3.15-rc5/fs/yaf
+int yaffs_check_tags_ecc(struct yaffs_tags *tags);
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_tagsmarshall.c linux-3.15-rc5/fs/yaffs2/yaffs_tagsmarshall.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_tagsmarshall.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_tagsmarshall.c 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_tagsmarshall.c linux-3.18.14/fs/yaffs2/yaffs_tagsmarshall.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_tagsmarshall.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_tagsmarshall.c 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,199 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
@@ -10152,9 +10108,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_tagsmarshall.c linux-3.15-rc5/fs/y
+ dev->tagger.mark_bad_fn = yaffs_tags_marshall_mark_bad;
+
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_tagsmarshall.h linux-3.15-rc5/fs/yaffs2/yaffs_tagsmarshall.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_tagsmarshall.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_tagsmarshall.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_tagsmarshall.h linux-3.18.14/fs/yaffs2/yaffs_tagsmarshall.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_tagsmarshall.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_tagsmarshall.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,22 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -10178,9 +10134,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_tagsmarshall.h linux-3.15-rc5/fs/y
+void yaffs_tags_marshall_install(struct yaffs_dev *dev);
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_trace.h linux-3.15-rc5/fs/yaffs2/yaffs_trace.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_trace.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_trace.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_trace.h linux-3.18.14/fs/yaffs2/yaffs_trace.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_trace.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_trace.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,57 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -10239,9 +10195,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_trace.h linux-3.15-rc5/fs/yaffs2/y
+#define YAFFS_TRACE_ALWAYS 0xf0000000
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_verify.c linux-3.15-rc5/fs/yaffs2/yaffs_verify.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_verify.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_verify.c 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_verify.c linux-3.18.14/fs/yaffs2/yaffs_verify.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_verify.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_verify.c 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,529 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
@@ -10772,9 +10728,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_verify.c linux-3.15-rc5/fs/yaffs2/
+ (void) in;
+ return YAFFS_OK;
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_verify.h linux-3.15-rc5/fs/yaffs2/yaffs_verify.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_verify.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_verify.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_verify.h linux-3.18.14/fs/yaffs2/yaffs_verify.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_verify.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_verify.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,43 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -10819,10 +10775,10 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_verify.h linux-3.15-rc5/fs/yaffs2/
+int yaffs_skip_verification(struct yaffs_dev *dev);
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaffs_vfs.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_vfs.c 2014-05-17 02:52:54.000000000 +0200
-@@ -0,0 +1,3604 @@
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_vfs.c linux-3.18.14/fs/yaffs2/yaffs_vfs.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_vfs.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_vfs.c 2015-06-15 18:42:09.000000000 +0200
+@@ -0,0 +1,3658 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
+ *
@@ -11061,6 +11017,15 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+#define Y_CLEAR_INODE(i) end_writeback(i)
+#endif
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
++#define YAFFS_USE_DIR_ITERATE
++#endif
++
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
++#define YAFFS_NEW_PROCFS
++#include <linux/seq_file.h>
++#endif
++
+
+#define update_dir_time(dir) do {\
+ (dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \
@@ -11154,33 +11119,6 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+ return ret;
+}
+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0))
-+#define YCRED_FSUID() from_kuid(&init_user_ns, current_fsuid())
-+#define YCRED_FSGID() from_kgid(&init_user_ns, current_fsgid())
-+#else
-+#define YCRED_FSUID() YCRED(current)->fsuid
-+#define YCRED_FSGID() YCRED(current)->fsgid
-+
-+static inline uid_t i_uid_read(const struct inode *inode)
-+{
-+ return inode->i_uid;
-+}
-+
-+static inline gid_t i_gid_read(const struct inode *inode)
-+{
-+ return inode->i_gid;
-+}
-+
-+static inline void i_uid_write(struct inode *inode, uid_t uid)
-+{
-+ inode->i_uid = uid;
-+}
-+
-+static inline void i_gid_write(struct inode *inode, gid_t gid)
-+{
-+ inode->i_gid = gid;
-+}
-+#endif
+
+static void yaffs_set_super_dirty_val(struct yaffs_dev *dev, int val)
+{
@@ -11581,7 +11519,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+
+ yaffs_gross_lock(dev);
+
-+ yaffs_flush_file(obj, 1, 0);
++ yaffs_flush_file(obj, 1, 0, 0);
+
+ yaffs_gross_unlock(dev);
+
@@ -11611,7 +11549,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+ yaffs_trace(YAFFS_TRACE_OS | YAFFS_TRACE_SYNC,
+ "yaffs_sync_object");
+ yaffs_gross_lock(dev);
-+ yaffs_flush_file(obj, 1, datasync);
++ yaffs_flush_file(obj, 1, datasync, 0);
+ yaffs_gross_unlock(dev);
+ return 0;
+}
@@ -11621,13 +11559,13 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+static const struct file_operations yaffs_file_operations = {
+ .read = do_sync_read,
+ .write = do_sync_write,
-+ .aio_read = generic_file_aio_read,
-+ .aio_write = generic_file_aio_write,
++ .read_iter = generic_file_read_iter,
++ .write_iter = generic_file_write_iter,
+ .mmap = generic_file_mmap,
+ .flush = yaffs_file_flush,
+ .fsync = yaffs_sync_object,
+ .splice_read = generic_file_splice_read,
-+ .splice_write = generic_file_splice_write,
++ .splice_write = iter_file_splice_write,
+ .llseek = generic_file_llseek,
+};
+
@@ -11875,10 +11813,10 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+ if (!alias)
+ return -ENOMEM;
+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
-+ ret = readlink_copy(buffer, buflen, alias);
-+#else
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)
+ ret = vfs_readlink(dentry, buffer, buflen, alias);
++#else
++ ret = readlink_copy(buffer, buflen, alias);
+#endif
+ kfree(alias);
+ return ret;
@@ -12062,6 +12000,23 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+#define YCRED(x) (x->cred)
+#endif
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
++#define YPROC_uid(p) (YCRED(p)->fsuid)
++#define YPROC_gid(p) (YCRED(p)->fsgid)
++#define EXTRACT_gid(x) x
++#define EXTRACT_uid(x) x
++#define MAKE_gid(x) x
++#define MAKE_uid(x) x
++#else
++#define YPROC_uid(p) from_kuid(&init_user_ns, YCRED(p)->fsuid)
++#define YPROC_gid(p) from_kgid(&init_user_ns, YCRED(p)->fsgid)
++#define EXTRACT_gid(x) from_kgid(&init_user_ns, x)
++#define EXTRACT_uid(x) from_kuid(&init_user_ns, x)
++#define MAKE_gid(x) make_kgid(&init_user_ns, x)
++#define MAKE_uid(x) make_kuid(&init_user_ns, x)
++#endif
++
++
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
+static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
+ dev_t rdev)
@@ -12081,9 +12036,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+ struct yaffs_obj *parent = yaffs_inode_to_obj(dir);
+
+ int error = -ENOSPC;
-+ uid_t uid = YCRED_FSUID();
++ uid_t uid = YPROC_uid(current);
+ gid_t gid =
-+ (dir->i_mode & S_ISGID) ? i_gid_read(dir) : YCRED_FSGID();
++ (dir->i_mode & S_ISGID) ? EXTRACT_gid(dir->i_gid) : YPROC_gid(current);
+
+ if ((dir->i_mode & S_ISGID) && S_ISDIR(mode))
+ mode |= S_ISGID;
@@ -12280,9 +12235,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+{
+ struct yaffs_obj *obj;
+ struct yaffs_dev *dev;
-+ uid_t uid = YCRED_FSUID();
++ uid_t uid = YPROC_uid(current);
+ gid_t gid =
-+ (dir->i_mode & S_ISGID) ? i_gid_read(dir) : YCRED_FSGID();
++ (dir->i_mode & S_ISGID) ? EXTRACT_gid(dir->i_gid) : YPROC_gid(current);
+
+ yaffs_trace(YAFFS_TRACE_OS, "yaffs_symlink");
+
@@ -12530,78 +12485,40 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+
+/*-----------------------------------------------------------------*/
+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
-+static int yaffs_readdir(struct file *file, struct dir_context *ctx)
++#ifdef YAFFS_USE_DIR_ITERATE
++static int yaffs_iterate(struct file *f, struct dir_context *dc)
+{
+ struct yaffs_obj *obj;
+ struct yaffs_dev *dev;
+ struct yaffs_search_context *sc;
-+ struct inode *inode = file->f_dentry->d_inode;
-+ unsigned long offset, curoffs;
++ unsigned long curoffs;
+ struct yaffs_obj *l;
+ int ret_val = 0;
+
+ char name[YAFFS_MAX_NAME_LENGTH + 1];
+
-+ obj = yaffs_dentry_to_obj(file->f_dentry);
++ obj = yaffs_dentry_to_obj(f->f_dentry);
+ dev = obj->my_dev;
+
+ yaffs_gross_lock(dev);
+
+ yaffs_dev_to_lc(dev)->readdir_process = current;
+
-+ offset = ctx->pos;
-+
+ sc = yaffs_new_search(obj);
+ if (!sc) {
+ ret_val = -ENOMEM;
+ goto out;
+ }
+
-+ yaffs_trace(YAFFS_TRACE_OS,
-+ "yaffs_readdir: starting at %d", (int)offset);
-+
-+ if (offset == 0) {
-+ yaffs_trace(YAFFS_TRACE_OS,
-+ "yaffs_readdir: entry . ino %d",
-+ (int)inode->i_ino);
-+ yaffs_gross_unlock(dev);
-+ if (!dir_emit_dot(file, ctx)) {
-+ yaffs_gross_lock(dev);
-+ goto out;
-+ }
-+ yaffs_gross_lock(dev);
-+ offset++;
-+ ctx->pos++;
-+ }
-+ if (offset == 1) {
-+ yaffs_trace(YAFFS_TRACE_OS,
-+ "yaffs_readdir: entry .. ino %d",
-+ (int)file->f_dentry->d_parent->d_inode->i_ino);
-+ yaffs_gross_unlock(dev);
-+ if (!dir_emit_dotdot(file, ctx)) {
-+ yaffs_gross_lock(dev);
-+ goto out;
-+ }
-+ yaffs_gross_lock(dev);
-+ offset++;
-+ ctx->pos++;
-+ }
++ if (!dir_emit_dots(f, dc))
++ return 0;
+
+ curoffs = 1;
+
-+ /* If the directory has changed since the open or last call to
-+ readdir, rewind to after the 2 canned entries. */
-+ if (file->f_version != inode->i_version) {
-+ offset = 2;
-+ ctx->pos = offset;
-+ file->f_version = inode->i_version;
-+ }
-+
+ while (sc->next_return) {
+ curoffs++;
+ l = sc->next_return;
-+ if (curoffs >= offset) {
++ if (curoffs >= dc->pos) {
+ int this_inode = yaffs_get_obj_inode(l);
+ int this_type = yaffs_get_obj_type(l);
+
@@ -12612,16 +12529,19 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+
+ yaffs_gross_unlock(dev);
+
-+ if (!dir_emit(ctx, name, strlen(name),
-+ this_inode, this_type) < 0) {
++ if (!dir_emit(dc,
++ name,
++ strlen(name),
++ this_inode,
++ this_type)) {
+ yaffs_gross_lock(dev);
+ goto out;
+ }
+
+ yaffs_gross_lock(dev);
+
-+ offset++;
-+ ctx->pos++;
++ dc->pos++;
++ f->f_pos++;
+ }
+ yaffs_search_advance(sc);
+ }
@@ -12633,7 +12553,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+
+ return ret_val;
+}
++
+#else
++
+static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
+{
+ struct yaffs_obj *obj;
@@ -12740,12 +12662,13 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+
+ return ret_val;
+}
++
+#endif
+
+static const struct file_operations yaffs_dir_operations = {
+ .read = generic_read_dir,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
-+ .iterate = yaffs_readdir,
++#ifdef YAFFS_USE_DIR_ITERATE
++ .iterate = yaffs_iterate,
+#else
+ .readdir = yaffs_readdir,
+#endif
@@ -12794,8 +12717,8 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+
+ inode->i_ino = obj->obj_id;
+ inode->i_mode = obj->yst_mode;
-+ i_uid_write(inode, obj->yst_uid);
-+ i_gid_write(inode, obj->yst_gid);
++ inode->i_uid = MAKE_uid(obj->yst_uid);
++ inode->i_gid = MAKE_gid(obj->yst_gid);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
+ inode->i_blksize = inode->i_sb->s_blocksize;
+#endif
@@ -12821,7 +12744,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+
+ yaffs_trace(YAFFS_TRACE_OS,
+ "yaffs_fill_inode mode %x uid %d gid %d size %lld count %d",
-+ inode->i_mode, i_uid_read(inode), i_gid_read(inode),
++ inode->i_mode, obj->yst_uid, obj->yst_gid,
+ inode->i_size, atomic_read(&inode->i_count));
+
+ switch (obj->yst_mode & S_IFMT) {
@@ -13045,7 +12968,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+ yaffs_trace(YAFFS_TRACE_OS,
+ "flushing obj %d",
+ obj->obj_id);
-+ yaffs_flush_file(obj, 1, 0);
++ yaffs_flush_file(obj, 1, 0, 0);
+ }
+ }
+}
@@ -13058,7 +12981,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+
+ yaffs_flush_inodes(sb);
+ yaffs_update_dirty_dirs(dev);
-+ yaffs_flush_whole_cache(dev);
++ yaffs_flush_whole_cache(dev, 1);
+ if (do_checkpoint)
+ yaffs_checkpoint_save(dev);
+}
@@ -13437,7 +13360,45 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+ return 0;
+}
+
++/* the function only is used to change dev->read_only when this file system
++ * is remounted.
++ */
++static int yaffs_remount_fs(struct super_block *sb, int *flags, char *data)
++{
++ int read_only = 0;
++ struct mtd_info *mtd;
++ struct yaffs_dev *dev = 0;
+
++ /* Get the device */
++ mtd = get_mtd_device(NULL, MINOR(sb->s_dev));
++ if (!mtd) {
++ yaffs_trace(YAFFS_TRACE_ALWAYS,
++ "MTD device #%u doesn't appear to exist",
++ MINOR(sb->s_dev));
++ return 1;
++ }
++
++ /* Check it's NAND */
++ if (mtd->type != MTD_NANDFLASH) {
++ yaffs_trace(YAFFS_TRACE_ALWAYS,
++ "MTD device is not NAND it's type %d",
++ mtd->type);
++ return 1;
++ }
++
++ read_only = ((*flags & MS_RDONLY) != 0);
++ if (!read_only && !(mtd->flags & MTD_WRITEABLE)) {
++ read_only = 1;
++ printk(KERN_INFO
++ "yaffs: mtd is read only, setting superblock read only");
++ *flags |= MS_RDONLY;
++ }
++
++ dev = sb->s_fs_info;
++ dev->read_only = read_only;
++
++ return 0;
++}
+
+static const struct super_operations yaffs_super_ops = {
+ .statfs = yaffs_statfs,
@@ -13459,6 +13420,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+#ifdef YAFFS_HAS_WRITE_SUPER
+ .write_super = yaffs_write_super,
+#endif
++ .remount_fs = yaffs_remount_fs,
+};
+
+struct yaffs_options {
@@ -13959,7 +13921,6 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+#endif
+
+
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0))
+static struct proc_dir_entry *my_proc_entry;
+
+static char *yaffs_dump_dev_part0(char *buf, struct yaffs_dev *dev)
@@ -14070,8 +14031,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+ if (step == 0)
+ buf +=
+ sprintf(buf,
-+ "Multi-version YAFFS built:" __DATE__ " " __TIME__
-+ "\n");
++ "Multi-version YAFFS\n");
+ else if (step == 1)
+ buf += sprintf(buf, "\n");
+ else {
@@ -14150,7 +14110,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+
+#define MAX_MASK_NAME_LENGTH 40
+static int yaffs_proc_write_trace_options(struct file *file, const char *buf,
-+ unsigned long count, void *data)
++ unsigned long count)
+{
+ unsigned rg = 0, mask_bitfield;
+ char *end;
@@ -14251,7 +14211,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+ */
+
+static int yaffs_proc_debug_write(struct file *file, const char *buf,
-+ unsigned long count, void *data)
++ unsigned long count)
+{
+
+ char str[100];
@@ -14263,7 +14223,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+ struct list_head *item;
+
+ memset(str, 0, sizeof(str));
-+ memcpy(str, buf, min(count, sizeof(str) -1));
++ memcpy(str, buf, min((size_t)count, sizeof(str) -1));
+
+ cmd = str[1];
+
@@ -14326,14 +14286,19 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+ return count;
+}
+
++
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
+static int yaffs_proc_write(struct file *file, const char *buf,
-+ unsigned long count, void *data)
++ unsigned long count, void *ppos)
++#else
++static ssize_t yaffs_proc_write(struct file *file, const char __user *buf,
++ size_t count, loff_t *ppos)
++#endif
+{
+ if (buf[0] == '.')
-+ return yaffs_proc_debug_write(file, buf, count, data);
-+ return yaffs_proc_write_trace_options(file, buf, count, data);
++ return yaffs_proc_debug_write(file, buf, count);
++ return yaffs_proc_write_trace_options(file, buf, count);
+}
-+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)) */
+
+/* Stuff to handle installation of file systems */
+struct file_system_to_install {
@@ -14347,17 +14312,52 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+ {NULL, 0}
+};
+
-+static int __init init_yaffs_fs(void)
++
++#ifdef YAFFS_NEW_PROCFS
++static int yaffs_proc_show(struct seq_file *m, void *v)
+{
-+ int error = 0;
-+ struct file_system_to_install *fsinst;
++ /* FIXME: Unify in a better way? */
++ char buffer[512];
++ char *start;
++ int len;
+
-+ yaffs_trace(YAFFS_TRACE_ALWAYS,
-+ "yaffs built " __DATE__ " " __TIME__ " Installing.");
++ len = yaffs_proc_read(buffer, &start, 0, sizeof(buffer), NULL, NULL);
++ seq_puts(m, buffer);
++ return 0;
++}
+
-+ mutex_init(&yaffs_context_lock);
++static int yaffs_proc_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, yaffs_proc_show, NULL);
++}
++
++static struct file_operations procfs_ops = {
++ .owner = THIS_MODULE,
++ .open = yaffs_proc_open,
++ .read = seq_read,
++ .write = yaffs_proc_write,
++};
++
++static int yaffs_procfs_init(void)
++{
++ /* Install the proc_fs entries */
++ my_proc_entry = proc_create("yaffs",
++ S_IRUGO | S_IFREG,
++ YPROC_ROOT,
++ &procfs_ops);
++
++ if (my_proc_entry) {
++ return 0;
++ } else {
++ return -ENOMEM;
++ }
++}
++
++#else
+
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0))
++
++static int yaffs_procfs_init(void)
++{
+ /* Install the proc_fs entries */
+ my_proc_entry = create_proc_entry("yaffs",
+ S_IRUGO | S_IFREG, YPROC_ROOT);
@@ -14366,11 +14366,26 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+ my_proc_entry->write_proc = yaffs_proc_write;
+ my_proc_entry->read_proc = yaffs_proc_read;
+ my_proc_entry->data = NULL;
++ return 0;
+ } else {
+ return -ENOMEM;
-+ }
++ }
++}
++
+#endif
+
++
++static int __init init_yaffs_fs(void)
++{
++ int error = 0;
++ struct file_system_to_install *fsinst;
++
++ mutex_init(&yaffs_context_lock);
++
++ error = yaffs_procfs_init();
++ if (error)
++ return error;
++
+ /* Now add the file system entries */
+
+ fsinst = fs_to_install;
@@ -14403,12 +14418,7 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+
+ struct file_system_to_install *fsinst;
+
-+ yaffs_trace(YAFFS_TRACE_ALWAYS,
-+ "yaffs built " __DATE__ " " __TIME__ " removing.");
-+
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0))
+ remove_proc_entry("yaffs", YPROC_ROOT);
-+#endif
+
+ fsinst = fs_to_install;
+
@@ -14427,9 +14437,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_vfs.c linux-3.15-rc5/fs/yaffs2/yaf
+ MODULE_DESCRIPTION("YAFFS2 - a NAND specific flash file system");
+MODULE_AUTHOR("Charles Manning, Aleph One Ltd., 2002-2011");
+MODULE_LICENSE("GPL");
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs1.c linux-3.15-rc5/fs/yaffs2/yaffs_yaffs1.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs1.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_yaffs1.c 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_yaffs1.c linux-3.18.14/fs/yaffs2/yaffs_yaffs1.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_yaffs1.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_yaffs1.c 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,422 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
@@ -14853,9 +14863,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs1.c linux-3.15-rc5/fs/yaffs2/
+
+ return YAFFS_OK;
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs1.h linux-3.15-rc5/fs/yaffs2/yaffs_yaffs1.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs1.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_yaffs1.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_yaffs1.h linux-3.18.14/fs/yaffs2/yaffs_yaffs1.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_yaffs1.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_yaffs1.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,22 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -14879,10 +14889,10 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs1.h linux-3.15-rc5/fs/yaffs2/
+int yaffs1_scan(struct yaffs_dev *dev);
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs2.c linux-3.15-rc5/fs/yaffs2/yaffs_yaffs2.c
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs2.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_yaffs2.c 2014-05-17 01:53:27.000000000 +0200
-@@ -0,0 +1,1534 @@
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_yaffs2.c linux-3.18.14/fs/yaffs2/yaffs_yaffs2.c
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_yaffs2.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_yaffs2.c 2015-06-14 21:23:22.000000000 +0200
+@@ -0,0 +1,1532 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
+ *
@@ -16236,7 +16246,6 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs2.c linux-3.15-rc5/fs/yaffs2/
+ int n_to_scan = 0;
+ enum yaffs_block_state state;
+ int c;
-+ int deleted;
+ LIST_HEAD(hard_list);
+ struct yaffs_block_info *bi;
+ u32 seq_number;
@@ -16354,7 +16363,6 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs2.c linux-3.15-rc5/fs/yaffs2/
+ /* get the block to scan in the correct order */
+ blk = block_index[block_iter].block;
+ bi = yaffs_get_block_info(dev, blk);
-+ deleted = 0;
+
+ summary_available = yaffs_summary_read(dev, dev->sum_tags, blk);
+
@@ -16417,9 +16425,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs2.c linux-3.15-rc5/fs/yaffs2/
+
+ return YAFFS_OK;
+}
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs2.h linux-3.15-rc5/fs/yaffs2/yaffs_yaffs2.h
---- linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs2.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yaffs_yaffs2.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yaffs_yaffs2.h linux-3.18.14/fs/yaffs2/yaffs_yaffs2.h
+--- linux-3.18.14.orig/fs/yaffs2/yaffs_yaffs2.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yaffs_yaffs2.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,39 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
@@ -16460,9 +16468,9 @@ diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yaffs_yaffs2.h linux-3.15-rc5/fs/yaffs2/
+int yaffs2_scan_backwards(struct yaffs_dev *dev);
+
+#endif
-diff -Nur linux-3.15-rc5.orig/fs/yaffs2/yportenv.h linux-3.15-rc5/fs/yaffs2/yportenv.h
---- linux-3.15-rc5.orig/fs/yaffs2/yportenv.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.15-rc5/fs/yaffs2/yportenv.h 2014-05-17 01:53:27.000000000 +0200
+diff -Nur linux-3.18.14.orig/fs/yaffs2/yportenv.h linux-3.18.14/fs/yaffs2/yportenv.h
+--- linux-3.18.14.orig/fs/yaffs2/yportenv.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-3.18.14/fs/yaffs2/yportenv.h 2015-06-14 21:23:22.000000000 +0200
@@ -0,0 +1,85 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.