c->cs_struct
) and inicializes it. CS calls a special building function to determine the status of the first three eraseblocks. If the first three eraseblock are marked as bad then CS is disabled and works as without CS support. If it finds a not bad block then sets c->cs_struct->csblock
to points to this eraseblock and reads the content of the csblock. CS differentiate five different case depending on the content.
In case 2 the last unmount was not clean. It means there is no valid CS data on flash and normal scan have to run down. cs_flags' valid field is set to true.
In case 3 the csblock is not valid and the valid flag is set to false. All of the contents must be replaced after the normal scan process, after the replacement the eraseblock is erased and used only for storing CS log nodes.
In case 4 the csblock may have bad area and the data can be wrong. The valid flag is set to true. csblock is erased and normal scan runs.
In case 5 the CS data is wrong CS writes a mount log. If not clean unmount comes then the next mount time CS will know that the last umount log is not valid. The valid flag is set to true and normal scan runs.