summaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-01-18 09:59:55 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-01-18 09:59:55 +0000
commitd7add7e5ed98c42e1f2648037fa3f836b5c38f81 (patch)
tree05c38d88f4045a58befe2a4a75b22ab12993c48e /target
parent677794e146a62562bbf459cd49e72db024ff0d40 (diff)
[kernel] generic-2.6: add yaffs fs fixes for 2.6.28
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@14085 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic-2.6/patches-2.6.28/514-yaffs_2.6.28_fixes.patch120
1 files changed, 120 insertions, 0 deletions
diff --git a/target/linux/generic-2.6/patches-2.6.28/514-yaffs_2.6.28_fixes.patch b/target/linux/generic-2.6/patches-2.6.28/514-yaffs_2.6.28_fixes.patch
new file mode 100644
index 000000000..012ba04f0
--- /dev/null
+++ b/target/linux/generic-2.6/patches-2.6.28/514-yaffs_2.6.28_fixes.patch
@@ -0,0 +1,120 @@
+--- a/fs/yaffs2/yaffs_fs.c
++++ b/fs/yaffs2/yaffs_fs.c
+@@ -207,10 +207,20 @@ static int yaffs_writepage(struct page *
+ #else
+ static int yaffs_writepage(struct page *page);
+ #endif
++
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
++static int yaffs_write_begin(struct file *f, struct address_space *mapping,
++ loff_t pos, unsigned len, unsigned flags,
++ struct page **pagep, void **fsdata);
++static int yaffs_write_end(struct file *f, struct address_space *mapping,
++ loff_t pos, unsigned len, unsigned copied,
++ struct page *pg, void *fsdata);
++#else
+ static int yaffs_prepare_write(struct file *f, struct page *pg,
+ unsigned offset, unsigned to);
+ static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset,
+ unsigned to);
++#endif
+
+ static int yaffs_readlink(struct dentry *dentry, char __user * buffer,
+ int buflen);
+@@ -223,8 +233,13 @@ static int yaffs_follow_link(struct dent
+ static struct address_space_operations yaffs_file_address_operations = {
+ .readpage = yaffs_readpage,
+ .writepage = yaffs_writepage,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
++ .write_begin = yaffs_write_begin,
++ .write_end = yaffs_write_end,
++#else
+ .prepare_write = yaffs_prepare_write,
+ .commit_write = yaffs_commit_write,
++#endif
+ };
+
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22))
+@@ -687,6 +702,74 @@ static int yaffs_writepage(struct page *
+ return (nWritten == nBytes) ? 0 : -ENOSPC;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
++static int yaffs_write_begin(struct file *f, struct address_space *mapping,
++ loff_t pos, unsigned len, unsigned flags,
++ struct page **pagep, void **fsdata)
++{
++ struct page *pg;
++ pgoff_t index = pos >> PAGE_CACHE_SHIFT;
++ int ret = 0;
++
++ pg = __grab_cache_page(mapping, index);
++ if (!pg)
++ return -ENOMEM;
++
++ *pagep = pg;
++
++ T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_write_begin\n"));
++ if (!Page_Uptodate(pg)) {
++ ret = yaffs_readpage_nolock(f, pg);
++ if (ret)
++ goto err_unlock;
++ }
++
++ T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_write_begin\n"));
++ return 0;
++
++ err_unlock:
++ unlock_page(pg);
++ page_cache_release(pg);
++ return ret;
++}
++
++static int yaffs_write_end(struct file *f, struct address_space *mapping,
++ loff_t pos, unsigned len, unsigned copied,
++ struct page *pg, void *fsdata)
++{
++ void *addr = page_address(pg) + (pos & (PAGE_CACHE_SIZE - 1));
++ loff_t pos2;
++ int nBytes = copied;
++ int nWritten;
++
++ T(YAFFS_TRACE_OS,
++ (KERN_DEBUG "yaffs_write_end addr %x pos %x nBytes %d\n", (unsigned)addr,
++ (unsigned)pos, nBytes));
++
++ pos2 = pos;
++ nWritten = yaffs_file_write(f, addr, nBytes, &pos2);
++
++ if (nWritten != nBytes) {
++ T(YAFFS_TRACE_OS,
++ (KERN_DEBUG
++ "yaffs_write_end not same size nWritten %d nBytes %d\n",
++ nWritten, nBytes));
++ SetPageError(pg);
++ ClearPageUptodate(pg);
++ } else {
++ SetPageUptodate(pg);
++ }
++
++ T(YAFFS_TRACE_OS,
++ (KERN_DEBUG "yaffs_write_end returning %d\n",
++ nWritten == nBytes ? nWritten : 0));
++
++ unlock_page(pg);
++ page_cache_release(pg);
++
++ return (nWritten == nBytes) ? nWritten : 0;
++}
++#else
+ static int yaffs_prepare_write(struct file *f, struct page *pg,
+ unsigned offset, unsigned to)
+ {
+@@ -735,6 +818,7 @@ static int yaffs_commit_write(struct fil
+ return nWritten == nBytes ? 0 : nWritten;
+
+ }
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) */
+
+ static void yaffs_FillInodeFromObject(struct inode *inode, yaffs_Object * obj)
+ {