wok-stable view shfs/stuff/shfs-0.35-2.6.24.2.u @ rev 422
Web site url for slitaz-loram*
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu Mar 13 13:09:24 2008 +0100 (2008-03-13) |
parents | |
children |
line source
1 --- shfs/Linux-2.6/dcache.c
2 +++ shfs/Linux-2.6/dcache.c
3 @@ -68,7 +68,7 @@ shfs_invalidate_dircache_entries(struct
4 spin_lock(&dcache_lock);
5 next = parent->d_subdirs.next;
6 while (next != &parent->d_subdirs) {
7 - dentry = list_entry(next, struct dentry, d_child);
8 + dentry = list_entry(next, struct dentry, d_u.d_child);
9 dentry->d_fsdata = NULL;
10 shfs_age_dentry(info, dentry);
11 next = next->next;
12 @@ -101,7 +101,7 @@ shfs_dget_fpos(struct dentry *dentry, st
13 spin_lock(&dcache_lock);
14 next = parent->d_subdirs.next;
15 while (next != &parent->d_subdirs) {
16 - dent = list_entry(next, struct dentry, d_child);
17 + dent = list_entry(next, struct dentry, d_u.d_child);
18 if ((unsigned long)dent->d_fsdata == fpos) {
19 if (dent->d_inode)
20 dget_locked(dent);
21 --- shfs/Linux-2.6/dir.c
22 +++ shfs/Linux-2.6/dir.c
23 @@ -300,8 +300,8 @@ shfs_create(struct inode* dir, struct de
25 shfs_invalid_dir_cache(dir);
26 result = shfs_instantiate(dentry);
27 - if (forced_write && dentry->d_inode && dentry->d_inode->u.generic_ip)
28 - ((struct shfs_inode_info *)dentry->d_inode->u.generic_ip)->unset_write_on_close = 1;
29 + if (forced_write && dentry->d_inode && dentry->d_inode->i_private)
30 + ((struct shfs_inode_info *)dentry->d_inode->i_private)->unset_write_on_close = 1;
31 return result;
32 }
34 @@ -488,7 +488,7 @@ shfs_d_delete(struct dentry *dentry)
35 return 0;
36 }
38 -static struct dentry_operations shfs_dentry_operations = {
39 +struct dentry_operations shfs_dentry_operations = {
40 .d_revalidate = shfs_d_revalidate,
41 .d_delete = shfs_d_delete,
42 };
43 --- shfs/Linux-2.6/fcache.c
44 +++ shfs/Linux-2.6/fcache.c
45 @@ -29,12 +29,12 @@ struct shfs_file {
46 char *data;
47 };
49 -kmem_cache_t *file_cache = NULL;
50 +struct kmem_cache *file_cache = NULL;
52 void
53 fcache_init(void)
54 {
55 - file_cache = kmem_cache_create("shfs_file", sizeof(struct shfs_file), 0, 0, NULL, NULL);
56 + file_cache = kmem_cache_create("shfs_file", sizeof(struct shfs_file), 0, 0, NULL);
57 DEBUG("file_cache: %p\n", file_cache);
58 }
60 @@ -100,7 +100,7 @@ fcache_file_open(struct file *f)
61 VERBOSE("dir in file cache?\n");
62 return -EINVAL;
63 }
64 - p = (struct shfs_inode_info *)inode->u.generic_ip;
65 + p = (struct shfs_inode_info *)inode->i_private;
66 if (!p) {
67 VERBOSE("inode without info\n");
68 return -EINVAL;
69 @@ -127,7 +127,7 @@ fcache_file_sync(struct file *f)
70 VERBOSE("dir in file cache?\n");
71 return -EINVAL;
72 }
73 - p = (struct shfs_inode_info *)inode->u.generic_ip;
74 + p = (struct shfs_inode_info *)inode->i_private;
75 if (!p) {
76 VERBOSE("inode without info\n");
77 return -EINVAL;
78 @@ -160,7 +160,7 @@ fcache_file_close(struct file *f)
79 if (result == 0) {
80 struct shfs_inode_info *p;
82 - p = (struct shfs_inode_info *)f->f_dentry->d_inode->u.generic_ip;
83 + p = (struct shfs_inode_info *)f->f_dentry->d_inode->i_private;
84 if (!p) {
85 VERBOSE("inode without info\n");
86 return -EINVAL;
87 @@ -184,7 +184,7 @@ fcache_file_clear(struct inode *inode)
88 return -EINVAL;
89 }
90 DEBUG("ino: %lu\n", inode->i_ino);
91 - p = (struct shfs_inode_info *)inode->u.generic_ip;
92 + p = (struct shfs_inode_info *)inode->i_private;
93 if (!p) {
94 VERBOSE("inode without info\n");
95 return -EINVAL;
96 @@ -226,7 +226,7 @@ fcache_file_read(struct file *f, unsigne
97 VERBOSE("dir in file cache?\n");
98 return -EINVAL;
99 }
100 - p = (struct shfs_inode_info *)inode->u.generic_ip;
101 + p = (struct shfs_inode_info *)inode->i_private;
102 if (!p) {
103 VERBOSE("inode without info\n");
104 return -EINVAL;
105 @@ -327,7 +327,7 @@ fcache_file_write(struct file *f, unsign
106 VERBOSE("dir in file cache?\n");
107 return -EINVAL;
108 }
109 - p = (struct shfs_inode_info *)inode->u.generic_ip;
110 + p = (struct shfs_inode_info *)inode->i_private;
111 if (!p) {
112 VERBOSE("inode without info\n");
113 return -EINVAL;
114 --- shfs/Linux-2.6/file.c
115 +++ shfs/Linux-2.6/file.c
116 @@ -90,7 +90,7 @@ shfs_file_commitwrite(struct file *f, st
117 struct dentry *dentry = f->f_dentry;
118 struct shfs_sb_info *info = info_from_dentry(dentry);
119 struct inode *inode = p->mapping->host;
120 - struct shfs_inode_info *i = (struct shfs_inode_info *)inode->u.generic_ip;
121 + struct shfs_inode_info *i = (struct shfs_inode_info *)inode->i_private;
122 char *buffer = kmap(p) + offset;
123 int written = 0, result;
124 unsigned count = to - offset;
125 @@ -199,7 +199,7 @@ shfs_file_open(struct inode *inode, stru
126 }
128 static int
129 -shfs_file_flush(struct file *f)
130 +shfs_file_flush(struct file *f, fl_owner_t id)
131 {
132 struct dentry *dentry = f->f_dentry;
133 struct shfs_sb_info *info = info_from_dentry(dentry);
134 @@ -242,8 +242,8 @@ shfs_file_release(struct inode *inode, s
135 }
136 }
137 /* if file was forced to be writeable, change attrs back on close */
138 - if (dentry->d_inode && dentry->d_inode->u.generic_ip) {
139 - if (((struct shfs_inode_info *)dentry->d_inode->u.generic_ip)->unset_write_on_close) {
140 + if (dentry->d_inode && dentry->d_inode->i_private) {
141 + if (((struct shfs_inode_info *)dentry->d_inode->i_private)->unset_write_on_close) {
142 char name[SHFS_PATH_MAX];
144 if (get_name(dentry, name) < 0)
145 @@ -292,7 +292,9 @@ shfs_slow_read(struct file *f, char *buf
146 goto error;
147 }
148 if (result != 0) {
149 - copy_to_user(buf, (char *)page, result);
150 + if (copy_to_user(buf, (char *)page, result)) {
151 + goto error;
152 + }
153 *ppos += result;
154 }
155 error:
156 @@ -309,9 +311,9 @@ shfs_slow_write(struct file *f, const ch
157 int result;
159 DEBUG("\n");
160 - written = generic_file_write(f, buf, count, offset);
161 + written = do_sync_write(f, buf, count, offset);
162 if (written > 0) {
163 - result = shfs_file_flush(f);
164 + result = shfs_file_flush(f, 0);
165 written = result < 0 ? result: written;
166 }
168 @@ -320,8 +322,8 @@ shfs_slow_write(struct file *f, const ch
170 struct file_operations shfs_file_operations = {
171 .llseek = generic_file_llseek,
172 - .read = generic_file_read,
173 - .write = generic_file_write,
174 + .read = do_sync_read,
175 + .write = do_sync_write,
176 .ioctl = shfs_ioctl,
177 .mmap = generic_file_mmap,
178 .open = shfs_file_open,
179 --- shfs/Linux-2.6/inode.c
180 +++ shfs/Linux-2.6/inode.c
181 @@ -29,13 +29,13 @@ int debug_level;
182 unsigned long alloc;
183 #endif
185 -kmem_cache_t *inode_cache = NULL;
186 +struct kmem_cache *inode_cache = NULL;
188 void
189 shfs_set_inode_attr(struct inode *inode, struct shfs_fattr *fattr)
190 {
191 struct shfs_sb_info *info = info_from_inode(inode);
192 - struct shfs_inode_info *i = inode->u.generic_ip;
193 + struct shfs_inode_info *i = inode->i_private;
194 struct timespec last_time = inode->i_mtime;
195 loff_t last_size = inode->i_size;
197 @@ -52,7 +52,8 @@ shfs_set_inode_attr(struct inode *inode,
198 inode->i_ctime = fattr->f_ctime;
199 inode->i_atime = fattr->f_atime;
200 inode->i_mtime = fattr->f_mtime;
201 - inode->i_blksize= fattr->f_blksize;
202 + //inode->i_blksize= fattr->f_blksize;
203 + inode->i_blkbits= 12; // 4K
204 inode->i_blocks = fattr->f_blocks;
205 inode->i_size = fattr->f_size;
207 @@ -60,7 +61,7 @@ shfs_set_inode_attr(struct inode *inode,
209 if (!timespec_equal(&inode->i_mtime, &last_time) || inode->i_size != last_size) {
210 DEBUG("inode changed (%ld/%ld, %lu/%lu)\n", inode->i_mtime.tv_sec, last_time.tv_sec, (unsigned long)inode->i_size, (unsigned long)last_size);
211 - invalidate_inode_pages(inode->i_mapping);
212 + invalidate_mapping_pages(inode->i_mapping, 0, ~0UL);
213 fcache_file_clear(inode);
214 }
215 }
216 @@ -75,7 +76,7 @@ shfs_iget(struct super_block *sb, struct
217 if (!inode)
218 return NULL;
219 inode->i_ino = fattr->f_ino;
220 - i = inode->u.generic_ip = (struct shfs_inode_info *)KMEM_ALLOC("inode", inode_cache, GFP_KERNEL);
221 + i = inode->i_private = (struct shfs_inode_info *)KMEM_ALLOC("inode", inode_cache, GFP_KERNEL);
222 if (!i)
223 return NULL;
224 i->cache = NULL;
225 @@ -107,7 +108,7 @@ shfs_delete_inode(struct inode *inode)
226 struct shfs_inode_info *i;
228 DEBUG("ino: %lu\n", inode->i_ino);
229 - i = (struct shfs_inode_info *)inode->u.generic_ip;
230 + i = (struct shfs_inode_info *)inode->i_private;
231 if (!i) {
232 VERBOSE("invalid inode\n");
233 goto out;
234 @@ -158,7 +159,7 @@ shfs_refresh_inode(struct dentry *dentry
235 * But we do want to invalidate the caches ...
236 */
237 if (!S_ISDIR(inode->i_mode))
238 - invalidate_inode_pages(inode->i_mapping);
239 + invalidate_mapping_pages(inode->i_mapping, 0, ~0UL);
240 else
241 shfs_invalid_dir_cache(inode);
242 result = -EIO;
243 @@ -172,7 +173,7 @@ shfs_revalidate_inode(struct dentry *den
244 {
245 struct shfs_sb_info *info = info_from_dentry(dentry);
246 struct inode *inode = dentry->d_inode;
247 - struct shfs_inode_info *i = (struct shfs_inode_info *)inode->u.generic_ip;
248 + struct shfs_inode_info *i = (struct shfs_inode_info *)inode->i_private;
249 int result;
251 DEBUG("%s\n", dentry->d_name.name);
252 @@ -337,11 +338,11 @@ out:
253 return -EINVAL;
254 }
256 -static struct super_block *
257 +static int
258 shfs_get_sb(struct file_system_type *fs_type,
259 - int flags, const char *dev_name, void *data)
260 + int flags, const char *dev_name, void *data, struct vfsmount *mnt)
261 {
262 - return get_sb_nodev(fs_type, flags, data, shfs_read_super);
263 + return get_sb_nodev(fs_type, flags, data, shfs_read_super, mnt);
264 }
266 static struct file_system_type sh_fs_type = {
267 @@ -356,7 +357,7 @@ init_shfs(void)
268 {
269 printk(KERN_NOTICE "SHell File System, (c) 2002-2004 Miroslav Spousta\n");
270 fcache_init();
271 - inode_cache = kmem_cache_create("shfs_inode", sizeof(struct shfs_inode_info), 0, 0, NULL, NULL);
272 + inode_cache = kmem_cache_create("shfs_inode", sizeof(struct shfs_inode_info), 0, 0, NULL);
274 debug_level = 0;
275 #ifdef ENABLE_DEBUG
276 --- shfs/Linux-2.6/proc.c
277 +++ shfs/Linux-2.6/proc.c
278 @@ -148,6 +148,7 @@ int
279 sock_write(struct shfs_sb_info *info, const void *buffer, int count)
280 {
281 struct file *f = info->sock;
282 + struct kiocb kiocb;
283 mm_segment_t fs;
284 int c, result = 0;
285 unsigned long flags, sigpipe;
286 @@ -173,12 +174,13 @@ sock_write(struct shfs_sb_info *info, co
287 SIGRECALC;
288 SIGUNLOCK(flags);
290 + init_sync_kiocb(&kiocb, f);
291 do {
292 struct iovec vec[1];
294 vec[0].iov_base = (void *)buffer;
295 vec[0].iov_len = c;
296 - result = f->f_op->writev(f, (const struct iovec *) &vec, 1, &f->f_pos);
297 + result = f->f_op->aio_write(&kiocb, (const struct iovec *) &vec, 1, f->f_pos);
298 if (result < 0) {
299 DEBUG("error: %d\n", result);
300 if (result == -EAGAIN)
301 @@ -218,6 +220,7 @@ int
302 sock_read(struct shfs_sb_info *info, void *buffer, int count)
303 {
304 struct file *f = info->sock;
305 + struct kiocb kiocb;
306 mm_segment_t fs;
307 int c, result = 0;
308 unsigned long flags, sigpipe;
309 @@ -256,12 +259,13 @@ sock_read(struct shfs_sb_info *info, voi
310 fs = get_fs();
311 set_fs(get_ds());
313 + init_sync_kiocb(&kiocb, f);
314 do {
315 struct iovec vec[1];
317 vec[0].iov_base = buffer;
318 vec[0].iov_len = c;
319 - result = f->f_op->readv(f, (const struct iovec *)&vec, 1, &f->f_pos);
320 + result = f->f_op->aio_read(&kiocb, (const struct iovec *) &vec, 1, f->f_pos);
321 if (!result) {
322 /* peer has closed socket */
323 result = -EIO;
324 @@ -302,6 +306,7 @@ int
325 sock_readln(struct shfs_sb_info *info, char *buffer, int count)
326 {
327 struct file *f = info->sock;
328 + struct kiocb kiocb;
329 mm_segment_t fs;
330 int c, l = 0, result;
331 char *nl;
332 @@ -315,6 +320,7 @@ sock_readln(struct shfs_sb_info *info, c
333 if (result < 0)
334 return result;
335 }
336 + init_sync_kiocb(&kiocb, f);
337 while (1) {
338 struct iovec vec[1];
340 @@ -350,7 +356,7 @@ sock_readln(struct shfs_sb_info *info, c
342 vec[0].iov_base = BUFFER+LEN;
343 vec[0].iov_len = c;
344 - result = f->f_op->readv(f, (const struct iovec *)&vec, 1, &f->f_pos);
345 + result = f->f_op->aio_read(&kiocb, (const struct iovec *) &vec, 1, f->f_pos);
346 SIGLOCK(flags);
347 if (result == -EPIPE && !sigpipe) {
348 sigdelset(¤t->pending.signal, SIGPIPE);
349 @@ -571,9 +577,9 @@ error:
350 }
352 int
353 -shfs_statfs(struct super_block *sb, struct kstatfs *attr)
354 +shfs_statfs(struct dentry *dentry, struct kstatfs *attr)
355 {
356 - struct shfs_sb_info *info = info_from_sb(sb);
357 + struct shfs_sb_info *info = info_from_sb(dentry->d_sb);
359 DEBUG("\n");
360 return info->fops.statfs(info, attr);
361 --- shfs/Linux-2.6/shfs_debug.h
362 +++ shfs/Linux-2.6/shfs_debug.h
363 @@ -19,7 +19,7 @@ extern int debug_level;
364 extern unsigned long alloc;
366 static inline void *
367 -__kmem_malloc_debug(char *s, kmem_cache_t *cache, int flags)
368 +__kmem_malloc_debug(char *s, struct kmem_cache *cache, int flags)
369 {
370 if (debug_level >= SHFS_ALLOC) {
371 void *x = kmem_cache_alloc(cache, flags);
372 @@ -32,7 +32,7 @@ __kmem_malloc_debug(char *s, kmem_cache_
373 }
375 static inline void
376 -__kmem_free_debug(char *s, kmem_cache_t *cache, void *p)
377 +__kmem_free_debug(char *s, struct kmem_cache *cache, void *p)
378 {
379 if (debug_level >= SHFS_ALLOC) {
380 VERBOSE("free (%s): %p\n", s, p);
381 --- shfs/Linux-2.6/shfs_fs.h
382 +++ shfs/Linux-2.6/shfs_fs.h
383 @@ -74,10 +74,10 @@ int shfs_fill_cache(struct file*, void*,
385 /* shfs/fcache.c */
386 #include <linux/slab.h>
387 -extern kmem_cache_t *file_cache;
388 -extern kmem_cache_t *dir_head_cache;
389 -extern kmem_cache_t *dir_entry_cache;
390 -extern kmem_cache_t *dir_name_cache;
391 +extern struct kmem_cache *file_cache;
392 +extern struct kmem_cache *dir_head_cache;
393 +extern struct kmem_cache *dir_entry_cache;
394 +extern struct kmem_cache *dir_name_cache;
395 void fcache_init(void);
396 void fcache_finish(void);
397 int fcache_file_open(struct file*);
398 @@ -101,7 +101,7 @@ int reply(char *s);
399 void set_garbage(struct shfs_sb_info *info, int write, int count);
400 int get_name(struct dentry *d, char *name);
401 int shfs_notify_change(struct dentry *dentry, struct iattr *attr);
402 -int shfs_statfs(struct super_block *sb, struct kstatfs *attr);
403 +int shfs_statfs(struct dentry *dentry, struct kstatfs *attr);
405 /* shfs/inode.c */
406 void shfs_set_inode_attr(struct inode *inode, struct shfs_fattr *fattr);
407 --- shfs/Linux-2.6/symlink.c
408 +++ shfs/Linux-2.6/symlink.c
409 @@ -41,7 +41,7 @@ error:
410 return result;
411 }
413 -static int
414 +static void *
415 shfs_follow_link(struct dentry *dentry, struct nameidata *nd)
416 {
417 struct shfs_sb_info *info = info_from_dentry(dentry);
418 @@ -51,7 +51,6 @@ shfs_follow_link(struct dentry *dentry,
420 DEBUG("%s\n", dentry->d_name.name);
422 - result = -ENAMETOOLONG;
423 if (get_name(dentry, name) < 0)
424 goto error;
426 @@ -59,9 +58,9 @@ shfs_follow_link(struct dentry *dentry,
427 if (result < 0)
428 goto error;
429 DEBUG("%s\n", real_name);
430 - result = vfs_follow_link(nd, real_name);
431 + nd_set_link(nd, real_name);
432 error:
433 - return result;
434 + return NULL;
435 }
437 struct inode_operations shfs_symlink_inode_operations = {