wok diff shfs/stuff/shfs-0.35-2.6.24.2.u @ rev 427
Up: slitaz-boot-scripts-1.7.2
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu Mar 13 17:38:39 2008 +0100 (2008-03-13) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/shfs/stuff/shfs-0.35-2.6.24.2.u Thu Mar 13 17:38:39 2008 +0100 1.3 @@ -0,0 +1,437 @@ 1.4 +--- shfs/Linux-2.6/dcache.c 1.5 ++++ shfs/Linux-2.6/dcache.c 1.6 +@@ -68,7 +68,7 @@ shfs_invalidate_dircache_entries(struct 1.7 + spin_lock(&dcache_lock); 1.8 + next = parent->d_subdirs.next; 1.9 + while (next != &parent->d_subdirs) { 1.10 +- dentry = list_entry(next, struct dentry, d_child); 1.11 ++ dentry = list_entry(next, struct dentry, d_u.d_child); 1.12 + dentry->d_fsdata = NULL; 1.13 + shfs_age_dentry(info, dentry); 1.14 + next = next->next; 1.15 +@@ -101,7 +101,7 @@ shfs_dget_fpos(struct dentry *dentry, st 1.16 + spin_lock(&dcache_lock); 1.17 + next = parent->d_subdirs.next; 1.18 + while (next != &parent->d_subdirs) { 1.19 +- dent = list_entry(next, struct dentry, d_child); 1.20 ++ dent = list_entry(next, struct dentry, d_u.d_child); 1.21 + if ((unsigned long)dent->d_fsdata == fpos) { 1.22 + if (dent->d_inode) 1.23 + dget_locked(dent); 1.24 +--- shfs/Linux-2.6/dir.c 1.25 ++++ shfs/Linux-2.6/dir.c 1.26 +@@ -300,8 +300,8 @@ shfs_create(struct inode* dir, struct de 1.27 + 1.28 + shfs_invalid_dir_cache(dir); 1.29 + result = shfs_instantiate(dentry); 1.30 +- if (forced_write && dentry->d_inode && dentry->d_inode->u.generic_ip) 1.31 +- ((struct shfs_inode_info *)dentry->d_inode->u.generic_ip)->unset_write_on_close = 1; 1.32 ++ if (forced_write && dentry->d_inode && dentry->d_inode->i_private) 1.33 ++ ((struct shfs_inode_info *)dentry->d_inode->i_private)->unset_write_on_close = 1; 1.34 + return result; 1.35 + } 1.36 + 1.37 +@@ -488,7 +488,7 @@ shfs_d_delete(struct dentry *dentry) 1.38 + return 0; 1.39 + } 1.40 + 1.41 +-static struct dentry_operations shfs_dentry_operations = { 1.42 ++struct dentry_operations shfs_dentry_operations = { 1.43 + .d_revalidate = shfs_d_revalidate, 1.44 + .d_delete = shfs_d_delete, 1.45 + }; 1.46 +--- shfs/Linux-2.6/fcache.c 1.47 ++++ shfs/Linux-2.6/fcache.c 1.48 +@@ -29,12 +29,12 @@ struct shfs_file { 1.49 + char *data; 1.50 + }; 1.51 + 1.52 +-kmem_cache_t *file_cache = NULL; 1.53 ++struct kmem_cache *file_cache = NULL; 1.54 + 1.55 + void 1.56 + fcache_init(void) 1.57 + { 1.58 +- file_cache = kmem_cache_create("shfs_file", sizeof(struct shfs_file), 0, 0, NULL, NULL); 1.59 ++ file_cache = kmem_cache_create("shfs_file", sizeof(struct shfs_file), 0, 0, NULL); 1.60 + DEBUG("file_cache: %p\n", file_cache); 1.61 + } 1.62 + 1.63 +@@ -100,7 +100,7 @@ fcache_file_open(struct file *f) 1.64 + VERBOSE("dir in file cache?\n"); 1.65 + return -EINVAL; 1.66 + } 1.67 +- p = (struct shfs_inode_info *)inode->u.generic_ip; 1.68 ++ p = (struct shfs_inode_info *)inode->i_private; 1.69 + if (!p) { 1.70 + VERBOSE("inode without info\n"); 1.71 + return -EINVAL; 1.72 +@@ -127,7 +127,7 @@ fcache_file_sync(struct file *f) 1.73 + VERBOSE("dir in file cache?\n"); 1.74 + return -EINVAL; 1.75 + } 1.76 +- p = (struct shfs_inode_info *)inode->u.generic_ip; 1.77 ++ p = (struct shfs_inode_info *)inode->i_private; 1.78 + if (!p) { 1.79 + VERBOSE("inode without info\n"); 1.80 + return -EINVAL; 1.81 +@@ -160,7 +160,7 @@ fcache_file_close(struct file *f) 1.82 + if (result == 0) { 1.83 + struct shfs_inode_info *p; 1.84 + 1.85 +- p = (struct shfs_inode_info *)f->f_dentry->d_inode->u.generic_ip; 1.86 ++ p = (struct shfs_inode_info *)f->f_dentry->d_inode->i_private; 1.87 + if (!p) { 1.88 + VERBOSE("inode without info\n"); 1.89 + return -EINVAL; 1.90 +@@ -184,7 +184,7 @@ fcache_file_clear(struct inode *inode) 1.91 + return -EINVAL; 1.92 + } 1.93 + DEBUG("ino: %lu\n", inode->i_ino); 1.94 +- p = (struct shfs_inode_info *)inode->u.generic_ip; 1.95 ++ p = (struct shfs_inode_info *)inode->i_private; 1.96 + if (!p) { 1.97 + VERBOSE("inode without info\n"); 1.98 + return -EINVAL; 1.99 +@@ -226,7 +226,7 @@ fcache_file_read(struct file *f, unsigne 1.100 + VERBOSE("dir in file cache?\n"); 1.101 + return -EINVAL; 1.102 + } 1.103 +- p = (struct shfs_inode_info *)inode->u.generic_ip; 1.104 ++ p = (struct shfs_inode_info *)inode->i_private; 1.105 + if (!p) { 1.106 + VERBOSE("inode without info\n"); 1.107 + return -EINVAL; 1.108 +@@ -327,7 +327,7 @@ fcache_file_write(struct file *f, unsign 1.109 + VERBOSE("dir in file cache?\n"); 1.110 + return -EINVAL; 1.111 + } 1.112 +- p = (struct shfs_inode_info *)inode->u.generic_ip; 1.113 ++ p = (struct shfs_inode_info *)inode->i_private; 1.114 + if (!p) { 1.115 + VERBOSE("inode without info\n"); 1.116 + return -EINVAL; 1.117 +--- shfs/Linux-2.6/file.c 1.118 ++++ shfs/Linux-2.6/file.c 1.119 +@@ -90,7 +90,7 @@ shfs_file_commitwrite(struct file *f, st 1.120 + struct dentry *dentry = f->f_dentry; 1.121 + struct shfs_sb_info *info = info_from_dentry(dentry); 1.122 + struct inode *inode = p->mapping->host; 1.123 +- struct shfs_inode_info *i = (struct shfs_inode_info *)inode->u.generic_ip; 1.124 ++ struct shfs_inode_info *i = (struct shfs_inode_info *)inode->i_private; 1.125 + char *buffer = kmap(p) + offset; 1.126 + int written = 0, result; 1.127 + unsigned count = to - offset; 1.128 +@@ -199,7 +199,7 @@ shfs_file_open(struct inode *inode, stru 1.129 + } 1.130 + 1.131 + static int 1.132 +-shfs_file_flush(struct file *f) 1.133 ++shfs_file_flush(struct file *f, fl_owner_t id) 1.134 + { 1.135 + struct dentry *dentry = f->f_dentry; 1.136 + struct shfs_sb_info *info = info_from_dentry(dentry); 1.137 +@@ -242,8 +242,8 @@ shfs_file_release(struct inode *inode, s 1.138 + } 1.139 + } 1.140 + /* if file was forced to be writeable, change attrs back on close */ 1.141 +- if (dentry->d_inode && dentry->d_inode->u.generic_ip) { 1.142 +- if (((struct shfs_inode_info *)dentry->d_inode->u.generic_ip)->unset_write_on_close) { 1.143 ++ if (dentry->d_inode && dentry->d_inode->i_private) { 1.144 ++ if (((struct shfs_inode_info *)dentry->d_inode->i_private)->unset_write_on_close) { 1.145 + char name[SHFS_PATH_MAX]; 1.146 + 1.147 + if (get_name(dentry, name) < 0) 1.148 +@@ -292,7 +292,9 @@ shfs_slow_read(struct file *f, char *buf 1.149 + goto error; 1.150 + } 1.151 + if (result != 0) { 1.152 +- copy_to_user(buf, (char *)page, result); 1.153 ++ if (copy_to_user(buf, (char *)page, result)) { 1.154 ++ goto error; 1.155 ++ } 1.156 + *ppos += result; 1.157 + } 1.158 + error: 1.159 +@@ -309,9 +311,9 @@ shfs_slow_write(struct file *f, const ch 1.160 + int result; 1.161 + 1.162 + DEBUG("\n"); 1.163 +- written = generic_file_write(f, buf, count, offset); 1.164 ++ written = do_sync_write(f, buf, count, offset); 1.165 + if (written > 0) { 1.166 +- result = shfs_file_flush(f); 1.167 ++ result = shfs_file_flush(f, 0); 1.168 + written = result < 0 ? result: written; 1.169 + } 1.170 + 1.171 +@@ -320,8 +322,8 @@ shfs_slow_write(struct file *f, const ch 1.172 + 1.173 + struct file_operations shfs_file_operations = { 1.174 + .llseek = generic_file_llseek, 1.175 +- .read = generic_file_read, 1.176 +- .write = generic_file_write, 1.177 ++ .read = do_sync_read, 1.178 ++ .write = do_sync_write, 1.179 + .ioctl = shfs_ioctl, 1.180 + .mmap = generic_file_mmap, 1.181 + .open = shfs_file_open, 1.182 +--- shfs/Linux-2.6/inode.c 1.183 ++++ shfs/Linux-2.6/inode.c 1.184 +@@ -29,13 +29,13 @@ int debug_level; 1.185 + unsigned long alloc; 1.186 + #endif 1.187 + 1.188 +-kmem_cache_t *inode_cache = NULL; 1.189 ++struct kmem_cache *inode_cache = NULL; 1.190 + 1.191 + void 1.192 + shfs_set_inode_attr(struct inode *inode, struct shfs_fattr *fattr) 1.193 + { 1.194 + struct shfs_sb_info *info = info_from_inode(inode); 1.195 +- struct shfs_inode_info *i = inode->u.generic_ip; 1.196 ++ struct shfs_inode_info *i = inode->i_private; 1.197 + struct timespec last_time = inode->i_mtime; 1.198 + loff_t last_size = inode->i_size; 1.199 + 1.200 +@@ -52,7 +52,8 @@ shfs_set_inode_attr(struct inode *inode, 1.201 + inode->i_ctime = fattr->f_ctime; 1.202 + inode->i_atime = fattr->f_atime; 1.203 + inode->i_mtime = fattr->f_mtime; 1.204 +- inode->i_blksize= fattr->f_blksize; 1.205 ++ //inode->i_blksize= fattr->f_blksize; 1.206 ++ inode->i_blkbits= 12; // 4K 1.207 + inode->i_blocks = fattr->f_blocks; 1.208 + inode->i_size = fattr->f_size; 1.209 + 1.210 +@@ -60,7 +61,7 @@ shfs_set_inode_attr(struct inode *inode, 1.211 + 1.212 + if (!timespec_equal(&inode->i_mtime, &last_time) || inode->i_size != last_size) { 1.213 + 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); 1.214 +- invalidate_inode_pages(inode->i_mapping); 1.215 ++ invalidate_mapping_pages(inode->i_mapping, 0, ~0UL); 1.216 + fcache_file_clear(inode); 1.217 + } 1.218 + } 1.219 +@@ -75,7 +76,7 @@ shfs_iget(struct super_block *sb, struct 1.220 + if (!inode) 1.221 + return NULL; 1.222 + inode->i_ino = fattr->f_ino; 1.223 +- i = inode->u.generic_ip = (struct shfs_inode_info *)KMEM_ALLOC("inode", inode_cache, GFP_KERNEL); 1.224 ++ i = inode->i_private = (struct shfs_inode_info *)KMEM_ALLOC("inode", inode_cache, GFP_KERNEL); 1.225 + if (!i) 1.226 + return NULL; 1.227 + i->cache = NULL; 1.228 +@@ -107,7 +108,7 @@ shfs_delete_inode(struct inode *inode) 1.229 + struct shfs_inode_info *i; 1.230 + 1.231 + DEBUG("ino: %lu\n", inode->i_ino); 1.232 +- i = (struct shfs_inode_info *)inode->u.generic_ip; 1.233 ++ i = (struct shfs_inode_info *)inode->i_private; 1.234 + if (!i) { 1.235 + VERBOSE("invalid inode\n"); 1.236 + goto out; 1.237 +@@ -158,7 +159,7 @@ shfs_refresh_inode(struct dentry *dentry 1.238 + * But we do want to invalidate the caches ... 1.239 + */ 1.240 + if (!S_ISDIR(inode->i_mode)) 1.241 +- invalidate_inode_pages(inode->i_mapping); 1.242 ++ invalidate_mapping_pages(inode->i_mapping, 0, ~0UL); 1.243 + else 1.244 + shfs_invalid_dir_cache(inode); 1.245 + result = -EIO; 1.246 +@@ -172,7 +173,7 @@ shfs_revalidate_inode(struct dentry *den 1.247 + { 1.248 + struct shfs_sb_info *info = info_from_dentry(dentry); 1.249 + struct inode *inode = dentry->d_inode; 1.250 +- struct shfs_inode_info *i = (struct shfs_inode_info *)inode->u.generic_ip; 1.251 ++ struct shfs_inode_info *i = (struct shfs_inode_info *)inode->i_private; 1.252 + int result; 1.253 + 1.254 + DEBUG("%s\n", dentry->d_name.name); 1.255 +@@ -337,11 +338,11 @@ out: 1.256 + return -EINVAL; 1.257 + } 1.258 + 1.259 +-static struct super_block * 1.260 ++static int 1.261 + shfs_get_sb(struct file_system_type *fs_type, 1.262 +- int flags, const char *dev_name, void *data) 1.263 ++ int flags, const char *dev_name, void *data, struct vfsmount *mnt) 1.264 + { 1.265 +- return get_sb_nodev(fs_type, flags, data, shfs_read_super); 1.266 ++ return get_sb_nodev(fs_type, flags, data, shfs_read_super, mnt); 1.267 + } 1.268 + 1.269 + static struct file_system_type sh_fs_type = { 1.270 +@@ -356,7 +357,7 @@ init_shfs(void) 1.271 + { 1.272 + printk(KERN_NOTICE "SHell File System, (c) 2002-2004 Miroslav Spousta\n"); 1.273 + fcache_init(); 1.274 +- inode_cache = kmem_cache_create("shfs_inode", sizeof(struct shfs_inode_info), 0, 0, NULL, NULL); 1.275 ++ inode_cache = kmem_cache_create("shfs_inode", sizeof(struct shfs_inode_info), 0, 0, NULL); 1.276 + 1.277 + debug_level = 0; 1.278 + #ifdef ENABLE_DEBUG 1.279 +--- shfs/Linux-2.6/proc.c 1.280 ++++ shfs/Linux-2.6/proc.c 1.281 +@@ -148,6 +148,7 @@ int 1.282 + sock_write(struct shfs_sb_info *info, const void *buffer, int count) 1.283 + { 1.284 + struct file *f = info->sock; 1.285 ++ struct kiocb kiocb; 1.286 + mm_segment_t fs; 1.287 + int c, result = 0; 1.288 + unsigned long flags, sigpipe; 1.289 +@@ -173,12 +174,13 @@ sock_write(struct shfs_sb_info *info, co 1.290 + SIGRECALC; 1.291 + SIGUNLOCK(flags); 1.292 + 1.293 ++ init_sync_kiocb(&kiocb, f); 1.294 + do { 1.295 + struct iovec vec[1]; 1.296 + 1.297 + vec[0].iov_base = (void *)buffer; 1.298 + vec[0].iov_len = c; 1.299 +- result = f->f_op->writev(f, (const struct iovec *) &vec, 1, &f->f_pos); 1.300 ++ result = f->f_op->aio_write(&kiocb, (const struct iovec *) &vec, 1, f->f_pos); 1.301 + if (result < 0) { 1.302 + DEBUG("error: %d\n", result); 1.303 + if (result == -EAGAIN) 1.304 +@@ -218,6 +220,7 @@ int 1.305 + sock_read(struct shfs_sb_info *info, void *buffer, int count) 1.306 + { 1.307 + struct file *f = info->sock; 1.308 ++ struct kiocb kiocb; 1.309 + mm_segment_t fs; 1.310 + int c, result = 0; 1.311 + unsigned long flags, sigpipe; 1.312 +@@ -256,12 +259,13 @@ sock_read(struct shfs_sb_info *info, voi 1.313 + fs = get_fs(); 1.314 + set_fs(get_ds()); 1.315 + 1.316 ++ init_sync_kiocb(&kiocb, f); 1.317 + do { 1.318 + struct iovec vec[1]; 1.319 + 1.320 + vec[0].iov_base = buffer; 1.321 + vec[0].iov_len = c; 1.322 +- result = f->f_op->readv(f, (const struct iovec *)&vec, 1, &f->f_pos); 1.323 ++ result = f->f_op->aio_read(&kiocb, (const struct iovec *) &vec, 1, f->f_pos); 1.324 + if (!result) { 1.325 + /* peer has closed socket */ 1.326 + result = -EIO; 1.327 +@@ -302,6 +306,7 @@ int 1.328 + sock_readln(struct shfs_sb_info *info, char *buffer, int count) 1.329 + { 1.330 + struct file *f = info->sock; 1.331 ++ struct kiocb kiocb; 1.332 + mm_segment_t fs; 1.333 + int c, l = 0, result; 1.334 + char *nl; 1.335 +@@ -315,6 +320,7 @@ sock_readln(struct shfs_sb_info *info, c 1.336 + if (result < 0) 1.337 + return result; 1.338 + } 1.339 ++ init_sync_kiocb(&kiocb, f); 1.340 + while (1) { 1.341 + struct iovec vec[1]; 1.342 + 1.343 +@@ -350,7 +356,7 @@ sock_readln(struct shfs_sb_info *info, c 1.344 + 1.345 + vec[0].iov_base = BUFFER+LEN; 1.346 + vec[0].iov_len = c; 1.347 +- result = f->f_op->readv(f, (const struct iovec *)&vec, 1, &f->f_pos); 1.348 ++ result = f->f_op->aio_read(&kiocb, (const struct iovec *) &vec, 1, f->f_pos); 1.349 + SIGLOCK(flags); 1.350 + if (result == -EPIPE && !sigpipe) { 1.351 + sigdelset(¤t->pending.signal, SIGPIPE); 1.352 +@@ -571,9 +577,9 @@ error: 1.353 + } 1.354 + 1.355 + int 1.356 +-shfs_statfs(struct super_block *sb, struct kstatfs *attr) 1.357 ++shfs_statfs(struct dentry *dentry, struct kstatfs *attr) 1.358 + { 1.359 +- struct shfs_sb_info *info = info_from_sb(sb); 1.360 ++ struct shfs_sb_info *info = info_from_sb(dentry->d_sb); 1.361 + 1.362 + DEBUG("\n"); 1.363 + return info->fops.statfs(info, attr); 1.364 +--- shfs/Linux-2.6/shfs_debug.h 1.365 ++++ shfs/Linux-2.6/shfs_debug.h 1.366 +@@ -19,7 +19,7 @@ extern int debug_level; 1.367 + extern unsigned long alloc; 1.368 + 1.369 + static inline void * 1.370 +-__kmem_malloc_debug(char *s, kmem_cache_t *cache, int flags) 1.371 ++__kmem_malloc_debug(char *s, struct kmem_cache *cache, int flags) 1.372 + { 1.373 + if (debug_level >= SHFS_ALLOC) { 1.374 + void *x = kmem_cache_alloc(cache, flags); 1.375 +@@ -32,7 +32,7 @@ __kmem_malloc_debug(char *s, kmem_cache_ 1.376 + } 1.377 + 1.378 + static inline void 1.379 +-__kmem_free_debug(char *s, kmem_cache_t *cache, void *p) 1.380 ++__kmem_free_debug(char *s, struct kmem_cache *cache, void *p) 1.381 + { 1.382 + if (debug_level >= SHFS_ALLOC) { 1.383 + VERBOSE("free (%s): %p\n", s, p); 1.384 +--- shfs/Linux-2.6/shfs_fs.h 1.385 ++++ shfs/Linux-2.6/shfs_fs.h 1.386 +@@ -74,10 +74,10 @@ int shfs_fill_cache(struct file*, void*, 1.387 + 1.388 + /* shfs/fcache.c */ 1.389 + #include <linux/slab.h> 1.390 +-extern kmem_cache_t *file_cache; 1.391 +-extern kmem_cache_t *dir_head_cache; 1.392 +-extern kmem_cache_t *dir_entry_cache; 1.393 +-extern kmem_cache_t *dir_name_cache; 1.394 ++extern struct kmem_cache *file_cache; 1.395 ++extern struct kmem_cache *dir_head_cache; 1.396 ++extern struct kmem_cache *dir_entry_cache; 1.397 ++extern struct kmem_cache *dir_name_cache; 1.398 + void fcache_init(void); 1.399 + void fcache_finish(void); 1.400 + int fcache_file_open(struct file*); 1.401 +@@ -101,7 +101,7 @@ int reply(char *s); 1.402 + void set_garbage(struct shfs_sb_info *info, int write, int count); 1.403 + int get_name(struct dentry *d, char *name); 1.404 + int shfs_notify_change(struct dentry *dentry, struct iattr *attr); 1.405 +-int shfs_statfs(struct super_block *sb, struct kstatfs *attr); 1.406 ++int shfs_statfs(struct dentry *dentry, struct kstatfs *attr); 1.407 + 1.408 + /* shfs/inode.c */ 1.409 + void shfs_set_inode_attr(struct inode *inode, struct shfs_fattr *fattr); 1.410 +--- shfs/Linux-2.6/symlink.c 1.411 ++++ shfs/Linux-2.6/symlink.c 1.412 +@@ -41,7 +41,7 @@ error: 1.413 + return result; 1.414 + } 1.415 + 1.416 +-static int 1.417 ++static void * 1.418 + shfs_follow_link(struct dentry *dentry, struct nameidata *nd) 1.419 + { 1.420 + struct shfs_sb_info *info = info_from_dentry(dentry); 1.421 +@@ -51,7 +51,6 @@ shfs_follow_link(struct dentry *dentry, 1.422 + 1.423 + DEBUG("%s\n", dentry->d_name.name); 1.424 + 1.425 +- result = -ENAMETOOLONG; 1.426 + if (get_name(dentry, name) < 0) 1.427 + goto error; 1.428 + 1.429 +@@ -59,9 +58,9 @@ shfs_follow_link(struct dentry *dentry, 1.430 + if (result < 0) 1.431 + goto error; 1.432 + DEBUG("%s\n", real_name); 1.433 +- result = vfs_follow_link(nd, real_name); 1.434 ++ nd_set_link(nd, real_name); 1.435 + error: 1.436 +- return result; 1.437 ++ return NULL; 1.438 + } 1.439 + 1.440 + struct inode_operations shfs_symlink_inode_operations = {