Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9eb7f2c6 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds
Browse files

[PATCH] isofs: remove debug stuff



isofs/inode.c:

- Remove some crufty leak detection code

- coding style cleanups

- kfree(NULL) is permitted.

Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a089221c
Loading
Loading
Loading
Loading
+32 −77
Original line number Diff line number Diff line
@@ -28,11 +28,6 @@

#define BEQUIET

#ifdef LEAK_CHECK
static int check_malloc;
static int check_bread;
#endif

static int isofs_hashi(struct dentry *parent, struct qstr *qstr);
static int isofs_hash(struct dentry *parent, struct qstr *qstr);
static int isofs_dentry_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b);
@@ -55,11 +50,6 @@ static void isofs_put_super(struct super_block *sb)
	}
#endif

#ifdef LEAK_CHECK
	printk("Outstanding mallocs:%d, outstanding buffers: %d\n",
	       check_malloc, check_bread);
#endif

	kfree(sbi);
	sb->s_fs_info = NULL;
	return;
@@ -73,7 +63,7 @@ static kmem_cache_t *isofs_inode_cachep;
static struct inode *isofs_alloc_inode(struct super_block *sb)
{
	struct iso_inode_info *ei;
	ei = (struct iso_inode_info *)kmem_cache_alloc(isofs_inode_cachep, SLAB_KERNEL);
	ei = kmem_cache_alloc(isofs_inode_cachep, SLAB_KERNEL);
	if (!ei)
		return NULL;
	return &ei->vfs_inode;
@@ -86,7 +76,7 @@ static void isofs_destroy_inode(struct inode *inode)

static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags)
{
	struct iso_inode_info *ei = (struct iso_inode_info *) foo;
	struct iso_inode_info *ei = foo;

	if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
	    SLAB_CTOR_CONSTRUCTOR)
@@ -107,7 +97,8 @@ static int init_inodecache(void)
static void destroy_inodecache(void)
{
	if (kmem_cache_destroy(isofs_inode_cachep))
		printk(KERN_INFO "iso_inode_cache: not all structures were freed\n");
		printk(KERN_INFO "iso_inode_cache: not all structures were "
					"freed\n");
}

static int isofs_remount(struct super_block *sb, int *flags, char *data)
@@ -144,7 +135,7 @@ static struct dentry_operations isofs_dentry_ops[] = {
	{
		.d_hash		= isofs_hashi_ms,
		.d_compare	= isofs_dentry_cmpi_ms,
	}
	},
#endif
};

@@ -219,8 +210,8 @@ isofs_hashi_common(struct dentry *dentry, struct qstr *qstr, int ms)
/*
 * Case insensitive compare of two isofs names.
 */
static int
isofs_dentry_cmpi_common(struct dentry *dentry,struct qstr *a,struct qstr *b,int ms)
static int isofs_dentry_cmpi_common(struct dentry *dentry, struct qstr *a,
				struct qstr *b, int ms)
{
	int alen, blen;

@@ -243,8 +234,8 @@ isofs_dentry_cmpi_common(struct dentry *dentry,struct qstr *a,struct qstr *b,int
/*
 * Case sensitive compare of two isofs names.
 */
static int
isofs_dentry_cmp_common(struct dentry *dentry,struct qstr *a,struct qstr *b,int ms)
static int isofs_dentry_cmp_common(struct dentry *dentry, struct qstr *a,
					struct qstr *b, int ms)
{
	int alen, blen;

@@ -518,7 +509,8 @@ static unsigned int isofs_get_last_session(struct super_block *sb,s32 session )
		printk(KERN_ERR "Invalid session number or type of track\n");
	}
	i = ioctl_by_bdev(bdev, CDROMMULTISESSION, (unsigned long) &ms_info);
	if(session > 0) printk(KERN_ERR "Invalid session number\n");
	if (session > 0)
		printk(KERN_ERR "Invalid session number\n");
#if 0
	printk("isofs.inode: CDROMMULTISESSION: rc=%d\n",i);
	if (i==0) {
@@ -557,11 +549,11 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
	struct iso9660_options		opt;
	struct isofs_sb_info	      * sbi;

	sbi = kmalloc(sizeof(struct isofs_sb_info), GFP_KERNEL);
	sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
	if (!sbi)
		return -ENOMEM;
	s->s_fs_info = sbi;
	memset(sbi, 0, sizeof(struct isofs_sb_info));
	memset(sbi, 0, sizeof(*sbi));

	if (!parse_options((char *)data, &opt))
		goto out_freesbi;
@@ -1002,7 +994,6 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
		rv++;
	}


abort:
	unlock_kernel();
	return rv;
@@ -1061,17 +1052,15 @@ static struct address_space_operations isofs_aops = {

static inline void test_and_set_uid(uid_t *p, uid_t value)
{
	if(value) {
	if (value)
		*p = value;
}
}

static inline void test_and_set_gid(gid_t *p, gid_t value)
{
        if(value) {
        if (value)
                *p = value;
}
}

static int isofs_read_level3_size(struct inode *inode)
{
@@ -1154,7 +1143,6 @@ static int isofs_read_level3_size(struct inode * inode)
			goto out_toomany;
	} while (more_entries);
out:
	if (tmpde)
	kfree(tmpde);
	if (bh)
		brelse(bh);
@@ -1394,11 +1382,8 @@ struct inode *isofs_iget(struct super_block *sb,

	hashval = (block << sb->s_blocksize_bits) | offset;

	inode = iget5_locked(sb,
			     hashval,
			     &isofs_iget5_test,
			     &isofs_iget5_set,
			     &data);
	inode = iget5_locked(sb, hashval, &isofs_iget5_test,
			     &isofs_iget5_set, &data);

	if (inode && (inode->i_state & I_NEW)) {
		sb->s_op->read_inode(inode);
@@ -1408,36 +1393,6 @@ struct inode *isofs_iget(struct super_block *sb,
	return inode;
}

#ifdef LEAK_CHECK
#undef malloc
#undef free_s
#undef sb_bread
#undef brelse

void * leak_check_malloc(unsigned int size){
  void * tmp;
  check_malloc++;
  tmp = kmalloc(size, GFP_KERNEL);
  return tmp;
}

void leak_check_free_s(void * obj, int size){
  check_malloc--;
  return kfree(obj);
}

struct buffer_head * leak_check_bread(struct super_block *sb, int block){
  check_bread++;
  return sb_bread(sb, block);
}

void leak_check_brelse(struct buffer_head * bh){
  check_bread--;
  return brelse(bh);
}

#endif

static struct super_block *isofs_get_sb(struct file_system_type *fs_type,
	int flags, const char *dev_name, void *data)
{