signed char ioman_flushAll(IOManager *ioman) { unsigned short c; for(c=0;c<ioman->numbuf;c++){ if(ioman_isWritable(c)){ if(ioman_flushSector(ioman,c)){ return(-1); } if(ioman->usage[c]==0)ioman_setNotWritable(c); } } return(0); }
esint8 ioman_flushAll(IOManager *ioman) { euint16 c; for(c=0;c<ioman->numbuf;c++){ if(ioman_isWritable(c)){ if(ioman_flushSector(ioman,c)){ return(-1); } if(ioman->usage[c]==0)ioman_setNotWritable(c); } } return(0); }
signed char ioman_flushRange(IOManager *ioman,unsigned long address_low, unsigned long address_high) { unsigned long c; if(address_low>address_high){ c=address_low; address_low=address_high;address_high=c; } for(c=0;c<ioman->numbuf;c++){ if((ioman->sector[c]>=address_low) && (ioman->sector[c]<=address_high) && (ioman_isWritable(c))){ if(ioman_flushSector(ioman,c)){ return(-1); } if(ioman->usage[c]==0)ioman_setNotWritable(c); } } return(0); }
signed char ioman_flushSector(IOManager *ioman, unsigned short bufplace) { unsigned char* buf; if((buf = ioman_getPtr(ioman,bufplace))==0){ ioman_setError(ioman,IOMAN_ERR_CACHEPTROUTOFRANGE); return(-1); } if(!ioman_isWritable(bufplace)){ ioman_setError(ioman,IOMAN_ERR_WRITEREADONLYSECTOR); return(-1); } if(!(ioman_writeSector(ioman,ioman->sector[bufplace],buf))){ ioman_setError(ioman,IOMAN_ERR_WRITEFAIL); return(-1); } if(ioman->usage==0)ioman_setNotWritable(bufplace); return(0); }