Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] isofs: remove debug stuff

isofs/inode.c:

- Remove some crufty leak detection code

- coding style cleanups

- kfree(NULL) is permitted.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Andrew Morton and committed by
Linus Torvalds
9eb7f2c6 a089221c

+32 -77
+32 -77
fs/isofs/inode.c
··· 28 28 29 29 #define BEQUIET 30 30 31 - #ifdef LEAK_CHECK 32 - static int check_malloc; 33 - static int check_bread; 34 - #endif 35 - 36 31 static int isofs_hashi(struct dentry *parent, struct qstr *qstr); 37 32 static int isofs_hash(struct dentry *parent, struct qstr *qstr); 38 33 static int isofs_dentry_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b); ··· 50 55 } 51 56 #endif 52 57 53 - #ifdef LEAK_CHECK 54 - printk("Outstanding mallocs:%d, outstanding buffers: %d\n", 55 - check_malloc, check_bread); 56 - #endif 57 - 58 58 kfree(sbi); 59 59 sb->s_fs_info = NULL; 60 60 return; ··· 63 73 static struct inode *isofs_alloc_inode(struct super_block *sb) 64 74 { 65 75 struct iso_inode_info *ei; 66 - ei = (struct iso_inode_info *)kmem_cache_alloc(isofs_inode_cachep, SLAB_KERNEL); 76 + ei = kmem_cache_alloc(isofs_inode_cachep, SLAB_KERNEL); 67 77 if (!ei) 68 78 return NULL; 69 79 return &ei->vfs_inode; ··· 74 84 kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode)); 75 85 } 76 86 77 - static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) 87 + static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags) 78 88 { 79 - struct iso_inode_info *ei = (struct iso_inode_info *) foo; 89 + struct iso_inode_info *ei = foo; 80 90 81 91 if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == 82 92 SLAB_CTOR_CONSTRUCTOR) ··· 97 107 static void destroy_inodecache(void) 98 108 { 99 109 if (kmem_cache_destroy(isofs_inode_cachep)) 100 - printk(KERN_INFO "iso_inode_cache: not all structures were freed\n"); 110 + printk(KERN_INFO "iso_inode_cache: not all structures were " 111 + "freed\n"); 101 112 } 102 113 103 114 static int isofs_remount(struct super_block *sb, int *flags, char *data) ··· 135 144 { 136 145 .d_hash = isofs_hashi_ms, 137 146 .d_compare = isofs_dentry_cmpi_ms, 138 - } 147 + }, 139 148 #endif 140 149 }; 141 150 ··· 210 219 /* 211 220 * Case insensitive compare of two isofs names. 212 221 */ 213 - static int 214 - isofs_dentry_cmpi_common(struct dentry *dentry,struct qstr *a,struct qstr *b,int ms) 222 + static int isofs_dentry_cmpi_common(struct dentry *dentry, struct qstr *a, 223 + struct qstr *b, int ms) 215 224 { 216 225 int alen, blen; 217 226 ··· 234 243 /* 235 244 * Case sensitive compare of two isofs names. 236 245 */ 237 - static int 238 - isofs_dentry_cmp_common(struct dentry *dentry,struct qstr *a,struct qstr *b,int ms) 246 + static int isofs_dentry_cmp_common(struct dentry *dentry, struct qstr *a, 247 + struct qstr *b, int ms) 239 248 { 240 249 int alen, blen; 241 250 ··· 347 356 {Opt_err, NULL} 348 357 }; 349 358 350 - static int parse_options(char *options, struct iso9660_options * popt) 359 + static int parse_options(char *options, struct iso9660_options *popt) 351 360 { 352 361 char *p; 353 362 int option; ··· 484 493 */ 485 494 #define WE_OBEY_THE_WRITTEN_STANDARDS 1 486 495 487 - static unsigned int isofs_get_last_session(struct super_block *sb,s32 session ) 496 + static unsigned int isofs_get_last_session(struct super_block *sb, s32 session) 488 497 { 489 498 struct cdrom_multisession ms_info; 490 499 unsigned int vol_desc_start; ··· 509 518 printk(KERN_ERR "Invalid session number or type of track\n"); 510 519 } 511 520 i = ioctl_by_bdev(bdev, CDROMMULTISESSION, (unsigned long) &ms_info); 512 - if(session > 0) printk(KERN_ERR "Invalid session number\n"); 521 + if (session > 0) 522 + printk(KERN_ERR "Invalid session number\n"); 513 523 #if 0 514 524 printk("isofs.inode: CDROMMULTISESSION: rc=%d\n",i); 515 525 if (i==0) { ··· 549 557 struct iso9660_options opt; 550 558 struct isofs_sb_info * sbi; 551 559 552 - sbi = kmalloc(sizeof(struct isofs_sb_info), GFP_KERNEL); 560 + sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); 553 561 if (!sbi) 554 562 return -ENOMEM; 555 563 s->s_fs_info = sbi; 556 - memset(sbi, 0, sizeof(struct isofs_sb_info)); 564 + memset(sbi, 0, sizeof(*sbi)); 557 565 558 - if (!parse_options((char *) data, &opt)) 566 + if (!parse_options((char *)data, &opt)) 559 567 goto out_freesbi; 560 568 561 569 /* ··· 994 1002 rv++; 995 1003 } 996 1004 997 - 998 1005 abort: 999 1006 unlock_kernel(); 1000 1007 return rv; ··· 1005 1014 static int isofs_get_block(struct inode *inode, sector_t iblock, 1006 1015 struct buffer_head *bh_result, int create) 1007 1016 { 1008 - if ( create ) { 1017 + if (create) { 1009 1018 printk("isofs_get_block: Kernel tries to allocate a block\n"); 1010 1019 return -EROFS; 1011 1020 } ··· 1052 1061 1053 1062 static inline void test_and_set_uid(uid_t *p, uid_t value) 1054 1063 { 1055 - if(value) { 1064 + if (value) 1056 1065 *p = value; 1057 - } 1058 1066 } 1059 1067 1060 1068 static inline void test_and_set_gid(gid_t *p, gid_t value) 1061 1069 { 1062 - if(value) { 1070 + if (value) 1063 1071 *p = value; 1064 - } 1065 1072 } 1066 1073 1067 - static int isofs_read_level3_size(struct inode * inode) 1074 + static int isofs_read_level3_size(struct inode *inode) 1068 1075 { 1069 1076 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); 1070 1077 int high_sierra = ISOFS_SB(inode->i_sb)->s_high_sierra; ··· 1125 1136 bh = sb_bread(inode->i_sb, block); 1126 1137 if (!bh) 1127 1138 goto out_noread; 1128 - memcpy((void *) tmpde + slop, bh->b_data, offset); 1139 + memcpy((void *)tmpde+slop, bh->b_data, offset); 1129 1140 } 1130 1141 de = tmpde; 1131 1142 } ··· 1139 1150 more_entries = de->flags[-high_sierra] & 0x80; 1140 1151 1141 1152 i++; 1142 - if(i > 100) 1153 + if (i > 100) 1143 1154 goto out_toomany; 1144 - } while(more_entries); 1155 + } while (more_entries); 1145 1156 out: 1146 - if (tmpde) 1147 - kfree(tmpde); 1157 + kfree(tmpde); 1148 1158 if (bh) 1149 1159 brelse(bh); 1150 1160 return 0; ··· 1167 1179 goto out; 1168 1180 } 1169 1181 1170 - static void isofs_read_inode(struct inode * inode) 1182 + static void isofs_read_inode(struct inode *inode) 1171 1183 { 1172 1184 struct super_block *sb = inode->i_sb; 1173 1185 struct isofs_sb_info *sbi = ISOFS_SB(sb); ··· 1237 1249 ei->i_format_parm[2] = 0; 1238 1250 1239 1251 ei->i_section_size = isonum_733 (de->size); 1240 - if(de->flags[-high_sierra] & 0x80) { 1252 + if (de->flags[-high_sierra] & 0x80) { 1241 1253 if(isofs_read_level3_size(inode)) goto fail; 1242 1254 } else { 1243 1255 ei->i_next_section_block = 0; ··· 1324 1336 /* XXX - parse_rock_ridge_inode() had already set i_rdev. */ 1325 1337 init_special_inode(inode, inode->i_mode, inode->i_rdev); 1326 1338 1327 - out: 1339 + out: 1328 1340 if (tmpde) 1329 1341 kfree(tmpde); 1330 1342 if (bh) 1331 1343 brelse(bh); 1332 1344 return; 1333 1345 1334 - out_badread: 1346 + out_badread: 1335 1347 printk(KERN_WARNING "ISOFS: unable to read i-node block\n"); 1336 - fail: 1348 + fail: 1337 1349 make_bad_inode(inode); 1338 1350 goto out; 1339 1351 } ··· 1382 1394 1383 1395 hashval = (block << sb->s_blocksize_bits) | offset; 1384 1396 1385 - inode = iget5_locked(sb, 1386 - hashval, 1387 - &isofs_iget5_test, 1388 - &isofs_iget5_set, 1389 - &data); 1397 + inode = iget5_locked(sb, hashval, &isofs_iget5_test, 1398 + &isofs_iget5_set, &data); 1390 1399 1391 1400 if (inode && (inode->i_state & I_NEW)) { 1392 1401 sb->s_op->read_inode(inode); ··· 1392 1407 1393 1408 return inode; 1394 1409 } 1395 - 1396 - #ifdef LEAK_CHECK 1397 - #undef malloc 1398 - #undef free_s 1399 - #undef sb_bread 1400 - #undef brelse 1401 - 1402 - void * leak_check_malloc(unsigned int size){ 1403 - void * tmp; 1404 - check_malloc++; 1405 - tmp = kmalloc(size, GFP_KERNEL); 1406 - return tmp; 1407 - } 1408 - 1409 - void leak_check_free_s(void * obj, int size){ 1410 - check_malloc--; 1411 - return kfree(obj); 1412 - } 1413 - 1414 - struct buffer_head * leak_check_bread(struct super_block *sb, int block){ 1415 - check_bread++; 1416 - return sb_bread(sb, block); 1417 - } 1418 - 1419 - void leak_check_brelse(struct buffer_head * bh){ 1420 - check_bread--; 1421 - return brelse(bh); 1422 - } 1423 - 1424 - #endif 1425 1410 1426 1411 static struct super_block *isofs_get_sb(struct file_system_type *fs_type, 1427 1412 int flags, const char *dev_name, void *data)