rem: static s32 __card_allocblock(u32 chn,u32 blocksneed,cardcallback callback)
add: static s32 __card_allocblock(s32 chn,u32 blocksneed,cardcallback callback)
context: static s32 __card_allocblock(u32 chn,u32 blocksneed,cardcallback callback){	s32 ret;	u16 block,currblock = 0,prevblock = 0;	u32 i,count;	card_block *card = NULL;	struct card_bat *fatblock = NULL;#ifdef _CARD_DEBUG	printf("__card_allocblock(%d,%d,%p)\n",chn,blocksneed,callback);#endif	if(chn<EXI_CHANNEL_0 || chn>=EXI_CHANNEL_2) return CARD_ERROR_FATAL_ERROR;	card = &cardmap[chn];	if(!card->attached) return CARD_ERROR_NOCARD;	fatblock = __card_getbatblock(card);#ifdef _CARD_DEBUG	printf("__card_allocblock(%p,%d)\n",fatblock,fatblock->freeblocks);#endif		if(fatblock->freeblocks<blocksneed) return CARD_ERROR_INSSPACE;		// Add which blocks this file will take up into the FAT	count = 0;	block = 0xffff;	currblock = fatblock->lastalloc;	i = blocksneed;	while(1) {		if(i==0) {			// Done allocating blocks#ifdef _CARD_DEBUG			printf("__card_allocblock(%d : %d)\n",block,currblock);#endif			fatblock->freeblocks -= blocksneed;			fatblock->lastalloc = currblock;			card->curr_fileblock = block;			ret = __card_updatefat(chn,fatblock,callback);			break;		}		/*		  Since testing free space has already been done, if all the blocks		  the file takes up cannot be entered into the FAT, something is		  wrong.		*/		count++;		if(count>=(card->blocks-CARD_SYSAREA)) return CARD_ERROR_BROKEN;			currblock++;	    if(currblock<CARD_SYSAREA || currblock>=card->blocks) currblock = CARD_SYSAREA;		if(fatblock->fat[currblock-CARD_SYSAREA]==0) {			if(block!=0xffff)				fatblock->fat[prevblock-CARD_SYSAREA] = currblock;			else				block = currblock;			fatblock->fat[currblock-CARD_SYSAREA] = 0xffff;			prevblock = currblock;			i--;		}	}	return ret;}