It is not used by any platform. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 39081master
parent
6928b4121f
commit
c05dc6f745
@ -1,18 +0,0 @@ |
||||
--- a/fs/Kconfig
|
||||
+++ b/fs/Kconfig
|
||||
@@ -35,6 +35,7 @@ source "fs/gfs2/Kconfig"
|
||||
source "fs/ocfs2/Kconfig"
|
||||
source "fs/btrfs/Kconfig"
|
||||
source "fs/nilfs2/Kconfig"
|
||||
+source "fs/yaffs2/Kconfig"
|
||||
|
||||
endif # BLOCK
|
||||
|
||||
--- a/fs/Makefile
|
||||
+++ b/fs/Makefile
|
||||
@@ -125,3 +125,5 @@ obj-$(CONFIG_GFS2_FS) += gfs2/
|
||||
obj-y += exofs/ # Multiple modules
|
||||
obj-$(CONFIG_CEPH_FS) += ceph/
|
||||
obj-$(CONFIG_PSTORE) += pstore/
|
||||
+obj-$(CONFIG_YAFFS_FS) += yaffs2/
|
||||
+
|
@ -1,31 +0,0 @@ |
||||
From 2505e8b0a13d3d5c5bbeaaae4eb889864f44c9df Mon Sep 17 00:00:00 2001
|
||||
From: Charles Manning <cdhmanning@gmail.com>
|
||||
Date: Thu, 3 Feb 2011 05:55:30 +1300
|
||||
Subject: [PATCH] yaffs: Fix directory unlinking in yaffs1 mode
|
||||
|
||||
commit 964b3425a71890e6701c830e38b04d8557c04f49 upstream.
|
||||
|
||||
Treat both yaffs2 and yaffs1 paths the same.
|
||||
|
||||
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
|
||||
---
|
||||
yaffs_guts.c | 8 +-------
|
||||
1 file changed, 1 insertion(+), 7 deletions(-)
|
||||
|
||||
--- a/fs/yaffs2/yaffs_guts.c
|
||||
+++ b/fs/yaffs2/yaffs_guts.c
|
||||
@@ -1708,13 +1708,7 @@ static int yaffs_change_obj_name(yaffs_o
|
||||
YBUG();
|
||||
}
|
||||
|
||||
- /* TODO: Do we need this different handling for YAFFS2 and YAFFS1?? */
|
||||
- if (obj->my_dev->param.is_yaffs2)
|
||||
- unlinkOp = (new_dir == obj->my_dev->unlinked_dir);
|
||||
- else
|
||||
- unlinkOp = (new_dir == obj->my_dev->unlinked_dir
|
||||
- && obj->variant_type == YAFFS_OBJECT_TYPE_FILE);
|
||||
-
|
||||
+ unlinkOp = (new_dir == obj->my_dev->unlinked_dir);
|
||||
deleteOp = (new_dir == obj->my_dev->del_dir);
|
||||
|
||||
existingTarget = yaffs_find_by_name(new_dir, new_name);
|
@ -1,138 +0,0 @@ |
||||
From c0c289363e84c53b5872f7c0c5069045096dca07 Mon Sep 17 00:00:00 2001
|
||||
From: Charles Manning <cdhmanning@gmail.com>
|
||||
Date: Wed, 3 Nov 2010 16:01:12 +1300
|
||||
Subject: [PATCH] yaffs: Switch from semaphores to mutexes
|
||||
|
||||
commit 73c54aa8c1de3f61a4c211cd47431293a6092f18 upstream.
|
||||
|
||||
Mutex is faster and init_MUTEX has been deprecated, so we'll just switch
|
||||
to mutexes.
|
||||
|
||||
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
|
||||
---
|
||||
yaffs_linux.h | 2 +-
|
||||
yaffs_vfs.c | 24 ++++++++++++------------
|
||||
yaffs_vfs_multi.c | 26 +++++++++++++-------------
|
||||
3 files changed, 26 insertions(+), 26 deletions(-)
|
||||
|
||||
--- a/fs/yaffs2/yaffs_linux.h
|
||||
+++ b/fs/yaffs2/yaffs_linux.h
|
||||
@@ -25,7 +25,7 @@ struct yaffs_LinuxContext {
|
||||
struct super_block * superBlock;
|
||||
struct task_struct *bgThread; /* Background thread for this device */
|
||||
int bgRunning;
|
||||
- struct semaphore grossLock; /* Gross locking semaphore */
|
||||
+ struct mutex grossLock; /* Gross locking mutex*/
|
||||
__u8 *spareBuffer; /* For mtdif2 use. Don't know the size of the buffer
|
||||
* at compile time so we have to allocate it.
|
||||
*/
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -515,14 +515,14 @@ static unsigned yaffs_gc_control_callbac
|
||||
static void yaffs_gross_lock(yaffs_dev_t *dev)
|
||||
{
|
||||
T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current));
|
||||
- down(&(yaffs_dev_to_lc(dev)->grossLock));
|
||||
+ mutex_lock(&(yaffs_dev_to_lc(dev)->grossLock));
|
||||
T(YAFFS_TRACE_LOCK, (TSTR("yaffs locked %p\n"), current));
|
||||
}
|
||||
|
||||
static void yaffs_gross_unlock(yaffs_dev_t *dev)
|
||||
{
|
||||
T(YAFFS_TRACE_LOCK, (TSTR("yaffs unlocking %p\n"), current));
|
||||
- up(&(yaffs_dev_to_lc(dev)->grossLock));
|
||||
+ mutex_unlock(&(yaffs_dev_to_lc(dev)->grossLock));
|
||||
}
|
||||
|
||||
#ifdef YAFFS_COMPILE_EXPORTFS
|
||||
@@ -2542,7 +2542,7 @@ static void yaffs_read_inode(struct inod
|
||||
#endif
|
||||
|
||||
static YLIST_HEAD(yaffs_context_list);
|
||||
-struct semaphore yaffs_context_lock;
|
||||
+struct mutex yaffs_context_lock;
|
||||
|
||||
static void yaffs_put_super(struct super_block *sb)
|
||||
{
|
||||
@@ -2568,9 +2568,9 @@ static void yaffs_put_super(struct super
|
||||
|
||||
yaffs_gross_unlock(dev);
|
||||
|
||||
- down(&yaffs_context_lock);
|
||||
+ mutex_lock(&yaffs_context_lock);
|
||||
ylist_del_init(&(yaffs_dev_to_lc(dev)->contextList));
|
||||
- up(&yaffs_context_lock);
|
||||
+ mutex_unlock(&yaffs_context_lock);
|
||||
|
||||
if (yaffs_dev_to_lc(dev)->spareBuffer) {
|
||||
YFREE(yaffs_dev_to_lc(dev)->spareBuffer);
|
||||
@@ -3016,7 +3016,7 @@ static struct super_block *yaffs_interna
|
||||
param->skip_checkpt_rd = options.skip_checkpoint_read;
|
||||
param->skip_checkpt_wr = options.skip_checkpoint_write;
|
||||
|
||||
- down(&yaffs_context_lock);
|
||||
+ mutex_lock(&yaffs_context_lock);
|
||||
/* Get a mount id */
|
||||
found = 0;
|
||||
for(mount_id=0; ! found; mount_id++){
|
||||
@@ -3030,13 +3030,13 @@ static struct super_block *yaffs_interna
|
||||
context->mount_id = mount_id;
|
||||
|
||||
ylist_add_tail(&(yaffs_dev_to_lc(dev)->contextList), &yaffs_context_list);
|
||||
- up(&yaffs_context_lock);
|
||||
+ mutex_unlock(&yaffs_context_lock);
|
||||
|
||||
/* Directory search handling...*/
|
||||
YINIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->searchContexts));
|
||||
param->remove_obj_fn = yaffs_remove_obj_callback;
|
||||
|
||||
- init_MUTEX(&(yaffs_dev_to_lc(dev)->grossLock));
|
||||
+ mutex_init(&(yaffs_dev_to_lc(dev)->grossLock));
|
||||
|
||||
yaffs_gross_lock(dev);
|
||||
|
||||
@@ -3268,7 +3268,7 @@ static int yaffs_proc_read(char *page,
|
||||
else {
|
||||
step-=2;
|
||||
|
||||
- down(&yaffs_context_lock);
|
||||
+ mutex_lock(&yaffs_context_lock);
|
||||
|
||||
/* Locate and print the Nth entry. Order N-squared but N is small. */
|
||||
ylist_for_each(item, &yaffs_context_list) {
|
||||
@@ -3287,7 +3287,7 @@ static int yaffs_proc_read(char *page,
|
||||
|
||||
break;
|
||||
}
|
||||
- up(&yaffs_context_lock);
|
||||
+ mutex_unlock(&yaffs_context_lock);
|
||||
}
|
||||
|
||||
return buf - page < count ? buf - page : count;
|
||||
@@ -3301,7 +3301,7 @@ static int yaffs_stats_proc_read(char *p
|
||||
char *buf = page;
|
||||
int n = 0;
|
||||
|
||||
- down(&yaffs_context_lock);
|
||||
+ mutex_lock(&yaffs_context_lock);
|
||||
|
||||
/* Locate and print the Nth entry. Order N-squared but N is small. */
|
||||
ylist_for_each(item, &yaffs_context_list) {
|
||||
@@ -3317,7 +3317,7 @@ static int yaffs_stats_proc_read(char *p
|
||||
dev->bg_gcs, dev->oldest_dirty_gc_count,
|
||||
dev->n_obj, dev->n_tnodes);
|
||||
}
|
||||
- up(&yaffs_context_lock);
|
||||
+ mutex_unlock(&yaffs_context_lock);
|
||||
|
||||
|
||||
return buf - page < count ? buf - page : count;
|
||||
@@ -3494,7 +3494,7 @@ static int __init init_yaffs_fs(void)
|
||||
|
||||
|
||||
|
||||
- init_MUTEX(&yaffs_context_lock);
|
||||
+ mutex_init(&yaffs_context_lock);
|
||||
|
||||
/* Install the proc_fs entries */
|
||||
my_proc_entry = create_proc_entry("yaffs",
|
@ -1,72 +0,0 @@ |
||||
From cd6657c4bde20886b0805ea9f2cbac7ec25ac2e5 Mon Sep 17 00:00:00 2001
|
||||
From: Charles Manning <cdhmanning@gmail.com>
|
||||
Date: Tue, 30 Nov 2010 16:01:28 +1300
|
||||
Subject: [PATCH 1/2] yaffs: Replace yaffs_dir_llseek with Linux generic
|
||||
llseek
|
||||
|
||||
commit ed8188fb7659cfb65b5adbe154d143190ade0324 upstream.
|
||||
|
||||
There was not much point in having the yaffs version as it is
|
||||
functionally equivalent to the kernel one.
|
||||
|
||||
This also gets rid of using BKL in yaffs2.
|
||||
|
||||
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
|
||||
---
|
||||
yaffs_vfs.c | 30 +-----------------------------
|
||||
yaffs_vfs_multi.c | 30 +-----------------------------
|
||||
2 files changed, 2 insertions(+), 58 deletions(-)
|
||||
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -342,8 +342,6 @@ static int yaffs_follow_link(struct dent
|
||||
|
||||
static void yaffs_touch_super(yaffs_dev_t *dev);
|
||||
|
||||
-static loff_t yaffs_dir_llseek(struct file *file, loff_t offset, int origin);
|
||||
-
|
||||
static int yaffs_vfs_setattr(struct inode *, struct iattr *);
|
||||
|
||||
|
||||
@@ -460,7 +458,7 @@ static const struct file_operations yaff
|
||||
.read = generic_read_dir,
|
||||
.readdir = yaffs_readdir,
|
||||
.fsync = yaffs_sync_object,
|
||||
- .llseek = yaffs_dir_llseek,
|
||||
+ .llseek = generic_file_llseek,
|
||||
};
|
||||
|
||||
static const struct super_operations yaffs_super_ops = {
|
||||
@@ -1534,32 +1532,6 @@ static void yaffs_release_space(struct f
|
||||
}
|
||||
|
||||
|
||||
-static loff_t yaffs_dir_llseek(struct file *file, loff_t offset, int origin)
|
||||
-{
|
||||
- long long retval;
|
||||
-
|
||||
- lock_kernel();
|
||||
-
|
||||
- switch (origin){
|
||||
- case 2:
|
||||
- offset += i_size_read(file->f_path.dentry->d_inode);
|
||||
- break;
|
||||
- case 1:
|
||||
- offset += file->f_pos;
|
||||
- }
|
||||
- retval = -EINVAL;
|
||||
-
|
||||
- if (offset >= 0){
|
||||
- if (offset != file->f_pos)
|
||||
- file->f_pos = offset;
|
||||
-
|
||||
- retval = offset;
|
||||
- }
|
||||
- unlock_kernel();
|
||||
- return retval;
|
||||
-}
|
||||
-
|
||||
-
|
||||
static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
|
||||
{
|
||||
yaffs_obj_t *obj;
|
@ -1,110 +0,0 @@ |
||||
From e1537a700c2e750c5eacc5ad93f30821f1e94424 Mon Sep 17 00:00:00 2001
|
||||
From: Charles Manning <cdhmanning@gmail.com>
|
||||
Date: Mon, 15 Aug 2011 11:40:30 +1200
|
||||
Subject: [PATCH 2/2] Mods for Linux 3.0 and fix a typo
|
||||
|
||||
commit a7b5dcf904ba6f7890e4b77ce1f56388b855d0f6 upstream.
|
||||
|
||||
Roll in NCB's patch and some other changes for Linux 3.0.
|
||||
Also fix a dumb type retired_writes->retried_writes
|
||||
|
||||
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
|
||||
---
|
||||
patch-ker.sh | 2 +-
|
||||
yaffs_vfs_glue.c | 42 ++++++++++++++++++++++++++++++++++--------
|
||||
2 files changed, 35 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -72,7 +72,9 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/proc_fs.h>
|
||||
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39))
|
||||
#include <linux/smp_lock.h>
|
||||
+#endif
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/interrupt.h>
|
||||
@@ -236,7 +238,9 @@ static int yaffs_file_flush(struct file
|
||||
static int yaffs_file_flush(struct file *file);
|
||||
#endif
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
+static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync);
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
|
||||
static int yaffs_sync_object(struct file *file, int datasync);
|
||||
#else
|
||||
static int yaffs_sync_object(struct file *file, struct dentry *dentry,
|
||||
@@ -1864,7 +1868,9 @@ static int yaffs_symlink(struct inode *d
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
+static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync)
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
|
||||
static int yaffs_sync_object(struct file *file, int datasync)
|
||||
#else
|
||||
static int yaffs_sync_object(struct file *file, struct dentry *dentry,
|
||||
@@ -3067,7 +3073,13 @@ static int yaffs_internal_read_super_mtd
|
||||
return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL;
|
||||
}
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
+static struct dentry *yaffs_mount(struct file_system_type *fs_type, int flags,
|
||||
+ const char *dev_name, void *data)
|
||||
+{
|
||||
+ return mount_bdev(fs_type, flags, dev_name, data, yaffs_internal_read_super_mtd);
|
||||
+}
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
|
||||
static int yaffs_read_super(struct file_system_type *fs,
|
||||
int flags, const char *dev_name,
|
||||
void *data, struct vfsmount *mnt)
|
||||
@@ -3090,8 +3102,12 @@ static struct super_block *yaffs_read_su
|
||||
static struct file_system_type yaffs_fs_type = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "yaffs",
|
||||
- .get_sb = yaffs_read_super,
|
||||
- .kill_sb = kill_block_super,
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
+ .mount = yaffs_mount,
|
||||
+#else
|
||||
+ .get_sb = yaffs_read_super,
|
||||
+#endif
|
||||
+ .kill_sb = kill_block_super,
|
||||
.fs_flags = FS_REQUIRES_DEV,
|
||||
};
|
||||
#else
|
||||
@@ -3115,7 +3131,13 @@ static int yaffs2_internal_read_super_mt
|
||||
return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL;
|
||||
}
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
+static struct dentry *yaffs2_mount(struct file_system_type *fs_type, int flags,
|
||||
+ const char *dev_name, void *data)
|
||||
+{
|
||||
+ return mount_bdev(fs_type, flags, dev_name, data, yaffs2_internal_read_super_mtd);
|
||||
+}
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
|
||||
static int yaffs2_read_super(struct file_system_type *fs,
|
||||
int flags, const char *dev_name, void *data,
|
||||
struct vfsmount *mnt)
|
||||
@@ -3137,8 +3159,12 @@ static struct super_block *yaffs2_read_s
|
||||
static struct file_system_type yaffs2_fs_type = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "yaffs2",
|
||||
- .get_sb = yaffs2_read_super,
|
||||
- .kill_sb = kill_block_super,
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
|
||||
+ .mount = yaffs2_mount,
|
||||
+#else
|
||||
+ .get_sb = yaffs2_read_super,
|
||||
+#endif
|
||||
+ .kill_sb = kill_block_super,
|
||||
.fs_flags = FS_REQUIRES_DEV,
|
||||
};
|
||||
#else
|
@ -1,54 +0,0 @@ |
||||
--- a/fs/yaffs2/yaffs_mtdif1.c
|
||||
+++ b/fs/yaffs2/yaffs_mtdif1.c
|
||||
@@ -127,7 +127,7 @@ int nandmtd1_WriteChunkWithTagsToNAND(ya
|
||||
#endif
|
||||
|
||||
memset(&ops, 0, sizeof(ops));
|
||||
- ops.mode = MTD_OOB_AUTO;
|
||||
+ ops.mode = MTD_OPS_AUTO_OOB;
|
||||
ops.len = (data) ? chunkBytes : 0;
|
||||
ops.ooblen = YTAG1_SIZE;
|
||||
ops.datbuf = (__u8 *)data;
|
||||
@@ -179,7 +179,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
|
||||
int deleted;
|
||||
|
||||
memset(&ops, 0, sizeof(ops));
|
||||
- ops.mode = MTD_OOB_AUTO;
|
||||
+ ops.mode = MTD_OPS_AUTO_OOB;
|
||||
ops.len = (data) ? chunkBytes : 0;
|
||||
ops.ooblen = YTAG1_SIZE;
|
||||
ops.datbuf = data;
|
||||
--- a/fs/yaffs2/yaffs_mtdif2.c
|
||||
+++ b/fs/yaffs2/yaffs_mtdif2.c
|
||||
@@ -71,7 +71,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya
|
||||
yaffs_PackTags2(&pt, tags, !dev->param.no_tags_ecc);
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
|
||||
- ops.mode = MTD_OOB_AUTO;
|
||||
+ ops.mode = MTD_OPS_AUTO_OOB;
|
||||
ops.ooblen = (dev->param.inband_tags) ? 0 : packed_tags_size;
|
||||
ops.len = dev->param.total_bytes_per_chunk;
|
||||
ops.ooboffs = 0;
|
||||
@@ -136,7 +136,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y
|
||||
retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk,
|
||||
&dummy, data);
|
||||
else if (tags) {
|
||||
- ops.mode = MTD_OOB_AUTO;
|
||||
+ ops.mode = MTD_OPS_AUTO_OOB;
|
||||
ops.ooblen = packed_tags_size;
|
||||
ops.len = data ? dev->data_bytes_per_chunk : packed_tags_size;
|
||||
ops.ooboffs = 0;
|
||||
--- a/fs/yaffs2/yaffs_mtdif.h
|
||||
+++ b/fs/yaffs2/yaffs_mtdif.h
|
||||
@@ -24,4 +24,11 @@ extern struct nand_oobinfo yaffs_noeccin
|
||||
#endif
|
||||
int nandmtd_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
|
||||
int nandmtd_InitialiseNAND(yaffs_dev_t *dev);
|
||||
+
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
|
||||
+#include <mtd/mtd-abi.h>
|
||||
+#else
|
||||
+#define MTD_OPS_AUTO_OOB MTD_OOB_AUTO
|
||||
+#endif
|
||||
+
|
||||
#endif
|
@ -1,78 +0,0 @@ |
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -220,6 +220,29 @@ static struct inode *yaffs_iget(struct s
|
||||
#define yaffs_SuperToDevice(sb) ((yaffs_dev_t *)sb->u.generic_sbp)
|
||||
#endif
|
||||
|
||||
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0))
|
||||
+static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink)
|
||||
+{
|
||||
+ set_nlink(inode, nlink);
|
||||
+}
|
||||
+
|
||||
+static inline void yaffs_dec_link_count(struct inode *inode)
|
||||
+{
|
||||
+ inode_dec_link_count(inode);
|
||||
+}
|
||||
+#else
|
||||
+static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink)
|
||||
+{
|
||||
+ inode->i_nlink = nlink;
|
||||
+}
|
||||
+
|
||||
+static inline void yaffs_dec_link_count(struct inode *inode)
|
||||
+{
|
||||
+ inode->i_nlink--;
|
||||
+ mark_inode_dirty(inode)
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
|
||||
#define update_dir_time(dir) do {\
|
||||
(dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \
|
||||
@@ -1362,7 +1385,7 @@ static void yaffs_fill_inode_from_obj(st
|
||||
inode->i_size = yaffs_get_obj_length(obj);
|
||||
inode->i_blocks = (inode->i_size + 511) >> 9;
|
||||
|
||||
- inode->i_nlink = yaffs_get_obj_link_count(obj);
|
||||
+ yaffs_set_nlink(inode, yaffs_get_obj_link_count(obj));
|
||||
|
||||
T(YAFFS_TRACE_OS,
|
||||
(TSTR("yaffs_fill_inode mode %x uid %d gid %d size %d count %d\n"),
|
||||
@@ -1784,10 +1807,9 @@ static int yaffs_unlink(struct inode *di
|
||||
retVal = yaffs_unlinker(obj, dentry->d_name.name);
|
||||
|
||||
if (retVal == YAFFS_OK) {
|
||||
- dentry->d_inode->i_nlink--;
|
||||
+ yaffs_dec_link_count(dentry->d_inode);
|
||||
dir->i_version++;
|
||||
yaffs_gross_unlock(dev);
|
||||
- mark_inode_dirty(dentry->d_inode);
|
||||
update_dir_time(dir);
|
||||
return 0;
|
||||
}
|
||||
@@ -1818,7 +1840,8 @@ static int yaffs_link(struct dentry *old
|
||||
obj);
|
||||
|
||||
if (link) {
|
||||
- old_dentry->d_inode->i_nlink = yaffs_get_obj_link_count(obj);
|
||||
+ yaffs_set_nlink(old_dentry->d_inode,
|
||||
+ yaffs_get_obj_link_count(obj));
|
||||
d_instantiate(dentry, old_dentry->d_inode);
|
||||
atomic_inc(&old_dentry->d_inode->i_count);
|
||||
T(YAFFS_TRACE_OS,
|
||||
@@ -1937,11 +1960,9 @@ static int yaffs_rename(struct inode *ol
|
||||
yaffs_gross_unlock(dev);
|
||||
|
||||
if (retVal == YAFFS_OK) {
|
||||
- if (target) {
|
||||
- new_dentry->d_inode->i_nlink--;
|
||||
- mark_inode_dirty(new_dentry->d_inode);
|
||||
- }
|
||||
-
|
||||
+ if (target)
|
||||
+ yaffs_dec_link_count(new_dentry->d_inode);
|
||||
+
|
||||
update_dir_time(old_dir);
|
||||
if(old_dir != new_dir)
|
||||
update_dir_time(new_dir);
|
@ -1,71 +0,0 @@ |
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -273,8 +273,13 @@ static int yaffs_sync_object(struct file
|
||||
static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir);
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
+ struct nameidata *n);
|
||||
+#else
|
||||
static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode,
|
||||
struct nameidata *n);
|
||||
+#endif
|
||||
static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
|
||||
struct nameidata *n);
|
||||
#else
|
||||
@@ -286,9 +291,17 @@ static int yaffs_link(struct dentry *old
|
||||
static int yaffs_unlink(struct inode *dir, struct dentry *dentry);
|
||||
static int yaffs_symlink(struct inode *dir, struct dentry *dentry,
|
||||
const char *symname);
|
||||
+
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
|
||||
+#else
|
||||
static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode);
|
||||
+#endif
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
+ dev_t dev);
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
|
||||
dev_t dev);
|
||||
#else
|
||||
@@ -1679,7 +1692,10 @@ out:
|
||||
#define YCRED(x) (x->cred)
|
||||
#endif
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
+ dev_t rdev)
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
|
||||
dev_t rdev)
|
||||
#else
|
||||
@@ -1769,7 +1785,11 @@ static int yaffs_mknod(struct inode *dir
|
||||
return error;
|
||||
}
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
||||
+#else
|
||||
static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
|
||||
+#endif
|
||||
{
|
||||
int retVal;
|
||||
T(YAFFS_TRACE_OS, (TSTR("yaffs_mkdir\n")));
|
||||
@@ -1777,7 +1797,10 @@ static int yaffs_mkdir(struct inode *dir
|
||||
return retVal;
|
||||
}
|
||||
|
||||
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
|
||||
+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
+ struct nameidata *n)
|
||||
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
|
||||
static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode,
|
||||
struct nameidata *n)
|
||||
#else
|
@ -1,160 +0,0 @@ |
||||
--- a/fs/yaffs2/yaffs_mtdif1.c
|
||||
+++ b/fs/yaffs2/yaffs_mtdif1.c
|
||||
@@ -133,7 +133,7 @@ int nandmtd1_WriteChunkWithTagsToNAND(ya
|
||||
ops.datbuf = (__u8 *)data;
|
||||
ops.oobbuf = (__u8 *)&pt1;
|
||||
|
||||
- retval = mtd->write_oob(mtd, addr, &ops);
|
||||
+ retval = mtd_write_oob(mtd, addr, &ops);
|
||||
if (retval) {
|
||||
T(YAFFS_TRACE_MTD,
|
||||
(TSTR("write_oob failed, chunk %d, mtd error %d"TENDSTR),
|
||||
@@ -194,7 +194,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
|
||||
/* Read page and oob using MTD.
|
||||
* Check status and determine ECC result.
|
||||
*/
|
||||
- retval = mtd->read_oob(mtd, addr, &ops);
|
||||
+ retval = mtd_read_oob(mtd, addr, &ops);
|
||||
if (retval) {
|
||||
T(YAFFS_TRACE_MTD,
|
||||
(TSTR("read_oob failed, chunk %d, mtd error %d"TENDSTR),
|
||||
@@ -218,7 +218,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
|
||||
/* fall into... */
|
||||
default:
|
||||
rettags(etags, YAFFS_ECC_RESULT_UNFIXED, 0);
|
||||
- etags->block_bad = (mtd->block_isbad)(mtd, addr);
|
||||
+ etags->block_bad = mtd_block_isbad(mtd, addr);
|
||||
return YAFFS_FAIL;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ int nandmtd1_MarkNANDBlockBad(struct yaf
|
||||
|
||||
T(YAFFS_TRACE_BAD_BLOCKS,(TSTR("marking block %d bad"TENDSTR), block_no));
|
||||
|
||||
- retval = mtd->block_markbad(mtd, (loff_t)blocksize * block_no);
|
||||
+ retval = mtd_block_markbad(mtd, (loff_t)blocksize * block_no);
|
||||
return (retval) ? YAFFS_FAIL : YAFFS_OK;
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ int nandmtd1_QueryNANDBlock(struct yaffs
|
||||
return YAFFS_FAIL;
|
||||
|
||||
retval = nandmtd1_ReadChunkWithTagsFromNAND(dev, chunkNo, NULL, &etags);
|
||||
- etags.block_bad = (mtd->block_isbad)(mtd, addr);
|
||||
+ etags.block_bad = mtd_block_isbad(mtd, addr);
|
||||
if (etags.block_bad) {
|
||||
T(YAFFS_TRACE_BAD_BLOCKS,
|
||||
(TSTR("block %d is marked bad"TENDSTR), block_no));
|
||||
--- a/fs/yaffs2/yaffs_vfs_glue.c
|
||||
+++ b/fs/yaffs2/yaffs_vfs_glue.c
|
||||
@@ -2607,8 +2607,8 @@ static void yaffs_MTDPutSuper(struct sup
|
||||
{
|
||||
struct mtd_info *mtd = yaffs_dev_to_mtd(yaffs_SuperToDevice(sb));
|
||||
|
||||
- if (mtd->sync)
|
||||
- mtd->sync(mtd);
|
||||
+ if (mtd)
|
||||
+ mtd_sync(mtd);
|
||||
|
||||
put_mtd_device(mtd);
|
||||
}
|
||||
--- a/fs/yaffs2/yaffs_mtdif2.c
|
||||
+++ b/fs/yaffs2/yaffs_mtdif2.c
|
||||
@@ -77,7 +77,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya
|
||||
ops.ooboffs = 0;
|
||||
ops.datbuf = (__u8 *)data;
|
||||
ops.oobbuf = (dev->param.inband_tags) ? NULL : packed_tags_ptr;
|
||||
- retval = mtd->write_oob(mtd, addr, &ops);
|
||||
+ retval = mtd_write_oob(mtd, addr, &ops);
|
||||
|
||||
#else
|
||||
if (!dev->param.inband_tags) {
|
||||
@@ -133,7 +133,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
|
||||
if (dev->param.inband_tags || (data && !tags))
|
||||
- retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk,
|
||||
+ retval = mtd_read(mtd, addr, dev->param.total_bytes_per_chunk,
|
||||
&dummy, data);
|
||||
else if (tags) {
|
||||
ops.mode = MTD_OPS_AUTO_OOB;
|
||||
@@ -142,7 +142,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y
|
||||
ops.ooboffs = 0;
|
||||
ops.datbuf = data;
|
||||
ops.oobbuf = yaffs_dev_to_lc(dev)->spareBuffer;
|
||||
- retval = mtd->read_oob(mtd, addr, &ops);
|
||||
+ retval = mtd_read_oob(mtd, addr, &ops);
|
||||
}
|
||||
#else
|
||||
if (!dev->param.inband_tags && data && tags) {
|
||||
@@ -201,7 +201,7 @@ int nandmtd2_MarkNANDBlockBad(struct yaf
|
||||
(TSTR("nandmtd2_MarkNANDBlockBad %d" TENDSTR), block_no));
|
||||
|
||||
retval =
|
||||
- mtd->block_markbad(mtd,
|
||||
+ mtd_block_markbad(mtd,
|
||||
block_no * dev->param.chunks_per_block *
|
||||
dev->param.total_bytes_per_chunk);
|
||||
|
||||
@@ -221,7 +221,7 @@ int nandmtd2_QueryNANDBlock(struct yaffs
|
||||
T(YAFFS_TRACE_MTD,
|
||||
(TSTR("nandmtd2_QueryNANDBlock %d" TENDSTR), block_no));
|
||||
retval =
|
||||
- mtd->block_isbad(mtd,
|
||||
+ mtd_block_isbad(mtd,
|
||||
block_no * dev->param.chunks_per_block *
|
||||
dev->param.total_bytes_per_chunk);
|
||||
|
||||
--- a/fs/yaffs2/yaffs_mtdif.h
|
||||
+++ b/fs/yaffs2/yaffs_mtdif.h
|
||||
@@ -31,4 +31,39 @@ int nandmtd_InitialiseNAND(yaffs_dev_t *
|
||||
#define MTD_OPS_AUTO_OOB MTD_OOB_AUTO
|
||||
#endif
|
||||
|
||||
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0))
|
||||
+static inline int mtd_erase(struct mdt_info *mtd, struct erase_info *ei)
|
||||
+{
|
||||
+ return mtd->erase(mtd, ei);
|
||||
+}
|
||||
+
|
||||
+static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs)
|
||||
+{
|
||||
+ return mtd->block_mark_bad(mtd, ofs);
|
||||
+}
|
||||
+
|
||||
+static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)
|
||||
+{
|
||||
+ return mtd->block_is_bad(mtd, ofs);
|
||||
+}
|
||||
+
|
||||
+static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from,
|
||||
+ struct mtd_oob_ops *ops)
|
||||
+{
|
||||
+ return mtd->read_oob(mtd, from, ops);
|
||||
+}
|
||||
+
|
||||
+static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
|
||||
+ struct mtd_oob_ops *ops)
|
||||
+{
|
||||
+ return mtd->write_oob(mtd, to, ops);
|
||||
+}
|
||||
+
|
||||
+static inline void mtd_sync(struct mtd_info *mtd)
|
||||
+{
|
||||
+ if (mtd->sync)
|
||||
+ mtd->sync(mtd);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#endif
|
||||
--- a/fs/yaffs2/yaffs_mtdif.c
|
||||
+++ b/fs/yaffs2/yaffs_mtdif.c
|
||||
@@ -41,7 +41,7 @@ int nandmtd_EraseBlockInNAND(yaffs_dev_t
|
||||
ei.callback = NULL;
|
||||
ei.priv = (u_long) dev;
|
||||
|
||||
- retval = mtd->erase(mtd, &ei);
|
||||
+ retval = mtd_erase(mtd, &ei);
|
||||
|
||||
if (retval == 0)
|
||||
return YAFFS_OK;
|
Loading…
Reference in new issue