void journalWrite(pfs_mount_t *pfsMount, pfs_cache_t *clink, u32 numBuffers) { u32 i=0; u32 logSector=2; for(i=0; i <numBuffers;i++) { if((clink[i].flags & CACHE_FLAG_DIRTY) && clink[i].pfsMount == pfsMount) { if(clink[i].flags & (CACHE_FLAG_SEGD|CACHE_FLAG_SEGI)) clink[i].u.inode->checksum=inodeCheckSum(clink[i].u.inode); journalBuf.log[journalBuf.num].sector = clink[i].sector << blockSize; journalBuf.log[journalBuf.num].sub = clink[i].sub; journalBuf.log[journalBuf.num].logSector = logSector; journalBuf.num+=1; } logSector+=2; } if(pfsMount->blockDev->transfer(pfsMount->fd, clink->u.inode, 0, (pfsMount->log.number << pfsMount->sector_scale) + 2, numBuffers*2, IOCTL2_TMODE_WRITE)>=0) journalFlush(pfsMount); }
int journalReset(u32 device) { memset(&journalBuf, 0, sizeof(apa_journal_t)); journalBuf.magic=APAL_MAGIC; return journalFlush(device); }