[kernel] refresh generic 2.6.25 patches
[openwrt/svn-archive/archive.git] / target / linux / generic-2.6 / patches-2.6.25 / 210-mini_fo_2.6.25_fixes.patch
1 Index: linux-2.6.25.4/fs/mini_fo/main.c
2 ===================================================================
3 --- linux-2.6.25.4.orig/fs/mini_fo/main.c
4 +++ linux-2.6.25.4/fs/mini_fo/main.c
5 @@ -79,6 +79,7 @@ mini_fo_tri_interpose(dentry_t *hidden_d
6 * of the new inode's fields
7 */
8
9 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
10 /*
11 * original: inode = iget(sb, hidden_inode->i_ino);
12 */
13 @@ -87,6 +88,13 @@ mini_fo_tri_interpose(dentry_t *hidden_d
14 err = -EACCES; /* should be impossible??? */
15 goto out;
16 }
17 +#else
18 + inode = mini_fo_iget(sb, iunique(sb, 25));
19 + if (IS_ERR(inode)) {
20 + err = PTR_ERR(inode);
21 + goto out;
22 + }
23 +#endif
24
25 /*
26 * interpose the inode if not already interposed
27 @@ -184,9 +192,9 @@ mini_fo_parse_options(super_block_t *sb,
28 hidden_root = ERR_PTR(err);
29 goto out;
30 }
31 - hidden_root = nd.dentry;
32 - stopd(sb)->base_dir_dentry = nd.dentry;
33 - stopd(sb)->hidden_mnt = nd.mnt;
34 + hidden_root = nd_get_dentry(&nd);
35 + stopd(sb)->base_dir_dentry = nd_get_dentry(&nd);
36 + stopd(sb)->hidden_mnt = nd_get_mnt(&nd);
37
38 } else if(!strncmp("sto=", options, 4)) {
39 /* parse the storage dir */
40 @@ -204,9 +212,9 @@ mini_fo_parse_options(super_block_t *sb,
41 hidden_root2 = ERR_PTR(err);
42 goto out;
43 }
44 - hidden_root2 = nd2.dentry;
45 - stopd(sb)->storage_dir_dentry = nd2.dentry;
46 - stopd(sb)->hidden_mnt2 = nd2.mnt;
47 + hidden_root2 = nd_get_dentry(&nd2);
48 + stopd(sb)->storage_dir_dentry = nd_get_dentry(&nd2);
49 + stopd(sb)->hidden_mnt2 = nd_get_mnt(&nd2);
50 stohs2(sb) = hidden_root2->d_sb;
51
52 /* validate storage dir, this is done in
53 Index: linux-2.6.25.4/fs/mini_fo/mini_fo.h
54 ===================================================================
55 --- linux-2.6.25.4.orig/fs/mini_fo/mini_fo.h
56 +++ linux-2.6.25.4/fs/mini_fo/mini_fo.h
57 @@ -302,6 +302,10 @@ extern int mini_fo_tri_interpose(dentry_
58 extern int mini_fo_cp_cont(dentry_t *tgt_dentry, struct vfsmount *tgt_mnt,
59 dentry_t *src_dentry, struct vfsmount *src_mnt);
60
61 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
62 +extern struct inode *mini_fo_iget(struct super_block *sb, unsigned long ino);
63 +#endif
64 +
65 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
66 extern int mini_fo_create(inode_t *dir, dentry_t *dentry, int mode, struct nameidata *nd);
67
68 @@ -501,6 +505,29 @@ static inline void double_unlock(struct
69 #endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */
70 #endif /* __KERNEL__ */
71
72 +
73 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
74 +static inline dentry_t *nd_get_dentry(struct nameidata *nd)
75 +{
76 + return (nd->path.dentry);
77 +}
78 +
79 +static inline struct vfsmount *nd_get_mnt(struct nameidata *nd)
80 +{
81 + return (nd->path.mnt);
82 +}
83 +#else
84 +static inline dentry_t *nd_get_dentry(struct nameidata *nd)
85 +{
86 + return (nd->dentry);
87 +}
88 +
89 +static inline struct vfsmount *nd_get_mnt(struct nameidata *nd)
90 +{
91 + return (nd->mnt);
92 +}
93 +#endif
94 +
95 /*
96 * Definitions for user and kernel code
97 */
98 Index: linux-2.6.25.4/fs/mini_fo/super.c
99 ===================================================================
100 --- linux-2.6.25.4.orig/fs/mini_fo/super.c
101 +++ linux-2.6.25.4/fs/mini_fo/super.c
102 @@ -262,10 +262,31 @@ mini_fo_umount_begin(super_block_t *sb)
103 }
104 #endif
105
106 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
107 +struct inode *
108 +mini_fo_iget(struct super_block *sb, unsigned long ino)
109 +{
110 + struct inode *inode;
111 +
112 + inode = iget_locked(sb, ino);
113 + if (!inode)
114 + return ERR_PTR(-ENOMEM);
115 +
116 + if (!(inode->i_state & I_NEW))
117 + return inode;
118 +
119 + mini_fo_read_inode(inode);
120 +
121 + unlock_new_inode(inode);
122 + return inode;
123 +}
124 +#endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) */
125
126 struct super_operations mini_fo_sops =
127 {
128 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
129 read_inode: mini_fo_read_inode,
130 +#endif
131 #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA)
132 write_inode: mini_fo_write_inode,
133 #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */
134 Index: linux-2.6.25.4/fs/mini_fo/aux.c
135 ===================================================================
136 --- linux-2.6.25.4.orig/fs/mini_fo/aux.c
137 +++ linux-2.6.25.4/fs/mini_fo/aux.c
138 @@ -164,11 +164,11 @@ dentry_t *bpath_walk(super_block_t *sb,
139 err = vfs_path_lookup(mnt->mnt_root, mnt, bpath+1, 0, &nd);
140
141 /* validate */
142 - if (err || !nd.dentry || !nd.dentry->d_inode) {
143 + if (err || !nd_get_dentry(&nd) || !nd_get_dentry(&nd)->d_inode) {
144 printk(KERN_CRIT "mini_fo: bpath_walk: path_walk failed.\n");
145 return NULL;
146 }
147 - return nd.dentry;
148 + return nd_get_dentry(&nd);
149 }
150
151