uint32_t alloclen, phys_ofs; 
uint32_t alloclen, phys_ofs, ilen; 
static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, 					struct jffs2_inode_info *f, struct jffs2_full_dnode *fn){	struct jffs2_full_dnode *new_fn;	struct jffs2_raw_inode ri;	jint16_t dev;	char *mdata = NULL, mdatalen = 0;	uint32_t alloclen, phys_ofs;	int ret;	if (S_ISBLK(JFFS2_F_I_MODE(f)) ||	    S_ISCHR(JFFS2_F_I_MODE(f)) ) {		/* For these, we don't actually need to read the old node */		/* FIXME: for minor or major > 255. */		dev = cpu_to_je16(((JFFS2_F_I_RDEV_MAJ(f) << 8) | 			JFFS2_F_I_RDEV_MIN(f)));		mdata = (char *)&dev;		mdatalen = sizeof(dev);		D1(printk(KERN_DEBUG "jffs2_garbage_collect_metadata(): Writing %d bytes of kdev_t\n", mdatalen));	} else if (S_ISLNK(JFFS2_F_I_MODE(f))) {		mdatalen = fn->size;		mdata = kmalloc(fn->size, GFP_KERNEL);		if (!mdata) {			printk(KERN_WARNING "kmalloc of mdata failed in jffs2_garbage_collect_metadata()\n");			return -ENOMEM;		}		ret = jffs2_read_dnode(c, f, fn, mdata, 0, mdatalen);		if (ret) {			printk(KERN_WARNING "read of old metadata failed in jffs2_garbage_collect_metadata(): %d\n", ret);			kfree(mdata);			return ret;		}		D1(printk(KERN_DEBUG "jffs2_garbage_collect_metadata(): Writing %d bites of symlink target\n", mdatalen));	}		ret = jffs2_reserve_space_gc(c, sizeof(ri) + mdatalen, &phys_ofs, &alloclen);	if (ret) {		printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_metadata failed: %d\n",		       sizeof(ri)+ mdatalen, ret);		goto out;	}		memset(&ri, 0, sizeof(ri));	ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);	ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);	ri.totlen = cpu_to_je32(sizeof(ri) + mdatalen);	ri.hdr_crc = cpu_to_je32(crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4));	ri.ino = cpu_to_je32(f->inocache->ino);	ri.version = cpu_to_je32(++f->highest_version);	ri.mode = cpu_to_jemode(JFFS2_F_I_MODE(f));	ri.uid = cpu_to_je16(JFFS2_F_I_UID(f));	ri.gid = cpu_to_je16(JFFS2_F_I_GID(f));	ri.isize = cpu_to_je32(JFFS2_F_I_SIZE(f));	ri.atime = cpu_to_je32(JFFS2_F_I_ATIME(f));	ri.ctime = cpu_to_je32(JFFS2_F_I_CTIME(f));	ri.mtime = cpu_to_je32(JFFS2_F_I_MTIME(f));	ri.offset = cpu_to_je32(0);	ri.csize = cpu_to_je32(mdatalen);	ri.dsize = cpu_to_je32(mdatalen);	ri.compr = JFFS2_COMPR_NONE;	ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));	ri.data_crc = cpu_to_je32(crc32(0, mdata, mdatalen));	new_fn = jffs2_write_dnode(c, f, &ri, mdata, mdatalen, phys_ofs, ALLOC_GC);	if (IS_ERR(new_fn)) {		printk(KERN_WARNING "Error writing new dnode: %ld\n", PTR_ERR(new_fn));		ret = PTR_ERR(new_fn);		goto out;	}	jffs2_mark_node_obsolete(c, fn->raw);	jffs2_free_full_dnode(fn);	f->metadata = new_fn; out:	if (S_ISLNK(JFFS2_F_I_MODE(f)))		kfree(mdata);	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/8557fd51c22e4c2109f062decd19de439061ceae/gc.c/buggy/fs/jffs2/gc.c