4 # Node ID 5b8914cfe0fb7ccfb6e7f61512374d8541f2a193
5 # Parent 81a85541800582144b7381e0b022c10245facc61
6 Fix kernel module compile for 2.6.24
8 --- a/kernel/dir.c Wed Dec 12 14:33:17 2007 +0000
9 +++ b/kernel/dir.c Wed Dec 12 18:59:43 2007 +0000
10 @@ -191,7 +191,7 @@ static int invalid_nodeid(u64 nodeid)
11 return !nodeid || nodeid == FUSE_ROOT_ID;
14 -static struct dentry_operations fuse_dentry_operations = {
15 +struct dentry_operations fuse_dentry_operations = {
16 .d_revalidate = fuse_dentry_revalidate,
19 @@ -378,6 +378,7 @@ static int fuse_create_open(struct inode
21 fuse_put_request(fc, forget_req);
22 d_instantiate(entry, inode);
23 + fuse_invalidate_attr(dir);
24 fuse_change_timeout(entry, &outentry);
25 file = lookup_instantiate_filp(nd, entry, generic_file_open);
27 @@ -619,6 +620,9 @@ static int fuse_rename(struct inode *old
28 err = req->out.h.error;
29 fuse_put_request(fc, req);
32 + fuse_invalidate_attr(oldent->d_inode);
34 fuse_invalidate_attr(olddir);
36 fuse_invalidate_attr(newdir);
37 --- a/kernel/fuse_i.h Wed Dec 12 14:33:17 2007 +0000
38 +++ b/kernel/fuse_i.h Wed Dec 12 18:59:43 2007 +0000
41 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
42 # define KERNEL_2_6_23_PLUS
44 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
45 +# define KERNEL_2_6_24_PLUS
48 #if defined(__arm__) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
49 @@ -647,3 +650,5 @@ int fuse_valid_type(int m);
50 * Is task allowed to perform filesystem operation?
52 int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task);
54 +extern struct dentry_operations fuse_dentry_operations;
55 --- a/kernel/inode.c Wed Dec 12 14:33:17 2007 +0000
56 +++ b/kernel/inode.c Wed Dec 12 18:59:43 2007 +0000
57 @@ -520,21 +520,26 @@ static struct inode *get_root_inode(stru
58 #ifdef HAVE_EXPORTFS_H
59 #include <linux/exportfs.h>
61 -static struct dentry *fuse_get_dentry(struct super_block *sb, void *vobjp)
63 +struct fuse_inode_handle
65 - __u32 *objp = vobjp;
66 - unsigned long nodeid = objp[0];
67 - __u32 generation = objp[1];
72 +static struct dentry *fuse_get_dentry(struct super_block *sb,
73 + struct fuse_inode_handle *handle)
79 + if (handle->nodeid == 0)
80 return ERR_PTR(-ESTALE);
82 - inode = ilookup5(sb, nodeid, fuse_inode_eq, &nodeid);
83 + inode = ilookup5(sb, handle->nodeid, fuse_inode_eq, &handle->nodeid);
85 return ERR_PTR(-ESTALE);
86 - if (inode->i_generation != generation) {
87 + if (inode->i_generation != handle->generation) {
89 return ERR_PTR(-ESTALE);
91 @@ -544,42 +549,130 @@ static struct dentry *fuse_get_dentry(st
93 return ERR_PTR(-ENOMEM);
95 + entry->d_op = &fuse_dentry_operations;
100 -static int fuse_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len,
102 +static int fuse_encode_fh(struct dentry *dentry, u32 *fh, int *max_len,
105 struct inode *inode = dentry->d_inode;
111 - if (len < 2 || (connectable && len < 4))
113 + if (len < 3 || (connectable && len < 6))
117 - fh[0] = get_fuse_inode(inode)->nodeid;
118 - fh[1] = inode->i_generation;
119 + nodeid = get_fuse_inode(inode)->nodeid;
120 + generation = inode->i_generation;
123 + fh[0] = (u32)(nodeid >> 32);
124 + fh[1] = (u32)(nodeid & 0xffffffff);
125 + fh[2] = generation;
127 if (connectable && !S_ISDIR(inode->i_mode)) {
128 struct inode *parent;
130 spin_lock(&dentry->d_lock);
131 parent = dentry->d_parent->d_inode;
132 - fh[2] = get_fuse_inode(parent)->nodeid;
133 - fh[3] = parent->i_generation;
134 + nodeid = get_fuse_inode(parent)->nodeid;
135 + generation = parent->i_generation;
137 + fh[3] = (u32)(nodeid >> 32);
138 + fh[4] = (u32)(nodeid & 0xffffffff);
139 + fh[5] = generation;
140 spin_unlock(&dentry->d_lock);
151 +#ifdef KERNEL_2_6_24_PLUS
152 +static struct dentry *fuse_fh_to_dentry(struct super_block *sb,
153 + struct fid *fid, int fh_len, int fh_type)
155 + struct fuse_inode_handle handle;
157 + if (fh_len < 3 || fh_type > 2)
160 + handle.nodeid = (u64) fid->raw[0] << 32;
161 + handle.nodeid |= (u64) fid->raw[1];
162 + handle.generation = fid->raw[2];
163 + return fuse_get_dentry(sb, &handle);
166 +static struct dentry *fuse_fh_to_parent(struct super_block *sb,
167 + struct fid *fid, int fh_len, int fh_type)
169 + struct fuse_inode_handle parent;
171 + if (fh_type != 2 || fh_len < 6)
174 + parent.nodeid = (u64) fid->raw[3] << 32;
175 + parent.nodeid |= (u64) fid->raw[4];
176 + parent.generation = fid->raw[5];
177 + return fuse_get_dentry(sb, &parent);
181 +static const struct export_operations fuse_export_operations = {
182 + .fh_to_dentry = fuse_fh_to_dentry,
183 + .fh_to_parent = fuse_fh_to_parent,
184 + .encode_fh = fuse_encode_fh,
187 +static struct dentry *fuse_get_dentry_old(struct super_block *sb, void *objp)
189 + return fuse_get_dentry(sb, objp);
192 +static struct dentry *fuse_decode_fh(struct super_block *sb, u32 *fh,
193 + int fh_len, int fileid_type,
194 + int (*acceptable)(void *context, struct dentry *de),
197 + struct fuse_inode_handle handle;
198 + struct fuse_inode_handle parent;
200 + if (fh_len < 3 || fileid_type > 2)
203 + if (fileid_type == 2) {
207 + parent.nodeid = (u64) fh[3] << 32;
208 + parent.nodeid |= (u64) fh[4];
209 + parent.generation = fh[5];
212 + parent.generation = 0;
215 + handle.nodeid = (u64) fh[0] << 32;
216 + handle.nodeid |= (u64) fh[1];
217 + handle.generation = fh[2];
219 + return ret = fuse_export_operations.
220 + find_exported_dentry(sb, &handle, &parent, acceptable, context);
223 static struct export_operations fuse_export_operations = {
224 - .get_dentry = fuse_get_dentry,
225 + .get_dentry = fuse_get_dentry_old,
226 .encode_fh = fuse_encode_fh,
227 + .decode_fh = fuse_decode_fh,
232 static struct super_operations fuse_super_operations = {
233 @@ -845,8 +938,12 @@ static decl_subsys(fuse, NULL, NULL);
234 static decl_subsys(fuse, NULL, NULL);
235 static decl_subsys(connections, NULL, NULL);
237 +#ifdef KERNEL_2_6_24_PLUS
238 +static void fuse_inode_init_once(struct kmem_cache *cachep, void *foo)
240 static void fuse_inode_init_once(void *foo, struct kmem_cache *cachep,
244 struct inode * inode = foo;