- dev->checkpointByteCount = 0;
- dev->checkpointSum = 0;
- dev->checkpointXor = 0;
- dev->checkpointCurrentBlock = -1;
- dev->checkpointCurrentChunk = -1;
- dev->checkpointNextBlock = dev->internalStartBlock;
-
- /* Erase all the blocks in the checkpoint area */
- if (forWriting) {
- memset(dev->checkpointBuffer, 0, dev->nDataBytesPerChunk);
- dev->checkpointByteOffset = 0;
- return yaffs_CheckpointErase(dev);
- } else {
- int i;
- /* Set to a value that will kick off a read */
- dev->checkpointByteOffset = dev->nDataBytesPerChunk;
- /* A checkpoint block list of 1 checkpoint block per 16 block is (hopefully)
- * going to be way more than we need */
- dev->blocksInCheckpoint = 0;
- dev->checkpointMaxBlocks = (dev->internalEndBlock - dev->internalStartBlock)/16 + 2;
- dev->checkpointBlockList = YMALLOC(sizeof(int) * dev->checkpointMaxBlocks);
- if(!dev->checkpointBlockList)
- return 0;
-
- for (i = 0; i < dev->checkpointMaxBlocks; i++)
- dev->checkpointBlockList[i] = -1;
- }