release/src/linux/linux/fs/jffs/intrep.c
/* Build a control block for the file system.  */
Build a control block for the file system.
Build a control block for the file system .
static struct jffs_control *
jffs_create_control(kdev_t dev)
{
	struct jffs_control *c;
	register int s = sizeof(struct jffs_control);
	int i;
	D(char *t = 0);
	D2(printk("jffs_create_control()\n"));
	if (!(c = (struct jffs_control *)kmalloc(s, GFP_KERNEL))) {
		goto fail_control;
	}
	DJM(no_jffs_control++);
	c->root = 0;
	c->gc_task = 0;
	c->hash_len = JFFS_HASH_SIZE;
	s = sizeof(struct list_head) * c->hash_len;
	if (!(c->hash = (struct list_head *)kmalloc(s, GFP_KERNEL))) {
		goto fail_hash;
	}
	DJM(no_hash++);
	for (i = 0; i < c->hash_len; i++)
		INIT_LIST_HEAD(&c->hash[i]);
	if (!(c->fmc = jffs_build_begin(c, dev))) {
		goto fail_fminit;
	}
	c->next_ino = JFFS_MIN_INO + 1;
	c->delete_list = (struct jffs_delete_list *) 0;
	return c;
fail_fminit:
	D(t = "c->fmc");
fail_hash:
	kfree(c);
	DJM(no_jffs_control--);
	D(t = t ? t : "c->hash");
fail_control:
	D(t = t ? t : "control");
	D(printk("jffs_create_control(): Allocation failed: (%s)\n", t));
	return (struct jffs_control *)0;
}
static struct jffs_control * jffs_create_control ( kdev_t dev ) { struct jffs_control * c ; register int s = sizeof ( struct jffs_control ) ; int i ; D ( char * t = 0 ) ; D2 ( printk ( " \n " ) ) ; if ( ! ( c = ( struct jffs_control * ) kmalloc ( s , GFP_KERNEL ) ) ) { goto fail_control ; } DJM ( no_jffs_control ++ ) ; c -> root = 0 ; c -> gc_task = 0 ; c -> hash_len = JFFS_HASH_SIZE ; s = sizeof ( struct list_head ) * c -> hash_len ; if ( ! ( c -> hash = ( struct list_head * ) kmalloc ( s , GFP_KERNEL ) ) ) { goto fail_hash ; } DJM ( no_hash ++ ) ; for ( i = 0 ; i < c -> hash_len ; i ++ ) INIT_LIST_HEAD ( & c -> hash [ i ] ) ; if ( ! ( c -> fmc = jffs_build_begin ( c , dev ) ) ) { goto fail_fminit ; } c -> next_ino = JFFS_MIN_INO + 1 ; c -> delete_list = ( struct jffs_delete_list * ) 0 ; return c ; fail_fminit : D ( t = " " ) ; fail_hash : kfree ( c ) ; DJM ( no_jffs_control -- ) ; D ( t = t ? t : " " ) ; fail_control : D ( t = t ? t : " " ) ; D ( printk ( " \n " , t ) ) ; return ( struct jffs_control * ) 0 ; }
Build a control block for the file system.
Build a control block for the file system .