rem: static void __write_callback(u32 chn,s32 result)
add: static void __write_callback(s32 chn,s32 result)
context: static void __write_callback(u32 chn,s32 result){	s32 ret;	cardcallback cb = NULL;	card_file *file = NULL;	struct card_bat *fatblock = NULL;	struct card_dir *dirblock = NULL;	struct card_direntry *entry = NULL;	card_block *card = &cardmap[chn];#ifdef _CARD_DEBUG	printf("__write_callback(%d,%d)\n",chn,result);#endif	ret = result;	if(ret>=0) {		file = card->curr_file;		if(file->len>=0) {			file->len = (card->sector_size-file->len);			if(file->len<=0) {				dirblock = __card_getdirblock(card);				entry = &dirblock->entries[file->filenum];				entry->lastmodified = time(NULL);				cb = card->card_api_cb;				card->card_api_cb = NULL;				if((ret=__card_updatedir(chn,cb))>=0) return;			} else {				fatblock = __card_getbatblock(card);				file->offset += card->sector_size;				file->iblock = fatblock->fat[file->iblock-CARD_SYSAREA];				if(file->iblock<CARD_SYSAREA || file->iblock>=card->blocks) {					ret = CARD_ERROR_BROKEN;					goto exit;				}				if((ret=__card_sectorerase(chn,(file->iblock*card->sector_size),__erase_callback))>=0) return;			}		} else			ret = CARD_ERROR_CANCELED;	}exit:	cb = card->card_api_cb;	card->card_api_cb = NULL;	__card_putcntrlblock(card,ret);	if(cb) cb(chn,ret);}