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