if(simulate_power_failure &&
remaining_ops < 1){
printf("Simulated power failure after %d operations\n",nops_so_far);
if(simulate_power_failure &&
remaining_ops < 1){
printf("Simulated power failure after %d operations\n",nops_so_far);
- printf(" power failed on chunkInNAND %d, at fail point %d\n",
- chunkInNAND, failPoint);
+ printf(" power failed on nand_chunk %d, at fail point %d\n",
+ nand_chunk, failPoint);
-int yflash2_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_ExtendedTags *tags)
+int yflash2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags)
- T(YAFFS_TRACE_MTD,(TSTR("write chunk %d data %x tags %x" TENDSTR),chunkInNAND,(unsigned)data, (unsigned)tags));
+ T(YAFFS_TRACE_MTD,(TSTR("write chunk %d data %x tags %x" TENDSTR),nand_chunk,(unsigned)data, (unsigned)tags));
- pos = (chunkInNAND % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE;
- h = filedisk.handle[(chunkInNAND / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
+ pos = (nand_chunk % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE;
+ h = filedisk.handle[(nand_chunk / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
- pos = (chunkInNAND % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE;
- h = filedisk.handle[(chunkInNAND / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
+ pos = (nand_chunk % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE;
+ h = filedisk.handle[(nand_chunk / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
- pos = (chunkInNAND % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE + PAGE_DATA_SIZE ;
- h = filedisk.handle[(chunkInNAND / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
+ pos = (nand_chunk % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE + PAGE_DATA_SIZE ;
+ h = filedisk.handle[(nand_chunk / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
- written = write(h,tags,sizeof(yaffs_ExtendedTags));
- if(written != sizeof(yaffs_ExtendedTags)) return YAFFS_FAIL;
+ written = write(h,tags,sizeof(yaffs_ext_tags));
+ if(written != sizeof(yaffs_ext_tags)) return YAFFS_FAIL;
__u8 * ptab = (__u8 *)&pt;
nRead = read(h,localBuffer,sizeof(pt));
for(i = error = 0; REPORT_ERROR && i < sizeof(pt) && !error; i++){
if(localBuffer[i] != 0xFF){
printf("nand simulation: chunk %d oob byte %d was %0x2\n",
__u8 * ptab = (__u8 *)&pt;
nRead = read(h,localBuffer,sizeof(pt));
for(i = error = 0; REPORT_ERROR && i < sizeof(pt) && !error; i++){
if(localBuffer[i] != 0xFF){
printf("nand simulation: chunk %d oob byte %d was %0x2\n",
- pos = (chunkInNAND % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE;
- h = filedisk.handle[(chunkInNAND / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
+ pos = (nand_chunk % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE;
+ h = filedisk.handle[(nand_chunk / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
- pos = (chunkInNAND % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE + PAGE_DATA_SIZE ;
- h = filedisk.handle[(chunkInNAND / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
+ pos = (nand_chunk % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE + PAGE_DATA_SIZE ;
+ h = filedisk.handle[(nand_chunk / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
- written = write(h,tags,sizeof(yaffs_ExtendedTags));
- if(written != sizeof(yaffs_ExtendedTags)) return YAFFS_FAIL;
+ written = write(h,tags,sizeof(yaffs_ext_tags));
+ if(written != sizeof(yaffs_ext_tags)) return YAFFS_FAIL;
__u8 * ptab = (__u8 *)&pt;
nRead = read(h,localBuffer,sizeof(pt));
for(i = error = 0; REPORT_ERROR && i < sizeof(pt) && !error; i++){
if(localBuffer[i] != 0xFF){
printf("nand simulation: chunk %d oob byte %d was %0x2\n",
__u8 * ptab = (__u8 *)&pt;
nRead = read(h,localBuffer,sizeof(pt));
for(i = error = 0; REPORT_ERROR && i < sizeof(pt) && !error; i++){
if(localBuffer[i] != 0xFF){
printf("nand simulation: chunk %d oob byte %d was %0x2\n",
-int yflash2_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_ExtendedTags *tags)
+int yflash2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags)
- T(YAFFS_TRACE_MTD,(TSTR("read chunk %d data %x tags %x" TENDSTR),chunkInNAND,(unsigned)data, (unsigned)tags));
+ T(YAFFS_TRACE_MTD,(TSTR("read chunk %d data %x tags %x" TENDSTR),nand_chunk,(unsigned)data, (unsigned)tags));
- pos = (chunkInNAND % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE;
- h = filedisk.handle[(chunkInNAND / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
+ pos = (nand_chunk % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE;
+ h = filedisk.handle[(nand_chunk / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
- pos = (chunkInNAND % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE;
- h = filedisk.handle[(chunkInNAND / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
+ pos = (nand_chunk % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE;
+ h = filedisk.handle[(nand_chunk / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
- pos = (chunkInNAND % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE + PAGE_DATA_SIZE;
- h = filedisk.handle[(chunkInNAND / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
+ pos = (nand_chunk % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE + PAGE_DATA_SIZE;
+ h = filedisk.handle[(nand_chunk / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
- nread= read(h,tags,sizeof(yaffs_ExtendedTags));
- if(nread != sizeof(yaffs_ExtendedTags))
+ nread= read(h,tags,sizeof(yaffs_ext_tags));
+ if(nread != sizeof(yaffs_ext_tags))
- if((chunkInNAND >> 6) == 100) {
- if(fail300 && tags->eccResult == YAFFS_ECC_RESULT_NO_ERROR){
- tags->eccResult = YAFFS_ECC_RESULT_FIXED;
+ if((nand_chunk >> 6) == 100) {
+ if(fail300 && tags->ecc_result == YAFFS_ECC_RESULT_NO_ERROR){
+ tags->ecc_result = YAFFS_ECC_RESULT_FIXED;
- if((chunkInNAND >> 6) == 110) {
- if(fail320 && tags->eccResult == YAFFS_ECC_RESULT_NO_ERROR){
- tags->eccResult = YAFFS_ECC_RESULT_FIXED;
+ if((nand_chunk >> 6) == 110) {
+ if(fail320 && tags->ecc_result == YAFFS_ECC_RESULT_NO_ERROR){
+ tags->ecc_result = YAFFS_ECC_RESULT_FIXED;
- h = filedisk.handle[(blockNo / ( BLOCKS_PER_HANDLE))];
- lseek(h,((blockNo % BLOCKS_PER_HANDLE) * dev->param.nChunksPerBlock) * PAGE_SIZE + PAGE_DATA_SIZE,SEEK_SET);
+ h = filedisk.handle[(block_no / ( BLOCKS_PER_HANDLE))];
+ lseek(h,((block_no % BLOCKS_PER_HANDLE) * dev->param.chunks_per_block) * PAGE_SIZE + PAGE_DATA_SIZE,SEEK_SET);
written = write(h,&pt,sizeof(pt));
if(written != sizeof(pt)) return YAFFS_FAIL;
written = write(h,&pt,sizeof(pt));
if(written != sizeof(pt)) return YAFFS_FAIL;
- lseek(h,((blockNumber % BLOCKS_PER_HANDLE) * dev->param.nChunksPerBlock) * PAGE_SIZE,SEEK_SET);
- for(i = 0; i < dev->param.nChunksPerBlock; i++)
+ lseek(h,((blockNumber % BLOCKS_PER_HANDLE) * dev->param.chunks_per_block) * PAGE_SIZE,SEEK_SET);
+ for(i = 0; i < dev->param.chunks_per_block; i++)
-int yflash2_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, yaffs_BlockState *state, __u32 *sequenceNumber)
+int yflash2_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, __u32 *seq_number)
yflash2_ReadChunkWithTagsFromNAND(dev,chunkNo,NULL,&tags);
yflash2_ReadChunkWithTagsFromNAND(dev,chunkNo,NULL,&tags);