aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs/inode-v23.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs/inode-v23.c')
-rw-r--r--fs/jffs/inode-v23.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
index 93068697a9bf..f5cf9c93e243 100644
--- a/fs/jffs/inode-v23.c
+++ b/fs/jffs/inode-v23.c
@@ -364,12 +364,11 @@ jffs_new_inode(const struct inode * dir, struct jffs_raw_inode *raw_inode,
364 inode->i_ctime.tv_nsec = 0; 364 inode->i_ctime.tv_nsec = 0;
365 inode->i_mtime.tv_nsec = 0; 365 inode->i_mtime.tv_nsec = 0;
366 inode->i_atime.tv_nsec = 0; 366 inode->i_atime.tv_nsec = 0;
367 inode->i_blksize = PAGE_SIZE;
368 inode->i_blocks = (inode->i_size + 511) >> 9; 367 inode->i_blocks = (inode->i_size + 511) >> 9;
369 368
370 f = jffs_find_file(c, raw_inode->ino); 369 f = jffs_find_file(c, raw_inode->ino);
371 370
372 inode->u.generic_ip = (void *)f; 371 inode->i_private = (void *)f;
373 insert_inode_hash(inode); 372 insert_inode_hash(inode);
374 373
375 return inode; 374 return inode;
@@ -442,7 +441,7 @@ jffs_rename(struct inode *old_dir, struct dentry *old_dentry,
442 }); 441 });
443 442
444 result = -ENOTDIR; 443 result = -ENOTDIR;
445 if (!(old_dir_f = (struct jffs_file *)old_dir->u.generic_ip)) { 444 if (!(old_dir_f = old_dir->i_private)) {
446 D(printk("jffs_rename(): Old dir invalid.\n")); 445 D(printk("jffs_rename(): Old dir invalid.\n"));
447 goto jffs_rename_end; 446 goto jffs_rename_end;
448 } 447 }
@@ -456,7 +455,7 @@ jffs_rename(struct inode *old_dir, struct dentry *old_dentry,
456 455
457 /* Find the new directory. */ 456 /* Find the new directory. */
458 result = -ENOTDIR; 457 result = -ENOTDIR;
459 if (!(new_dir_f = (struct jffs_file *)new_dir->u.generic_ip)) { 458 if (!(new_dir_f = new_dir->i_private)) {
460 D(printk("jffs_rename(): New dir invalid.\n")); 459 D(printk("jffs_rename(): New dir invalid.\n"));
461 goto jffs_rename_end; 460 goto jffs_rename_end;
462 } 461 }
@@ -593,7 +592,7 @@ jffs_readdir(struct file *filp, void *dirent, filldir_t filldir)
593 } 592 }
594 else { 593 else {
595 ddino = ((struct jffs_file *) 594 ddino = ((struct jffs_file *)
596 inode->u.generic_ip)->pino; 595 inode->i_private)->pino;
597 } 596 }
598 D3(printk("jffs_readdir(): \"..\" %u\n", ddino)); 597 D3(printk("jffs_readdir(): \"..\" %u\n", ddino));
599 if (filldir(dirent, "..", 2, filp->f_pos, ddino, DT_DIR) < 0) { 598 if (filldir(dirent, "..", 2, filp->f_pos, ddino, DT_DIR) < 0) {
@@ -604,7 +603,7 @@ jffs_readdir(struct file *filp, void *dirent, filldir_t filldir)
604 } 603 }
605 filp->f_pos++; 604 filp->f_pos++;
606 } 605 }
607 f = ((struct jffs_file *)inode->u.generic_ip)->children; 606 f = ((struct jffs_file *)inode->i_private)->children;
608 607
609 j = 2; 608 j = 2;
610 while(f && (f->deleted || j++ < filp->f_pos )) { 609 while(f && (f->deleted || j++ < filp->f_pos )) {
@@ -652,7 +651,7 @@ jffs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
652 lock_kernel(); 651 lock_kernel();
653 652
654 D3({ 653 D3({
655 char *s = (char *)kmalloc(len + 1, GFP_KERNEL); 654 char *s = kmalloc(len + 1, GFP_KERNEL);
656 memcpy(s, name, len); 655 memcpy(s, name, len);
657 s[len] = '\0'; 656 s[len] = '\0';
658 printk("jffs_lookup(): dir: 0x%p, name: \"%s\"\n", dir, s); 657 printk("jffs_lookup(): dir: 0x%p, name: \"%s\"\n", dir, s);
@@ -668,7 +667,7 @@ jffs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
668 } 667 }
669 668
670 r = -EACCES; 669 r = -EACCES;
671 if (!(d = (struct jffs_file *)dir->u.generic_ip)) { 670 if (!(d = (struct jffs_file *)dir->i_private)) {
672 D(printk("jffs_lookup(): No such inode! (%lu)\n", 671 D(printk("jffs_lookup(): No such inode! (%lu)\n",
673 dir->i_ino)); 672 dir->i_ino));
674 goto jffs_lookup_end; 673 goto jffs_lookup_end;
@@ -739,7 +738,7 @@ jffs_do_readpage_nolock(struct file *file, struct page *page)
739 unsigned long read_len; 738 unsigned long read_len;
740 int result; 739 int result;
741 struct inode *inode = (struct inode*)page->mapping->host; 740 struct inode *inode = (struct inode*)page->mapping->host;
742 struct jffs_file *f = (struct jffs_file *)inode->u.generic_ip; 741 struct jffs_file *f = (struct jffs_file *)inode->i_private;
743 struct jffs_control *c = (struct jffs_control *)inode->i_sb->s_fs_info; 742 struct jffs_control *c = (struct jffs_control *)inode->i_sb->s_fs_info;
744 int r; 743 int r;
745 loff_t offset; 744 loff_t offset;
@@ -828,7 +827,7 @@ jffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
828 }); 827 });
829 828
830 lock_kernel(); 829 lock_kernel();
831 dir_f = (struct jffs_file *)dir->u.generic_ip; 830 dir_f = dir->i_private;
832 831
833 ASSERT(if (!dir_f) { 832 ASSERT(if (!dir_f) {
834 printk(KERN_ERR "jffs_mkdir(): No reference to a " 833 printk(KERN_ERR "jffs_mkdir(): No reference to a "
@@ -972,7 +971,7 @@ jffs_remove(struct inode *dir, struct dentry *dentry, int type)
972 kfree(_name); 971 kfree(_name);
973 }); 972 });
974 973
975 dir_f = (struct jffs_file *) dir->u.generic_ip; 974 dir_f = dir->i_private;
976 c = dir_f->c; 975 c = dir_f->c;
977 976
978 result = -ENOENT; 977 result = -ENOENT;
@@ -1082,7 +1081,7 @@ jffs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
1082 if (!old_valid_dev(rdev)) 1081 if (!old_valid_dev(rdev))
1083 return -EINVAL; 1082 return -EINVAL;
1084 lock_kernel(); 1083 lock_kernel();
1085 dir_f = (struct jffs_file *)dir->u.generic_ip; 1084 dir_f = dir->i_private;
1086 c = dir_f->c; 1085 c = dir_f->c;
1087 1086
1088 D3(printk (KERN_NOTICE "mknod(): down biglock\n")); 1087 D3(printk (KERN_NOTICE "mknod(): down biglock\n"));
@@ -1173,8 +1172,8 @@ jffs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
1173 lock_kernel(); 1172 lock_kernel();
1174 D1({ 1173 D1({
1175 int len = dentry->d_name.len; 1174 int len = dentry->d_name.len;
1176 char *_name = (char *)kmalloc(len + 1, GFP_KERNEL); 1175 char *_name = kmalloc(len + 1, GFP_KERNEL);
1177 char *_symname = (char *)kmalloc(symname_len + 1, GFP_KERNEL); 1176 char *_symname = kmalloc(symname_len + 1, GFP_KERNEL);
1178 memcpy(_name, dentry->d_name.name, len); 1177 memcpy(_name, dentry->d_name.name, len);
1179 _name[len] = '\0'; 1178 _name[len] = '\0';
1180 memcpy(_symname, symname, symname_len); 1179 memcpy(_symname, symname, symname_len);
@@ -1186,7 +1185,7 @@ jffs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
1186 kfree(_symname); 1185 kfree(_symname);
1187 }); 1186 });
1188 1187
1189 dir_f = (struct jffs_file *)dir->u.generic_ip; 1188 dir_f = dir->i_private;
1190 ASSERT(if (!dir_f) { 1189 ASSERT(if (!dir_f) {
1191 printk(KERN_ERR "jffs_symlink(): No reference to a " 1190 printk(KERN_ERR "jffs_symlink(): No reference to a "
1192 "jffs_file struct in inode.\n"); 1191 "jffs_file struct in inode.\n");
@@ -1282,14 +1281,14 @@ jffs_create(struct inode *dir, struct dentry *dentry, int mode,
1282 lock_kernel(); 1281 lock_kernel();
1283 D1({ 1282 D1({
1284 int len = dentry->d_name.len; 1283 int len = dentry->d_name.len;
1285 char *s = (char *)kmalloc(len + 1, GFP_KERNEL); 1284 char *s = kmalloc(len + 1, GFP_KERNEL);
1286 memcpy(s, dentry->d_name.name, len); 1285 memcpy(s, dentry->d_name.name, len);
1287 s[len] = '\0'; 1286 s[len] = '\0';
1288 printk("jffs_create(): dir: 0x%p, name: \"%s\"\n", dir, s); 1287 printk("jffs_create(): dir: 0x%p, name: \"%s\"\n", dir, s);
1289 kfree(s); 1288 kfree(s);
1290 }); 1289 });
1291 1290
1292 dir_f = (struct jffs_file *)dir->u.generic_ip; 1291 dir_f = dir->i_private;
1293 ASSERT(if (!dir_f) { 1292 ASSERT(if (!dir_f) {
1294 printk(KERN_ERR "jffs_create(): No reference to a " 1293 printk(KERN_ERR "jffs_create(): No reference to a "
1295 "jffs_file struct in inode.\n"); 1294 "jffs_file struct in inode.\n");
@@ -1403,9 +1402,9 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
1403 goto out_isem; 1402 goto out_isem;
1404 } 1403 }
1405 1404
1406 if (!(f = (struct jffs_file *)inode->u.generic_ip)) { 1405 if (!(f = inode->i_private)) {
1407 D(printk("jffs_file_write(): inode->u.generic_ip = 0x%p\n", 1406 D(printk("jffs_file_write(): inode->i_private = 0x%p\n",
1408 inode->u.generic_ip)); 1407 inode->i_private));
1409 goto out_isem; 1408 goto out_isem;
1410 } 1409 }
1411 1410
@@ -1693,7 +1692,7 @@ jffs_read_inode(struct inode *inode)
1693 mutex_unlock(&c->fmc->biglock); 1692 mutex_unlock(&c->fmc->biglock);
1694 return; 1693 return;
1695 } 1694 }
1696 inode->u.generic_ip = (void *)f; 1695 inode->i_private = f;
1697 inode->i_mode = f->mode; 1696 inode->i_mode = f->mode;
1698 inode->i_nlink = f->nlink; 1697 inode->i_nlink = f->nlink;
1699 inode->i_uid = f->uid; 1698 inode->i_uid = f->uid;
@@ -1706,7 +1705,6 @@ jffs_read_inode(struct inode *inode)
1706 inode->i_mtime.tv_nsec = 1705 inode->i_mtime.tv_nsec =
1707 inode->i_ctime.tv_nsec = 0; 1706 inode->i_ctime.tv_nsec = 0;
1708 1707
1709 inode->i_blksize = PAGE_SIZE;
1710 inode->i_blocks = (inode->i_size + 511) >> 9; 1708 inode->i_blocks = (inode->i_size + 511) >> 9;
1711 if (S_ISREG(inode->i_mode)) { 1709 if (S_ISREG(inode->i_mode)) {
1712 inode->i_op = &jffs_file_inode_operations; 1710 inode->i_op = &jffs_file_inode_operations;
@@ -1748,7 +1746,7 @@ jffs_delete_inode(struct inode *inode)
1748 lock_kernel(); 1746 lock_kernel();
1749 inode->i_size = 0; 1747 inode->i_size = 0;
1750 inode->i_blocks = 0; 1748 inode->i_blocks = 0;
1751 inode->u.generic_ip = NULL; 1749 inode->i_private = NULL;
1752 clear_inode(inode); 1750 clear_inode(inode);
1753 if (inode->i_nlink == 0) { 1751 if (inode->i_nlink == 0) {
1754 c = (struct jffs_control *) inode->i_sb->s_fs_info; 1752 c = (struct jffs_control *) inode->i_sb->s_fs_info;