linux/generic: add kernel 2.6.36 preliminary support
[openwrt.git] / target / linux / generic / patches-2.6.25 / 512-yaffs_2.6.25_fix.patch
1 --- a/fs/yaffs2/yaffs_fs.c
2 +++ b/fs/yaffs2/yaffs_fs.c
3 @@ -181,7 +181,13 @@ static int yaffs_statfs(struct super_blo
4 #else
5 static int yaffs_statfs(struct super_block *sb, struct statfs *buf);
6 #endif
7 +
8 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
9 +static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino);
10 +#else
11 static void yaffs_read_inode(struct inode *inode);
12 +#endif
13 +
14
15 static void yaffs_put_inode(struct inode *inode);
16 static void yaffs_delete_inode(struct inode *);
17 @@ -284,7 +290,9 @@ static struct file_operations yaffs_dir_
18
19 static struct super_operations yaffs_super_ops = {
20 .statfs = yaffs_statfs,
21 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
22 .read_inode = yaffs_read_inode,
23 +#endif
24 .put_inode = yaffs_put_inode,
25 .put_super = yaffs_put_super,
26 .delete_inode = yaffs_delete_inode,
27 @@ -844,11 +852,17 @@ struct inode *yaffs_get_inode(struct sup
28 T(YAFFS_TRACE_OS,
29 (KERN_DEBUG "yaffs_get_inode for object %d\n", obj->objectId));
30
31 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
32 + inode = yaffs_iget(sb, obj->objectId);
33 + if (IS_ERR(inode))
34 + return NULL;
35 +#else
36 inode = iget(sb, obj->objectId);
37
38 /* NB Side effect: iget calls back to yaffs_read_inode(). */
39 /* iget also increments the inode's i_count */
40 /* NB You can't be holding grossLock or deadlock will happen! */
41 +#endif
42
43 return inode;
44 }
45 @@ -1427,6 +1441,39 @@ static int yaffs_sync_fs(struct super_bl
46 }
47
48
49 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
50 +static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino)
51 +{
52 + yaffs_Object *obj;
53 + yaffs_Device *dev = yaffs_SuperToDevice(sb);
54 + struct inode *inode;
55 +
56 + T(YAFFS_TRACE_OS,
57 + (KERN_DEBUG "yaffs_iget for %lu\n", ino));
58 +
59 + inode = iget_locked(sb, ino);
60 + if (!inode)
61 + return ERR_PTR(-ENOMEM);
62 + if (!(inode->i_state & I_NEW))
63 + return inode;
64 +
65 + /* NB This is called as a side effect of other functions, but
66 + * we had to release the lock to prevent deadlocks, so
67 + * need to lock again.
68 + */
69 +
70 + yaffs_GrossLock(dev);
71 +
72 + obj = yaffs_FindObjectByNumber(dev, inode->i_ino);
73 +
74 + yaffs_FillInodeFromObject(inode, obj);
75 +
76 + yaffs_GrossUnlock(dev);
77 +
78 + unlock_new_inode(inode);
79 + return inode;
80 +}
81 +#else
82 static void yaffs_read_inode(struct inode *inode)
83 {
84 /* NB This is called as a side effect of other functions, but
85 @@ -1448,6 +1495,7 @@ static void yaffs_read_inode(struct inod
86
87 yaffs_GrossUnlock(dev);
88 }
89 +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) */
90
91 static LIST_HEAD(yaffs_dev_list);
92
This page took 0.046717 seconds and 5 git commands to generate.