yaffs Make more symbol changes
authorCharles Manning <cdhmanning@gmail.com>
Wed, 6 Oct 2010 22:10:58 +0000 (11:10 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Wed, 6 Oct 2010 22:14:38 +0000 (11:14 +1300)
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
64 files changed:
direct/basic-test/dtest.c
direct/basic-test/yaffs_fileem.c
direct/basic-test/yaffs_fileem2k.c
direct/basic-test/yaffs_norif1.c
direct/basic-test/yaffs_norif1.h
direct/basic-test/yaffs_ramdisk.c
direct/basic-test/yaffs_ramdisk.h
direct/basic-test/yaffs_ramem2k.c
direct/basic-test/yaffscfg.c
direct/basic-test/yaffscfg2k.c
direct/basic-test/yramsim.c
direct/basic-test/yramsim.h
direct/tests/nor_stress.c
direct/yaffs_flashif.c
direct/yaffs_flashif.h
direct/yaffs_flashif2.h
direct/yaffs_nandif.c
direct/yaffs_nandif.h
direct/yaffscfg.h
direct/yaffsfs.c
direct/yaffsfs.h
moduleconfig.h
mtdemul/nandemul2k.c
patches/yaffs_mtdif2.c
utils/mkyaffs2image.c
utils/mkyaffsimage.c
yaffs_allocator.c
yaffs_allocator.h
yaffs_bitmap.c
yaffs_bitmap.h
yaffs_checkptrw.c
yaffs_checkptrw.h
yaffs_ecc.c
yaffs_ecc.h
yaffs_getblockinfo.h
yaffs_guts.c
yaffs_guts.h
yaffs_linux.h
yaffs_linux_allocator.c
yaffs_mtdif.c
yaffs_mtdif.h
yaffs_mtdif1.c
yaffs_mtdif1.h
yaffs_mtdif2.c
yaffs_mtdif2.h
yaffs_nand.c
yaffs_nand.h
yaffs_nandemul2k.h
yaffs_packedtags1.c
yaffs_packedtags1.h
yaffs_packedtags2.c
yaffs_packedtags2.h
yaffs_tagscompat.c
yaffs_tagscompat.h
yaffs_tagsvalidity.c
yaffs_tagsvalidity.h
yaffs_verify.c
yaffs_verify.h
yaffs_vfs.c
yaffs_vfs_multi.c
yaffs_yaffs1.c
yaffs_yaffs1.h
yaffs_yaffs2.c
yaffs_yaffs2.h

index f272f0c..779ac15 100644 (file)
@@ -2642,15 +2642,15 @@ void big_xattr_test(const char *mountpt)
 }
 
 
-void dump_dev_stats(yaffs_Device *dev, const char * str)
+void dump_dev_stats(yaffs_dev_t *dev, const char * str)
 {
        printf("%s\n",str);
        printf( "space free %d erased %d "
                "nand reads %d writes %d erases %d "
                "gc all %d passive %d oldestdirty %d blocks %d copies %d \n",
-               dev->nFreeChunks, dev->nErasedBlocks * dev->param.nChunksPerBlock,
-               dev->nPageReads, dev->nPageWrites, dev->nBlockErasures,
-               dev->allGCs, dev->passiveGCs, dev->oldestDirtyGCs, dev->nGCBlocks, dev->nGCCopies);
+               dev->n_free_chunks, dev->n_erased_blocks * dev->param.chunks_per_block,
+               dev->n_page_reads, dev->n_page_writes, dev->n_erasures,
+               dev->all_gcs, dev->passive_gc_count, dev->oldest_dirty_gc_count, dev->n_gc_blocks, dev->n_gc_copies);
 }
 
 void test_flash_traffic(const char *mountpt)
@@ -2658,7 +2658,7 @@ void test_flash_traffic(const char *mountpt)
        char name0[100];
        char name1[100];
        int i;
-       yaffs_Device *dev;
+       yaffs_dev_t *dev;
 
        yaffs_trace_mask = 0;
 
index 90c8f9e..419b16f 100644 (file)
@@ -62,7 +62,7 @@ typedef struct
 
 static yflash_Device filedisk;
 
-static int  CheckInit(yaffs_Device *dev)
+static int  CheckInit(yaffs_dev_t *dev)
 {
        static int initialised = 0;
        
@@ -118,7 +118,7 @@ static int  CheckInit(yaffs_Device *dev)
        return 1;
 }
 
-int yflash_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_Spare *spare)
+int yflash_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_spare *spare)
 {
        int written;
 
@@ -128,7 +128,7 @@ int yflash_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data,
        
        if(data)
        {
-               lseek(filedisk.handle,chunkInNAND * 528,SEEK_SET);
+               lseek(filedisk.handle,nand_chunk * 528,SEEK_SET);
                written = write(filedisk.handle,data,512);
                
                if(written != 512) return YAFFS_FAIL;
@@ -136,7 +136,7 @@ int yflash_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data,
        
        if(spare)
        {
-               lseek(filedisk.handle,chunkInNAND * 528 + 512,SEEK_SET);
+               lseek(filedisk.handle,nand_chunk * 528 + 512,SEEK_SET);
                written = write(filedisk.handle,spare,16);
                
                if(written != 16) return YAFFS_FAIL;
@@ -148,7 +148,7 @@ int yflash_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data,
 }
 
 
-int yflash_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare)
+int yflash_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_spare *spare)
 {
        int nread;
 
@@ -158,7 +158,7 @@ int yflash_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaff
        
        if(data)
        {
-               lseek(filedisk.handle,chunkInNAND * 528,SEEK_SET);
+               lseek(filedisk.handle,nand_chunk * 528,SEEK_SET);
                nread = read(filedisk.handle,data,512);
                
                if(nread != 512) return YAFFS_FAIL;
@@ -166,7 +166,7 @@ int yflash_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaff
        
        if(spare)
        {
-               lseek(filedisk.handle,chunkInNAND * 528 + 512,SEEK_SET);
+               lseek(filedisk.handle,nand_chunk * 528 + 512,SEEK_SET);
                nread= read(filedisk.handle,spare,16);
                
                if(nread != 16) return YAFFS_FAIL;
@@ -178,7 +178,7 @@ int yflash_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaff
 }
 
 
-int yflash_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
+int yflash_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber)
 {
 
        int i;
@@ -208,7 +208,7 @@ int yflash_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
        
 }
 
-int yflash_InitialiseNAND(yaffs_Device *dev)
+int yflash_InitialiseNAND(yaffs_dev_t *dev)
 {
        
        return YAFFS_OK;
index a939e26..ad76c01 100644 (file)
@@ -73,7 +73,7 @@ static int nops_so_far;
 int ops_multiplier;
 
 
-static void yflash2_MaybePowerFail(unsigned int chunkInNAND, int failPoint)
+static void yflash2_MaybePowerFail(unsigned int nand_chunk, int failPoint)
 {
 
    nops_so_far++;
@@ -83,8 +83,8 @@ static void yflash2_MaybePowerFail(unsigned int chunkInNAND, int failPoint)
    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);
        exit(0);
   }
 }
@@ -171,7 +171,7 @@ int yflash2_GetNumberOfBlocks(void)
        return filedisk.nBlocks;
 }
 
-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)
 {
        int written;
        int pos;
@@ -180,22 +180,22 @@ int yflash2_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u
        int nRead;
        int error;
        
-       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));
 
        CheckInit();
        
        
-       if(dev->param.inbandTags){
+       if(dev->param.inband_tags){
                
                yaffs_PackedTags2TagsPart * pt2tp;
-               pt2tp = (yaffs_PackedTags2TagsPart *)&data[dev->nDataBytesPerChunk];
+               pt2tp = (yaffs_PackedTags2TagsPart *)&data[dev->data_bytes_per_chunk];
                yaffs_PackTags2TagsPart(pt2tp,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))];
                                                        
                lseek(h,pos,SEEK_SET);
-               written = write(h,data,dev->param.totalBytesPerChunk);
+               written = write(h,data,dev->param.total_bytes_per_chunk);
 
                
                if(yaffs_test_partial_write){
@@ -203,7 +203,7 @@ int yflash2_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u
                        exit(1);
                }
                
-               if(written != dev->param.totalBytesPerChunk) return YAFFS_FAIL;
+               if(written != dev->param.total_bytes_per_chunk) return YAFFS_FAIL;
 
 
        }
@@ -215,25 +215,25 @@ int yflash2_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u
 
                if(data)
                {
-                       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))];
                
                        
-                       memcpy(localBuffer,data, dev->nDataBytesPerChunk);
+                       memcpy(localBuffer,data, dev->data_bytes_per_chunk);
                        
                        n_partials = rand()%20;
                        
                        for(i = 0; i < n_partials; i++){
-                               bpos = rand() % dev->nDataBytesPerChunk;
+                               bpos = rand() % dev->data_bytes_per_chunk;
                                
                                localBuffer[bpos] |= (1 << (rand() & 7));
                        }
                  
-                       if(REPORT_ERROR && memcmp(localBuffer,data,dev->nDataBytesPerChunk))
+                       if(REPORT_ERROR && memcmp(localBuffer,data,dev->data_bytes_per_chunk))
                                printf("nand simulator: data does not match\n");
                        
                        lseek(h,pos,SEEK_SET);
-                       written = write(h,localBuffer,dev->nDataBytesPerChunk);
+                       written = write(h,localBuffer,dev->data_bytes_per_chunk);
                
                        if(yaffs_test_partial_write){
                                close(h);
@@ -241,34 +241,34 @@ int yflash2_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u
                        }
 
 
-                       if(written != dev->nDataBytesPerChunk) return YAFFS_FAIL;
+                       if(written != dev->data_bytes_per_chunk) return YAFFS_FAIL;
                }
-               // yflash2_MaybePowerFail(chunkInNAND,1);
+               // yflash2_MaybePowerFail(nand_chunk,1);
        
                if(tags)
                {
-                       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))];
                
                        lseek(h,pos,SEEK_SET);
 
-                       if( 0 && dev->param.isYaffs2)
+                       if( 0 && dev->param.is_yaffs2)
                        {
                        
-                               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;
                        }
                        else
                        {
                                yaffs_PackedTags2 pt;
-                               yaffs_PackTags2(&pt,tags, !dev->param.noTagsECC);
+                               yaffs_PackTags2(&pt,tags, !dev->param.no_tags_ecc);
                                __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",
-                                                       chunkInNAND,i,localBuffer[i]);
+                                                       nand_chunk,i,localBuffer[i]);
                                                        error = 1;
                                        }
                                }
@@ -294,25 +294,25 @@ int yflash2_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u
                        }
                }
                
-               //yflash2_MaybePowerFail(chunkInNAND,2);
+               //yflash2_MaybePowerFail(nand_chunk,2);
                
                /* Next do the whole write */
                if(data)
                {
-                       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))];
                
                        
                        memset(localBuffer,0xFF, PAGE_SIZE);            
-                       for(i = 0; i < dev->nDataBytesPerChunk; i++){
+                       for(i = 0; i < dev->data_bytes_per_chunk; i++){
                                localBuffer[i] &= data[i];
                        }
                  
-                       if(REPORT_ERROR && memcmp(localBuffer,data,dev->nDataBytesPerChunk))
+                       if(REPORT_ERROR && memcmp(localBuffer,data,dev->data_bytes_per_chunk))
                                printf("nand simulator: data does not match\n");
                        
                        lseek(h,pos,SEEK_SET);
-                       written = write(h,localBuffer,dev->nDataBytesPerChunk);
+                       written = write(h,localBuffer,dev->data_bytes_per_chunk);
                
                        if(yaffs_test_partial_write){
                                close(h);
@@ -320,33 +320,33 @@ int yflash2_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u
                        }
 
 
-                       if(written != dev->nDataBytesPerChunk) return YAFFS_FAIL;
+                       if(written != dev->data_bytes_per_chunk) return YAFFS_FAIL;
                }
        
                if(tags)
                {
-                       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))];
                
                        lseek(h,pos,SEEK_SET);
 
-                       if( 0 && dev->param.isYaffs2)
+                       if( 0 && dev->param.is_yaffs2)
                        {
                        
-                               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;
                        }
                        else
                        {
                                yaffs_PackedTags2 pt;
-                               yaffs_PackTags2(&pt,tags,!dev->param.noTagsECC);
+                               yaffs_PackTags2(&pt,tags,!dev->param.no_tags_ecc);
                                __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",
-                                                       chunkInNAND,i,localBuffer[i]);
+                                                       nand_chunk,i,localBuffer[i]);
                                                        error = 1;
                                        }
                                }
@@ -364,7 +364,7 @@ int yflash2_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u
                        }
                }
                
-               yflash2_MaybePowerFail(chunkInNAND,3);
+               yflash2_MaybePowerFail(nand_chunk,3);
        
        }
        return YAFFS_OK;        
@@ -388,7 +388,7 @@ static int fail320 = 1;
 
 static int failRead10 = 2;
 
-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)
 {
        int nread;
        int pos;
@@ -397,14 +397,14 @@ int yflash2_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *d
        int retval = YAFFS_OK;
        int nRead;
        
-       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));
        
        CheckInit();
        
        
        
        
-       if(dev->param.inbandTags){
+       if(dev->param.inband_tags){
                /* Got to suck the tags out of the data area */
                if(!data) {
                        localData=1;
@@ -413,19 +413,19 @@ int yflash2_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *d
 
                
                yaffs_PackedTags2TagsPart * pt2tp;
-               pt2tp = (yaffs_PackedTags2TagsPart *)&data[dev->nDataBytesPerChunk];
+               pt2tp = (yaffs_PackedTags2TagsPart *)&data[dev->data_bytes_per_chunk];
 
                
-               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))];
                
                lseek(h,pos,SEEK_SET);
 
-               nRead = read(h, data,dev->param.totalBytesPerChunk);
+               nRead = read(h, data,dev->param.total_bytes_per_chunk);
 
                yaffs_unpack_tags2tags_part(tags,pt2tp);
                
-               if(nread != dev->param.totalBytesPerChunk)
+               if(nread != dev->param.total_bytes_per_chunk)
                        retval = YAFFS_FAIL;
                        
                if(localData)
@@ -440,57 +440,57 @@ int yflash2_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *d
                if(data)
                {
 
-                       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))];              
                        lseek(h,pos,SEEK_SET);
-                       nread = read(h,data,dev->nDataBytesPerChunk);
+                       nread = read(h,data,dev->data_bytes_per_chunk);
                
                
-                       if(nread != dev->nDataBytesPerChunk) 
+                       if(nread != dev->data_bytes_per_chunk) 
                                retval = YAFFS_FAIL;
                }
        
                if(tags)
                {
-                       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))];              
                        lseek(h,pos,SEEK_SET);
 
-                       if(0 && dev->param.isYaffs2)
+                       if(0 && dev->param.is_yaffs2)
                        {
-                               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))
                                         retval =  YAFFS_FAIL;
-                               if(yaffs_check_all_ff((__u8 *)tags,sizeof(yaffs_ExtendedTags)))
+                               if(yaffs_check_all_ff((__u8 *)tags,sizeof(yaffs_ext_tags)))
                                {
                                        yaffs_init_tags(tags);
                                }
                                else
                                {
-                                       tags->chunkUsed = 1;
+                                       tags->chunk_used = 1;
                                }
                        }
                        else
                        {
                                yaffs_PackedTags2 pt;
                                nread= read(h,&pt,sizeof(pt));
-                               yaffs_unpack_tags2(tags,&pt, !dev->param.noTagsECC);
+                               yaffs_unpack_tags2(tags,&pt, !dev->param.no_tags_ecc);
 #ifdef SIMULATE_FAILURES
-                               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;
                                                fail300 = 0;
                                        }
                                }
                                
-                               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;
                                                fail320 = 0;
                                        }
                                }
 #endif
-                               if(failRead10>0 && chunkInNAND == 10){
+                               if(failRead10>0 && nand_chunk == 10){
                                        failRead10--;
                                        nread = 0;
                                }
@@ -508,7 +508,7 @@ int yflash2_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *d
 }
 
 
-int yflash2_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
+int yflash2_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no)
 {
        int written;
        int h;
@@ -518,8 +518,8 @@ int yflash2_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
        CheckInit();
        
        memset(&pt,0,sizeof(pt));
-       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;
@@ -529,7 +529,7 @@ int yflash2_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
        
 }
 
-int yflash2_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
+int yflash2_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber)
 {
 
        int i;
@@ -558,8 +558,8 @@ int yflash2_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
                
 
                h = filedisk.handle[(blockNumber / ( BLOCKS_PER_HANDLE))];
-               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++)
                {
                        write(h,pg,PAGE_SIZE);
                }
@@ -570,7 +570,7 @@ int yflash2_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
        
 }
 
-int yflash2_InitialiseNAND(yaffs_Device *dev)
+int yflash2_InitialiseNAND(yaffs_dev_t *dev)
 {
        CheckInit();
        
@@ -580,28 +580,28 @@ int yflash2_InitialiseNAND(yaffs_Device *dev)
 
 
 
-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)
 {
-       yaffs_ExtendedTags tags;
+       yaffs_ext_tags tags;
        int chunkNo;
 
-       *sequenceNumber = 0;
+       *seq_number = 0;
        
-       chunkNo = blockNo * dev->param.nChunksPerBlock;
+       chunkNo = block_no * dev->param.chunks_per_block;
        
        yflash2_ReadChunkWithTagsFromNAND(dev,chunkNo,NULL,&tags);
-       if(tags.blockBad)
+       if(tags.block_bad)
        {
                *state = YAFFS_BLOCK_STATE_DEAD;
        }
-       else if(!tags.chunkUsed)
+       else if(!tags.chunk_used)
        {
                *state = YAFFS_BLOCK_STATE_EMPTY;
        }
-       else if(tags.chunkUsed)
+       else if(tags.chunk_used)
        {
                *state = YAFFS_BLOCK_STATE_NEEDS_SCANNING;
-               *sequenceNumber = tags.sequenceNumber;
+               *seq_number = tags.seq_number;
        }
        return YAFFS_OK;
 }
index 4fcf971..5657c00 100644 (file)
@@ -88,7 +88,7 @@ const char *yaffs_norif1_c_version = "$Id: yaffs_norif1.c,v 1.6 2010-02-18 01:18
 #define DEVICE_BASE     (32 * 1024 * 1024)
 #endif
 
-__u32 *Block2Addr(yaffs_Device *dev, int blockNumber)
+__u32 *Block2Addr(yaffs_dev_t *dev, int blockNumber)
 {
        __u32 addr;
        dev=dev;
@@ -99,7 +99,7 @@ __u32 *Block2Addr(yaffs_Device *dev, int blockNumber)
        return (__u32 *) addr;
 }
 
-__u32 *Block2FormatAddr(yaffs_Device *dev,int blockNumber)
+__u32 *Block2FormatAddr(yaffs_dev_t *dev,int blockNumber)
 {
        __u32 addr;
 
@@ -108,14 +108,14 @@ __u32 *Block2FormatAddr(yaffs_Device *dev,int blockNumber)
        
        return (__u32 *)addr;
 }
-__u32 *Chunk2DataAddr(yaffs_Device *dev,int chunkId)
+__u32 *Chunk2DataAddr(yaffs_dev_t *dev,int chunk_id)
 {
        unsigned block;
        unsigned chunkInBlock;
        __u32  addr;
        
-       block = chunkId/dev->param.nChunksPerBlock;
-       chunkInBlock = chunkId % dev->param.nChunksPerBlock;
+       block = chunk_id/dev->param.chunks_per_block;
+       chunkInBlock = chunk_id % dev->param.chunks_per_block;
        
        addr = (__u32) Block2Addr(dev,block);
        addr += chunkInBlock * DATA_BYTES_PER_CHUNK;
@@ -123,14 +123,14 @@ __u32 *Chunk2DataAddr(yaffs_Device *dev,int chunkId)
        return (__u32 *)addr;
 }
 
-__u32 *Chunk2SpareAddr(yaffs_Device *dev,int chunkId)
+__u32 *Chunk2SpareAddr(yaffs_dev_t *dev,int chunk_id)
 {
        unsigned block;
        unsigned chunkInBlock;
        __u32 addr;
        
-       block = chunkId/dev->param.nChunksPerBlock;
-       chunkInBlock = chunkId % dev->param.nChunksPerBlock;
+       block = chunk_id/dev->param.chunks_per_block;
+       chunkInBlock = chunk_id % dev->param.chunks_per_block;
        
        addr = (__u32) Block2Addr(dev,block);
        addr += SPARE_AREA_OFFSET;
@@ -149,12 +149,12 @@ void ynorif1_AndBytes(__u8*target, const __u8   *src, int nbytes)
         }
 }
 
-int ynorif1_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_Spare *spare)
+int ynorif1_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_spare *spare)
 {
-        __u32 *dataAddr = Chunk2DataAddr(dev,chunkInNAND);
-        __u32 *spareAddr = Chunk2SpareAddr(dev,chunkInNAND);
+        __u32 *dataAddr = Chunk2DataAddr(dev,nand_chunk);
+        __u32 *spareAddr = Chunk2SpareAddr(dev,nand_chunk);
         
-        yaffs_Spare tmpSpare;
+        yaffs_spare tmpSpare;
         
         /* We should only be getting called for one of 3 reasons:
          * Writing a chunk: data and spare will not be NULL
@@ -162,30 +162,30 @@ int ynorif1_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data,
          * Writing a bad block marker: data will be NULL, spare not NULL
          */
          
-        if(sizeof(yaffs_Spare) != 16)
+        if(sizeof(yaffs_spare) != 16)
                 YBUG();
         
         if(data && spare)
         {
-                if(spare->pageStatus != 0xff)
+                if(spare->page_status != 0xff)
                         YBUG();
                 /* Write a pre-marker */
                 memset(&tmpSpare,0xff,sizeof(tmpSpare));
-                tmpSpare.pageStatus = YNOR_PREMARKER;
-                ynorif1_FlashWrite32(spareAddr,(__u32 *)&tmpSpare,sizeof(yaffs_Spare)/4);
+                tmpSpare.page_status = YNOR_PREMARKER;
+                ynorif1_FlashWrite32(spareAddr,(__u32 *)&tmpSpare,sizeof(yaffs_spare)/4);
 
                 /* Write the data */            
-                ynorif1_FlashWrite32(dataAddr,(__u32 *)data,dev->param.totalBytesPerChunk / 4);
+                ynorif1_FlashWrite32(dataAddr,(__u32 *)data,dev->param.total_bytes_per_chunk / 4);
                 
                 
-                memcpy(&tmpSpare,spare,sizeof(yaffs_Spare));
+                memcpy(&tmpSpare,spare,sizeof(yaffs_spare));
                 
                 /* Write the real tags, but override the premarker*/
-                tmpSpare.pageStatus = YNOR_PREMARKER;
-                ynorif1_FlashWrite32(spareAddr,(__u32 *)&tmpSpare,sizeof(yaffs_Spare)/4);
+                tmpSpare.page_status = YNOR_PREMARKER;
+                ynorif1_FlashWrite32(spareAddr,(__u32 *)&tmpSpare,sizeof(yaffs_spare)/4);
                 
                 /* Write a post-marker */
-                tmpSpare.pageStatus = YNOR_POSTMARKER;
+                tmpSpare.page_status = YNOR_POSTMARKER;
                 ynorif1_FlashWrite32(spareAddr,(__u32 *)&tmpSpare,sizeof(tmpSpare)/4);  
 
         } else if(spare){
@@ -193,7 +193,7 @@ int ynorif1_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data,
 
                 ynorif1_FlashRead32(spareAddr,(__u32 *)&tmpSpare,16/ 4);
                 
-                ynorif1_AndBytes((__u8 *)&tmpSpare,(__u8 *)spare,sizeof(yaffs_Spare));
+                ynorif1_AndBytes((__u8 *)&tmpSpare,(__u8 *)spare,sizeof(yaffs_spare));
                 
                 ynorif1_FlashWrite32(spareAddr,(__u32 *)&tmpSpare,16/ 4);
         }
@@ -206,15 +206,15 @@ int ynorif1_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data,
 
 }
 
-int ynorif1_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare)
+int ynorif1_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_spare *spare)
 {
 
-       __u32 *dataAddr = Chunk2DataAddr(dev,chunkInNAND);
-       __u32 *spareAddr = Chunk2SpareAddr(dev,chunkInNAND);
+       __u32 *dataAddr = Chunk2DataAddr(dev,nand_chunk);
+       __u32 *spareAddr = Chunk2SpareAddr(dev,nand_chunk);
        
        if(data)
        {
-               ynorif1_FlashRead32(dataAddr,(__u32 *)data,dev->param.totalBytesPerChunk / 4);
+               ynorif1_FlashRead32(dataAddr,(__u32 *)data,dev->param.total_bytes_per_chunk / 4);
        }
        
         if(spare)
@@ -224,11 +224,11 @@ int ynorif1_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaf
                 /* If the page status is YNOR_POSTMARKER then it was written properly
                  * so change that to 0xFF so that the rest of yaffs is happy.
                  */
-                if(spare->pageStatus == YNOR_POSTMARKER)
-                        spare->pageStatus = 0xFF;
-               else if(spare->pageStatus != 0xff &&
-                       (spare->pageStatus | YNOR_PREMARKER) != 0xff)
-                       spare->pageStatus = YNOR_PREMARKER;
+                if(spare->page_status == YNOR_POSTMARKER)
+                        spare->page_status = 0xFF;
+               else if(spare->page_status != 0xff &&
+                       (spare->page_status | YNOR_PREMARKER) != 0xff)
+                       spare->page_status = YNOR_PREMARKER;
         }
         
 
@@ -236,7 +236,7 @@ int ynorif1_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaf
 
 }
 
-static int ynorif1_FormatBlock(yaffs_Device *dev, int blockNumber)
+static int ynorif1_FormatBlock(yaffs_dev_t *dev, int blockNumber)
 {
        __u32 *blockAddr = Block2Addr(dev,blockNumber);
        __u32 *formatAddr = Block2FormatAddr(dev,blockNumber);
@@ -248,7 +248,7 @@ static int ynorif1_FormatBlock(yaffs_Device *dev, int blockNumber)
        return YAFFS_OK;
 }
 
-static int ynorif1_UnformatBlock(yaffs_Device *dev, int blockNumber)
+static int ynorif1_UnformatBlock(yaffs_dev_t *dev, int blockNumber)
 {
        __u32 *formatAddr = Block2FormatAddr(dev,blockNumber);
        __u32 formatValue = 0;
@@ -258,7 +258,7 @@ static int ynorif1_UnformatBlock(yaffs_Device *dev, int blockNumber)
        return YAFFS_OK;
 }
 
-static int ynorif1_IsBlockFormatted(yaffs_Device *dev, int blockNumber)
+static int ynorif1_IsBlockFormatted(yaffs_dev_t *dev, int blockNumber)
 {
        __u32 *formatAddr = Block2FormatAddr(dev,blockNumber);
        __u32 formatValue;
@@ -269,7 +269,7 @@ static int ynorif1_IsBlockFormatted(yaffs_Device *dev, int blockNumber)
        return (formatValue == FORMAT_VALUE);
 }
 
-int ynorif1_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
+int ynorif1_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber)
 {
 
        if(blockNumber < 0 || blockNumber >= BLOCKS_IN_DEVICE)
@@ -286,13 +286,13 @@ int ynorif1_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
        
 }
 
-int ynorif1_InitialiseNAND(yaffs_Device *dev)
+int ynorif1_InitialiseNAND(yaffs_dev_t *dev)
 {
        int i;
        
        ynorif1_FlashInit();
        /* Go through the blocks formatting them if they are not formatted */
-       for(i = dev->param.startBlock; i <= dev->param.endBlock; i++){
+       for(i = dev->param.start_block; i <= dev->param.end_block; i++){
                if(!ynorif1_IsBlockFormatted(dev,i)){
                        ynorif1_FormatBlock(dev,i);
                }
@@ -300,7 +300,7 @@ int ynorif1_InitialiseNAND(yaffs_Device *dev)
        return YAFFS_OK;
 }
 
-int ynorif1_DeinitialiseNAND(yaffs_Device *dev)
+int ynorif1_Deinitialise_flash_fn(yaffs_dev_t *dev)
 {
        dev=dev;        
        ynorif1_FlashDeinit();
index 2ab11d2..ac78423 100644 (file)
 
 #include "yaffs_guts.h"
 
-int ynorif1_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_Spare *spare);
-int ynorif1_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare);
-int ynorif1_EraseBlockInNAND(yaffs_Device *dev, int blockNumber);
-int ynorif1_InitialiseNAND(yaffs_Device *dev);
-int ynorif1_DeinitialiseNAND(yaffs_Device *dev);
+int ynorif1_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_spare *spare);
+int ynorif1_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_spare *spare);
+int ynorif1_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
+int ynorif1_InitialiseNAND(yaffs_dev_t *dev);
+int ynorif1_Deinitialise_flash_fn(yaffs_dev_t *dev);
 
 #endif
 
index 9ca963b..f6e7773 100644 (file)
@@ -15,7 +15,7 @@
  * yaffs_ramdisk.c: yaffs ram disk component
  * This provides a ram disk under yaffs.
  * NB this is not intended for NAND emulation.
- * Use this with dev->useNANDECC enabled, then ECC overheads are not required.
+ * Use this with dev->use_nand_ecc enabled, then ECC overheads are not required.
  */
 
 const char *yaffs_ramdisk_c_version = "$Id: yaffs_ramdisk.c,v 1.6 2010-01-11 04:06:47 charles Exp $";
@@ -61,7 +61,7 @@ typedef struct
 
 static yramdisk_device ramdisk;
 
-static int  CheckInit(yaffs_Device *dev)
+static int  CheckInit(yaffs_dev_t *dev)
 {
        static int initialised = 0;
        
@@ -119,7 +119,7 @@ static int  CheckInit(yaffs_Device *dev)
        return 1;
 }
 
-int yramdisk_wr_chunk(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_ExtendedTags *tags)
+int yramdisk_wr_chunk(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags)
 {
        int blk;
        int pg;
@@ -127,8 +127,8 @@ int yramdisk_wr_chunk(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const
 
        CheckInit(dev);
        
-       blk = chunkInNAND/32;
-       pg = chunkInNAND%32;
+       blk = nand_chunk/32;
+       pg = nand_chunk%32;
        
        
        if(data)
@@ -150,7 +150,7 @@ int yramdisk_wr_chunk(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const
 }
 
 
-int yramdisk_rd_chunk(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_ExtendedTags *tags)
+int yramdisk_rd_chunk(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags)
 {
        int blk;
        int pg;
@@ -158,8 +158,8 @@ int yramdisk_rd_chunk(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Exten
        
        CheckInit(dev);
        
-       blk = chunkInNAND/32;
-       pg = chunkInNAND%32;
+       blk = nand_chunk/32;
+       pg = nand_chunk%32;
        
        
        if(data)
@@ -181,7 +181,7 @@ int yramdisk_rd_chunk(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Exten
 }
 
 
-int yramdisk_check_chunk_erased(yaffs_Device *dev,int chunkInNAND)
+int yramdisk_check_chunk_erased(yaffs_dev_t *dev,int nand_chunk)
 {
        int blk;
        int pg;
@@ -190,8 +190,8 @@ int yramdisk_check_chunk_erased(yaffs_Device *dev,int chunkInNAND)
        
        CheckInit(dev);
        
-       blk = chunkInNAND/32;
-       pg = chunkInNAND%32;
+       blk = nand_chunk/32;
+       pg = nand_chunk%32;
        
        
        for(i = 0; i < 528; i++)
@@ -206,7 +206,7 @@ int yramdisk_check_chunk_erased(yaffs_Device *dev,int chunkInNAND)
 
 }
 
-int yramdisk_erase(yaffs_Device *dev, int blockNumber)
+int yramdisk_erase(yaffs_dev_t *dev, int blockNumber)
 {
        
        CheckInit(dev);
@@ -224,9 +224,9 @@ int yramdisk_erase(yaffs_Device *dev, int blockNumber)
        
 }
 
-int yramdisk_initialise(yaffs_Device *dev)
+int yramdisk_initialise(yaffs_dev_t *dev)
 {
-       //dev->useNANDECC = 1; // force on useNANDECC which gets faked. 
+       //dev->use_nand_ecc = 1; // force on use_nand_ecc which gets faked. 
                                                 // This saves us doing ECC checks.
        
        return YAFFS_OK;
index 772743e..c250bcc 100644 (file)
 
 
 #include "yaffs_guts.h"
-int yramdisk_erase(yaffs_Device *dev, int blockNumber);
-int yramdisk_wr_chunk(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_ExtendedTags *tags);
-int yramdisk_rd_chunk(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_ExtendedTags *tags);
-int yramdisk_initialise(yaffs_Device *dev);
-int yramdisk_mark_block_bad(yaffs_Device *dev,int blockNumber);
-int yramdisk_query_block(yaffs_Device *dev, int blockNo, yaffs_BlockState *state, int *sequenceNumber);
+int yramdisk_erase(yaffs_dev_t *dev, int blockNumber);
+int yramdisk_wr_chunk(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags);
+int yramdisk_rd_chunk(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags);
+int yramdisk_initialise(yaffs_dev_t *dev);
+int yramdisk_mark_block_bad(yaffs_dev_t *dev,int blockNumber);
+int yramdisk_query_block(yaffs_dev_t *dev, int block_no, yaffs_block_state_t *state, int *seq_number);
 #endif
index f0b7c71..9bf673a 100644 (file)
@@ -191,7 +191,7 @@ static int  CheckInit(void)
        return 1;
 }
 
-int nandemul2k_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_ExtendedTags *tags)
+int nandemul2k_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags)
 {
        int blk;
        int pg;
@@ -200,8 +200,8 @@ int nandemul2k_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const
        __u8 *x;
 
        
-       blk = chunkInNAND/PAGES_PER_BLOCK;
-       pg = chunkInNAND%PAGES_PER_BLOCK;
+       blk = nand_chunk/PAGES_PER_BLOCK;
+       pg = nand_chunk%PAGES_PER_BLOCK;
        
        
        if(data)
@@ -221,7 +221,7 @@ int nandemul2k_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const
        {
                x = &ned.block[blk]->page[pg]->data[PAGE_DATA_SIZE];
                
-               yaffs_PackTags2((yaffs_PackedTags2 *)x,tags, !dev->param.noTagsECC);
+               yaffs_PackTags2((yaffs_PackedTags2 *)x,tags, !dev->param.no_tags_ecc);
                        
        }
        
@@ -234,7 +234,7 @@ int nandemul2k_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const
 }
 
 
-int nandemul2k_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_ExtendedTags *tags)
+int nandemul2k_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags)
 {
        int blk;
        int pg;
@@ -243,8 +243,8 @@ int nandemul2k_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8
 
        
        
-       blk = chunkInNAND/PAGES_PER_BLOCK;
-       pg = chunkInNAND%PAGES_PER_BLOCK;
+       blk = nand_chunk/PAGES_PER_BLOCK;
+       pg = nand_chunk%PAGES_PER_BLOCK;
        
        
        if(data)
@@ -257,14 +257,14 @@ int nandemul2k_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8
        {
                x = &ned.block[blk]->page[pg]->data[PAGE_DATA_SIZE];
                
-               yaffs_unpack_tags2(tags,(yaffs_PackedTags2 *)x, !dev->param.noTagsECC);
+               yaffs_unpack_tags2(tags,(yaffs_PackedTags2 *)x, !dev->param.no_tags_ecc);
        }
 
        return YAFFS_OK;
 }
 
 
-static int nandemul2k_CheckChunkErased(yaffs_Device *dev,int chunkInNAND)
+static int nandemul2k_CheckChunkErased(yaffs_dev_t *dev,int nand_chunk)
 {
        int blk;
        int pg;
@@ -272,8 +272,8 @@ static int nandemul2k_CheckChunkErased(yaffs_Device *dev,int chunkInNAND)
 
        
        
-       blk = chunkInNAND/PAGES_PER_BLOCK;
-       pg = chunkInNAND%PAGES_PER_BLOCK;
+       blk = nand_chunk/PAGES_PER_BLOCK;
+       pg = nand_chunk%PAGES_PER_BLOCK;
        
        
        for(i = 0; i < PAGE_TOTAL_SIZE; i++)
@@ -288,7 +288,7 @@ static int nandemul2k_CheckChunkErased(yaffs_Device *dev,int chunkInNAND)
 
 }
 
-int nandemul2k_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
+int nandemul2k_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber)
 {
        
        
@@ -308,18 +308,18 @@ int nandemul2k_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
        return YAFFS_OK;
 }
 
-int nandemul2k_InitialiseNAND(yaffs_Device *dev)
+int nandemul2k_InitialiseNAND(yaffs_dev_t *dev)
 {
        CheckInit();
        return YAFFS_OK;
 }
  
-int nandemul2k_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
+int nandemul2k_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no)
 {
        
        __u8 *x;
        
-       x = &ned.block[blockNo]->page[0]->data[PAGE_DATA_SIZE];
+       x = &ned.block[block_no]->page[0]->data[PAGE_DATA_SIZE];
        
        memset(x,0,sizeof(yaffs_PackedTags2));
        
@@ -328,28 +328,28 @@ int nandemul2k_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
        
 }
 
-int nandemul2k_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, yaffs_BlockState *state, __u32  *sequenceNumber)
+int nandemul2k_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, __u32  *seq_number)
 {
-       yaffs_ExtendedTags tags;
+       yaffs_ext_tags tags;
        int chunkNo;
 
-       *sequenceNumber = 0;
+       *seq_number = 0;
        
-       chunkNo = blockNo * dev->param.nChunksPerBlock;
+       chunkNo = block_no * dev->param.chunks_per_block;
        
        nandemul2k_ReadChunkWithTagsFromNAND(dev,chunkNo,NULL,&tags);
-       if(tags.blockBad)
+       if(tags.block_bad)
        {
                *state = YAFFS_BLOCK_STATE_DEAD;
        }
-       else if(!tags.chunkUsed)
+       else if(!tags.chunk_used)
        {
                *state = YAFFS_BLOCK_STATE_EMPTY;
        }
-       else if(tags.chunkUsed)
+       else if(tags.chunk_used)
        {
                *state = YAFFS_BLOCK_STATE_NEEDS_SCANNING;
-               *sequenceNumber = tags.sequenceNumber;
+               *seq_number = tags.seq_number;
        }
        return YAFFS_OK;
 }
index c2ac04f..590cb87 100644 (file)
@@ -67,16 +67,16 @@ void yaffsfs_LocalInitialisation(void)
 // /boot 2MB boot disk (flash)
 // /flash 14MB flash disk (flash)
 // NB Though /boot and /flash occupy the same physical device they
-// are still disticnt "yaffs_Devices. You may think of these as "partitions"
+// are still disticnt "yaffs_dev_ts. You may think of these as "partitions"
 // using non-overlapping areas in the same device.
 // 
 
 #include "yaffs_ramdisk.h"
 #include "yaffs_flashif.h"
 
-static yaffs_Device ramDev;
-static yaffs_Device bootDev;
-static yaffs_Device flashDev;
+static yaffs_dev_t ramDev;
+static yaffs_dev_t bootDev;
+static yaffs_dev_t flashDev;
 
 static yaffsfs_DeviceConfiguration yaffsfs_config[] = {
 
@@ -99,46 +99,46 @@ int yaffs_start_up(void)
        // Set up devices
 
        // /ram
-       ramDev.nDataBytesPerChunk = 512;
-       ramDev.nChunksPerBlock = 32;
-       ramDev.nReservedBlocks = 2; // Set this smaller for RAM
-       ramDev.startBlock = 1; // Can't use block 0
-       ramDev.endBlock = 127; // Last block in 2MB.    
-       ramDev.useNANDECC = 1;
-       ramDev.nShortOpCaches = 0;      // Disable caching on this device.
+       ramDev.data_bytes_per_chunk = 512;
+       ramDev.chunks_per_block = 32;
+       ramDev.n_reserved_blocks = 2; // Set this smaller for RAM
+       ramDev.start_block = 1; // Can't use block 0
+       ramDev.end_block = 127; // Last block in 2MB.   
+       ramDev.use_nand_ecc = 1;
+       ramDev.n_caches = 0;    // Disable caching on this device.
        ramDev.genericDevice = (void *) 0;      // Used to identify the device in fstat.
-       ramDev.writeChunkWithTagsToNAND = yramdisk_wr_chunk;
-       ramDev.readChunkWithTagsFromNAND = yramdisk_rd_chunk;
-       ramDev.eraseBlockInNAND = yramdisk_erase;
-       ramDev.initialiseNAND = yramdisk_initialise;
+       ramDev.write_chunk_tags_fn = yramdisk_wr_chunk;
+       ramDev.read_chunk_tags_fn = yramdisk_rd_chunk;
+       ramDev.erase_fn = yramdisk_erase;
+       ramDev.initialise_flash_fn = yramdisk_initialise;
 
        // /boot
-       bootDev.nDataBytesPerChunk = 512;
-       bootDev.nChunksPerBlock = 32;
-       bootDev.nReservedBlocks = 5;
-       bootDev.startBlock = 1; // Can't use block 0
-       bootDev.endBlock = 127; // Last block in 2MB.   
-       bootDev.useNANDECC = 0; // use YAFFS's ECC
-       bootDev.nShortOpCaches = 10; // Use caches
+       bootDev.data_bytes_per_chunk = 512;
+       bootDev.chunks_per_block = 32;
+       bootDev.n_reserved_blocks = 5;
+       bootDev.start_block = 1; // Can't use block 0
+       bootDev.end_block = 127; // Last block in 2MB.  
+       bootDev.use_nand_ecc = 0; // use YAFFS's ECC
+       bootDev.n_caches = 10; // Use caches
        bootDev.genericDevice = (void *) 1;     // Used to identify the device in fstat.
-       bootDev.writeChunkToNAND = yflash_WriteChunkToNAND;
-       bootDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
-       bootDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
-       bootDev.initialiseNAND = yflash_InitialiseNAND;
+       bootDev.write_chunk_fn = yflash_WriteChunkToNAND;
+       bootDev.read_chunk_fn = yflash_ReadChunkFromNAND;
+       bootDev.erase_fn = yflash_EraseBlockInNAND;
+       bootDev.initialise_flash_fn = yflash_InitialiseNAND;
 
                // /flash
-       flashDev.nDataBytesPerChunk =  512;
-       flashDev.nChunksPerBlock = 32;
-       flashDev.nReservedBlocks = 5;
-       flashDev.startBlock = 128; // First block after 2MB
-       flashDev.endBlock = 1023; // Last block in 16MB
-       flashDev.useNANDECC = 0; // use YAFFS's ECC
-       flashDev.nShortOpCaches = 10; // Use caches
+       flashDev.data_bytes_per_chunk =  512;
+       flashDev.chunks_per_block = 32;
+       flashDev.n_reserved_blocks = 5;
+       flashDev.start_block = 128; // First block after 2MB
+       flashDev.end_block = 1023; // Last block in 16MB
+       flashDev.use_nand_ecc = 0; // use YAFFS's ECC
+       flashDev.n_caches = 10; // Use caches
        flashDev.genericDevice = (void *) 2;    // Used to identify the device in fstat.
-       flashDev.writeChunkToNAND = yflash_WriteChunkToNAND;
-       flashDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
-       flashDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
-       flashDev.initialiseNAND = yflash_InitialiseNAND;
+       flashDev.write_chunk_fn = yflash_WriteChunkToNAND;
+       flashDev.read_chunk_fn = yflash_ReadChunkFromNAND;
+       flashDev.erase_fn = yflash_EraseBlockInNAND;
+       flashDev.initialise_flash_fn = yflash_InitialiseNAND;
 
        yaffs_initialise(yaffsfs_config);
 #endif
index 57ec4a9..de8953e 100644 (file)
@@ -106,9 +106,9 @@ void yaffsfs_LocalInitialisation(void)
 #include "yaffs_flashif2.h"
 #include "yaffs_nandemul2k.h"
 
-struct yaffs_DeviceStruct ram1Dev;
-struct yaffs_DeviceStruct flashDev;
-struct yaffs_DeviceStruct m18_1Dev;
+struct yaffs_dev_s ram1Dev;
+struct yaffs_dev_s flashDev;
+struct yaffs_dev_s m18_1Dev;
 
 int yaffs_start_up(void)
 {
@@ -120,39 +120,39 @@ int yaffs_start_up(void)
        // /ram1   ram, yaffs1
        memset(&ram1Dev,0,sizeof(ram1Dev));
        ram1Dev.param.name = "ram1";
-       ram1Dev.param.totalBytesPerChunk = 512;
-       ram1Dev.param.nChunksPerBlock = 32;
-       ram1Dev.param.nReservedBlocks = 2; // Set this smaller for RAM
-       ram1Dev.param.startBlock = 0; // Can use block 0
-       ram1Dev.param.endBlock = 127; // Last block in 2MB.     
-       //ram1Dev.param.useNANDECC = 1;
-       ram1Dev.param.nShortOpCaches = 0;       // Disable caching on this device.
-       ram1Dev.driverContext = (void *) 0;     // Used to identify the device in fstat.
-       ram1Dev.param.writeChunkWithTagsToNAND = yramdisk_wr_chunk;
-       ram1Dev.param.readChunkWithTagsFromNAND = yramdisk_rd_chunk;
-       ram1Dev.param.eraseBlockInNAND = yramdisk_erase;
-       ram1Dev.param.initialiseNAND = yramdisk_initialise;
+       ram1Dev.param.total_bytes_per_chunk = 512;
+       ram1Dev.param.chunks_per_block = 32;
+       ram1Dev.param.n_reserved_blocks = 2; // Set this smaller for RAM
+       ram1Dev.param.start_block = 0; // Can use block 0
+       ram1Dev.param.end_block = 127; // Last block in 2MB.    
+       //ram1Dev.param.use_nand_ecc = 1;
+       ram1Dev.param.n_caches = 0;     // Disable caching on this device.
+       ram1Dev.driver_context = (void *) 0;    // Used to identify the device in fstat.
+       ram1Dev.param.write_chunk_tags_fn = yramdisk_wr_chunk;
+       ram1Dev.param.read_chunk_tags_fn = yramdisk_rd_chunk;
+       ram1Dev.param.erase_fn = yramdisk_erase;
+       ram1Dev.param.initialise_flash_fn = yramdisk_initialise;
        
        yaffs_add_device(&ram1Dev);
 
        // /M18-1 yaffs1 on M18 nor sim
        memset(&m18_1Dev,0,sizeof(m18_1Dev));
        m18_1Dev.param.name = "M18-1";
-       m18_1Dev.param.totalBytesPerChunk = 1024;
-       m18_1Dev.param.nChunksPerBlock =248;
-       m18_1Dev.param.nReservedBlocks = 2;
-       m18_1Dev.param.startBlock = 0; // Can use block 0
-       m18_1Dev.param.endBlock = 31; // Last block
-       m18_1Dev.param.useNANDECC = 0; // use YAFFS's ECC
-       m18_1Dev.param.nShortOpCaches = 10; // Use caches
-       m18_1Dev.driverContext = (void *) 1;    // Used to identify the device in fstat.
-       m18_1Dev.param.writeChunkToNAND = ynorif1_WriteChunkToNAND;
-       m18_1Dev.param.readChunkFromNAND = ynorif1_ReadChunkFromNAND;
-       m18_1Dev.param.eraseBlockInNAND = ynorif1_EraseBlockInNAND;
-       m18_1Dev.param.initialiseNAND = ynorif1_InitialiseNAND;
-       m18_1Dev.param.deinitialiseNAND = ynorif1_DeinitialiseNAND;
-
-//     m18_1Dev.param.disableSoftDelete = 1;
+       m18_1Dev.param.total_bytes_per_chunk = 1024;
+       m18_1Dev.param.chunks_per_block =248;
+       m18_1Dev.param.n_reserved_blocks = 2;
+       m18_1Dev.param.start_block = 0; // Can use block 0
+       m18_1Dev.param.end_block = 31; // Last block
+       m18_1Dev.param.use_nand_ecc = 0; // use YAFFS's ECC
+       m18_1Dev.param.n_caches = 10; // Use caches
+       m18_1Dev.driver_context = (void *) 1;   // Used to identify the device in fstat.
+       m18_1Dev.param.write_chunk_fn = ynorif1_WriteChunkToNAND;
+       m18_1Dev.param.read_chunk_fn = ynorif1_ReadChunkFromNAND;
+       m18_1Dev.param.erase_fn = ynorif1_EraseBlockInNAND;
+       m18_1Dev.param.initialise_flash_fn = ynorif1_InitialiseNAND;
+       m18_1Dev.param.deinitialise_flash_fn = ynorif1_Deinitialise_flash_fn;
+
+//     m18_1Dev.param.disable_soft_del = 1;
 
        yaffs_add_device(&m18_1Dev);
 
@@ -161,25 +161,25 @@ int yaffs_start_up(void)
        //
        memset(&flashDev,0,sizeof(flashDev));
        flashDev.param.name = "yaffs2";
-       flashDev.param.totalBytesPerChunk = 2048;
-       flashDev.param.nChunksPerBlock = 64;
-       flashDev.param.nReservedBlocks = 5;
-       flashDev.param.inbandTags = 0;
-       flashDev.param.startBlock = 0;
-       flashDev.param.endBlock = yflash2_GetNumberOfBlocks()-1;
-       flashDev.param.isYaffs2 = 1;
-       flashDev.param.useNANDECC=1;
-       flashDev.param.wideTnodesDisabled=0;
-       flashDev.param.refreshPeriod = 1000;
-       flashDev.param.nShortOpCaches = 10; // Use caches
-       flashDev.driverContext = (void *) 2;    // Used to identify the device in fstat.
-       flashDev.param.writeChunkWithTagsToNAND = yflash2_WriteChunkWithTagsToNAND;
-       flashDev.param.readChunkWithTagsFromNAND = yflash2_ReadChunkWithTagsFromNAND;
-       flashDev.param.eraseBlockInNAND = yflash2_EraseBlockInNAND;
-       flashDev.param.initialiseNAND = yflash2_InitialiseNAND;
-       flashDev.param.markNANDBlockBad = yflash2_MarkNANDBlockBad;
-       flashDev.param.queryNANDBlock = yflash2_QueryNANDBlock;
-       flashDev.param.enableXattr = 1;
+       flashDev.param.total_bytes_per_chunk = 2048;
+       flashDev.param.chunks_per_block = 64;
+       flashDev.param.n_reserved_blocks = 5;
+       flashDev.param.inband_tags = 0;
+       flashDev.param.start_block = 0;
+       flashDev.param.end_block = yflash2_GetNumberOfBlocks()-1;
+       flashDev.param.is_yaffs2 = 1;
+       flashDev.param.use_nand_ecc=1;
+       flashDev.param.wide_tnodes_disabled=0;
+       flashDev.param.refresh_period = 1000;
+       flashDev.param.n_caches = 10; // Use caches
+       flashDev.driver_context = (void *) 2;   // Used to identify the device in fstat.
+       flashDev.param.write_chunk_tags_fn = yflash2_WriteChunkWithTagsToNAND;
+       flashDev.param.read_chunk_tags_fn = yflash2_ReadChunkWithTagsFromNAND;
+       flashDev.param.erase_fn = yflash2_EraseBlockInNAND;
+       flashDev.param.initialise_flash_fn = yflash2_InitialiseNAND;
+       flashDev.param.bad_block_fn = yflash2_MarkNANDBlockBad;
+       flashDev.param.query_block_fn = yflash2_QueryNANDBlock;
+       flashDev.param.enable_xattr = 1;
 
        yaffs_add_device(&flashDev);
 
index 48509c7..0a50fcf 100644 (file)
@@ -26,9 +26,9 @@ typedef struct {
 
 SimData *simDevs[N_RAM_SIM_DEVS];
 
-static SimData *DevToSim(yaffs_Device *dev)
+static SimData *DevToSim(yaffs_dev_t *dev)
 {
-       ynandif_Geometry *geom = (ynandif_Geometry *)(dev->driverContext);
+       ynandif_Geometry *geom = (ynandif_Geometry *)(dev->driver_context);
        SimData * sim = (SimData*)(geom->privateData);
        return sim;
 }
@@ -62,7 +62,7 @@ static int yramsim_erase_internal(SimData *sim, unsigned blockId,int force)
 
 
 
-static int yramsim_initialise(yaffs_Device *dev)
+static int yramsim_initialise(yaffs_dev_t *dev)
 {
        SimData *sim = DevToSim(dev);
        Block **blockList = sim->blockList;
@@ -70,12 +70,12 @@ static int yramsim_initialise(yaffs_Device *dev)
 }
 
 
-static int yramsim_deinitialise(yaffs_Device *dev)
+static int yramsim_deinitialise(yaffs_dev_t *dev)
 {
        return 1;
 }
 
-static int yramsim_rd_chunk (yaffs_Device *dev, unsigned pageId,
+static int yramsim_rd_chunk (yaffs_dev_t *dev, unsigned pageId,
                                          unsigned char *data, unsigned dataLength,
                                          unsigned char *spare, unsigned spareLength,
                                          int *eccStatus)
@@ -110,7 +110,7 @@ static int yramsim_rd_chunk (yaffs_Device *dev, unsigned pageId,
        return 1;
 }
 
-static int yramsim_wr_chunk (yaffs_Device *dev,unsigned pageId,
+static int yramsim_wr_chunk (yaffs_dev_t *dev,unsigned pageId,
                                           const unsigned char *data, unsigned dataLength,
                                           const unsigned char *spare, unsigned spareLength)
 {
@@ -142,7 +142,7 @@ static int yramsim_wr_chunk (yaffs_Device *dev,unsigned pageId,
 }
 
 
-static int yramsim_erase(yaffs_Device *dev,unsigned blockId)
+static int yramsim_erase(yaffs_dev_t *dev,unsigned blockId)
 {
        SimData *sim = DevToSim(dev);
 
@@ -150,7 +150,7 @@ static int yramsim_erase(yaffs_Device *dev,unsigned blockId)
        return yramsim_erase_internal(sim,blockId,0);
 }
 
-static int yramsim_check_block_ok(yaffs_Device *dev,unsigned blockId)
+static int yramsim_check_block_ok(yaffs_dev_t *dev,unsigned blockId)
 {
        SimData *sim = DevToSim(dev);
        Block **blockList = sim->blockList;
@@ -161,7 +161,7 @@ static int yramsim_check_block_ok(yaffs_Device *dev,unsigned blockId)
        return blockList[blockId]->blockOk ? 1 : 0;
 }
 
-static int yramsim_mark_block_bad(yaffs_Device *dev,unsigned blockId)
+static int yramsim_mark_block_bad(yaffs_dev_t *dev,unsigned blockId)
 {
        SimData *sim = DevToSim(dev);
        Block **blockList = sim->blockList;
@@ -236,9 +236,9 @@ static SimData *yramsim_alloc_sim_data(__u32 devId, __u32 nBlocks)
 }
 
 
-struct yaffs_DeviceStruct *yramsim_CreateRamSim(const YCHAR *name,
+struct yaffs_dev_s *yramsim_CreateRamSim(const YCHAR *name,
                                __u32 devId, __u32 nBlocks,
-                               __u32 startBlock, __u32 endBlock)
+                               __u32 start_block, __u32 end_block)
 {
        SimData *sim;
        ynandif_Geometry *g;
@@ -253,19 +253,19 @@ struct yaffs_DeviceStruct *yramsim_CreateRamSim(const YCHAR *name,
                return NULL;
        }
 
-       if(startBlock >= sim->nBlocks)
-               startBlock = 0;
-       if(endBlock == 0 || endBlock >= sim->nBlocks)
-               endBlock = sim->nBlocks - 1;
+       if(start_block >= sim->nBlocks)
+               start_block = 0;
+       if(end_block == 0 || end_block >= sim->nBlocks)
+               end_block = sim->nBlocks - 1;
 
        memset(g,0,sizeof(ynandif_Geometry));
-       g->startBlock = startBlock;
-       g->endBlock = endBlock;
+       g->start_block = start_block;
+       g->end_block = end_block;
        g->dataSize = DATA_SIZE;
        g->spareSize= SPARE_SIZE;
        g->pagesPerBlock = PAGES_PER_BLOCK;
        g->hasECC = 1;
-       g->inbandTags = 0;
+       g->inband_tags = 0;
        g->useYaffs2 = 1;
        g->initialise = yramsim_initialise;
        g->deinitialise = yramsim_deinitialise;
index 81a7d87..4f20364 100644 (file)
@@ -23,9 +23,9 @@
 
 #define N_RAM_SIM_DEVS  2
 
-struct yaffs_DeviceStruct *yramsim_CreateRamSim(const YCHAR *name,
+struct yaffs_dev_s *yramsim_CreateRamSim(const YCHAR *name,
                                                __u32 devId, __u32 nBlocks,
-                                               __u32 startBlock, __u32 endBlock);
+                                               __u32 start_block, __u32 end_block);
 
 #endif
 
index 20df837..730bd43 100644 (file)
@@ -87,9 +87,9 @@ void MakeFullNames(const char *prefix)
   MakeName(fullTempMainName,prefix,"tmp-main");
 }
 
-static void FatalError(int lineNo)
+static void FatalError(int line_no)
 {
-  printf("Integrity error %d\n",lineNo);
+  printf("Integrity error %d\n",line_no);
 
   if(fuzz_test)
        return;
index b7ee482..79732a1 100644 (file)
@@ -50,7 +50,7 @@ typedef struct
 
 static yflash_Device ramdisk;
 
-static int  CheckInit(yaffs_Device *dev)
+static int  CheckInit(yaffs_dev_t *dev)
 {
        static int initialised = 0;
        
@@ -108,7 +108,7 @@ static int  CheckInit(yaffs_Device *dev)
        return 1;
 }
 
-int yflash_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, yaffs_ExtendedTags *tags)
+int yflash_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, yaffs_ext_tags *tags)
 {
        int blk;
        int pg;
@@ -116,8 +116,8 @@ int yflash_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8
 
        CheckInit(dev);
        
-       blk = chunkInNAND/32;
-       pg = chunkInNAND%32;
+       blk = nand_chunk/32;
+       pg = nand_chunk%32;
        
        
        if(data)
@@ -138,7 +138,7 @@ int yflash_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8
 }
 
 
-int yflash_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Tags *tags)
+int yflash_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_tags_t *tags)
 {
        int blk;
        int pg;
@@ -146,8 +146,8 @@ int yflash_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *da
        
        CheckInit(dev);
        
-       blk = chunkInNAND/32;
-       pg = chunkInNAND%32;
+       blk = nand_chunk/32;
+       pg = nand_chunk%32;
        
        
        if(data)
@@ -167,7 +167,7 @@ int yflash_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *da
 }
 
 
-int yflash_CheckChunkErased(yaffs_Device *dev,int chunkInNAND)
+int yflash_CheckChunkErased(yaffs_dev_t *dev,int nand_chunk)
 {
        int blk;
        int pg;
@@ -176,8 +176,8 @@ int yflash_CheckChunkErased(yaffs_Device *dev,int chunkInNAND)
        
        CheckInit(dev);
        
-       blk = chunkInNAND/32;
-       pg = chunkInNAND%32;
+       blk = nand_chunk/32;
+       pg = nand_chunk%32;
        
        
        for(i = 0; i < 528; i++)
@@ -192,7 +192,7 @@ int yflash_CheckChunkErased(yaffs_Device *dev,int chunkInNAND)
 
 }
 
-int yflash_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
+int yflash_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber)
 {
        
        CheckInit(dev);
@@ -210,19 +210,19 @@ int yflash_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
        
 }
 
-int yflash_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
+int yflash_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no)
 {
        return YAFFS_OK;
        
 }
-int yflash_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, yaffs_BlockState *state, int *sequenceNumber)
+int yflash_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, int *seq_number)
 {
        *state = YAFFS_BLOCK_STATE_EMPTY;
-       *sequenceNumber = 0;
+       *seq_number = 0;
 }
 
 
-int yflash_InitialiseNAND(yaffs_Device *dev)
+int yflash_InitialiseNAND(yaffs_dev_t *dev)
 {
        return YAFFS_OK;
 }
index eec2842..bc3ed70 100644 (file)
 
 
 #include "yaffs_guts.h"
-int yflash_EraseBlockInNAND(yaffs_Device *dev, int blockNumber);
-int yflash_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_Spare *spare);
-int yflash_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_ExtendedTags *tags);
-int yflash_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare);
-int yflash_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_ExtendedTags *tags);
-int yflash_InitialiseNAND(yaffs_Device *dev);
-int yflash_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo);
-int yflash_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, yaffs_BlockState *state, __u32 *sequenceNumber);
+int yflash_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
+int yflash_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_spare *spare);
+int yflash_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags);
+int yflash_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_spare *spare);
+int yflash_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags);
+int yflash_InitialiseNAND(yaffs_dev_t *dev);
+int yflash_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no);
+int yflash_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, __u32 *seq_number);
 
 #endif
index 3d4e1fd..de82085 100644 (file)
 
 
 #include "yaffs_guts.h"
-int yflash2_EraseBlockInNAND(yaffs_Device *dev, int blockNumber);
-int yflash2_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_Spare *spare);
-int yflash2_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_ExtendedTags *tags);
-int yflash2_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare);
-int yflash2_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_ExtendedTags *tags);
-int yflash2_EraseBlockInNAND(yaffs_Device *dev, int blockNumber);
-int yflash2_InitialiseNAND(yaffs_Device *dev);
-int yflash2_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo);
-int yflash2_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, yaffs_BlockState *state, __u32 *sequenceNumber);
+int yflash2_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
+int yflash2_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_spare *spare);
+int yflash2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags);
+int yflash2_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_spare *spare);
+int yflash2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags);
+int yflash2_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
+int yflash2_InitialiseNAND(yaffs_dev_t *dev);
+int yflash2_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no);
+int yflash2_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, __u32 *seq_number);
 
 #endif
index b0c9bd8..8a8f3fb 100644 (file)
  * We assume that the data buffer is of size totalBytersPerChunk so that we can also
  * use it to load the tags.
  */
-int ynandif_WriteChunkWithTagsToNAND(yaffs_Device * dev, int chunkInNAND,
+int ynandif_WriteChunkWithTagsToNAND(yaffs_dev_t * dev, int nand_chunk,
                                      const __u8 * data,
-                                     const yaffs_ExtendedTags * tags)
+                                     const yaffs_ext_tags * tags)
 {
 
        int retval = 0;
        yaffs_PackedTags2 pt;
        void *spare;
        unsigned spareSize = 0;
-       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driverContext);
+       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driver_context);
 
        T(YAFFS_TRACE_MTD,
          (TSTR
           ("nandmtd2_WriteChunkWithTagsToNAND chunk %d data %p tags %p"
-           TENDSTR), chunkInNAND, data, tags));
+           TENDSTR), nand_chunk, data, tags));
            
 
        /* For yaffs2 writing there must be both data and tags.
@@ -51,27 +51,27 @@ int ynandif_WriteChunkWithTagsToNAND(yaffs_Device * dev, int chunkInNAND,
         * the end of the data buffer.
         */
 
-       if(dev->param.inbandTags){
+       if(dev->param.inband_tags){
                yaffs_PackedTags2TagsPart *pt2tp;
-               pt2tp = (yaffs_PackedTags2TagsPart *)(data + dev->nDataBytesPerChunk);
+               pt2tp = (yaffs_PackedTags2TagsPart *)(data + dev->data_bytes_per_chunk);
                yaffs_PackTags2TagsPart(pt2tp,tags);
                spare = NULL;
                spareSize = 0;
        }
        else{
-               yaffs_PackTags2(&pt, tags,!dev->param.noTagsECC);
+               yaffs_PackTags2(&pt, tags,!dev->param.no_tags_ecc);
                spare = &pt;
                spareSize = sizeof(yaffs_PackedTags2);
        }
        
-       retval = geometry->writeChunk(dev,chunkInNAND,
-                                         data, dev->param.totalBytesPerChunk, spare, spareSize);
+       retval = geometry->writeChunk(dev,nand_chunk,
+                                         data, dev->param.total_bytes_per_chunk, spare, spareSize);
 
        return retval;
 }
 
-int ynandif_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
-                                      __u8 * data, yaffs_ExtendedTags * tags)
+int ynandif_ReadChunkWithTagsFromNAND(yaffs_dev_t * dev, int nand_chunk,
+                                      __u8 * data, yaffs_ext_tags * tags)
 {
        yaffs_PackedTags2 pt;
        int localData = 0;
@@ -79,17 +79,17 @@ int ynandif_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
        unsigned spareSize;
        int retval = 0;
        int eccStatus; //0 = ok, 1 = fixed, -1 = unfixed
-       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driverContext);
+       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driver_context);
 
        T(YAFFS_TRACE_MTD,
          (TSTR
           ("nandmtd2_ReadChunkWithTagsFromNAND chunk %d data %p tags %p"
-           TENDSTR), chunkInNAND, data, tags));
+           TENDSTR), nand_chunk, data, tags));
            
        if(!tags){
                spare = NULL;
                spareSize = 0;
-       }else if(dev->param.inbandTags){
+       }else if(dev->param.inband_tags){
                
                if(!data) {
                        localData = 1;
@@ -103,34 +103,34 @@ int ynandif_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
                spareSize = sizeof(yaffs_PackedTags2);
        }
 
-       retval = geometry->readChunk(dev,chunkInNAND,
+       retval = geometry->readChunk(dev,nand_chunk,
                                         data,
-                                        data ? dev->param.totalBytesPerChunk : 0,
+                                        data ? dev->param.total_bytes_per_chunk : 0,
                                         spare,spareSize,
                                         &eccStatus);
 
-       if(dev->param.inbandTags){
+       if(dev->param.inband_tags){
                if(tags){
                        yaffs_PackedTags2TagsPart * pt2tp;
-                       pt2tp = (yaffs_PackedTags2TagsPart *)&data[dev->nDataBytesPerChunk];    
+                       pt2tp = (yaffs_PackedTags2TagsPart *)&data[dev->data_bytes_per_chunk];  
                        yaffs_unpack_tags2tags_part(tags,pt2tp);
                }
        }
        else {
                if (tags){
-                       yaffs_unpack_tags2(tags, &pt,!dev->param.noTagsECC);
+                       yaffs_unpack_tags2(tags, &pt,!dev->param.no_tags_ecc);
                }
        }
 
-       if(tags && tags->chunkUsed){
+       if(tags && tags->chunk_used){
                if(eccStatus < 0 || 
-                  tags->eccResult == YAFFS_ECC_RESULT_UNFIXED)
-                       tags->eccResult = YAFFS_ECC_RESULT_UNFIXED;
+                  tags->ecc_result == YAFFS_ECC_RESULT_UNFIXED)
+                       tags->ecc_result = YAFFS_ECC_RESULT_UNFIXED;
                else if(eccStatus > 0 ||
-                            tags->eccResult == YAFFS_ECC_RESULT_FIXED)
-                       tags->eccResult = YAFFS_ECC_RESULT_FIXED;
+                            tags->ecc_result == YAFFS_ECC_RESULT_FIXED)
+                       tags->ecc_result = YAFFS_ECC_RESULT_FIXED;
                else
-                       tags->eccResult = YAFFS_ECC_RESULT_NO_ERROR;
+                       tags->ecc_result = YAFFS_ECC_RESULT_NO_ERROR;
        }
 
        if(localData)
@@ -139,37 +139,37 @@ int ynandif_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
        return retval;
 }
 
-int ynandif_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockId)
+int ynandif_MarkNANDBlockBad(struct yaffs_dev_s *dev, int blockId)
 {
-       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driverContext);
+       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driver_context);
 
        return geometry->markBlockBad(dev,blockId);
 }
 
-int ynandif_EraseBlockInNAND(struct yaffs_DeviceStruct *dev, int blockId)
+int ynandif_EraseBlockInNAND(struct yaffs_dev_s *dev, int blockId)
 {
-       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driverContext);
+       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driver_context);
 
        return geometry->eraseBlock(dev,blockId);
 
 }
 
 
-static int ynandif_IsBlockOk(struct yaffs_DeviceStruct *dev, int blockId)
+static int ynandif_IsBlockOk(struct yaffs_dev_s *dev, int blockId)
 {
-       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driverContext);
+       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driver_context);
 
        return geometry->checkBlockOk(dev,blockId);
 }
 
-int ynandif_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockId, yaffs_BlockState *state, __u32 *sequenceNumber)
+int ynandif_QueryNANDBlock(struct yaffs_dev_s *dev, int blockId, yaffs_block_state_t *state, __u32 *seq_number)
 {
        unsigned chunkNo;
-       yaffs_ExtendedTags tags;
+       yaffs_ext_tags tags;
 
-       *sequenceNumber = 0;
+       *seq_number = 0;
        
-       chunkNo = blockId * dev->param.nChunksPerBlock;
+       chunkNo = blockId * dev->param.chunks_per_block;
        
        if(!ynandif_IsBlockOk(dev,blockId)){
                *state = YAFFS_BLOCK_STATE_DEAD;
@@ -178,14 +178,14 @@ int ynandif_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockId, yaffs_Bl
        {
                ynandif_ReadChunkWithTagsFromNAND(dev,chunkNo,NULL,&tags);
 
-               if(!tags.chunkUsed)
+               if(!tags.chunk_used)
                {
                        *state = YAFFS_BLOCK_STATE_EMPTY;
                }
                else 
                {
                        *state = YAFFS_BLOCK_STATE_NEEDS_SCANNING;
-                       *sequenceNumber = tags.sequenceNumber;
+                       *seq_number = tags.seq_number;
                }
        }
 
@@ -193,18 +193,18 @@ int ynandif_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockId, yaffs_Bl
 }
 
 
-int ynandif_InitialiseNAND(yaffs_Device *dev)
+int ynandif_InitialiseNAND(yaffs_dev_t *dev)
 {
-       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driverContext);
+       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driver_context);
 
        geometry->initialise(dev);
 
        return YAFFS_OK;
 }
 
-int ynandif_DeinitialiseNAND(yaffs_Device *dev)
+int ynandif_Deinitialise_flash_fn(yaffs_dev_t *dev)
 {
-       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driverContext);
+       ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driver_context);
 
        geometry->deinitialise(dev);
 
@@ -212,35 +212,35 @@ int ynandif_DeinitialiseNAND(yaffs_Device *dev)
 }
 
 
-struct yaffs_DeviceStruct * 
+struct yaffs_dev_s * 
        yaffs_add_dev_from_geometry(const YCHAR *name,
                                        const ynandif_Geometry *geometry)
 {
        YCHAR *clonedName = YMALLOC(sizeof(YCHAR) * (yaffs_strnlen(name,YAFFS_MAX_NAME_LENGTH)+1));
-       struct yaffs_DeviceStruct *dev = YMALLOC(sizeof(struct yaffs_DeviceStruct));
+       struct yaffs_dev_s *dev = YMALLOC(sizeof(struct yaffs_dev_s));
 
        if(dev && clonedName){
-               memset(dev,0,sizeof(struct yaffs_DeviceStruct));
+               memset(dev,0,sizeof(struct yaffs_dev_s));
                yaffs_strcpy(clonedName,name);
 
                dev->param.name = clonedName;
-               dev->param.writeChunkWithTagsToNAND  = ynandif_WriteChunkWithTagsToNAND;
-               dev->param.readChunkWithTagsFromNAND = ynandif_ReadChunkWithTagsFromNAND;
-               dev->param.eraseBlockInNAND          = ynandif_EraseBlockInNAND;
-               dev->param.initialiseNAND            = ynandif_InitialiseNAND;
-               dev->param.queryNANDBlock            = ynandif_QueryNANDBlock;
-               dev->param.markNANDBlockBad          = ynandif_MarkNANDBlockBad;
-               dev->param.nShortOpCaches                          = 20;
-               dev->param.startBlock                = geometry->startBlock;
-               dev->param.endBlock                  = geometry->endBlock;
-               dev->param.totalBytesPerChunk              = geometry->dataSize;
-               dev->param.spareBytesPerChunk              = geometry->spareSize;
-               dev->param.inbandTags                              = geometry->inbandTags;
-               dev->param.nChunksPerBlock                 = geometry->pagesPerBlock;
-               dev->param.useNANDECC                              = geometry->hasECC;
-               dev->param.isYaffs2                                = geometry->useYaffs2;
-               dev->param.nReservedBlocks                 = 5;
-               dev->driverContext                         = (void *)geometry;
+               dev->param.write_chunk_tags_fn  = ynandif_WriteChunkWithTagsToNAND;
+               dev->param.read_chunk_tags_fn = ynandif_ReadChunkWithTagsFromNAND;
+               dev->param.erase_fn          = ynandif_EraseBlockInNAND;
+               dev->param.initialise_flash_fn            = ynandif_InitialiseNAND;
+               dev->param.query_block_fn            = ynandif_QueryNANDBlock;
+               dev->param.bad_block_fn          = ynandif_MarkNANDBlockBad;
+               dev->param.n_caches                        = 20;
+               dev->param.start_block                = geometry->start_block;
+               dev->param.end_block                  = geometry->end_block;
+               dev->param.total_bytes_per_chunk                   = geometry->dataSize;
+               dev->param.spare_bytes_per_chunk                   = geometry->spareSize;
+               dev->param.inband_tags                             = geometry->inband_tags;
+               dev->param.chunks_per_block                = geometry->pagesPerBlock;
+               dev->param.use_nand_ecc                            = geometry->hasECC;
+               dev->param.is_yaffs2                               = geometry->useYaffs2;
+               dev->param.n_reserved_blocks               = 5;
+               dev->driver_context                        = (void *)geometry;
 
                yaffs_add_device(dev);
 
index 9009b62..c38834d 100644 (file)
 
 
 typedef struct {
-       unsigned startBlock;
-       unsigned endBlock;
+       unsigned start_block;
+       unsigned end_block;
        unsigned dataSize;
        unsigned spareSize;
        unsigned pagesPerBlock;
        unsigned hasECC;
-       unsigned inbandTags;
+       unsigned inband_tags;
        unsigned useYaffs2;
 
-       int (*initialise)(yaffs_Device *dev);
-       int (*deinitialise)(yaffs_Device *dev);
+       int (*initialise)(yaffs_dev_t *dev);
+       int (*deinitialise)(yaffs_dev_t *dev);
 
-       int (*readChunk) (yaffs_Device *dev,
+       int (*readChunk) (yaffs_dev_t *dev,
                                          unsigned pageId, 
                                          unsigned char *data, unsigned dataLength,
                                          unsigned char *spare, unsigned spareLength,
                                          int *eccStatus);
 // ECC status is set to 0 for OK, 1 for fixed, -1 for unfixed.
 
-       int (*writeChunk)(yaffs_Device *dev,
+       int (*writeChunk)(yaffs_dev_t *dev,
                                          unsigned pageId, 
                                          const unsigned char *data, unsigned dataLength,
                                          const unsigned char *spare, unsigned spareLength);
 
-       int (*eraseBlock)(yaffs_Device *dev, unsigned blockId);
+       int (*eraseBlock)(yaffs_dev_t *dev, unsigned blockId);
 
-       int (*checkBlockOk)(yaffs_Device *dev, unsigned blockId);
-       int (*markBlockBad)(yaffs_Device *dev, unsigned blockId);
+       int (*checkBlockOk)(yaffs_dev_t *dev, unsigned blockId);
+       int (*markBlockBad)(yaffs_dev_t *dev, unsigned blockId);
 
        void *privateData;
 
 } ynandif_Geometry;
 
-struct yaffs_DeviceStruct * 
+struct yaffs_dev_s * 
        yaffs_add_dev_from_geometry(const YCHAR *name,
                                        const ynandif_Geometry *geometry);
 
 #if 0
 
-int ynandif_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_ExtendedTags *tags);
-int ynandif_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_ExtendedTags *tags);
-int ynandif_EraseBlockInNAND(yaffs_Device *dev, int blockNumber);
-int ynandif_InitialiseNAND(yaffs_Device *dev);
-int ynandif_MarkNANDBlockBad(yaffs_Device *dev,int blockNumber);
-int ynandif_QueryNANDBlock(yaffs_Device *dev, int blockNo, yaffs_BlockState *state, __u32 *sequenceNumber);
-int ynandif_GetGeometry(yaffs_Device *dev, ynandif_Geometry *geometry);
+int ynandif_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags);
+int ynandif_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags);
+int ynandif_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
+int ynandif_InitialiseNAND(yaffs_dev_t *dev);
+int ynandif_MarkNANDBlockBad(yaffs_dev_t *dev,int blockNumber);
+int ynandif_QueryNANDBlock(yaffs_dev_t *dev, int block_no, yaffs_block_state_t *state, __u32 *seq_number);
+int ynandif_GetGeometry(yaffs_dev_t *dev, ynandif_Geometry *geometry);
 #endif
 
 
index a14797f..c4cd48b 100644 (file)
@@ -31,7 +31,7 @@
 
 typedef struct yaffsfs_DeviceConfigurationStruct {
        const YCHAR *prefix;
-       struct yaffs_DeviceStruct *dev;
+       struct yaffs_dev_s *dev;
 } yaffsfs_DeviceConfiguration;
 
 
index b8e49bb..191ac8d 100644 (file)
@@ -31,8 +31,8 @@
 #define YAFFSFS_RW_SIZE  (1<<YAFFSFS_RW_SHIFT)
 
 /* Some forward references */
-static yaffs_Object *yaffsfs_FindObject(yaffs_Object *relativeDirectory, const YCHAR *path, int symDepth);
-static void yaffsfs_RemoveObjectCallback(yaffs_Object *obj);
+static yaffs_obj_t *yaffsfs_FindObject(yaffs_obj_t *relativeDirectory, const YCHAR *path, int symDepth);
+static void yaffsfs_RemoveObjectCallback(yaffs_obj_t *obj);
 
 unsigned int yaffs_wr_attempts;
 
@@ -49,7 +49,7 @@ unsigned int yaffs_wr_attempts;
 
 typedef struct {
        int count;      /* Number of handles accessing this inode */
-       yaffs_Object *iObj;
+       yaffs_obj_t *iObj;
 } yaffsfs_Inode;
 
 typedef struct{
@@ -102,7 +102,7 @@ yaffsfs_Inode *yaffsfs_GetInodePointer(int handle)
        return NULL;
 }
 
-yaffs_Object *yaffsfs_GetHandleObject(int handle)
+yaffs_obj_t *yaffsfs_GetHandleObject(int handle)
 {
        yaffsfs_Inode *in = yaffsfs_GetInodePointer(handle);
 
@@ -117,7 +117,7 @@ yaffs_Object *yaffsfs_GetHandleObject(int handle)
  * Find the inode entry for an object, if it exists.
  */
 
-static int yaffsfs_FindInodeIdForObject(yaffs_Object *obj)
+static int yaffsfs_FindInodeIdForObject(yaffs_obj_t *obj)
 {
        int i;
        int ret = -1;
@@ -137,7 +137,7 @@ static int yaffsfs_FindInodeIdForObject(yaffs_Object *obj)
  * yaffsfs_GetInodeIdForObject
  * Grab an inode entry when opening a new inode.
  */
-static int yaffsfs_GetInodeIdForObject(yaffs_Object *obj)
+static int yaffsfs_GetInodeIdForObject(yaffs_obj_t *obj)
 {
        int i;
        int ret;
@@ -166,7 +166,7 @@ static int yaffsfs_GetInodeIdForObject(yaffs_Object *obj)
 }
 
 
-static int yaffsfs_CountHandles(yaffs_Object *obj)
+static int yaffsfs_CountHandles(yaffs_obj_t *obj)
 {
        int i = yaffsfs_FindInodeIdForObject(obj);
 
@@ -178,14 +178,14 @@ static int yaffsfs_CountHandles(yaffs_Object *obj)
 
 static void yaffsfs_ReleaseInode(yaffsfs_Inode *in)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
        
        obj = in->iObj;
 
        if(obj->unlinked)
                yaffs_del_obj(obj);
        
-       obj->myInode = NULL;
+       obj->my_inode = NULL;
        in->iObj = NULL;
 
 }
@@ -299,13 +299,13 @@ YLIST_HEAD(yaffsfs_deviceList);
  * Curveballs: Should match paths that end in '/' too
  * Curveball2 Might have "/x/ and "/x/y". Need to return the longest match
  */
-static yaffs_Device *yaffsfs_FindDevice(const YCHAR *path, YCHAR **restOfPath)
+static yaffs_dev_t *yaffsfs_FindDevice(const YCHAR *path, YCHAR **restOfPath)
 {
        struct ylist_head *cfg;
        const YCHAR *leftOver;
        const YCHAR *p;
-       yaffs_Device *retval = NULL;
-       yaffs_Device *dev = NULL;
+       yaffs_dev_t *retval = NULL;
+       yaffs_dev_t *dev = NULL;
        int thisMatchLength;
        int longestMatch = -1;
        int matching;
@@ -316,7 +316,7 @@ static yaffs_Device *yaffsfs_FindDevice(const YCHAR *path, YCHAR **restOfPath)
         * 2) Matches the longest.
         */
        ylist_for_each(cfg, &yaffsfs_deviceList){
-               dev = ylist_entry(cfg, yaffs_Device, devList);
+               dev = ylist_entry(cfg, yaffs_dev_t, dev_list);
                leftOver = path;
                p = dev->param.name;
                thisMatchLength = 0;
@@ -371,12 +371,12 @@ static yaffs_Device *yaffsfs_FindDevice(const YCHAR *path, YCHAR **restOfPath)
 }
 
 #if 0
-static yaffs_Device *yaffsfs_FindDevice(const YCHAR *path, YCHAR **restOfPath)
+static yaffs_dev_t *yaffsfs_FindDevice(const YCHAR *path, YCHAR **restOfPath)
 {
        yaffsfs_DeviceConfiguration *cfg = yaffsfs_configurationList;
        const YCHAR *leftOver;
        const YCHAR *p;
-       yaffs_Device *retval = NULL;
+       yaffs_dev_t *retval = NULL;
        int thisMatchLength;
        int longestMatch = -1;
 
@@ -413,23 +413,23 @@ static yaffs_Device *yaffsfs_FindDevice(const YCHAR *path, YCHAR **restOfPath)
 }
 #endif
 
-static yaffs_Object *yaffsfs_FindRoot(const YCHAR *path, YCHAR **restOfPath)
+static yaffs_obj_t *yaffsfs_FindRoot(const YCHAR *path, YCHAR **restOfPath)
 {
 
-       yaffs_Device *dev;
+       yaffs_dev_t *dev;
 
        dev= yaffsfs_FindDevice(path,restOfPath);
-       if(dev && dev->isMounted){
-               return dev->rootDir;
+       if(dev && dev->is_mounted){
+               return dev->root_dir;
        }
        return NULL;
 }
 
-static yaffs_Object *yaffsfs_FollowLink(yaffs_Object *obj,int symDepth)
+static yaffs_obj_t *yaffsfs_FollowLink(yaffs_obj_t *obj,int symDepth)
 {
 
-       while(obj && obj->variantType == YAFFS_OBJECT_TYPE_SYMLINK){
-               YCHAR *alias = obj->variant.symLinkVariant.alias;
+       while(obj && obj->variant_type == YAFFS_OBJECT_TYPE_SYMLINK){
+               YCHAR *alias = obj->variant.symlink_variant.alias;
 
                if(yaffsfs_IsPathDivider(*alias))
                        /* Starts with a /, need to scan from root up */
@@ -448,10 +448,10 @@ static yaffs_Object *yaffsfs_FollowLink(yaffs_Object *obj,int symDepth)
  *
  * eg. "/data/xx/ff" --> puts name="ff" and returns the directory "/data/xx"
  */
-static yaffs_Object *yaffsfs_DoFindDirectory(yaffs_Object *startDir,
+static yaffs_obj_t *yaffsfs_DoFindDirectory(yaffs_obj_t *startDir,
                                const YCHAR *path, YCHAR **name, int symDepth)
 {
-       yaffs_Object *dir;
+       yaffs_obj_t *dir;
        YCHAR *restOfPath;
        YCHAR str[YAFFS_MAX_NAME_LENGTH+1];
        int i;
@@ -500,11 +500,11 @@ static yaffs_Object *yaffsfs_DoFindDirectory(yaffs_Object *startDir,
                        else{
                                dir = yaffs_find_by_name(dir,str);
 
-                               while(dir && dir->variantType == YAFFS_OBJECT_TYPE_SYMLINK)
+                               while(dir && dir->variant_type == YAFFS_OBJECT_TYPE_SYMLINK)
                                        dir = yaffsfs_FollowLink(dir,symDepth);
 
 
-                               if(dir && dir->variantType != YAFFS_OBJECT_TYPE_DIRECTORY)
+                               if(dir && dir->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY)
                                        dir = NULL;
                        }
                }
@@ -513,7 +513,7 @@ static yaffs_Object *yaffsfs_DoFindDirectory(yaffs_Object *startDir,
        return NULL;
 }
 
-static yaffs_Object *yaffsfs_FindDirectory(yaffs_Object *relativeDirectory,
+static yaffs_obj_t *yaffsfs_FindDirectory(yaffs_obj_t *relativeDirectory,
                                        const YCHAR *path,YCHAR **name,int symDepth)
 {
        return yaffsfs_DoFindDirectory(relativeDirectory,path,name,symDepth);
@@ -522,9 +522,9 @@ static yaffs_Object *yaffsfs_FindDirectory(yaffs_Object *relativeDirectory,
 /*
  * yaffsfs_FindObject turns a path for an existing object into the object
  */
-static yaffs_Object *yaffsfs_FindObject(yaffs_Object *relativeDirectory, const YCHAR *path,int symDepth)
+static yaffs_obj_t *yaffsfs_FindObject(yaffs_obj_t *relativeDirectory, const YCHAR *path,int symDepth)
 {
-       yaffs_Object *dir;
+       yaffs_obj_t *dir;
        YCHAR *name;
 
        dir = yaffsfs_FindDirectory(relativeDirectory,path,&name,symDepth);
@@ -566,8 +566,8 @@ int yaffs_dup(int fd)
 
 int yaffs_open_sharing(const YCHAR *path, int oflag, int mode, int sharing)
 {
-       yaffs_Object *obj = NULL;
-       yaffs_Object *dir = NULL;
+       yaffs_obj_t *obj = NULL;
+       yaffs_obj_t *dir = NULL;
        YCHAR *name;
        int handle = -1;
        yaffsfs_Handle *h = NULL;
@@ -605,15 +605,15 @@ int yaffs_open_sharing(const YCHAR *path, int oflag, int mode, int sharing)
                /* try to find the exisiting object */
                obj = yaffsfs_FindObject(NULL,path,0);
 
-               if(obj && obj->variantType == YAFFS_OBJECT_TYPE_SYMLINK)
+               if(obj && obj->variant_type == YAFFS_OBJECT_TYPE_SYMLINK)
                        obj = yaffsfs_FollowLink(obj,symDepth++);
 
                if(obj)
                        obj = yaffs_get_equivalent_obj(obj);
 
                if(obj &&
-                       obj->variantType != YAFFS_OBJECT_TYPE_FILE &&
-                       obj->variantType != YAFFS_OBJECT_TYPE_DIRECTORY)
+                       obj->variant_type != YAFFS_OBJECT_TYPE_FILE &&
+                       obj->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY)
                        obj = NULL;
 
                if(obj){
@@ -621,7 +621,7 @@ int yaffs_open_sharing(const YCHAR *path, int oflag, int mode, int sharing)
                        /* The file already exists or it might be a directory */
 
                        /* If it is a directory then we can't open it as a file */
-                       if(obj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY){
+                       if(obj->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY){
                                openDenied = 1;
                                yaffsfs_SetError(-EISDIR);
                                errorReported = 1;
@@ -689,7 +689,7 @@ int yaffs_open_sharing(const YCHAR *path, int oflag, int mode, int sharing)
                } else if((oflag & O_CREAT)) {
                        /* Let's see if we can create this file */
                        dir = yaffsfs_FindDirectory(NULL,path,&name,0);
-                       if(dir  && dir->myDev->readOnly){
+                       if(dir  && dir->my_dev->read_only){
                                yaffsfs_SetError(-EINVAL);
                                errorReported = 1;
                        } else if(dir)
@@ -719,7 +719,7 @@ int yaffs_open_sharing(const YCHAR *path, int oflag, int mode, int sharing)
                        h->shareWrite = shareWrite;
 
                        /* Hook inode to object */
-                        obj->myInode = (void*) &yaffsfs_inode[inodeId];
+                        obj->my_inode = (void*) &yaffsfs_inode[inodeId];
 
                         if((oflag & O_TRUNC) && h->writing)
                                 yaffs_resize_file(obj,0);
@@ -811,7 +811,7 @@ int yaffs_close(int fd)
 int yaffsfs_do_read(int fd, void *vbuf, unsigned int nbyte, int isPread, int offset)
 {
        yaffsfs_Handle *h = NULL;
-       yaffs_Object *obj = NULL;
+       yaffs_obj_t *obj = NULL;
        int pos = 0;
        int startPos = 0;
        int nRead = 0;
@@ -903,12 +903,12 @@ int yaffs_pread(int fd, void *buf, unsigned int nbyte, unsigned int offset)
 int yaffsfs_do_write(int fd, const void *vbuf, unsigned int nbyte, int isPwrite, int offset)
 {
        yaffsfs_Handle *h = NULL;
-       yaffs_Object *obj = NULL;
+       yaffs_obj_t *obj = NULL;
        int pos = 0;
        int startPos = 0;
        int nWritten = 0;
        int totalWritten = 0;
-       int writeThrough = 0;
+       int write_trhrough = 0;
        int nToWrite = 0;
        const __u8 *buf = (const __u8 *)vbuf;
 
@@ -920,7 +920,7 @@ int yaffsfs_do_write(int fd, const void *vbuf, unsigned int nbyte, int isPwrite,
                /* bad handle */
                yaffsfs_SetError(-EBADF);
                totalWritten = -1;
-       } else if( h && obj && (!h->writing || obj->myDev->readOnly)){
+       } else if( h && obj && (!h->writing || obj->my_dev->read_only)){
                yaffsfs_SetError(-EINVAL);
                totalWritten=-1;
        } else if( h && obj){
@@ -938,7 +938,7 @@ int yaffsfs_do_write(int fd, const void *vbuf, unsigned int nbyte, int isPwrite,
                        if(nToWrite > nbyte)
                                nToWrite = nbyte;
 
-                       nWritten = yaffs_wr_file(obj,buf,pos,nToWrite,writeThrough);
+                       nWritten = yaffs_wr_file(obj,buf,pos,nToWrite,write_trhrough);
                        if(nWritten > 0){
                                totalWritten += nWritten;
                                pos += nWritten;
@@ -988,9 +988,9 @@ int yaffs_pwrite(int fd, const void *buf, unsigned int nbyte, unsigned int offse
 }
 
 
-int yaffs_truncate(const YCHAR *path,off_t newSize)
+int yaffs_truncate(const YCHAR *path,off_t new_size)
 {
-       yaffs_Object *obj = NULL;
+       yaffs_obj_t *obj = NULL;
        int result = YAFFS_FAIL;
 
        yaffsfs_Lock();
@@ -1001,12 +1001,12 @@ int yaffs_truncate(const YCHAR *path,off_t newSize)
 
        if(!obj)
                yaffsfs_SetError(-ENOENT);
-       else if(obj->variantType != YAFFS_OBJECT_TYPE_FILE)
+       else if(obj->variant_type != YAFFS_OBJECT_TYPE_FILE)
                yaffsfs_SetError(-EISDIR);
-       else if(obj->myDev->readOnly)
+       else if(obj->my_dev->read_only)
                yaffsfs_SetError(-EINVAL);
        else
-               result = yaffs_resize_file(obj,newSize);
+               result = yaffs_resize_file(obj,new_size);
 
        yaffsfs_Unlock();
 
@@ -1014,10 +1014,10 @@ int yaffs_truncate(const YCHAR *path,off_t newSize)
        return (result) ? 0 : -1;
 }
 
-int yaffs_ftruncate(int fd, off_t newSize)
+int yaffs_ftruncate(int fd, off_t new_size)
 {
        yaffsfs_Handle *h = NULL;
-       yaffs_Object *obj = NULL;
+       yaffs_obj_t *obj = NULL;
        int result = 0;
 
        yaffsfs_Lock();
@@ -1027,11 +1027,11 @@ int yaffs_ftruncate(int fd, off_t newSize)
        if(!h || !obj)
                /* bad handle */
                yaffsfs_SetError(-EBADF);
-       else if(obj->myDev->readOnly)
+       else if(obj->my_dev->read_only)
                yaffsfs_SetError(-EINVAL);
        else
                /* resize the file */
-               result = yaffs_resize_file(obj,newSize);
+               result = yaffs_resize_file(obj,new_size);
        yaffsfs_Unlock();
 
 
@@ -1042,7 +1042,7 @@ int yaffs_ftruncate(int fd, off_t newSize)
 off_t yaffs_lseek(int fd, off_t offset, int whence)
 {
        yaffsfs_Handle *h = NULL;
-       yaffs_Object *obj = NULL;
+       yaffs_obj_t *obj = NULL;
        int pos = -1;
        int fSize = -1;
 
@@ -1082,8 +1082,8 @@ off_t yaffs_lseek(int fd, off_t offset, int whence)
 
 int yaffsfs_DoUnlink(const YCHAR *path,int isDirectory)
 {
-       yaffs_Object *dir = NULL;
-       yaffs_Object *obj = NULL;
+       yaffs_obj_t *dir = NULL;
+       yaffs_obj_t *obj = NULL;
        YCHAR *name;
        int result = YAFFS_FAIL;
 
@@ -1095,11 +1095,11 @@ int yaffsfs_DoUnlink(const YCHAR *path,int isDirectory)
                yaffsfs_SetError(-ENOTDIR);
        else if(!obj)
                yaffsfs_SetError(-ENOENT);
-       else if(obj->myDev->readOnly)
+       else if(obj->my_dev->read_only)
                yaffsfs_SetError(-EINVAL);
-       else if(!isDirectory && obj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY)
+       else if(!isDirectory && obj->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY)
                yaffsfs_SetError(-EISDIR);
-       else if(isDirectory && obj->variantType != YAFFS_OBJECT_TYPE_DIRECTORY)
+       else if(isDirectory && obj->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY)
                yaffsfs_SetError(-ENOTDIR);
        else {
                result = yaffs_unlinker(dir,name);
@@ -1128,13 +1128,13 @@ int yaffs_unlink(const YCHAR *path)
 
 int yaffs_rename(const YCHAR *oldPath, const YCHAR *newPath)
 {
-       yaffs_Object *olddir = NULL;
-       yaffs_Object *newdir = NULL;
-       yaffs_Object *obj = NULL;
+       yaffs_obj_t *olddir = NULL;
+       yaffs_obj_t *newdir = NULL;
+       yaffs_obj_t *obj = NULL;
        YCHAR *oldname;
        YCHAR *newname;
        int result= YAFFS_FAIL;
-       int renameAllowed = 1;
+       int rename_allowed = 1;
 
        yaffsfs_Lock();
 
@@ -1145,34 +1145,34 @@ int yaffs_rename(const YCHAR *oldPath, const YCHAR *newPath)
        if(!olddir || !newdir || !obj) {
                /* bad file */
                yaffsfs_SetError(-EBADF);
-               renameAllowed = 0;
-       } else if(obj->myDev->readOnly){
+               rename_allowed = 0;
+       } else if(obj->my_dev->read_only){
                yaffsfs_SetError(-EINVAL);
-               renameAllowed = 0;
-       } else if(olddir->myDev != newdir->myDev) {
+               rename_allowed = 0;
+       } else if(olddir->my_dev != newdir->my_dev) {
                /* oops must be on same device */
                /* todo error */
                yaffsfs_SetError(-EXDEV);
-               renameAllowed = 0;
-       } else if(obj && obj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY) {
+               rename_allowed = 0;
+       } else if(obj && obj->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY) {
                /*
                 * It is a directory, check that it is not being renamed to
                 * being its own decendent.
                 * Do this by tracing from the new directory back to the root, checking for obj
                 */
 
-               yaffs_Object *xx = newdir;
+               yaffs_obj_t *xx = newdir;
 
-               while( renameAllowed && xx){
+               while( rename_allowed && xx){
                        if(xx == obj)
-                               renameAllowed = 0;
+                               rename_allowed = 0;
                        xx = xx->parent;
                }
-               if(!renameAllowed)
+               if(!rename_allowed)
                        yaffsfs_SetError(-EACCES);
        }
 
-       if(renameAllowed)
+       if(rename_allowed)
                result = yaffs_rename_obj(olddir,oldname,newdir,newname);
 
        yaffsfs_Unlock();
@@ -1181,7 +1181,7 @@ int yaffs_rename(const YCHAR *oldPath, const YCHAR *newPath)
 }
 
 
-static int yaffsfs_DoStat(yaffs_Object *obj,struct yaffs_stat *buf)
+static int yaffsfs_DoStat(yaffs_obj_t *obj,struct yaffs_stat *buf)
 {
        int retVal = -1;
 
@@ -1189,15 +1189,15 @@ static int yaffsfs_DoStat(yaffs_Object *obj,struct yaffs_stat *buf)
                obj = yaffs_get_equivalent_obj(obj);
 
        if(obj && buf){
-               buf->st_dev = (int)obj->myDev->osContext;
-               buf->st_ino = obj->objectId;
+               buf->st_dev = (int)obj->my_dev->os_context;
+               buf->st_ino = obj->obj_id;
                buf->st_mode = obj->yst_mode & ~S_IFMT; /* clear out file type bits */
 
-               if(obj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY)
+               if(obj->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY)
                        buf->st_mode |= S_IFDIR;
-               else if(obj->variantType == YAFFS_OBJECT_TYPE_SYMLINK)
+               else if(obj->variant_type == YAFFS_OBJECT_TYPE_SYMLINK)
                        buf->st_mode |= S_IFLNK;
-               else if(obj->variantType == YAFFS_OBJECT_TYPE_FILE)
+               else if(obj->variant_type == YAFFS_OBJECT_TYPE_FILE)
                        buf->st_mode |= S_IFREG;
 
                buf->st_nlink = yaffs_get_obj_link_count(obj);
@@ -1205,7 +1205,7 @@ static int yaffsfs_DoStat(yaffs_Object *obj,struct yaffs_stat *buf)
                buf->st_gid = 0;;
                buf->st_rdev = obj->yst_rdev;
                buf->st_size = yaffs_get_obj_length(obj);
-               buf->st_blksize = obj->myDev->nDataBytesPerChunk;
+               buf->st_blksize = obj->my_dev->data_bytes_per_chunk;
                buf->st_blocks = (buf->st_size + buf->st_blksize -1)/buf->st_blksize;
 #if CONFIG_YAFFS_WINCE
                buf->yst_wince_atime[0] = obj->win_atime[0];
@@ -1226,7 +1226,7 @@ static int yaffsfs_DoStat(yaffs_Object *obj,struct yaffs_stat *buf)
 
 static int yaffsfs_DoStatOrLStat(const YCHAR *path, struct yaffs_stat *buf,int doLStat)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retVal = -1;
 
@@ -1260,7 +1260,7 @@ int yaffs_lstat(const YCHAR *path, struct yaffs_stat *buf)
 
 int yaffs_fstat(int fd, struct yaffs_stat *buf)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retVal = -1;
 
@@ -1284,7 +1284,7 @@ int yaffs_fstat(int fd, struct yaffs_stat *buf)
 
 static int yaffs_do_setxattr(const YCHAR *path, const char *name, const void *data, int size, int flags, int follow)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retVal = -1;
 
@@ -1324,7 +1324,7 @@ int yaffs_lsetxattr(const YCHAR *path, const char *name, const void *data, int s
 
 int yaffs_fsetxattr(int fd, const char *name, const void *data, int size, int flags)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retVal = -1;
 
@@ -1348,7 +1348,7 @@ int yaffs_fsetxattr(int fd, const char *name, const void *data, int size, int fl
 
 static int yaffs_do_getxattr(const YCHAR *path, const char *name, void *data, int size, int follow)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retVal = -1;
 
@@ -1387,7 +1387,7 @@ int yaffs_lgetxattr(const YCHAR *path, const char *name, void *data, int size)
 
 int yaffs_fgetxattr(int fd, const char *name, void *data, int size)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retVal = -1;
 
@@ -1411,7 +1411,7 @@ int yaffs_fgetxattr(int fd, const char *name, void *data, int size)
 
 static int yaffs_do_listxattr(const YCHAR *path, char *data, int size, int follow)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retVal = -1;
 
@@ -1449,7 +1449,7 @@ int yaffs_llistxattr(const YCHAR *path, char *data, int size)
 
 int yaffs_flistxattr(int fd, char *data, int size)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retVal = -1;
 
@@ -1473,7 +1473,7 @@ int yaffs_flistxattr(int fd, char *data, int size)
 
 static int yaffs_do_removexattr(const YCHAR *path, const char *name, int follow)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retVal = -1;
 
@@ -1511,7 +1511,7 @@ int yaffs_lremovexattr(const YCHAR *path, const char *name)
 
 int yaffs_fremovexattr(int fd, const char *name)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retVal = -1;
 
@@ -1537,7 +1537,7 @@ int yaffs_fremovexattr(int fd, const char *name)
 #ifdef CONFIG_YAFFS_WINCE
 int yaffs_get_wince_times(int fd, unsigned *wctime, unsigned *watime, unsigned *wmtime)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retVal = -1;
 
@@ -1576,7 +1576,7 @@ int yaffs_set_wince_times(int fd,
                                                  const unsigned *watime, 
                                                   const unsigned *wmtime)
 {
-        yaffs_Object *obj;
+        yaffs_obj_t *obj;
         int result;
         int retVal = -1;
 
@@ -1613,7 +1613,7 @@ int yaffs_set_wince_times(int fd,
 #endif
 
 
-static int yaffsfs_DoChMod(yaffs_Object *obj,mode_t mode)
+static int yaffsfs_DoChMod(yaffs_obj_t *obj,mode_t mode)
 {
        int result = -1;
 
@@ -1632,7 +1632,7 @@ static int yaffsfs_DoChMod(yaffs_Object *obj,mode_t mode)
 
 int yaffs_access(const YCHAR *path, int amode)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retval = 0;
 
@@ -1668,7 +1668,7 @@ int yaffs_access(const YCHAR *path, int amode)
 
 int yaffs_chmod(const YCHAR *path, mode_t mode)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retVal = -1;
 
@@ -1677,7 +1677,7 @@ int yaffs_chmod(const YCHAR *path, mode_t mode)
 
        if(!obj)
                yaffsfs_SetError(-ENOENT);
-       else if(obj->myDev->readOnly)
+       else if(obj->my_dev->read_only)
                yaffsfs_SetError(-EINVAL);
        else
                retVal = yaffsfs_DoChMod(obj,mode);
@@ -1691,7 +1691,7 @@ int yaffs_chmod(const YCHAR *path, mode_t mode)
 
 int yaffs_fchmod(int fd, mode_t mode)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        int retVal = -1;
 
@@ -1700,7 +1700,7 @@ int yaffs_fchmod(int fd, mode_t mode)
 
        if(!obj)
                yaffsfs_SetError(-ENOENT);
-       else if(obj->myDev->readOnly)
+       else if(obj->my_dev->read_only)
                yaffsfs_SetError(-EINVAL);
        else
                retVal = yaffsfs_DoChMod(obj,mode);
@@ -1713,8 +1713,8 @@ int yaffs_fchmod(int fd, mode_t mode)
 
 int yaffs_mkdir(const YCHAR *path, mode_t mode)
 {
-       yaffs_Object *parent = NULL;
-       yaffs_Object *dir = NULL;
+       yaffs_obj_t *parent = NULL;
+       yaffs_obj_t *dir = NULL;
        YCHAR *name;
        int retVal= -1;
 
@@ -1723,7 +1723,7 @@ int yaffs_mkdir(const YCHAR *path, mode_t mode)
        if(parent && yaffs_strnlen(name,5) == 0){
                /* Trying to make the root itself */
                yaffsfs_SetError(-EEXIST);
-       } else if(parent && parent->myDev->readOnly){
+       } else if(parent && parent->my_dev->read_only){
                yaffsfs_SetError(-EINVAL);
        } else {
                if(parent)
@@ -1748,17 +1748,17 @@ int yaffs_mkdir(const YCHAR *path, mode_t mode)
 
 void * yaffs_getdev(const YCHAR *path)
 {
-       yaffs_Device *dev=NULL;
+       yaffs_dev_t *dev=NULL;
        YCHAR *dummy;
        dev = yaffsfs_FindDevice(path,&dummy);
        return (void *)dev;
 }
 
-int yaffs_mount2(const YCHAR *path,int readOnly)
+int yaffs_mount2(const YCHAR *path,int read_only)
 {
        int retVal=-1;
        int result=YAFFS_FAIL;
-       yaffs_Device *dev=NULL;
+       yaffs_dev_t *dev=NULL;
        YCHAR *dummy;
 
        T(YAFFS_TRACE_ALWAYS,(TSTR("yaffs: Mounting %s" TENDSTR),path));
@@ -1769,8 +1769,8 @@ int yaffs_mount2(const YCHAR *path,int readOnly)
 
        dev = yaffsfs_FindDevice(path,&dummy);
        if(dev){
-               if(!dev->isMounted){
-                       dev->readOnly = readOnly ? 1 : 0;
+               if(!dev->is_mounted){
+                       dev->read_only = read_only ? 1 : 0;
                        result = yaffs_guts_initialise(dev);
                        if(result == YAFFS_FAIL)
                                /* todo error - mount failed */
@@ -1798,13 +1798,13 @@ int yaffs_mount(const YCHAR *path)
 int yaffs_sync(const YCHAR *path)
 {
         int retVal=-1;
-        yaffs_Device *dev=NULL;
+        yaffs_dev_t *dev=NULL;
         YCHAR *dummy;
         
         yaffsfs_Lock();
         dev = yaffsfs_FindDevice(path,&dummy);
         if(dev){
-                if(dev->isMounted){
+                if(dev->is_mounted){
                         
                         yaffs_flush_whole_cache(dev);
                         yaffs_checkpoint_save(dev);
@@ -1823,30 +1823,30 @@ int yaffs_sync(const YCHAR *path)
 }
 
 
-int yaffs_remount(const YCHAR *path, int force, int readOnly)
+int yaffs_remount(const YCHAR *path, int force, int read_only)
 {
         int retVal=-1;
-       yaffs_Device *dev=NULL;
+       yaffs_dev_t *dev=NULL;
        YCHAR *dummy;
 
        yaffsfs_Lock();
        dev = yaffsfs_FindDevice(path,&dummy);
        if(dev){
-               if(dev->isMounted){
+               if(dev->is_mounted){
                        int i;
                        int inUse;
 
                        yaffs_flush_whole_cache(dev);
 
                        for(i = inUse = 0; i < YAFFSFS_N_HANDLES && !inUse && !force; i++){
-                               if(yaffsfs_handle[i].useCount>0 && yaffsfs_inode[yaffsfs_handle[i].inodeId].iObj->myDev == dev)
+                               if(yaffsfs_handle[i].useCount>0 && yaffsfs_inode[yaffsfs_handle[i].inodeId].iObj->my_dev == dev)
                                        inUse = 1; /* the device is in use, can't unmount */
                        }
 
                        if(!inUse || force){
-                               if(readOnly)
+                               if(read_only)
                                        yaffs_checkpoint_save(dev);
-                               dev->readOnly =  readOnly ? 1 : 0;
+                               dev->read_only =  read_only ? 1 : 0;
                                retVal = 0;
                        } else
                                yaffsfs_SetError(-EBUSY);
@@ -1866,13 +1866,13 @@ int yaffs_remount(const YCHAR *path, int force, int readOnly)
 int yaffs_unmount2(const YCHAR *path, int force)
 {
         int retVal=-1;
-       yaffs_Device *dev=NULL;
+       yaffs_dev_t *dev=NULL;
        YCHAR *dummy;
 
        yaffsfs_Lock();
        dev = yaffsfs_FindDevice(path,&dummy);
        if(dev){
-               if(dev->isMounted){
+               if(dev->is_mounted){
                        int i;
                        int inUse;
 
@@ -1880,7 +1880,7 @@ int yaffs_unmount2(const YCHAR *path, int force)
                        yaffs_checkpoint_save(dev);
 
                        for(i = inUse = 0; i < YAFFSFS_N_HANDLES && !inUse; i++){
-                               if(yaffsfs_handle[i].useCount > 0 && yaffsfs_inode[yaffsfs_handle[i].inodeId].iObj->myDev == dev)
+                               if(yaffsfs_handle[i].useCount > 0 && yaffsfs_inode[yaffsfs_handle[i].inodeId].iObj->my_dev == dev)
                                        inUse = 1; /* the device is in use, can't unmount */
                        }
 
@@ -1914,14 +1914,14 @@ int yaffs_unmount(const YCHAR *path)
 loff_t yaffs_freespace(const YCHAR *path)
 {
        loff_t retVal=-1;
-       yaffs_Device *dev=NULL;
+       yaffs_dev_t *dev=NULL;
        YCHAR *dummy;
 
        yaffsfs_Lock();
        dev = yaffsfs_FindDevice(path,&dummy);
-       if(dev  && dev->isMounted){
+       if(dev  && dev->is_mounted){
                retVal = yaffs_get_n_free_chunks(dev);
-               retVal *= dev->nDataBytesPerChunk;
+               retVal *= dev->data_bytes_per_chunk;
 
        } else
                yaffsfs_SetError(-EINVAL);
@@ -1933,15 +1933,15 @@ loff_t yaffs_freespace(const YCHAR *path)
 loff_t yaffs_totalspace(const YCHAR *path)
 {
        loff_t retVal=-1;
-       yaffs_Device *dev=NULL;
+       yaffs_dev_t *dev=NULL;
        YCHAR *dummy;
 
        yaffsfs_Lock();
        dev = yaffsfs_FindDevice(path,&dummy);
-       if(dev  && dev->isMounted){
-               retVal = (dev->param.endBlock - dev->param.startBlock + 1) - dev->param.nReservedBlocks;
-               retVal *= dev->param.nChunksPerBlock;
-               retVal *= dev->nDataBytesPerChunk;
+       if(dev  && dev->is_mounted){
+               retVal = (dev->param.end_block - dev->param.start_block + 1) - dev->param.n_reserved_blocks;
+               retVal *= dev->param.chunks_per_block;
+               retVal *= dev->data_bytes_per_chunk;
 
        } else
                yaffsfs_SetError(-EINVAL);
@@ -1953,15 +1953,15 @@ loff_t yaffs_totalspace(const YCHAR *path)
 int yaffs_inodecount(const YCHAR *path)
 {
        loff_t retVal= -1;
-       yaffs_Device *dev=NULL;
+       yaffs_dev_t *dev=NULL;
        YCHAR *dummy;
 
        yaffsfs_Lock();
        dev = yaffsfs_FindDevice(path,&dummy);
-       if(dev  && dev->isMounted) {
-          int nObjects = dev->nObjects;
-          if(nObjects > dev->nHardLinks)
-               retVal = nObjects - dev->nHardLinks;
+       if(dev  && dev->is_mounted) {
+          int n_obj = dev->n_obj;
+          if(n_obj > dev->n_hardlinks)
+               retVal = n_obj - dev->n_hardlinks;
        }
        
        if(retVal < 0)
@@ -1972,20 +1972,20 @@ int yaffs_inodecount(const YCHAR *path)
 }
 
 
-void yaffs_add_device(yaffs_Device *dev)
+void yaffs_add_device(yaffs_dev_t *dev)
 {
-       dev->isMounted = 0;
-       dev->param.removeObjectCallback = yaffsfs_RemoveObjectCallback;
+       dev->is_mounted = 0;
+       dev->param.remove_obj_fn = yaffsfs_RemoveObjectCallback;
 
-       if(!dev->devList.next)
-               YINIT_LIST_HEAD(&dev->devList);
+       if(!dev->dev_list.next)
+               YINIT_LIST_HEAD(&dev->dev_list);
 
-       ylist_add(&dev->devList,&yaffsfs_deviceList);
+       ylist_add(&dev->dev_list,&yaffsfs_deviceList);
 }
 
-void yaffs_remove_device(yaffs_Device *dev)
+void yaffs_remove_device(yaffs_dev_t *dev)
 {
-       ylist_del_init(&dev->devList);
+       ylist_del_init(&dev->dev_list);
 }
 
 
@@ -2005,8 +2005,8 @@ typedef struct
        __u32 magic;
        yaffs_dirent de;                /* directory entry being used by this dsc */
        YCHAR name[NAME_MAX+1];         /* name of directory being searched */
-        yaffs_Object *dirObj;           /* ptr to directory being searched */
-        yaffs_Object *nextReturn;       /* obj to be returned by next readddir */
+        yaffs_obj_t *dirObj;           /* ptr to directory being searched */
+        yaffs_obj_t *nextReturn;       /* obj to be returned by next readddir */
         int offset;
         struct ylist_head others;       
 } yaffsfs_DirectorySearchContext;
@@ -2020,15 +2020,15 @@ static void yaffsfs_SetDirRewound(yaffsfs_DirectorySearchContext *dsc)
 {
        if(dsc &&
           dsc->dirObj &&
-          dsc->dirObj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY){
+          dsc->dirObj->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY){
 
            dsc->offset = 0;
 
-           if( ylist_empty(&dsc->dirObj->variant.directoryVariant.children))
+           if( ylist_empty(&dsc->dirObj->variant.dir_variant.children))
                 dsc->nextReturn = NULL;
            else
-                dsc->nextReturn = ylist_entry(dsc->dirObj->variant.directoryVariant.children.next,
-                                                yaffs_Object,siblings);
+                dsc->nextReturn = ylist_entry(dsc->dirObj->variant.dir_variant.children.next,
+                                                yaffs_obj_t,siblings);
         } else {
                /* Hey someone isn't playing nice! */
        }
@@ -2038,25 +2038,25 @@ static void yaffsfs_DirAdvance(yaffsfs_DirectorySearchContext *dsc)
 {
        if(dsc &&
           dsc->dirObj &&
-           dsc->dirObj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY){
+           dsc->dirObj->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY){
 
            if( dsc->nextReturn == NULL ||
-               ylist_empty(&dsc->dirObj->variant.directoryVariant.children))
+               ylist_empty(&dsc->dirObj->variant.dir_variant.children))
                 dsc->nextReturn = NULL;
            else {
                    struct ylist_head *next = dsc->nextReturn->siblings.next;
 
-                   if( next == &dsc->dirObj->variant.directoryVariant.children)
+                   if( next == &dsc->dirObj->variant.dir_variant.children)
                         dsc->nextReturn = NULL; /* end of list */
                    else
-                        dsc->nextReturn = ylist_entry(next,yaffs_Object,siblings);
+                        dsc->nextReturn = ylist_entry(next,yaffs_obj_t,siblings);
            }
         } else {
                 /* Hey someone isn't playing nice! */
        }
 }
 
-static void yaffsfs_RemoveObjectCallback(yaffs_Object *obj)
+static void yaffsfs_RemoveObjectCallback(yaffs_obj_t *obj)
 {
 
         struct ylist_head *i;
@@ -2083,14 +2083,14 @@ static void yaffsfs_RemoveObjectCallback(yaffs_Object *obj)
 yaffs_DIR *yaffs_opendir(const YCHAR *dirname)
 {
        yaffs_DIR *dir = NULL;
-       yaffs_Object *obj = NULL;
+       yaffs_obj_t *obj = NULL;
        yaffsfs_DirectorySearchContext *dsc = NULL;
 
        yaffsfs_Lock();
 
        obj = yaffsfs_FindObject(NULL,dirname,0);
 
-       if(obj && obj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY){
+       if(obj && obj->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY){
 
                dsc = YMALLOC(sizeof(yaffsfs_DirectorySearchContext));
                dir = (yaffs_DIR *)dsc;
@@ -2126,7 +2126,7 @@ struct yaffs_dirent *yaffs_readdir(yaffs_DIR *dirp)
        if(dsc && dsc->magic == YAFFS_MAGIC){
                yaffsfs_SetError(0);
                if(dsc->nextReturn){
-                       dsc->de.d_ino = yaffs_get_equivalent_obj(dsc->nextReturn)->objectId;
+                       dsc->de.d_ino = yaffs_get_equivalent_obj(dsc->nextReturn)->obj_id;
                        dsc->de.d_dont_use = (unsigned)dsc->nextReturn;
                        dsc->de.d_off = dsc->offset++;
                        yaffs_get_obj_name(dsc->nextReturn,dsc->de.d_name,NAME_MAX);
@@ -2179,15 +2179,15 @@ int yaffs_closedir(yaffs_DIR *dirp)
 
 int yaffs_symlink(const YCHAR *oldpath, const YCHAR *newpath)
 {
-       yaffs_Object *parent = NULL;
-       yaffs_Object *obj;
+       yaffs_obj_t *parent = NULL;
+       yaffs_obj_t *obj;
        YCHAR *name;
        int retVal= -1;
        int mode = 0; /* ignore for now */
 
        yaffsfs_Lock();
        parent = yaffsfs_FindDirectory(NULL,newpath,&name,0);
-       if(parent && parent->myDev->readOnly)
+       if(parent && parent->my_dev->read_only)
                yaffsfs_SetError(-EINVAL);
        else if(parent){
                obj = yaffs_create_symlink(parent,name,mode,0,0,oldpath);
@@ -2210,7 +2210,7 @@ int yaffs_symlink(const YCHAR *oldpath, const YCHAR *newpath)
 
 int yaffs_readlink(const YCHAR *path, YCHAR *buf, int bufsiz)
 {
-       yaffs_Object *obj = NULL;
+       yaffs_obj_t *obj = NULL;
        int retVal;
 
 
@@ -2221,11 +2221,11 @@ int yaffs_readlink(const YCHAR *path, YCHAR *buf, int bufsiz)
        if(!obj) {
                yaffsfs_SetError(-ENOENT);
                retVal = -1;
-       } else if(obj->variantType != YAFFS_OBJECT_TYPE_SYMLINK) {
+       } else if(obj->variant_type != YAFFS_OBJECT_TYPE_SYMLINK) {
                yaffsfs_SetError(-EINVAL);
                retVal = -1;
        } else {
-               YCHAR *alias = obj->variant.symLinkVariant.alias;
+               YCHAR *alias = obj->variant.symlink_variant.alias;
                memset(buf,0,bufsiz);
                yaffs_strncpy(buf,alias,bufsiz - 1);
                retVal = 0;
@@ -2237,10 +2237,10 @@ int yaffs_readlink(const YCHAR *path, YCHAR *buf, int bufsiz)
 int yaffs_link(const YCHAR *oldpath, const YCHAR *newpath)
 {
        /* Creates a link called newpath to existing oldpath */
-       yaffs_Object *obj = NULL;
-       yaffs_Object *target = NULL;
+       yaffs_obj_t *obj = NULL;
+       yaffs_obj_t *target = NULL;
        int retVal = 0;
-       int newNameLength = 0;
+       int new_nameLength = 0;
 
 
        yaffsfs_Lock();
@@ -2251,15 +2251,15 @@ int yaffs_link(const YCHAR *oldpath, const YCHAR *newpath)
        if(!obj) {
                yaffsfs_SetError(-ENOENT);
                retVal = -1;
-       } else if(obj->myDev->readOnly){
+       } else if(obj->my_dev->read_only){
                yaffsfs_SetError(-EINVAL);
                retVal= -1;
        } else if(target) {
                yaffsfs_SetError(-EEXIST);
                retVal = -1;
        } else {
-               yaffs_Object *newdir = NULL;
-               yaffs_Object *link = NULL;
+               yaffs_obj_t *newdir = NULL;
+               yaffs_obj_t *link = NULL;
 
                YCHAR *newname;
 
@@ -2268,23 +2268,23 @@ int yaffs_link(const YCHAR *oldpath, const YCHAR *newpath)
                if(!newdir){
                        yaffsfs_SetError(-ENOTDIR);
                        retVal = -1;
-               }else if(newdir->myDev != obj->myDev){
+               }else if(newdir->my_dev != obj->my_dev){
                        yaffsfs_SetError(-EXDEV);
                        retVal = -1;
                }
                
-               newNameLength = yaffs_strnlen(newname,YAFFS_MAX_NAME_LENGTH+1);
+               new_nameLength = yaffs_strnlen(newname,YAFFS_MAX_NAME_LENGTH+1);
                
-               if(newNameLength == 0){
+               if(new_nameLength == 0){
                        yaffsfs_SetError(-ENOENT);
                        retVal = -1;
-               } else if (newNameLength > YAFFS_MAX_NAME_LENGTH){
+               } else if (new_nameLength > YAFFS_MAX_NAME_LENGTH){
                        yaffsfs_SetError(-ENAMETOOLONG);
                        retVal = -1;
                }
                
                if(retVal == 0) {
-                       link = yaffs_Link(newdir,newname,obj);
+                       link = yaffs_link_obj(newdir,newname,obj);
                        if(link)
                                retVal = 0;
                        else{
@@ -2312,7 +2312,7 @@ int yaffs_mknod(const YCHAR *pathname, mode_t mode, dev_t dev)
  */
 int yaffs_n_handles(const YCHAR *path)
 {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
 
        obj = yaffsfs_FindObject(NULL,path,0);
        if(obj)
@@ -2326,23 +2326,23 @@ int yaffs_dump_dev(const YCHAR *path)
 #if 0
        YCHAR *rest;
 
-       yaffs_Object *obj = yaffsfs_FindRoot(path,&rest);
+       yaffs_obj_t *obj = yaffsfs_FindRoot(path,&rest);
 
        if(obj){
-               yaffs_Device *dev = obj->myDev;
+               yaffs_dev_t *dev = obj->my_dev;
 
                printf("\n"
-                          "nPageWrites.......... %d\n"
-                          "nPageReads........... %d\n"
-                          "nBlockErasures....... %d\n"
-                          "nGCCopies............ %d\n"
+                          "n_page_writes.......... %d\n"
+                          "n_page_reads........... %d\n"
+                          "n_erasures....... %d\n"
+                          "n_gc_copies............ %d\n"
                           "garbageCollections... %d\n"
                           "passiveGarbageColl'ns %d\n"
                           "\n",
-                               dev->nPageWrites,
-                               dev->nPageReads,
-                               dev->nBlockErasures,
-                               dev->nGCCopies,
+                               dev->n_page_writes,
+                               dev->n_page_reads,
+                               dev->n_erasures,
+                               dev->n_gc_copies,
                                dev->garbageCollections,
                                dev->passiveGarbageCollections
                );
index 2a450e9..5f47a2d 100644 (file)
@@ -94,8 +94,8 @@ int yaffs_pwrite(int fd, const void *buf, unsigned int nbyte, unsigned int offse
 
 off_t yaffs_lseek(int fd, off_t offset, int whence) ;
 
-int yaffs_truncate(const YCHAR *path, off_t newSize);
-int yaffs_ftruncate(int fd, off_t newSize);
+int yaffs_truncate(const YCHAR *path, off_t new_size);
+int yaffs_ftruncate(int fd, off_t new_size);
 
 int yaffs_unlink(const YCHAR *path) ;
 int yaffs_rename(const YCHAR *oldPath, const YCHAR *newPath) ;
@@ -140,10 +140,10 @@ void yaffs_rewinddir(yaffs_DIR *dirp) ;
 int yaffs_closedir(yaffs_DIR *dirp) ;
 
 int yaffs_mount(const YCHAR *path) ;
-int yaffs_mount2(const YCHAR *path, int readOnly);
+int yaffs_mount2(const YCHAR *path, int read_only);
 int yaffs_unmount(const YCHAR *path) ;
 int yaffs_unmount2(const YCHAR *path, int force);
-int yaffs_remount(const YCHAR *path, int force, int readOnly);
+int yaffs_remount(const YCHAR *path, int force, int read_only);
 
 
 int yaffs_sync(const YCHAR *path) ;
@@ -166,8 +166,8 @@ int yaffs_n_handles(const YCHAR *path);
 int yaffs_open_sharing(const YCHAR *path, int oflag, int mode, int shareMode) ;
 
 
-struct yaffs_DeviceStruct;
-void yaffs_add_device(struct yaffs_DeviceStruct *dev);
+struct yaffs_dev_s;
+void yaffs_add_device(struct yaffs_dev_s *dev);
 
 int yaffs_start_up(void);
 
index 43f1144..4b4d642 100644 (file)
@@ -68,7 +68,7 @@
 #define CONFIG_YAFFS_XATTR
 
 /*
-Older-style on-NAND data format has a "pageStatus" byte to record
+Older-style on-NAND data format has a "page_status" byte to record
 chunk/page state.  This byte is zeroed when the page is discarded.
 Choose this option if you have existing on-NAND data in this format
 that you need to continue to support.  New data written also uses the
@@ -78,7 +78,7 @@ adjusted to use the older-style format.  See notes on tags formats and
 MTD versions in yaffs_mtdif1.c.
 */
 /* Default: Not selected */
-/* Meaning: Use older-style on-NAND data format with pageStatus byte */
+/* Meaning: Use older-style on-NAND data format with page_status byte */
 /* #define CONFIG_YAFFS_9BYTE_TAGS */
 
 #endif /* YAFFS_OUT_OF_TREE */
index 7efa8d4..a877cbe 100644 (file)
@@ -99,18 +99,18 @@ static void nandemul_yield(int n)
 }
 
 
-static void nandemul2k_Read(void *buffer, int page, int start, int nBytes)
+static void nandemul2k_Read(void *buffer, int page, int start, int n_bytes)
 {
        int pg = page%PAGES_PER_BLOCK;
        int blk = page/PAGES_PER_BLOCK;
-       if(buffer && nBytes > 0)
+       if(buffer && n_bytes > 0)
        {
-               memcpy(buffer,&ned.block[blk]->page[pg]->data[start],nBytes);
+               memcpy(buffer,&ned.block[blk]->page[pg]->data[start],n_bytes);
        }
        
 }
 
-static void nandemul2k_Program(const void *buffer, int page, int start, int nBytes)
+static void nandemul2k_Program(const void *buffer, int page, int start, int n_bytes)
 {
        int pg = page%PAGES_PER_BLOCK;
        int blk = page/PAGES_PER_BLOCK;
@@ -119,12 +119,12 @@ static void nandemul2k_Program(const void *buffer, int page, int start, int nByt
 
        p = &ned.block[blk]->page[pg]->data[start];
        
-       while(buffer && nBytes>0)
+       while(buffer && n_bytes>0)
        {
                *p = *p & *b;
                p++;
                b++;
-               nBytes--;
+               n_bytes--;
        }
 }
 
index 6d95651..71fb027 100644 (file)
@@ -28,7 +28,7 @@ const char *yaffs_mtdif2_c_version =
 #include "yaffs_packedtags2.h"
 
 
-void nandmtd2_pt2buf(yaffs_Device *dev, yaffs_PackedTags2 *pt, int is_raw)
+void nandmtd2_pt2buf(yaffs_dev_t *dev, yaffs_PackedTags2 *pt, int is_raw)
 {
        struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
        __u8 *ptab = (__u8 *)pt; /* packed tags as bytes */
@@ -69,7 +69,7 @@ void nandmtd2_pt2buf(yaffs_Device *dev, yaffs_PackedTags2 *pt, int is_raw)
 
 }
 
-void nandmtd2_buf2pt(yaffs_Device *dev, yaffs_PackedTags2 *pt, int is_raw)
+void nandmtd2_buf2pt(yaffs_dev_t *dev, yaffs_PackedTags2 *pt, int is_raw)
 {
        struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
        int     i, j = 0, k, n;
@@ -107,22 +107,22 @@ void nandmtd2_buf2pt(yaffs_Device *dev, yaffs_PackedTags2 *pt, int is_raw)
                
 }
 
-int nandmtd2_WriteChunkWithTagsToNAND(yaffs_Device * dev, int chunkInNAND,
+int nandmtd2_WriteChunkWithTagsToNAND(yaffs_dev_t * dev, int nand_chunk,
                                      const __u8 * data,
-                                     const yaffs_ExtendedTags * tags)
+                                     const yaffs_ext_tags * tags)
 {
        struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
        size_t dummy;
        int retval = 0;
 
-       loff_t addr = ((loff_t) chunkInNAND) * dev->nBytesPerChunk;
+       loff_t addr = ((loff_t) nand_chunk) * dev->n_bytesPerChunk;
 
        yaffs_PackedTags2 pt;
 
        T(YAFFS_TRACE_MTD,
          (TSTR
           ("nandmtd2_WriteChunkWithTagsToNAND chunk %d data %p tags %p"
-           TENDSTR), chunkInNAND, data, tags));
+           TENDSTR), nand_chunk, data, tags));
 
        if (tags) {
                yaffs_PackTags2(&pt, tags);
@@ -131,7 +131,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(yaffs_Device * dev, int chunkInNAND,
        if (data && tags) {
                        nandmtd2_pt2buf(dev, &pt, 0);
                        retval =
-                           mtd->write_ecc(mtd, addr, dev->nBytesPerChunk,
+                           mtd->write_ecc(mtd, addr, dev->n_bytesPerChunk,
                                           &dummy, data, dev->spareBuffer,
                                           NULL);
 
@@ -149,32 +149,32 @@ int nandmtd2_WriteChunkWithTagsToNAND(yaffs_Device * dev, int chunkInNAND,
                return YAFFS_FAIL;
 }
 
-int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
-                                      __u8 * data, yaffs_ExtendedTags * tags)
+int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_dev_t * dev, int nand_chunk,
+                                      __u8 * data, yaffs_ext_tags * tags)
 {
        struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
        size_t dummy;
        int retval = 0;
 
-       loff_t addr = ((loff_t) chunkInNAND) * dev->nBytesPerChunk;
+       loff_t addr = ((loff_t) nand_chunk) * dev->n_bytesPerChunk;
 
        yaffs_PackedTags2 pt;
 
        T(YAFFS_TRACE_MTD,
          (TSTR
           ("nandmtd2_ReadChunkWithTagsToNAND chunk %d data %p tags %p"
-           TENDSTR), chunkInNAND, data, tags));
+           TENDSTR), nand_chunk, data, tags));
 
        if (0 && data && tags) {
                        retval =
-                           mtd->read_ecc(mtd, addr, dev->nBytesPerChunk,
+                           mtd->read_ecc(mtd, addr, dev->n_bytesPerChunk,
                                          &dummy, data, dev->spareBuffer,
                                          NULL);
                        nandmtd2_buf2pt(dev, &pt, 0);
        } else {
                if (data)
                        retval =
-                           mtd->read(mtd, addr, dev->nBytesPerChunk, &dummy,
+                           mtd->read(mtd, addr, dev->n_bytesPerChunk, &dummy,
                                      data);
                if (tags) {
                        retval =
@@ -193,17 +193,17 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
                return YAFFS_FAIL;
 }
 
-int nandmtd2_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
+int nandmtd2_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no)
 {
        struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
        int retval;
        T(YAFFS_TRACE_MTD,
-         (TSTR("nandmtd2_MarkNANDBlockBad %d" TENDSTR), blockNo));
+         (TSTR("nandmtd2_MarkNANDBlockBad %d" TENDSTR), block_no));
 
        retval =
            mtd->block_markbad(mtd,
-                              blockNo * dev->nChunksPerBlock *
-                              dev->nBytesPerChunk);
+                              block_no * dev->chunks_per_block *
+                              dev->n_bytesPerChunk);
 
        if (retval == 0)
                return YAFFS_OK;
@@ -212,41 +212,41 @@ int nandmtd2_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
 
 }
 
-int nandmtd2_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo,
-                           yaffs_BlockState * state, int *sequenceNumber)
+int nandmtd2_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no,
+                           yaffs_block_state_t * state, int *seq_number)
 {
        struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
        int retval;
 
        T(YAFFS_TRACE_MTD,
-         (TSTR("nandmtd2_QueryNANDBlock %d" TENDSTR), blockNo));
+         (TSTR("nandmtd2_QueryNANDBlock %d" TENDSTR), block_no));
        retval =
            mtd->block_isbad(mtd,
-                            blockNo * dev->nChunksPerBlock *
-                            dev->nBytesPerChunk);
+                            block_no * dev->chunks_per_block *
+                            dev->n_bytesPerChunk);
 
        if (retval) {
                T(YAFFS_TRACE_MTD, (TSTR("block is bad" TENDSTR)));
 
                *state = YAFFS_BLOCK_STATE_DEAD;
-               *sequenceNumber = 0;
+               *seq_number = 0;
        } else {
-               yaffs_ExtendedTags t;
+               yaffs_ext_tags t;
                nandmtd2_ReadChunkWithTagsFromNAND(dev,
-                                                  blockNo *
-                                                  dev->nChunksPerBlock, NULL,
+                                                  block_no *
+                                                  dev->chunks_per_block, NULL,
                                                   &t);
 
-               if (t.chunkUsed) {
-                       *sequenceNumber = t.sequenceNumber;
+               if (t.chunk_used) {
+                       *seq_number = t.seq_number;
                        *state = YAFFS_BLOCK_STATE_NEEDS_SCANNING;
                } else {
-                       *sequenceNumber = 0;
+                       *seq_number = 0;
                        *state = YAFFS_BLOCK_STATE_EMPTY;
                }
 
                T(YAFFS_TRACE_MTD,
-                 (TSTR("block is OK seq %d state %d" TENDSTR), *sequenceNumber,
+                 (TSTR("block is OK seq %d state %d" TENDSTR), *seq_number,
                   *state));
        }
 
index ac658b1..df9b044 100644 (file)
@@ -61,7 +61,7 @@ static objItem obj_list[MAX_OBJECTS];
 static int n_obj = 0;
 static int obj_id = YAFFS_NOBJECT_BUCKETS + 1;
 
-static int nObjects, nDirectories, nPages;
+static int n_obj, nDirectories, nPages;
 
 static int outFile;
 
@@ -145,7 +145,7 @@ static int find_obj_in_list(dev_t dev, ino_t ino)
  * NOTE: The tag is not usable after this other than calculating the CRC
  * with.
  */
-static void little_to_big_endian(yaffs_Tags *tagsPtr)
+static void little_to_big_endian(yaffs_tags_t *tagsPtr)
 {
 #if 0 // FIXME NCB
     yaffs_tags_union_t * tags = (yaffs_tags_union_t* )tagsPtr; // Work in bytes.
@@ -153,24 +153,24 @@ static void little_to_big_endian(yaffs_Tags *tagsPtr)
 
     memset(&temp, 0, sizeof(temp));
     // Ick, I hate magic numbers.
-    temp.asBytes[0] = ((tags->asBytes[2] & 0x0F) << 4) | ((tags->asBytes[1] & 0xF0) >> 4);
-    temp.asBytes[1] = ((tags->asBytes[1] & 0x0F) << 4) | ((tags->asBytes[0] & 0xF0) >> 4);
-    temp.asBytes[2] = ((tags->asBytes[0] & 0x0F) << 4) | ((tags->asBytes[2] & 0x30) >> 2) | ((tags->asBytes[3] & 0xC0) >> 6);
-    temp.asBytes[3] = ((tags->asBytes[3] & 0x3F) << 2) | ((tags->asBytes[2] & 0xC0) >> 6);
-    temp.asBytes[4] = ((tags->asBytes[6] & 0x03) << 6) | ((tags->asBytes[5] & 0xFC) >> 2);
-    temp.asBytes[5] = ((tags->asBytes[5] & 0x03) << 6) | ((tags->asBytes[4] & 0xFC) >> 2);
-    temp.asBytes[6] = ((tags->asBytes[4] & 0x03) << 6) | (tags->asBytes[7] & 0x3F);
-    temp.asBytes[7] = (tags->asBytes[6] & 0xFC) | ((tags->asBytes[7] & 0xC0) >> 6);
+    temp.as_bytes[0] = ((tags->as_bytes[2] & 0x0F) << 4) | ((tags->as_bytes[1] & 0xF0) >> 4);
+    temp.as_bytes[1] = ((tags->as_bytes[1] & 0x0F) << 4) | ((tags->as_bytes[0] & 0xF0) >> 4);
+    temp.as_bytes[2] = ((tags->as_bytes[0] & 0x0F) << 4) | ((tags->as_bytes[2] & 0x30) >> 2) | ((tags->as_bytes[3] & 0xC0) >> 6);
+    temp.as_bytes[3] = ((tags->as_bytes[3] & 0x3F) << 2) | ((tags->as_bytes[2] & 0xC0) >> 6);
+    temp.as_bytes[4] = ((tags->as_bytes[6] & 0x03) << 6) | ((tags->as_bytes[5] & 0xFC) >> 2);
+    temp.as_bytes[5] = ((tags->as_bytes[5] & 0x03) << 6) | ((tags->as_bytes[4] & 0xFC) >> 2);
+    temp.as_bytes[6] = ((tags->as_bytes[4] & 0x03) << 6) | (tags->as_bytes[7] & 0x3F);
+    temp.as_bytes[7] = (tags->as_bytes[6] & 0xFC) | ((tags->as_bytes[7] & 0xC0) >> 6);
 
     // Now copy it back.
-    tags->asBytes[0] = temp.asBytes[0];
-    tags->asBytes[1] = temp.asBytes[1];
-    tags->asBytes[2] = temp.asBytes[2];
-    tags->asBytes[3] = temp.asBytes[3];
-    tags->asBytes[4] = temp.asBytes[4];
-    tags->asBytes[5] = temp.asBytes[5];
-    tags->asBytes[6] = temp.asBytes[6];
-    tags->asBytes[7] = temp.asBytes[7];
+    tags->as_bytes[0] = temp.as_bytes[0];
+    tags->as_bytes[1] = temp.as_bytes[1];
+    tags->as_bytes[2] = temp.as_bytes[2];
+    tags->as_bytes[3] = temp.as_bytes[3];
+    tags->as_bytes[4] = temp.as_bytes[4];
+    tags->as_bytes[5] = temp.as_bytes[5];
+    tags->as_bytes[6] = temp.as_bytes[6];
+    tags->as_bytes[7] = temp.as_bytes[7];
 #endif
 }
 
@@ -181,9 +181,9 @@ static void shuffle_oob(char *spareData, yaffs_PackedTags2 *pt)
        memcpy(spareData, pt, sizeof(*pt));
 }
 
-static int write_chunk(__u8 *data, __u32 objId, __u32 chunkId, __u32 nBytes)
+static int write_chunk(__u8 *data, __u32 obj_id, __u32 chunk_id, __u32 n_bytes)
 {
-       yaffs_ExtendedTags t;
+       yaffs_ext_tags t;
        yaffs_PackedTags2 pt;
        char spareData[spareSize];
 
@@ -192,16 +192,16 @@ static int write_chunk(__u8 *data, __u32 objId, __u32 chunkId, __u32 nBytes)
 
        yaffs_init_tags(&t);
        
-       t.chunkId = chunkId;
-//     t.serialNumber = 0;
-       t.serialNumber = 1;     // **CHECK**
-       t.byteCount = nBytes;
-       t.objectId = objId;
+       t.chunk_id = chunk_id;
+//     t.serial_number = 0;
+       t.serial_number = 1;    // **CHECK**
+       t.n_bytes = n_bytes;
+       t.obj_id = obj_id;
        
-       t.sequenceNumber = YAFFS_LOWEST_SEQUENCE_NUMBER;
+       t.seq_number = YAFFS_LOWEST_SEQUENCE_NUMBER;
 
 // added NCB **CHECK**
-       t.chunkUsed = 1;
+       t.chunk_used = 1;
 
        if (convert_endian)
        {
@@ -230,12 +230,12 @@ static int write_chunk(__u8 *data, __u32 objId, __u32 chunkId, __u32 nBytes)
                      (((x) & 0xFF00) >> 8))
         
 // This one is easier, since the types are more standard. No funky shifts here.
-static void object_header_little_to_big_endian(yaffs_ObjectHeader* oh)
+static void object_header_little_to_big_endian(yaffs_obj_header* oh)
 {
     int i;    
     oh->type = SWAP32(oh->type); // GCC makes enums 32 bits.
-    oh->parentObjectId = SWAP32(oh->parentObjectId); // int
-    oh->sum__NoLongerUsed = SWAP16(oh->sum__NoLongerUsed); // __u16 - Not used, but done for completeness.
+    oh->parent_obj_id = SWAP32(oh->parent_obj_id); // int
+    oh->sum_no_longer_used = SWAP16(oh->sum_no_longer_used); // __u16 - Not used, but done for completeness.
     // name = skip. Char array. Not swapped.
     oh->yst_mode = SWAP32(oh->yst_mode);
 #ifdef CONFIG_YAFFS_WINCE // WinCE doesn't implement this, but we need to just in case. 
@@ -243,9 +243,9 @@ static void object_header_little_to_big_endian(yaffs_ObjectHeader* oh)
     // Why? WINCE is little-endian only.
 
     {
-        int n = sizeof(oh->notForWinCE)/sizeof(oh->notForWinCE[0]);
+        int n = sizeof(oh->not_for_wince)/sizeof(oh->not_for_wince[0]);
         for(i = 0; i < n; i++)
-            oh->notForWinCE[i] = SWAP32(oh->notForWinCE[i]);
+            oh->not_for_wince[i] = SWAP32(oh->not_for_wince[i]);
     }
 #else
     // Regular POSIX.
@@ -256,8 +256,8 @@ static void object_header_little_to_big_endian(yaffs_ObjectHeader* oh)
     oh->yst_ctime = SWAP32(oh->yst_ctime);
 #endif
 
-    oh->fileSize = SWAP32(oh->fileSize); // Aiee. An int... signed, at that!
-    oh->equivalentObjectId = SWAP32(oh->equivalentObjectId);
+    oh->file_size = SWAP32(oh->file_size); // Aiee. An int... signed, at that!
+    oh->equiv_id = SWAP32(oh->equiv_id);
     // alias  - char array.
     oh->yst_rdev = SWAP32(oh->yst_rdev);
 
@@ -271,25 +271,25 @@ static void object_header_little_to_big_endian(yaffs_ObjectHeader* oh)
 #else
 
     {
-        int n = sizeof(oh->roomToGrow)/sizeof(oh->roomToGrow[0]);
+        int n = sizeof(oh->room_to_grow)/sizeof(oh->room_to_grow[0]);
         for(i=0; i < n; i++)
-            oh->roomToGrow[i] = SWAP32(oh->roomToGrow[i]);
+            oh->room_to_grow[i] = SWAP32(oh->room_to_grow[i]);
     }
 #endif
 }
 
-static int write_object_header(int objId, yaffs_ObjectType t, struct stat *s, int parent, const char *name, int equivalentObj, const char * alias)
+static int write_object_header(int obj_id, yaffs_obj_type t, struct stat *s, int parent, const char *name, int equivalentObj, const char * alias)
 {
        __u8 bytes[chunkSize];
        
        
-       yaffs_ObjectHeader *oh = (yaffs_ObjectHeader *)bytes;
+       yaffs_obj_header *oh = (yaffs_obj_header *)bytes;
        
        memset(bytes,0xff,sizeof(bytes));
        
        oh->type = t;
 
-       oh->parentObjectId = parent;
+       oh->parent_obj_id = parent;
        
        if (strlen(name)+1 > sizeof(oh->name))
        {
@@ -314,12 +314,12 @@ static int write_object_header(int objId, yaffs_ObjectType t, struct stat *s, in
        
        if(t == YAFFS_OBJECT_TYPE_FILE)
        {
-               oh->fileSize = s->st_size;
+               oh->file_size = s->st_size;
        }
        
        if(t == YAFFS_OBJECT_TYPE_HARDLINK)
        {
-               oh->equivalentObjectId = equivalentObj;
+               oh->equiv_id = equivalentObj;
        }
        
        if(t == YAFFS_OBJECT_TYPE_SYMLINK)
@@ -338,7 +338,7 @@ static int write_object_header(int objId, yaffs_ObjectType t, struct stat *s, in
                object_header_little_to_big_endian(oh);
        }
        
-       return write_chunk(bytes,objId,0,0xffff);
+       return write_chunk(bytes,obj_id,0,0xffff);
        
 }
 
@@ -407,7 +407,7 @@ static int process_directory(int parent, const char *path)
                                {
                                
                                        newObj = obj_id++;
-                                       nObjects++;
+                                       n_obj++;
                                        
                                        printf("Object %d, %s is a ",newObj,full_name);
                                        
@@ -447,20 +447,20 @@ static int process_directory(int parent, const char *path)
                                                        {
                                                                int h;
                                                                __u8 bytes[chunkSize];
-                                                               int nBytes;
+                                                               int n_bytes;
                                                                int chunk = 0;
                                                                
                                                                h = open(full_name,O_RDONLY);
                                                                if(h >= 0)
                                                                {
                                                                        memset(bytes,0xff,sizeof(bytes));
-                                                                       while((nBytes = read(h,bytes,sizeof(bytes))) > 0)
+                                                                       while((n_bytes = read(h,bytes,sizeof(bytes))) > 0)
                                                                        {
                                                                                chunk++;
-                                                                               write_chunk(bytes,newObj,chunk,nBytes);
+                                                                               write_chunk(bytes,newObj,chunk,n_bytes);
                                                                                memset(bytes,0xff,sizeof(bytes));
                                                                        }
-                                                                       if(nBytes < 0) 
+                                                                       if(n_bytes < 0) 
                                                                           warn("read");
                                                                           
                                                                        printf("%d data chunks written\n",chunk);
@@ -575,7 +575,7 @@ int main(int argc, char *argv[])
        {
                printf("Operation complete.\n"
                       "%d objects in %d directories\n"
-                      "%d NAND pages\n",nObjects, nDirectories, nPages);
+                      "%d NAND pages\n",n_obj, nDirectories, nPages);
        }
        
        exit(error);
index 8a50da5..640d7ec 100644 (file)
@@ -48,7 +48,7 @@ static objItem obj_list[MAX_OBJECTS];
 static int n_obj = 0;
 static int obj_id = YAFFS_NOBJECT_BUCKETS + 1;
 
-static int nObjects, nDirectories, nPages;
+static int n_obj, nDirectories, nPages;
 
 static int outFile;
 
@@ -130,16 +130,16 @@ static __u16 yaffs_calc_name_sum(const char *name)
 }
 
 
-static void yaffs_calc_ecc(const __u8 *data, yaffs_Spare *spare)
+static void yaffs_calc_ecc(const __u8 *data, yaffs_spare *spare)
 {
        yaffs_ecc_cacl(data , spare->ecc1);
        yaffs_ecc_cacl(&data[256] , spare->ecc2);
 }
 
-static void yaffs_calc_tags_ecc(yaffs_Tags *tags)
+static void yaffs_calc_tags_ecc(yaffs_tags_t *tags)
 {
        // Todo don't do anything yet. Need to calculate ecc
-       unsigned char *b = ((yaffs_tags_union_t *)tags)->asBytes;
+       unsigned char *b = ((yaffs_tags_union_t *)tags)->as_bytes;
        unsigned  i,j;
        unsigned  ecc = 0;
        unsigned bit = 0;
@@ -181,68 +181,68 @@ static void yaffs_calc_tags_ecc(yaffs_Tags *tags)
         b[7] |= ((ecc & 0x3F) << 2);
     }
 }
-static void yaffs_load_tags_to_spare(yaffs_Spare *sparePtr, yaffs_Tags *tagsPtr)
+static void yaffs_load_tags_to_spare(yaffs_spare *sparePtr, yaffs_tags_t *tagsPtr)
 {
        yaffs_tags_union_t *tu = (yaffs_tags_union_t *)tagsPtr;
        
        //yaffs_calc_tags_ecc(tagsPtr);
        
-       sparePtr->tb0 = tu->asBytes[0];
-       sparePtr->tb1 = tu->asBytes[1];
-       sparePtr->tb2 = tu->asBytes[2];
-       sparePtr->tb3 = tu->asBytes[3];
-       sparePtr->tb4 = tu->asBytes[4];
-       sparePtr->tb5 = tu->asBytes[5];
-       sparePtr->tb6 = tu->asBytes[6];
-       sparePtr->tb7 = tu->asBytes[7];
+       sparePtr->tb0 = tu->as_bytes[0];
+       sparePtr->tb1 = tu->as_bytes[1];
+       sparePtr->tb2 = tu->as_bytes[2];
+       sparePtr->tb3 = tu->as_bytes[3];
+       sparePtr->tb4 = tu->as_bytes[4];
+       sparePtr->tb5 = tu->as_bytes[5];
+       sparePtr->tb6 = tu->as_bytes[6];
+       sparePtr->tb7 = tu->as_bytes[7];
 }
 
 /* This little function converts a little endian tag to a big endian tag.
  * NOTE: The tag is not usable after this other than calculating the CRC
  * with.
  */
-static void little_to_big_endian(yaffs_Tags *tagsPtr)
+static void little_to_big_endian(yaffs_tags_t *tagsPtr)
 {
     yaffs_tags_union_t * tags = (yaffs_tags_union_t* )tagsPtr; // Work in bytes.
     yaffs_tags_union_t   temp;
 
     memset(&temp, 0, sizeof(temp));
     // Ick, I hate magic numbers.
-    temp.asBytes[0] = ((tags->asBytes[2] & 0x0F) << 4) | ((tags->asBytes[1] & 0xF0) >> 4);
-    temp.asBytes[1] = ((tags->asBytes[1] & 0x0F) << 4) | ((tags->asBytes[0] & 0xF0) >> 4);
-    temp.asBytes[2] = ((tags->asBytes[0] & 0x0F) << 4) | ((tags->asBytes[2] & 0x30) >> 2) | ((tags->asBytes[3] & 0xC0) >> 6);
-    temp.asBytes[3] = ((tags->asBytes[3] & 0x3F) << 2) | ((tags->asBytes[2] & 0xC0) >> 6);
-    temp.asBytes[4] = ((tags->asBytes[6] & 0x03) << 6) | ((tags->asBytes[5] & 0xFC) >> 2);
-    temp.asBytes[5] = ((tags->asBytes[5] & 0x03) << 6) | ((tags->asBytes[4] & 0xFC) >> 2);
-    temp.asBytes[6] = ((tags->asBytes[4] & 0x03) << 6) | (tags->asBytes[7] & 0x3F);
-    temp.asBytes[7] = (tags->asBytes[6] & 0xFC) | ((tags->asBytes[7] & 0xC0) >> 6);
+    temp.as_bytes[0] = ((tags->as_bytes[2] & 0x0F) << 4) | ((tags->as_bytes[1] & 0xF0) >> 4);
+    temp.as_bytes[1] = ((tags->as_bytes[1] & 0x0F) << 4) | ((tags->as_bytes[0] & 0xF0) >> 4);
+    temp.as_bytes[2] = ((tags->as_bytes[0] & 0x0F) << 4) | ((tags->as_bytes[2] & 0x30) >> 2) | ((tags->as_bytes[3] & 0xC0) >> 6);
+    temp.as_bytes[3] = ((tags->as_bytes[3] & 0x3F) << 2) | ((tags->as_bytes[2] & 0xC0) >> 6);
+    temp.as_bytes[4] = ((tags->as_bytes[6] & 0x03) << 6) | ((tags->as_bytes[5] & 0xFC) >> 2);
+    temp.as_bytes[5] = ((tags->as_bytes[5] & 0x03) << 6) | ((tags->as_bytes[4] & 0xFC) >> 2);
+    temp.as_bytes[6] = ((tags->as_bytes[4] & 0x03) << 6) | (tags->as_bytes[7] & 0x3F);
+    temp.as_bytes[7] = (tags->as_bytes[6] & 0xFC) | ((tags->as_bytes[7] & 0xC0) >> 6);
 
     // Now copy it back.
-    tags->asBytes[0] = temp.asBytes[0];
-    tags->asBytes[1] = temp.asBytes[1];
-    tags->asBytes[2] = temp.asBytes[2];
-    tags->asBytes[3] = temp.asBytes[3];
-    tags->asBytes[4] = temp.asBytes[4];
-    tags->asBytes[5] = temp.asBytes[5];
-    tags->asBytes[6] = temp.asBytes[6];
-    tags->asBytes[7] = temp.asBytes[7];
+    tags->as_bytes[0] = temp.as_bytes[0];
+    tags->as_bytes[1] = temp.as_bytes[1];
+    tags->as_bytes[2] = temp.as_bytes[2];
+    tags->as_bytes[3] = temp.as_bytes[3];
+    tags->as_bytes[4] = temp.as_bytes[4];
+    tags->as_bytes[5] = temp.as_bytes[5];
+    tags->as_bytes[6] = temp.as_bytes[6];
+    tags->as_bytes[7] = temp.as_bytes[7];
 }
 
-static int write_chunk(__u8 *data, __u32 objId, __u32 chunkId, __u32 nBytes)
+static int write_chunk(__u8 *data, __u32 obj_id, __u32 chunk_id, __u32 n_bytes)
 {
-       yaffs_Tags t;
-       yaffs_Spare s;
+       yaffs_tags_t t;
+       yaffs_spare s;
 
        error = write(outFile,data,512);
        if(error < 0) return error;
 
-       memset(&t,0xff,sizeof (yaffs_Tags));
-       memset(&s,0xff,sizeof (yaffs_Spare));
+       memset(&t,0xff,sizeof (yaffs_tags_t));
+       memset(&s,0xff,sizeof (yaffs_spare));
        
-       t.chunkId = chunkId;
-       t.serialNumber = 0;
-       t.byteCountLSB = nBytes;
-       t.objectId = objId;
+       t.chunk_id = chunk_id;
+       t.serial_number = 0;
+       t.n_bytes_lsb = n_bytes;
+       t.obj_id = obj_id;
 
     if (convert_endian)
     {
@@ -255,7 +255,7 @@ static int write_chunk(__u8 *data, __u32 objId, __u32 chunkId, __u32 nBytes)
        
        nPages++;
        
-       return write(outFile,&s,sizeof(yaffs_Spare));
+       return write(outFile,&s,sizeof(yaffs_spare));
        
 }
 
@@ -268,20 +268,20 @@ static int write_chunk(__u8 *data, __u32 objId, __u32 chunkId, __u32 nBytes)
                      (((x) & 0xFF00) >> 8))
         
 // This one is easier, since the types are more standard. No funky shifts here.
-static void object_header_little_to_big_endian(yaffs_ObjectHeader* oh)
+static void object_header_little_to_big_endian(yaffs_obj_header* oh)
 {
     oh->type = SWAP32(oh->type); // GCC makes enums 32 bits.
-    oh->parentObjectId = SWAP32(oh->parentObjectId); // int
-    oh->sum__NoLongerUsed = SWAP16(oh->sum__NoLongerUsed); // __u16 - Not used, but done for completeness.
+    oh->parent_obj_id = SWAP32(oh->parent_obj_id); // int
+    oh->sum_no_longer_used = SWAP16(oh->sum_no_longer_used); // __u16 - Not used, but done for completeness.
     // name = skip. Char array. Not swapped.
     oh->yst_mode = SWAP32(oh->yst_mode);
 #ifdef CONFIG_YAFFS_WINCE // WinCE doesn't implement this, but we need to just in case. 
     // In fact, WinCE would be *THE* place where this would be an issue!
-    oh->notForWinCE[0] = SWAP32(oh->notForWinCE[0]);
-    oh->notForWinCE[1] = SWAP32(oh->notForWinCE[1]);
-    oh->notForWinCE[2] = SWAP32(oh->notForWinCE[2]);
-    oh->notForWinCE[3] = SWAP32(oh->notForWinCE[3]);
-    oh->notForWinCE[4] = SWAP32(oh->notForWinCE[4]);
+    oh->not_for_wince[0] = SWAP32(oh->not_for_wince[0]);
+    oh->not_for_wince[1] = SWAP32(oh->not_for_wince[1]);
+    oh->not_for_wince[2] = SWAP32(oh->not_for_wince[2]);
+    oh->not_for_wince[3] = SWAP32(oh->not_for_wince[3]);
+    oh->not_for_wince[4] = SWAP32(oh->not_for_wince[4]);
 #else
     // Regular POSIX.
     oh->yst_uid = SWAP32(oh->yst_uid);
@@ -291,8 +291,8 @@ static void object_header_little_to_big_endian(yaffs_ObjectHeader* oh)
     oh->yst_ctime = SWAP32(oh->yst_ctime);
 #endif
 
-    oh->fileSize = SWAP32(oh->fileSize); // Aiee. An int... signed, at that!
-    oh->equivalentObjectId = SWAP32(oh->equivalentObjectId);
+    oh->file_size = SWAP32(oh->file_size); // Aiee. An int... signed, at that!
+    oh->equiv_id = SWAP32(oh->equiv_id);
     // alias  - char array.
     oh->yst_rdev = SWAP32(oh->yst_rdev);
 
@@ -303,40 +303,40 @@ static void object_header_little_to_big_endian(yaffs_ObjectHeader* oh)
     oh->win_atime[1] = SWAP32(oh->win_atime[1]);
     oh->win_mtime[0] = SWAP32(oh->win_mtime[0]);
     oh->win_mtime[1] = SWAP32(oh->win_mtime[1]);
-    oh->roomToGrow[0] = SWAP32(oh->roomToGrow[0]);
-    oh->roomToGrow[1] = SWAP32(oh->roomToGrow[1]);
-    oh->roomToGrow[2] = SWAP32(oh->roomToGrow[2]);
-    oh->roomToGrow[3] = SWAP32(oh->roomToGrow[3]);
-    oh->roomToGrow[4] = SWAP32(oh->roomToGrow[4]);
-    oh->roomToGrow[5] = SWAP32(oh->roomToGrow[5]);
+    oh->room_to_grow[0] = SWAP32(oh->room_to_grow[0]);
+    oh->room_to_grow[1] = SWAP32(oh->room_to_grow[1]);
+    oh->room_to_grow[2] = SWAP32(oh->room_to_grow[2]);
+    oh->room_to_grow[3] = SWAP32(oh->room_to_grow[3]);
+    oh->room_to_grow[4] = SWAP32(oh->room_to_grow[4]);
+    oh->room_to_grow[5] = SWAP32(oh->room_to_grow[5]);
 #else
-    oh->roomToGrow[0] = SWAP32(oh->roomToGrow[0]);
-    oh->roomToGrow[1] = SWAP32(oh->roomToGrow[1]);
-    oh->roomToGrow[2] = SWAP32(oh->roomToGrow[2]);
-    oh->roomToGrow[3] = SWAP32(oh->roomToGrow[3]);
-    oh->roomToGrow[4] = SWAP32(oh->roomToGrow[4]);
-    oh->roomToGrow[5] = SWAP32(oh->roomToGrow[5]);
-    oh->roomToGrow[6] = SWAP32(oh->roomToGrow[6]);
-    oh->roomToGrow[7] = SWAP32(oh->roomToGrow[7]);
-    oh->roomToGrow[8] = SWAP32(oh->roomToGrow[8]);
-    oh->roomToGrow[9] = SWAP32(oh->roomToGrow[9]);
-    oh->roomToGrow[10] = SWAP32(oh->roomToGrow[10]);
-    oh->roomToGrow[11] = SWAP32(oh->roomToGrow[11]);
+    oh->room_to_grow[0] = SWAP32(oh->room_to_grow[0]);
+    oh->room_to_grow[1] = SWAP32(oh->room_to_grow[1]);
+    oh->room_to_grow[2] = SWAP32(oh->room_to_grow[2]);
+    oh->room_to_grow[3] = SWAP32(oh->room_to_grow[3]);
+    oh->room_to_grow[4] = SWAP32(oh->room_to_grow[4]);
+    oh->room_to_grow[5] = SWAP32(oh->room_to_grow[5]);
+    oh->room_to_grow[6] = SWAP32(oh->room_to_grow[6]);
+    oh->room_to_grow[7] = SWAP32(oh->room_to_grow[7]);
+    oh->room_to_grow[8] = SWAP32(oh->room_to_grow[8]);
+    oh->room_to_grow[9] = SWAP32(oh->room_to_grow[9]);
+    oh->room_to_grow[10] = SWAP32(oh->room_to_grow[10]);
+    oh->room_to_grow[11] = SWAP32(oh->room_to_grow[11]);
 #endif
 }
 
-static int write_object_header(int objId, yaffs_ObjectType t, struct stat *s, int parent, const char *name, int equivalentObj, const char * alias)
+static int write_object_header(int obj_id, yaffs_obj_type t, struct stat *s, int parent, const char *name, int equivalentObj, const char * alias)
 {
        __u8 bytes[512];
        
        
-       yaffs_ObjectHeader *oh = (yaffs_ObjectHeader *)bytes;
+       yaffs_obj_header *oh = (yaffs_obj_header *)bytes;
        
        memset(bytes,0xff,512);
        
        oh->type = t;
 
-       oh->parentObjectId = parent;
+       oh->parent_obj_id = parent;
        
        strncpy(oh->name,name,YAFFS_MAX_NAME_LENGTH);
        
@@ -355,12 +355,12 @@ static int write_object_header(int objId, yaffs_ObjectType t, struct stat *s, in
        
        if(t == YAFFS_OBJECT_TYPE_FILE)
        {
-               oh->fileSize = s->st_size;
+               oh->file_size = s->st_size;
        }
        
        if(t == YAFFS_OBJECT_TYPE_HARDLINK)
        {
-               oh->equivalentObjectId = equivalentObj;
+               oh->equiv_id = equivalentObj;
        }
        
        if(t == YAFFS_OBJECT_TYPE_SYMLINK)
@@ -373,7 +373,7 @@ static int write_object_header(int objId, yaffs_ObjectType t, struct stat *s, in
         object_header_little_to_big_endian(oh);
     }
        
-       return write_chunk(bytes,objId,0,0xffff);
+       return write_chunk(bytes,obj_id,0,0xffff);
        
 }
 
@@ -416,7 +416,7 @@ static int process_directory(int parent, const char *path)
                                {
                                
                                        newObj = obj_id++;
-                                       nObjects++;
+                                       n_obj++;
                                        
                                        printf("Object %d, %s is a ",newObj,full_name);
                                        
@@ -454,21 +454,21 @@ static int process_directory(int parent, const char *path)
                                                        {
                                                                int h;
                                                                __u8 bytes[512];
-                                                               int nBytes;
+                                                               int n_bytes;
                                                                int chunk = 0;
                                                                
                                                                h = open(full_name,O_RDONLY);
                                                                if(h >= 0)
                                                                {
                                                                        memset(bytes,0xff,512);
-                                                                       while((nBytes = read(h,bytes,512)) > 0)
+                                                                       while((n_bytes = read(h,bytes,512)) > 0)
                                                                        {
                                                                                chunk++;
-                                                                               write_chunk(bytes,newObj,chunk,nBytes);
+                                                                               write_chunk(bytes,newObj,chunk,n_bytes);
                                                                                memset(bytes,0xff,512);
                                                                        }
-                                                                       if(nBytes < 0) 
-                                                                          error = nBytes;
+                                                                       if(n_bytes < 0) 
+                                                                          error = n_bytes;
                                                                           
                                                                        printf("%d data chunks written\n",chunk);
                                                                }
@@ -580,7 +580,7 @@ int main(int argc, char *argv[])
        {
                printf("Operation complete.\n"
                       "%d objects in %d directories\n"
-                      "%d NAND pages\n",nObjects, nDirectories, nPages);
+                      "%d NAND pages\n",n_obj, nDirectories, nPages);
        }
        
        close(outFile);
index 1501a8e..c0513d5 100644 (file)
 
 #ifdef CONFIG_YAFFS_YMALLOC_ALLOCATOR
 
-void yaffs_deinit_raw_tnodes_and_objs(yaffs_Device *dev)
+void yaffs_deinit_raw_tnodes_and_objs(yaffs_dev_t *dev)
 {
        dev = dev;
 }
 
-void yaffs_init_raw_tnodes_and_objs(yaffs_Device *dev)
+void yaffs_init_raw_tnodes_and_objs(yaffs_dev_t *dev)
 {
        dev = dev;
 }
 
-yaffs_tnode_t *yaffs_alloc_raw_tnode(yaffs_Device *dev)
+yaffs_tnode_t *yaffs_alloc_raw_tnode(yaffs_dev_t *dev)
 {
-       return (yaffs_tnode_t *)YMALLOC(dev->tnodeSize);
+       return (yaffs_tnode_t *)YMALLOC(dev->tnode_size);
 }
 
-void yaffs_free_raw_tnode(yaffs_Device *dev, yaffs_tnode_t *tn)
+void yaffs_free_raw_tnode(yaffs_dev_t *dev, yaffs_tnode_t *tn)
 {
        dev = dev;
        YFREE(tn);
 }
 
-void yaffs_init_raw_objs(yaffs_Device *dev)
+void yaffs_init_raw_objs(yaffs_dev_t *dev)
 {
        dev = dev;
 }
 
-void yaffs_deinit_raw_objs(yaffs_Device *dev)
+void yaffs_deinit_raw_objs(yaffs_dev_t *dev)
 {
        dev = dev;
 }
 
-yaffs_Object *yaffs_alloc_raw_obj(yaffs_Device *dev)
+yaffs_obj_t *yaffs_alloc_raw_obj(yaffs_dev_t *dev)
 {
        dev = dev;
-       return (yaffs_Object *) YMALLOC(sizeof(yaffs_Object));
+       return (yaffs_obj_t *) YMALLOC(sizeof(yaffs_obj_t));
 }
 
 
-void yaffs_free_raw_obj(yaffs_Device *dev, yaffs_Object *obj)
+void yaffs_free_raw_obj(yaffs_dev_t *dev, yaffs_obj_t *obj)
 {
 
        dev = dev;
@@ -75,31 +75,31 @@ struct yaffs_tnode_list {
 
 typedef struct yaffs_tnode_list yaffs_tnodelist_t;
 
-struct yaffs_ObjectList_struct {
-       yaffs_Object *objects;
-       struct yaffs_ObjectList_struct *next;
+struct yaffs_obj_tList_struct {
+       yaffs_obj_t *objects;
+       struct yaffs_obj_tList_struct *next;
 };
 
-typedef struct yaffs_ObjectList_struct yaffs_ObjectList;
+typedef struct yaffs_obj_tList_struct yaffs_obj_tList;
 
 
 struct yaffs_AllocatorStruct {
-       int nTnodesCreated;
+       int n_tnodesCreated;
        yaffs_tnode_t *freeTnodes;
        int nFreeTnodes;
        yaffs_tnodelist_t *allocatedTnodeList;
 
-       int nObjectsCreated;
-       yaffs_Object *freeObjects;
+       int n_objCreated;
+       yaffs_obj_t *freeObjects;
        int nFreeObjects;
 
-       yaffs_ObjectList *allocatedObjectList;
+       yaffs_obj_tList *allocatedObjectList;
 };
 
 typedef struct yaffs_AllocatorStruct yaffs_Allocator;
 
 
-static void yaffs_deinit_raw_tnodes(yaffs_Device *dev)
+static void yaffs_deinit_raw_tnodes(yaffs_dev_t *dev)
 {
 
        yaffs_Allocator *allocator = (yaffs_Allocator *)dev->allocator;
@@ -122,10 +122,10 @@ static void yaffs_deinit_raw_tnodes(yaffs_Device *dev)
 
        allocator->freeTnodes = NULL;
        allocator->nFreeTnodes = 0;
-       allocator->nTnodesCreated = 0;
+       allocator->n_tnodesCreated = 0;
 }
 
-static void yaffs_init_raw_tnodes(yaffs_Device *dev)
+static void yaffs_init_raw_tnodes(yaffs_dev_t *dev)
 {
        yaffs_Allocator *allocator = dev->allocator;
 
@@ -133,12 +133,12 @@ static void yaffs_init_raw_tnodes(yaffs_Device *dev)
                allocator->allocatedTnodeList = NULL;
                allocator->freeTnodes = NULL;
                allocator->nFreeTnodes = 0;
-               allocator->nTnodesCreated = 0;
+               allocator->n_tnodesCreated = 0;
        } else
                YBUG();
 }
 
-static int yaffs_create_tnodes(yaffs_Device *dev, int nTnodes)
+static int yaffs_create_tnodes(yaffs_dev_t *dev, int n_tnodes)
 {
        yaffs_Allocator *allocator = (yaffs_Allocator *)dev->allocator;
        int i;
@@ -153,13 +153,13 @@ static int yaffs_create_tnodes(yaffs_Device *dev, int nTnodes)
                return YAFFS_FAIL;
        }
 
-       if (nTnodes < 1)
+       if (n_tnodes < 1)
                return YAFFS_OK;
 
 
        /* make these things */
 
-       newTnodes = YMALLOC(nTnodes * dev->tnodeSize);
+       newTnodes = YMALLOC(n_tnodes * dev->tnode_size);
        mem = (__u8 *)newTnodes;
 
        if (!newTnodes) {
@@ -169,18 +169,18 @@ static int yaffs_create_tnodes(yaffs_Device *dev, int nTnodes)
        }
 
        /* New hookup for wide tnodes */
-       for (i = 0; i < nTnodes - 1; i++) {
-               curr = (yaffs_tnode_t *) &mem[i * dev->tnodeSize];
-               next = (yaffs_tnode_t *) &mem[(i+1) * dev->tnodeSize];
+       for (i = 0; i < n_tnodes - 1; i++) {
+               curr = (yaffs_tnode_t *) &mem[i * dev->tnode_size];
+               next = (yaffs_tnode_t *) &mem[(i+1) * dev->tnode_size];
                curr->internal[0] = next;
        }
 
-       curr = (yaffs_tnode_t *) &mem[(nTnodes - 1) * dev->tnodeSize];
+       curr = (yaffs_tnode_t *) &mem[(n_tnodes - 1) * dev->tnode_size];
        curr->internal[0] = allocator->freeTnodes;
        allocator->freeTnodes = (yaffs_tnode_t *)mem;
 
-       allocator->nFreeTnodes += nTnodes;
-       allocator->nTnodesCreated += nTnodes;
+       allocator->nFreeTnodes += n_tnodes;
+       allocator->n_tnodesCreated += n_tnodes;
 
        /* Now add this bunch of tnodes to a list for freeing up.
         * NB If we can't add this to the management list it isn't fatal
@@ -205,7 +205,7 @@ static int yaffs_create_tnodes(yaffs_Device *dev, int nTnodes)
 }
 
 
-yaffs_tnode_t *yaffs_alloc_raw_tnode(yaffs_Device *dev)
+yaffs_tnode_t *yaffs_alloc_raw_tnode(yaffs_dev_t *dev)
 {
        yaffs_Allocator *allocator = (yaffs_Allocator *)dev->allocator;
        yaffs_tnode_t *tn = NULL;
@@ -229,7 +229,7 @@ yaffs_tnode_t *yaffs_alloc_raw_tnode(yaffs_Device *dev)
 }
 
 /* FreeTnode frees up a tnode and puts it back on the free list */
-void yaffs_free_raw_tnode(yaffs_Device *dev, yaffs_tnode_t *tn)
+void yaffs_free_raw_tnode(yaffs_dev_t *dev, yaffs_tnode_t *tn)
 {
        yaffs_Allocator *allocator = dev->allocator;
 
@@ -243,12 +243,12 @@ void yaffs_free_raw_tnode(yaffs_Device *dev, yaffs_tnode_t *tn)
                allocator->freeTnodes = tn;
                allocator->nFreeTnodes++;
        }
-       dev->nCheckpointBlocksRequired = 0; /* force recalculation*/
+       dev->checkpoint_blocks_required = 0; /* force recalculation*/
 }
 
 
 
-static void yaffs_init_raw_objs(yaffs_Device *dev)
+static void yaffs_init_raw_objs(yaffs_dev_t *dev)
 {
        yaffs_Allocator *allocator = dev->allocator;
 
@@ -260,10 +260,10 @@ static void yaffs_init_raw_objs(yaffs_Device *dev)
                YBUG();
 }
 
-static void yaffs_deinit_raw_objs(yaffs_Device *dev)
+static void yaffs_deinit_raw_objs(yaffs_dev_t *dev)
 {
        yaffs_Allocator *allocator = dev->allocator;
-       yaffs_ObjectList *tmp;
+       yaffs_obj_tList *tmp;
 
        if(!allocator){
                YBUG();
@@ -280,29 +280,29 @@ static void yaffs_deinit_raw_objs(yaffs_Device *dev)
 
        allocator->freeObjects = NULL;
        allocator->nFreeObjects = 0;
-       allocator->nObjectsCreated = 0;
+       allocator->n_objCreated = 0;
 }
 
 
-static int yaffs_create_free_objs(yaffs_Device *dev, int nObjects)
+static int yaffs_create_free_objs(yaffs_dev_t *dev, int n_obj)
 {
        yaffs_Allocator *allocator = dev->allocator;
 
        int i;
-       yaffs_Object *newObjects;
-       yaffs_ObjectList *list;
+       yaffs_obj_t *newObjects;
+       yaffs_obj_tList *list;
 
        if(!allocator){
                YBUG();
                return YAFFS_FAIL;
        }
 
-       if (nObjects < 1)
+       if (n_obj < 1)
                return YAFFS_OK;
 
        /* make these things */
-       newObjects = YMALLOC(nObjects * sizeof(yaffs_Object));
-       list = YMALLOC(sizeof(yaffs_ObjectList));
+       newObjects = YMALLOC(n_obj * sizeof(yaffs_obj_t));
+       list = YMALLOC(sizeof(yaffs_obj_tList));
 
        if (!newObjects || !list) {
                if (newObjects){
@@ -319,15 +319,15 @@ static int yaffs_create_free_objs(yaffs_Device *dev, int nObjects)
        }
 
        /* Hook them into the free list */
-       for (i = 0; i < nObjects - 1; i++) {
+       for (i = 0; i < n_obj - 1; i++) {
                newObjects[i].siblings.next =
                                (struct ylist_head *)(&newObjects[i + 1]);
        }
 
-       newObjects[nObjects - 1].siblings.next = (void *)allocator->freeObjects;
+       newObjects[n_obj - 1].siblings.next = (void *)allocator->freeObjects;
        allocator->freeObjects = newObjects;
-       allocator->nFreeObjects += nObjects;
-       allocator->nObjectsCreated += nObjects;
+       allocator->nFreeObjects += n_obj;
+       allocator->n_objCreated += n_obj;
 
        /* Now add this bunch of Objects to a list for freeing up. */
 
@@ -338,9 +338,9 @@ static int yaffs_create_free_objs(yaffs_Device *dev, int nObjects)
        return YAFFS_OK;
 }
 
-yaffs_Object *yaffs_alloc_raw_obj(yaffs_Device *dev)
+yaffs_obj_t *yaffs_alloc_raw_obj(yaffs_dev_t *dev)
 {
-       yaffs_Object *obj = NULL;
+       yaffs_obj_t *obj = NULL;
        yaffs_Allocator *allocator = dev->allocator;
 
        if(!allocator) {
@@ -355,7 +355,7 @@ yaffs_Object *yaffs_alloc_raw_obj(yaffs_Device *dev)
        if (allocator->freeObjects) {
                obj = allocator->freeObjects;
                allocator->freeObjects =
-                       (yaffs_Object *) (allocator->freeObjects->siblings.next);
+                       (yaffs_obj_t *) (allocator->freeObjects->siblings.next);
                allocator->nFreeObjects--;
        }
 
@@ -363,7 +363,7 @@ yaffs_Object *yaffs_alloc_raw_obj(yaffs_Device *dev)
 }
 
 
-void yaffs_free_raw_obj(yaffs_Device *dev, yaffs_Object *obj)
+void yaffs_free_raw_obj(yaffs_dev_t *dev, yaffs_obj_t *obj)
 {
 
        yaffs_Allocator *allocator = dev->allocator;
@@ -378,7 +378,7 @@ void yaffs_free_raw_obj(yaffs_Device *dev, yaffs_Object *obj)
        }
 }
 
-void yaffs_deinit_raw_tnodes_and_objs(yaffs_Device *dev)
+void yaffs_deinit_raw_tnodes_and_objs(yaffs_dev_t *dev)
 {
        if(dev->allocator){
                yaffs_deinit_raw_tnodes(dev);
@@ -390,7 +390,7 @@ void yaffs_deinit_raw_tnodes_and_objs(yaffs_Device *dev)
                YBUG();
 }
 
-void yaffs_init_raw_tnodes_and_objs(yaffs_Device *dev)
+void yaffs_init_raw_tnodes_and_objs(yaffs_dev_t *dev)
 {
        yaffs_Allocator *allocator;
 
index ec9e1c7..777f3b0 100644 (file)
 
 #include "yaffs_guts.h"
 
-void yaffs_init_raw_tnodes_and_objs(yaffs_Device *dev);
-void yaffs_deinit_raw_tnodes_and_objs(yaffs_Device *dev);
+void yaffs_init_raw_tnodes_and_objs(yaffs_dev_t *dev);
+void yaffs_deinit_raw_tnodes_and_objs(yaffs_dev_t *dev);
 
-yaffs_tnode_t *yaffs_alloc_raw_tnode(yaffs_Device *dev);
-void yaffs_free_raw_tnode(yaffs_Device *dev, yaffs_tnode_t *tn);
+yaffs_tnode_t *yaffs_alloc_raw_tnode(yaffs_dev_t *dev);
+void yaffs_free_raw_tnode(yaffs_dev_t *dev, yaffs_tnode_t *tn);
 
-yaffs_Object *yaffs_alloc_raw_obj(yaffs_Device *dev);
-void yaffs_free_raw_obj(yaffs_Device *dev, yaffs_Object *obj);
+yaffs_obj_t *yaffs_alloc_raw_obj(yaffs_dev_t *dev);
+void yaffs_free_raw_obj(yaffs_dev_t *dev, yaffs_obj_t *obj);
 
 #endif
index a24dbb7..1769e9b 100644 (file)
  * Chunk bitmap manipulations
  */
 
-static Y_INLINE __u8 *yaffs_BlockBits(yaffs_Device *dev, int blk)
+static Y_INLINE __u8 *yaffs_BlockBits(yaffs_dev_t *dev, int blk)
 {
-       if (blk < dev->internalStartBlock || blk > dev->internalEndBlock) {
+       if (blk < dev->internal_start_block || blk > dev->internal_end_block) {
                T(YAFFS_TRACE_ERROR,
                        (TSTR("**>> yaffs: BlockBits block %d is not valid" TENDSTR),
                        blk));
                YBUG();
        }
-       return dev->chunkBits +
-               (dev->chunkBitmapStride * (blk - dev->internalStartBlock));
+       return dev->chunk_bits +
+               (dev->chunk_bit_stride * (blk - dev->internal_start_block));
 }
 
-void yaffs_verify_chunk_bit_id(yaffs_Device *dev, int blk, int chunk)
+void yaffs_verify_chunk_bit_id(yaffs_dev_t *dev, int blk, int chunk)
 {
-       if (blk < dev->internalStartBlock || blk > dev->internalEndBlock ||
-                       chunk < 0 || chunk >= dev->param.nChunksPerBlock) {
+       if (blk < dev->internal_start_block || blk > dev->internal_end_block ||
+                       chunk < 0 || chunk >= dev->param.chunks_per_block) {
                T(YAFFS_TRACE_ERROR,
                (TSTR("**>> yaffs: Chunk Id (%d:%d) invalid"TENDSTR),
                        blk, chunk));
@@ -40,14 +40,14 @@ void yaffs_verify_chunk_bit_id(yaffs_Device *dev, int blk, int chunk)
        }
 }
 
-void yaffs_clear_chunk_bits(yaffs_Device *dev, int blk)
+void yaffs_clear_chunk_bits(yaffs_dev_t *dev, int blk)
 {
        __u8 *blkBits = yaffs_BlockBits(dev, blk);
 
-       memset(blkBits, 0, dev->chunkBitmapStride);
+       memset(blkBits, 0, dev->chunk_bit_stride);
 }
 
-void yaffs_clear_chunk_bit(yaffs_Device *dev, int blk, int chunk)
+void yaffs_clear_chunk_bit(yaffs_dev_t *dev, int blk, int chunk)
 {
        __u8 *blkBits = yaffs_BlockBits(dev, blk);
 
@@ -56,7 +56,7 @@ void yaffs_clear_chunk_bit(yaffs_Device *dev, int blk, int chunk)
        blkBits[chunk / 8] &= ~(1 << (chunk & 7));
 }
 
-void yaffs_set_chunk_bit(yaffs_Device *dev, int blk, int chunk)
+void yaffs_set_chunk_bit(yaffs_dev_t *dev, int blk, int chunk)
 {
        __u8 *blkBits = yaffs_BlockBits(dev, blk);
 
@@ -65,7 +65,7 @@ void yaffs_set_chunk_bit(yaffs_Device *dev, int blk, int chunk)
        blkBits[chunk / 8] |= (1 << (chunk & 7));
 }
 
-int yaffs_check_chunk_bit(yaffs_Device *dev, int blk, int chunk)
+int yaffs_check_chunk_bit(yaffs_dev_t *dev, int blk, int chunk)
 {
        __u8 *blkBits = yaffs_BlockBits(dev, blk);
        yaffs_verify_chunk_bit_id(dev, blk, chunk);
@@ -73,11 +73,11 @@ int yaffs_check_chunk_bit(yaffs_Device *dev, int blk, int chunk)
        return (blkBits[chunk / 8] & (1 << (chunk & 7))) ? 1 : 0;
 }
 
-int yaffs_still_some_chunks(yaffs_Device *dev, int blk)
+int yaffs_still_some_chunks(yaffs_dev_t *dev, int blk)
 {
        __u8 *blkBits = yaffs_BlockBits(dev, blk);
        int i;
-       for (i = 0; i < dev->chunkBitmapStride; i++) {
+       for (i = 0; i < dev->chunk_bit_stride; i++) {
                if (*blkBits)
                        return 1;
                blkBits++;
@@ -85,12 +85,12 @@ int yaffs_still_some_chunks(yaffs_Device *dev, int blk)
        return 0;
 }
 
-int yaffs_count_chunk_bits(yaffs_Device *dev, int blk)
+int yaffs_count_chunk_bits(yaffs_dev_t *dev, int blk)
 {
        __u8 *blkBits = yaffs_BlockBits(dev, blk);
        int i;
        int n = 0;
-       for (i = 0; i < dev->chunkBitmapStride; i++) {
+       for (i = 0; i < dev->chunk_bit_stride; i++) {
                __u8 x = *blkBits;
                while (x) {
                        if (x & 1)
index d693b31..c11ca2f 100644 (file)
 
 #include "yaffs_guts.h"
 
-void yaffs_verify_chunk_bit_id(yaffs_Device *dev, int blk, int chunk);
-void yaffs_clear_chunk_bits(yaffs_Device *dev, int blk);
-void yaffs_clear_chunk_bit(yaffs_Device *dev, int blk, int chunk);
-void yaffs_set_chunk_bit(yaffs_Device *dev, int blk, int chunk);
-int yaffs_check_chunk_bit(yaffs_Device *dev, int blk, int chunk);
-int yaffs_still_some_chunks(yaffs_Device *dev, int blk);
-int yaffs_count_chunk_bits(yaffs_Device *dev, int blk);
+void yaffs_verify_chunk_bit_id(yaffs_dev_t *dev, int blk, int chunk);
+void yaffs_clear_chunk_bits(yaffs_dev_t *dev, int blk);
+void yaffs_clear_chunk_bit(yaffs_dev_t *dev, int blk, int chunk);
+void yaffs_set_chunk_bit(yaffs_dev_t *dev, int blk, int chunk);
+int yaffs_check_chunk_bit(yaffs_dev_t *dev, int blk, int chunk);
+int yaffs_still_some_chunks(yaffs_dev_t *dev, int blk);
+int yaffs_count_chunk_bits(yaffs_dev_t *dev, int blk);
 
 #endif
index c047caf..d46f563 100644 (file)
@@ -14,9 +14,9 @@
 #include "yaffs_checkptrw.h"
 #include "yaffs_getblockinfo.h"
 
-static int yaffs2_checkpt_space_ok(yaffs_Device *dev)
+static int yaffs2_checkpt_space_ok(yaffs_dev_t *dev)
 {
-       int blocksAvailable = dev->nErasedBlocks - dev->param.nReservedBlocks;
+       int blocksAvailable = dev->n_erased_blocks - dev->param.n_reserved_blocks;
 
        T(YAFFS_TRACE_CHECKPOINT,
                (TSTR("checkpt blocks available = %d" TENDSTR),
@@ -26,56 +26,56 @@ static int yaffs2_checkpt_space_ok(yaffs_Device *dev)
 }
 
 
-static int yaffs_checkpt_erase(yaffs_Device *dev)
+static int yaffs_checkpt_erase(yaffs_dev_t *dev)
 {
        int i;
 
-       if (!dev->param.eraseBlockInNAND)
+       if (!dev->param.erase_fn)
                return 0;
        T(YAFFS_TRACE_CHECKPOINT, (TSTR("checking blocks %d to %d"TENDSTR),
-               dev->internalStartBlock, dev->internalEndBlock));
+               dev->internal_start_block, dev->internal_end_block));
 
-       for (i = dev->internalStartBlock; i <= dev->internalEndBlock; i++) {
-               yaffs_BlockInfo *bi = yaffs_get_block_info(dev, i);
-               if (bi->blockState == YAFFS_BLOCK_STATE_CHECKPOINT) {
+       for (i = dev->internal_start_block; i <= dev->internal_end_block; i++) {
+               yaffs_block_info_t *bi = yaffs_get_block_info(dev, i);
+               if (bi->block_state == YAFFS_BLOCK_STATE_CHECKPOINT) {
                        T(YAFFS_TRACE_CHECKPOINT, (TSTR("erasing checkpt block %d"TENDSTR), i));
 
-                       dev->nBlockErasures++;
+                       dev->n_erasures++;
 
-                       if (dev->param.eraseBlockInNAND(dev, i - dev->blockOffset /* realign */)) {
-                               bi->blockState = YAFFS_BLOCK_STATE_EMPTY;
-                               dev->nErasedBlocks++;
-                               dev->nFreeChunks += dev->param.nChunksPerBlock;
+                       if (dev->param.erase_fn(dev, i - dev->block_offset /* realign */)) {
+                               bi->block_state = YAFFS_BLOCK_STATE_EMPTY;
+                               dev->n_erased_blocks++;
+                               dev->n_free_chunks += dev->param.chunks_per_block;
                        } else {
-                               dev->param.markNANDBlockBad(dev, i);
-                               bi->blockState = YAFFS_BLOCK_STATE_DEAD;
+                               dev->param.bad_block_fn(dev, i);
+                               bi->block_state = YAFFS_BLOCK_STATE_DEAD;
                        }
                }
        }
 
-       dev->blocksInCheckpoint = 0;
+       dev->blocks_in_checkpt = 0;
 
        return 1;
 }
 
 
-static void yaffs2_checkpt_find_erased_block(yaffs_Device *dev)
+static void yaffs2_checkpt_find_erased_block(yaffs_dev_t *dev)
 {
        int  i;
-       int blocksAvailable = dev->nErasedBlocks - dev->param.nReservedBlocks;
+       int blocksAvailable = dev->n_erased_blocks - dev->param.n_reserved_blocks;
        T(YAFFS_TRACE_CHECKPOINT,
                (TSTR("allocating checkpt block: erased %d reserved %d avail %d next %d "TENDSTR),
-               dev->nErasedBlocks, dev->param.nReservedBlocks, blocksAvailable, dev->checkpointNextBlock));
+               dev->n_erased_blocks, dev->param.n_reserved_blocks, blocksAvailable, dev->checkpt_next_block));
 
-       if (dev->checkpointNextBlock >= 0 &&
-                       dev->checkpointNextBlock <= dev->internalEndBlock &&
+       if (dev->checkpt_next_block >= 0 &&
+                       dev->checkpt_next_block <= dev->internal_end_block &&
                        blocksAvailable > 0) {
 
-               for (i = dev->checkpointNextBlock; i <= dev->internalEndBlock; i++) {
-                       yaffs_BlockInfo *bi = yaffs_get_block_info(dev, i);
-                       if (bi->blockState == YAFFS_BLOCK_STATE_EMPTY) {
-                               dev->checkpointNextBlock = i + 1;
-                               dev->checkpointCurrentBlock = i;
+               for (i = dev->checkpt_next_block; i <= dev->internal_end_block; i++) {
+                       yaffs_block_info_t *bi = yaffs_get_block_info(dev, i);
+                       if (bi->block_state == YAFFS_BLOCK_STATE_EMPTY) {
+                               dev->checkpt_next_block = i + 1;
+                               dev->checkpt_cur_block = i;
                                T(YAFFS_TRACE_CHECKPOINT, (TSTR("allocating checkpt block %d"TENDSTR), i));
                                return;
                        }
@@ -83,34 +83,34 @@ static void yaffs2_checkpt_find_erased_block(yaffs_Device *dev)
        }
        T(YAFFS_TRACE_CHECKPOINT, (TSTR("out of checkpt blocks"TENDSTR)));
 
-       dev->checkpointNextBlock = -1;
-       dev->checkpointCurrentBlock = -1;
+       dev->checkpt_next_block = -1;
+       dev->checkpt_cur_block = -1;
 }
 
-static void yaffs2_checkpt_find_block(yaffs_Device *dev)
+static void yaffs2_checkpt_find_block(yaffs_dev_t *dev)
 {
        int  i;
-       yaffs_ExtendedTags tags;
+       yaffs_ext_tags tags;
 
        T(YAFFS_TRACE_CHECKPOINT, (TSTR("find next checkpt block: start:  blocks %d next %d" TENDSTR),
-               dev->blocksInCheckpoint, dev->checkpointNextBlock));
+               dev->blocks_in_checkpt, dev->checkpt_next_block));
 
-       if (dev->blocksInCheckpoint < dev->checkpointMaxBlocks)
-               for (i = dev->checkpointNextBlock; i <= dev->internalEndBlock; i++) {
-                       int chunk = i * dev->param.nChunksPerBlock;
-                       int realignedChunk = chunk - dev->chunkOffset;
+       if (dev->blocks_in_checkpt < dev->checkpt_max_blocks)
+               for (i = dev->checkpt_next_block; i <= dev->internal_end_block; i++) {
+                       int chunk = i * dev->param.chunks_per_block;
+                       int realignedChunk = chunk - dev->chunk_offset;
 
-                       dev->param.readChunkWithTagsFromNAND(dev, realignedChunk,
+                       dev->param.read_chunk_tags_fn(dev, realignedChunk,
                                        NULL, &tags);
                        T(YAFFS_TRACE_CHECKPOINT, (TSTR("find next checkpt block: search: block %d oid %d seq %d eccr %d" TENDSTR),
-                               i, tags.objectId, tags.sequenceNumber, tags.eccResult));
+                               i, tags.obj_id, tags.seq_number, tags.ecc_result));
 
-                       if (tags.sequenceNumber == YAFFS_SEQUENCE_CHECKPOINT_DATA) {
+                       if (tags.seq_number == YAFFS_SEQUENCE_CHECKPOINT_DATA) {
                                /* Right kind of block */
-                               dev->checkpointNextBlock = tags.objectId;
-                               dev->checkpointCurrentBlock = i;
-                               dev->checkpointBlockList[dev->blocksInCheckpoint] = i;
-                               dev->blocksInCheckpoint++;
+                               dev->checkpt_next_block = tags.obj_id;
+                               dev->checkpt_cur_block = i;
+                               dev->checkpt_block_list[dev->blocks_in_checkpt] = i;
+                               dev->blocks_in_checkpt++;
                                T(YAFFS_TRACE_CHECKPOINT, (TSTR("found checkpt block %d"TENDSTR), i));
                                return;
                        }
@@ -118,127 +118,127 @@ static void yaffs2_checkpt_find_block(yaffs_Device *dev)
 
        T(YAFFS_TRACE_CHECKPOINT, (TSTR("found no more checkpt blocks"TENDSTR)));
 
-       dev->checkpointNextBlock = -1;
-       dev->checkpointCurrentBlock = -1;
+       dev->checkpt_next_block = -1;
+       dev->checkpt_cur_block = -1;
 }
 
 
-int yaffs2_checkpt_open(yaffs_Device *dev, int forWriting)
+int yaffs2_checkpt_open(yaffs_dev_t *dev, int forWriting)
 {
 
 
-       dev->checkpointOpenForWrite = forWriting;
+       dev->checkpt_open_write = forWriting;
 
        /* Got the functions we need? */
-       if (!dev->param.writeChunkWithTagsToNAND ||
-               !dev->param.readChunkWithTagsFromNAND ||
-               !dev->param.eraseBlockInNAND ||
-               !dev->param.markNANDBlockBad)
+       if (!dev->param.write_chunk_tags_fn ||
+               !dev->param.read_chunk_tags_fn ||
+               !dev->param.erase_fn ||
+               !dev->param.bad_block_fn)
                return 0;
 
        if (forWriting && !yaffs2_checkpt_space_ok(dev))
                return 0;
 
-       if (!dev->checkpointBuffer)
-               dev->checkpointBuffer = YMALLOC_DMA(dev->param.totalBytesPerChunk);
-       if (!dev->checkpointBuffer)
+       if (!dev->checkpt_buffer)
+               dev->checkpt_buffer = YMALLOC_DMA(dev->param.total_bytes_per_chunk);
+       if (!dev->checkpt_buffer)
                return 0;
 
 
-       dev->checkpointPageSequence = 0;
-       dev->checkpointByteCount = 0;
-       dev->checkpointSum = 0;
-       dev->checkpointXor = 0;
-       dev->checkpointCurrentBlock = -1;
-       dev->checkpointCurrentChunk = -1;
-       dev->checkpointNextBlock = dev->internalStartBlock;
+       dev->checkpt_page_seq = 0;
+       dev->checkpt_byte_count = 0;
+       dev->checkpt_sum = 0;
+       dev->checkpt_xor = 0;
+       dev->checkpt_cur_block = -1;
+       dev->checkpt_cur_chunk = -1;
+       dev->checkpt_next_block = dev->internal_start_block;
 
        /* Erase all the blocks in the checkpoint area */
        if (forWriting) {
-               memset(dev->checkpointBuffer, 0, dev->nDataBytesPerChunk);
-               dev->checkpointByteOffset = 0;
+               memset(dev->checkpt_buffer, 0, dev->data_bytes_per_chunk);
+               dev->checkpt_byte_offs = 0;
                return yaffs_checkpt_erase(dev);
        } else {
                int i;
                /* Set to a value that will kick off a read */
-               dev->checkpointByteOffset = dev->nDataBytesPerChunk;
+               dev->checkpt_byte_offs = dev->data_bytes_per_chunk;
                /* 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)
+               dev->blocks_in_checkpt = 0;
+               dev->checkpt_max_blocks = (dev->internal_end_block - dev->internal_start_block)/16 + 2;
+               dev->checkpt_block_list = YMALLOC(sizeof(int) * dev->checkpt_max_blocks);
+               if(!dev->checkpt_block_list)
                        return 0;
 
-               for (i = 0; i < dev->checkpointMaxBlocks; i++)
-                       dev->checkpointBlockList[i] = -1;
+               for (i = 0; i < dev->checkpt_max_blocks; i++)
+                       dev->checkpt_block_list[i] = -1;
        }
 
        return 1;
 }
 
-int yaffs2_get_checkpt_sum(yaffs_Device *dev, __u32 *sum)
+int yaffs2_get_checkpt_sum(yaffs_dev_t *dev, __u32 *sum)
 {
        __u32 compositeSum;
-       compositeSum =  (dev->checkpointSum << 8) | (dev->checkpointXor & 0xFF);
+       compositeSum =  (dev->checkpt_sum << 8) | (dev->checkpt_xor & 0xFF);
        *sum = compositeSum;
        return 1;
 }
 
-static int yaffs2_checkpt_flush_buffer(yaffs_Device *dev)
+static int yaffs2_checkpt_flush_buffer(yaffs_dev_t *dev)
 {
        int chunk;
        int realignedChunk;
 
-       yaffs_ExtendedTags tags;
+       yaffs_ext_tags tags;
 
-       if (dev->checkpointCurrentBlock < 0) {
+       if (dev->checkpt_cur_block < 0) {
                yaffs2_checkpt_find_erased_block(dev);
-               dev->checkpointCurrentChunk = 0;
+               dev->checkpt_cur_chunk = 0;
        }
 
-       if (dev->checkpointCurrentBlock < 0)
+       if (dev->checkpt_cur_block < 0)
                return 0;
 
-       tags.chunkDeleted = 0;
-       tags.objectId = dev->checkpointNextBlock; /* Hint to next place to look */
-       tags.chunkId = dev->checkpointPageSequence + 1;
-       tags.sequenceNumber =  YAFFS_SEQUENCE_CHECKPOINT_DATA;
-       tags.byteCount = dev->nDataBytesPerChunk;
-       if (dev->checkpointCurrentChunk == 0) {
+       tags.is_deleted = 0;
+       tags.obj_id = dev->checkpt_next_block; /* Hint to next place to look */
+       tags.chunk_id = dev->checkpt_page_seq + 1;
+       tags.seq_number =  YAFFS_SEQUENCE_CHECKPOINT_DATA;
+       tags.n_bytes = dev->data_bytes_per_chunk;
+       if (dev->checkpt_cur_chunk == 0) {
                /* First chunk we write for the block? Set block state to
                   checkpoint */
-               yaffs_BlockInfo *bi = yaffs_get_block_info(dev, dev->checkpointCurrentBlock);
-               bi->blockState = YAFFS_BLOCK_STATE_CHECKPOINT;
-               dev->blocksInCheckpoint++;
+               yaffs_block_info_t *bi = yaffs_get_block_info(dev, dev->checkpt_cur_block);
+               bi->block_state = YAFFS_BLOCK_STATE_CHECKPOINT;
+               dev->blocks_in_checkpt++;
        }
 
-       chunk = dev->checkpointCurrentBlock * dev->param.nChunksPerBlock + dev->checkpointCurrentChunk;
+       chunk = dev->checkpt_cur_block * dev->param.chunks_per_block + dev->checkpt_cur_chunk;
 
 
        T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint wite buffer nand %d(%d:%d) objid %d chId %d" TENDSTR),
-               chunk, dev->checkpointCurrentBlock, dev->checkpointCurrentChunk, tags.objectId, tags.chunkId));
+               chunk, dev->checkpt_cur_block, dev->checkpt_cur_chunk, tags.obj_id, tags.chunk_id));
 
-       realignedChunk = chunk - dev->chunkOffset;
+       realignedChunk = chunk - dev->chunk_offset;
 
-       dev->nPageWrites++;
+       dev->n_page_writes++;
 
-       dev->param.writeChunkWithTagsToNAND(dev, realignedChunk,
-                       dev->checkpointBuffer, &tags);
-       dev->checkpointByteOffset = 0;
-       dev->checkpointPageSequence++;
-       dev->checkpointCurrentChunk++;
-       if (dev->checkpointCurrentChunk >= dev->param.nChunksPerBlock) {
-               dev->checkpointCurrentChunk = 0;
-               dev->checkpointCurrentBlock = -1;
+       dev->param.write_chunk_tags_fn(dev, realignedChunk,
+                       dev->checkpt_buffer, &tags);
+       dev->checkpt_byte_offs = 0;
+       dev->checkpt_page_seq++;
+       dev->checkpt_cur_chunk++;
+       if (dev->checkpt_cur_chunk >= dev->param.chunks_per_block) {
+               dev->checkpt_cur_chunk = 0;
+               dev->checkpt_cur_block = -1;
        }
-       memset(dev->checkpointBuffer, 0, dev->nDataBytesPerChunk);
+       memset(dev->checkpt_buffer, 0, dev->data_bytes_per_chunk);
 
        return 1;
 }
 
 
-int yaffs2_checkpt_wr(yaffs_Device *dev, const void *data, int nBytes)
+int yaffs2_checkpt_wr(yaffs_dev_t *dev, const void *data, int n_bytes)
 {
        int i = 0;
        int ok = 1;
@@ -248,36 +248,36 @@ int yaffs2_checkpt_wr(yaffs_Device *dev, const void *data, int nBytes)
 
 
 
-       if (!dev->checkpointBuffer)
+       if (!dev->checkpt_buffer)
                return 0;
 
-       if (!dev->checkpointOpenForWrite)
+       if (!dev->checkpt_open_write)
                return -1;
 
-       while (i < nBytes && ok) {
-               dev->checkpointBuffer[dev->checkpointByteOffset] = *dataBytes;
-               dev->checkpointSum += *dataBytes;
-               dev->checkpointXor ^= *dataBytes;
+       while (i < n_bytes && ok) {
+               dev->checkpt_buffer[dev->checkpt_byte_offs] = *dataBytes;
+               dev->checkpt_sum += *dataBytes;
+               dev->checkpt_xor ^= *dataBytes;
 
-               dev->checkpointByteOffset++;
+               dev->checkpt_byte_offs++;
                i++;
                dataBytes++;
-               dev->checkpointByteCount++;
+               dev->checkpt_byte_count++;
 
 
-               if (dev->checkpointByteOffset < 0 ||
-                  dev->checkpointByteOffset >= dev->nDataBytesPerChunk)
+               if (dev->checkpt_byte_offs < 0 ||
+                  dev->checkpt_byte_offs >= dev->data_bytes_per_chunk)
                        ok = yaffs2_checkpt_flush_buffer(dev);
        }
 
        return i;
 }
 
-int yaffs2_checkpt_rd(yaffs_Device *dev, void *data, int nBytes)
+int yaffs2_checkpt_rd(yaffs_dev_t *dev, void *data, int n_bytes)
 {
        int i = 0;
        int ok = 1;
-       yaffs_ExtendedTags tags;
+       yaffs_ext_tags tags;
 
 
        int chunk;
@@ -285,114 +285,114 @@ int yaffs2_checkpt_rd(yaffs_Device *dev, void *data, int nBytes)
 
        __u8 *dataBytes = (__u8 *)data;
 
-       if (!dev->checkpointBuffer)
+       if (!dev->checkpt_buffer)
                return 0;
 
-       if (dev->checkpointOpenForWrite)
+       if (dev->checkpt_open_write)
                return -1;
 
-       while (i < nBytes && ok) {
+       while (i < n_bytes && ok) {
 
 
-               if (dev->checkpointByteOffset < 0 ||
-                       dev->checkpointByteOffset >= dev->nDataBytesPerChunk) {
+               if (dev->checkpt_byte_offs < 0 ||
+                       dev->checkpt_byte_offs >= dev->data_bytes_per_chunk) {
 
-                       if (dev->checkpointCurrentBlock < 0) {
+                       if (dev->checkpt_cur_block < 0) {
                                yaffs2_checkpt_find_block(dev);
-                               dev->checkpointCurrentChunk = 0;
+                               dev->checkpt_cur_chunk = 0;
                        }
 
-                       if (dev->checkpointCurrentBlock < 0)
+                       if (dev->checkpt_cur_block < 0)
                                ok = 0;
                        else {
-                               chunk = dev->checkpointCurrentBlock *
-                                       dev->param.nChunksPerBlock +
-                                       dev->checkpointCurrentChunk;
+                               chunk = dev->checkpt_cur_block *
+                                       dev->param.chunks_per_block +
+                                       dev->checkpt_cur_chunk;
 
-                               realignedChunk = chunk - dev->chunkOffset;
+                               realignedChunk = chunk - dev->chunk_offset;
                                
-                               dev->nPageReads++;
+                               dev->n_page_reads++;
 
                                /* read in the next chunk */
                                /* printf("read checkpoint page %d\n",dev->checkpointPage); */
-                               dev->param.readChunkWithTagsFromNAND(dev,
+                               dev->param.read_chunk_tags_fn(dev,
                                                realignedChunk,
-                                               dev->checkpointBuffer,
+                                               dev->checkpt_buffer,
                                                &tags);
 
-                               if (tags.chunkId != (dev->checkpointPageSequence + 1) ||
-                                       tags.eccResult > YAFFS_ECC_RESULT_FIXED ||
-                                       tags.sequenceNumber != YAFFS_SEQUENCE_CHECKPOINT_DATA)
+                               if (tags.chunk_id != (dev->checkpt_page_seq + 1) ||
+                                       tags.ecc_result > YAFFS_ECC_RESULT_FIXED ||
+                                       tags.seq_number != YAFFS_SEQUENCE_CHECKPOINT_DATA)
                                        ok = 0;
 
-                               dev->checkpointByteOffset = 0;
-                               dev->checkpointPageSequence++;
-                               dev->checkpointCurrentChunk++;
+                               dev->checkpt_byte_offs = 0;
+                               dev->checkpt_page_seq++;
+                               dev->checkpt_cur_chunk++;
 
-                               if (dev->checkpointCurrentChunk >= dev->param.nChunksPerBlock)
-                                       dev->checkpointCurrentBlock = -1;
+                               if (dev->checkpt_cur_chunk >= dev->param.chunks_per_block)
+                                       dev->checkpt_cur_block = -1;
                        }
                }
 
                if (ok) {
-                       *dataBytes = dev->checkpointBuffer[dev->checkpointByteOffset];
-                       dev->checkpointSum += *dataBytes;
-                       dev->checkpointXor ^= *dataBytes;
-                       dev->checkpointByteOffset++;
+                       *dataBytes = dev->checkpt_buffer[dev->checkpt_byte_offs];
+                       dev->checkpt_sum += *dataBytes;
+                       dev->checkpt_xor ^= *dataBytes;
+                       dev->checkpt_byte_offs++;
                        i++;
                        dataBytes++;
-                       dev->checkpointByteCount++;
+                       dev->checkpt_byte_count++;
                }
        }
 
        return  i;
 }
 
-int yaffs_checkpt_close(yaffs_Device *dev)
+int yaffs_checkpt_close(yaffs_dev_t *dev)
 {
 
-       if (dev->checkpointOpenForWrite) {
-               if (dev->checkpointByteOffset != 0)
+       if (dev->checkpt_open_write) {
+               if (dev->checkpt_byte_offs != 0)
                        yaffs2_checkpt_flush_buffer(dev);
-       } else if(dev->checkpointBlockList){
+       } else if(dev->checkpt_block_list){
                int i;
-               for (i = 0; i < dev->blocksInCheckpoint && dev->checkpointBlockList[i] >= 0; i++) {
-                       int blk = dev->checkpointBlockList[i];
-                       yaffs_BlockInfo *bi = NULL;
-                       if( dev->internalStartBlock <= blk && blk <= dev->internalEndBlock)
+               for (i = 0; i < dev->blocks_in_checkpt && dev->checkpt_block_list[i] >= 0; i++) {
+                       int blk = dev->checkpt_block_list[i];
+                       yaffs_block_info_t *bi = NULL;
+                       if( dev->internal_start_block <= blk && blk <= dev->internal_end_block)
                                bi = yaffs_get_block_info(dev, blk);
-                       if (bi && bi->blockState == YAFFS_BLOCK_STATE_EMPTY)
-                               bi->blockState = YAFFS_BLOCK_STATE_CHECKPOINT;
+                       if (bi && bi->block_state == YAFFS_BLOCK_STATE_EMPTY)
+                               bi->block_state = YAFFS_BLOCK_STATE_CHECKPOINT;
                        else {
                                /* Todo this looks odd... */
                        }
                }
-               YFREE(dev->checkpointBlockList);
-               dev->checkpointBlockList = NULL;
+               YFREE(dev->checkpt_block_list);
+               dev->checkpt_block_list = NULL;
        }
 
-       dev->nFreeChunks -= dev->blocksInCheckpoint * dev->param.nChunksPerBlock;
-       dev->nErasedBlocks -= dev->blocksInCheckpoint;
+       dev->n_free_chunks -= dev->blocks_in_checkpt * dev->param.chunks_per_block;
+       dev->n_erased_blocks -= dev->blocks_in_checkpt;
 
 
        T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint byte count %d" TENDSTR),
-                       dev->checkpointByteCount));
+                       dev->checkpt_byte_count));
 
-       if (dev->checkpointBuffer) {
+       if (dev->checkpt_buffer) {
                /* free the buffer */
-               YFREE(dev->checkpointBuffer);
-               dev->checkpointBuffer = NULL;
+               YFREE(dev->checkpt_buffer);
+               dev->checkpt_buffer = NULL;
                return 1;
        } else
                return 0;
 }
 
-int yaffs2_checkpt_invalidate_stream(yaffs_Device *dev)
+int yaffs2_checkpt_invalidate_stream(yaffs_dev_t *dev)
 {
        /* Erase the checkpoint data */
 
        T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint invalidate of %d blocks"TENDSTR),
-               dev->blocksInCheckpoint));
+               dev->blocks_in_checkpt));
 
        return yaffs_checkpt_erase(dev);
 }
index 61ba179..059ba9e 100644 (file)
 
 #include "yaffs_guts.h"
 
-int yaffs2_checkpt_open(yaffs_Device *dev, int forWriting);
+int yaffs2_checkpt_open(yaffs_dev_t *dev, int forWriting);
 
-int yaffs2_checkpt_wr(yaffs_Device *dev, const void *data, int nBytes);
+int yaffs2_checkpt_wr(yaffs_dev_t *dev, const void *data, int n_bytes);
 
-int yaffs2_checkpt_rd(yaffs_Device *dev, void *data, int nBytes);
+int yaffs2_checkpt_rd(yaffs_dev_t *dev, void *data, int n_bytes);
 
-int yaffs2_get_checkpt_sum(yaffs_Device *dev, __u32 *sum);
+int yaffs2_get_checkpt_sum(yaffs_dev_t *dev, __u32 *sum);
 
-int yaffs_checkpt_close(yaffs_Device *dev);
+int yaffs_checkpt_close(yaffs_dev_t *dev);
 
-int yaffs2_checkpt_invalidate_stream(yaffs_Device *dev);
+int yaffs2_checkpt_invalidate_stream(yaffs_dev_t *dev);
 
 
 #endif
index 71ebe76..4030908 100644 (file)
@@ -245,7 +245,7 @@ int yaffs_ecc_correct(unsigned char *data, unsigned char *read_ecc,
 /*
  * ECCxxxOther does ECC calcs on arbitrary n bytes of data
  */
-void yaffs_ecc_calc_other(const unsigned char *data, unsigned nBytes,
+void yaffs_ecc_calc_other(const unsigned char *data, unsigned n_bytes,
                                yaffs_ECCOther *eccOther)
 {
        unsigned int i;
@@ -255,7 +255,7 @@ void yaffs_ecc_calc_other(const unsigned char *data, unsigned nBytes,
        unsigned line_parity_prime = 0;
        unsigned char b;
 
-       for (i = 0; i < nBytes; i++) {
+       for (i = 0; i < n_bytes; i++) {
                b = column_parity_table[*data++];
                col_parity ^= b;
 
@@ -272,7 +272,7 @@ void yaffs_ecc_calc_other(const unsigned char *data, unsigned nBytes,
        eccOther->lineParityPrime = line_parity_prime;
 }
 
-int yaffs_ecc_correct_other(unsigned char *data, unsigned nBytes,
+int yaffs_ecc_correct_other(unsigned char *data, unsigned n_bytes,
                        yaffs_ECCOther *read_ecc,
                        const yaffs_ECCOther *test_ecc)
 {
@@ -301,7 +301,7 @@ int yaffs_ecc_correct_other(unsigned char *data, unsigned nBytes,
                if (cDelta & 0x02)
                        bit |= 0x01;
 
-               if (lDelta >= nBytes)
+               if (lDelta >= n_bytes)
                        return -1;
 
                data[lDelta] ^= (1 << bit);
index ef1fa60..124e5a0 100644 (file)
@@ -36,9 +36,9 @@ void yaffs_ecc_cacl(const unsigned char *data, unsigned char *ecc);
 int yaffs_ecc_correct(unsigned char *data, unsigned char *read_ecc,
                const unsigned char *test_ecc);
 
-void yaffs_ecc_calc_other(const unsigned char *data, unsigned nBytes,
+void yaffs_ecc_calc_other(const unsigned char *data, unsigned n_bytes,
                        yaffs_ECCOther *ecc);
-int yaffs_ecc_correct_other(unsigned char *data, unsigned nBytes,
+int yaffs_ecc_correct_other(unsigned char *data, unsigned n_bytes,
                        yaffs_ECCOther *read_ecc,
                        const yaffs_ECCOther *test_ecc);
 #endif
index 781d0ab..432441b 100644 (file)
 #include "yaffs_trace.h"
 
 /* Function to manipulate block info */
-static Y_INLINE yaffs_BlockInfo *yaffs_get_block_info(yaffs_Device * dev, int blk)
+static Y_INLINE yaffs_block_info_t *yaffs_get_block_info(yaffs_dev_t * dev, int blk)
 {
-       if (blk < dev->internalStartBlock || blk > dev->internalEndBlock) {
+       if (blk < dev->internal_start_block || blk > dev->internal_end_block) {
                T(YAFFS_TRACE_ERROR,
                  (TSTR
                   ("**>> yaffs: getBlockInfo block %d is not valid" TENDSTR),
                   blk));
                YBUG();
        }
-       return &dev->blockInfo[blk - dev->internalStartBlock];
+       return &dev->block_info[blk - dev->internal_start_block];
 }
 
 #endif
index 8bb5ed7..36e11f5 100644 (file)
 
 
 /* Robustification (if it ever comes about...) */
-static void yaffs_retire_block(yaffs_Device *dev, int blockInNAND);
-static void yaffs_handle_chunk_wr_error(yaffs_Device *dev, int chunkInNAND,
+static void yaffs_retire_block(yaffs_dev_t *dev, int flash_block);
+static void yaffs_handle_chunk_wr_error(yaffs_dev_t *dev, int nand_chunk,
                int erasedOk);
-static void yaffs_handle_chunk_wr_ok(yaffs_Device *dev, int chunkInNAND,
+static void yaffs_handle_chunk_wr_ok(yaffs_dev_t *dev, int nand_chunk,
                                const __u8 *data,
-                               const yaffs_ExtendedTags *tags);
-static void yaffs_handle_chunk_update(yaffs_Device *dev, int chunkInNAND,
-                               const yaffs_ExtendedTags *tags);
+                               const yaffs_ext_tags *tags);
+static void yaffs_handle_chunk_update(yaffs_dev_t *dev, int nand_chunk,
+                               const yaffs_ext_tags *tags);
 
 /* Other local prototypes */
-static void yaffs_update_parent(yaffs_Object *obj);
-static int yaffs_unlink_obj(yaffs_Object *obj);
-static int yaffs_obj_cache_dirty(yaffs_Object *obj);
+static void yaffs_update_parent(yaffs_obj_t *obj);
+static int yaffs_unlink_obj(yaffs_obj_t *obj);
+static int yaffs_obj_cache_dirty(yaffs_obj_t *obj);
 
-static int yaffs_write_new_chunk(yaffs_Device *dev,
+static int yaffs_write_new_chunk(yaffs_dev_t *dev,
                                        const __u8 *buffer,
-                                       yaffs_ExtendedTags *tags,
+                                       yaffs_ext_tags *tags,
                                        int useReserve);
 
 
-static yaffs_Object *yaffs_new_obj(yaffs_Device *dev, int number,
-                                       yaffs_ObjectType type);
+static yaffs_obj_t *yaffs_new_obj(yaffs_dev_t *dev, int number,
+                                       yaffs_obj_type type);
 
 
-static int yaffs_apply_xattrib_mod(yaffs_Object *obj, char *buffer, yaffs_xattr_mod *xmod);
+static int yaffs_apply_xattrib_mod(yaffs_obj_t *obj, char *buffer, yaffs_xattr_mod *xmod);
 
-static void yaffs_remove_obj_from_dir(yaffs_Object *obj);
+static void yaffs_remove_obj_from_dir(yaffs_obj_t *obj);
 static int yaffs_check_structures(void);
-static int yaffs_generic_obj_del(yaffs_Object *in);
+static int yaffs_generic_obj_del(yaffs_obj_t *in);
 
-static int yaffs_check_chunk_erased(struct yaffs_DeviceStruct *dev,
-                               int chunkInNAND);
+static int yaffs_check_chunk_erased(struct yaffs_dev_s *dev,
+                               int nand_chunk);
 
-static int yaffs_unlink_worker(yaffs_Object *obj);
+static int yaffs_unlink_worker(yaffs_obj_t *obj);
 
-static int yaffs_tags_match(const yaffs_ExtendedTags *tags, int objectId,
+static int yaffs_tags_match(const yaffs_ext_tags *tags, int obj_id,
                        int chunkInObject);
 
-static int yaffs_alloc_chunk(yaffs_Device *dev, int useReserve,
-                               yaffs_BlockInfo **blockUsedPtr);
+static int yaffs_alloc_chunk(yaffs_dev_t *dev, int useReserve,
+                               yaffs_block_info_t **blockUsedPtr);
 
-static void yaffs_check_obj_details_loaded(yaffs_Object *in);
+static void yaffs_check_obj_details_loaded(yaffs_obj_t *in);
 
-static void yaffs_invalidate_whole_cache(yaffs_Object *in);
-static void yaffs_invalidate_chunk_cache(yaffs_Object *object, int chunkId);
+static void yaffs_invalidate_whole_cache(yaffs_obj_t *in);
+static void yaffs_invalidate_chunk_cache(yaffs_obj_t *object, int chunk_id);
 
-static int yaffs_find_chunk_in_file(yaffs_Object *in, int chunkInInode,
-                               yaffs_ExtendedTags *tags);
+static int yaffs_find_chunk_in_file(yaffs_obj_t *in, int inode_chunk,
+                               yaffs_ext_tags *tags);
 
-static int yaffs_verify_chunk_written(yaffs_Device *dev,
-                                       int chunkInNAND,
+static int yaffs_verify_chunk_written(yaffs_dev_t *dev,
+                                       int nand_chunk,
                                        const __u8 *data,
-                                       yaffs_ExtendedTags *tags);
+                                       yaffs_ext_tags *tags);
 
 
-static void yaffs_load_name_from_oh(yaffs_Device *dev,YCHAR *name, const YCHAR *ohName, int bufferSize);
-static void yaffs_load_oh_from_name(yaffs_Device *dev,YCHAR *ohName, const YCHAR *name);
+static void yaffs_load_name_from_oh(yaffs_dev_t *dev,YCHAR *name, const YCHAR *ohName, int bufferSize);
+static void yaffs_load_oh_from_name(yaffs_dev_t *dev,YCHAR *ohName, const YCHAR *name);
 
 
 /* Function to calculate chunk and offset */
 
-static void yaffs_addr_to_chunk(yaffs_Device *dev, loff_t addr, int *chunkOut,
+static void yaffs_addr_to_chunk(yaffs_dev_t *dev, loff_t addr, int *chunkOut,
                __u32 *offsetOut)
 {
        int chunk;
        __u32 offset;
 
-       chunk  = (__u32)(addr >> dev->chunkShift);
+       chunk  = (__u32)(addr >> dev->chunk_shift);
 
-       if (dev->chunkDiv == 1) {
+       if (dev->chunk_div == 1) {
                /* easy power of 2 case */
-               offset = (__u32)(addr & dev->chunkMask);
+               offset = (__u32)(addr & dev->chunk_mask);
        } else {
                /* Non power-of-2 case */
 
                loff_t chunkBase;
 
-               chunk /= dev->chunkDiv;
+               chunk /= dev->chunk_div;
 
-               chunkBase = ((loff_t)chunk) * dev->nDataBytesPerChunk;
+               chunkBase = ((loff_t)chunk) * dev->data_bytes_per_chunk;
                offset = (__u32)(addr - chunkBase);
        }
 
@@ -181,49 +181,49 @@ static __u32 Shifts(__u32 x)
  * Temporary buffer manipulations.
  */
 
-static int yaffs_init_tmp_buffers(yaffs_Device *dev)
+static int yaffs_init_tmp_buffers(yaffs_dev_t *dev)
 {
        int i;
        __u8 *buf = (__u8 *)1;
 
-       memset(dev->tempBuffer, 0, sizeof(dev->tempBuffer));
+       memset(dev->temp_buffer, 0, sizeof(dev->temp_buffer));
 
        for (i = 0; buf && i < YAFFS_N_TEMP_BUFFERS; i++) {
-               dev->tempBuffer[i].line = 0;    /* not in use */
-               dev->tempBuffer[i].buffer = buf =
-                   YMALLOC_DMA(dev->param.totalBytesPerChunk);
+               dev->temp_buffer[i].line = 0;   /* not in use */
+               dev->temp_buffer[i].buffer = buf =
+                   YMALLOC_DMA(dev->param.total_bytes_per_chunk);
        }
 
        return buf ? YAFFS_OK : YAFFS_FAIL;
 }
 
-__u8 *yaffs_get_temp_buffer(yaffs_Device *dev, int lineNo)
+__u8 *yaffs_get_temp_buffer(yaffs_dev_t *dev, int line_no)
 {
        int i, j;
 
-       dev->tempInUse++;
-       if (dev->tempInUse > dev->maxTemp)
-               dev->maxTemp = dev->tempInUse;
+       dev->temp_in_use++;
+       if (dev->temp_in_use > dev->max_temp)
+               dev->max_temp = dev->temp_in_use;
 
        for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++) {
-               if (dev->tempBuffer[i].line == 0) {
-                       dev->tempBuffer[i].line = lineNo;
-                       if ((i + 1) > dev->maxTemp) {
-                               dev->maxTemp = i + 1;
+               if (dev->temp_buffer[i].line == 0) {
+                       dev->temp_buffer[i].line = line_no;
+                       if ((i + 1) > dev->max_temp) {
+                               dev->max_temp = i + 1;
                                for (j = 0; j <= i; j++)
-                                       dev->tempBuffer[j].maxLine =
-                                           dev->tempBuffer[j].line;
+                                       dev->temp_buffer[j].max_line =
+                                           dev->temp_buffer[j].line;
                        }
 
-                       return dev->tempBuffer[i].buffer;
+                       return dev->temp_buffer[i].buffer;
                }
        }
 
        T(YAFFS_TRACE_BUFFERS,
          (TSTR("Out of temp buffers at line %d, other held by lines:"),
-          lineNo));
+          line_no));
        for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++)
-               T(YAFFS_TRACE_BUFFERS, (TSTR(" %d "), dev->tempBuffer[i].line));
+               T(YAFFS_TRACE_BUFFERS, (TSTR(" %d "), dev->temp_buffer[i].line));
 
        T(YAFFS_TRACE_BUFFERS, (TSTR(" " TENDSTR)));
 
@@ -232,21 +232,21 @@ __u8 *yaffs_get_temp_buffer(yaffs_Device *dev, int lineNo)
         * This is not good.
         */
 
-       dev->unmanagedTempAllocations++;
-       return YMALLOC(dev->nDataBytesPerChunk);
+       dev->unmanaged_buffer_allocs++;
+       return YMALLOC(dev->data_bytes_per_chunk);
 
 }
 
-void yaffs_release_temp_buffer(yaffs_Device *dev, __u8 *buffer,
-                                   int lineNo)
+void yaffs_release_temp_buffer(yaffs_dev_t *dev, __u8 *buffer,
+                                   int line_no)
 {
        int i;
 
-       dev->tempInUse--;
+       dev->temp_in_use--;
 
        for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++) {
-               if (dev->tempBuffer[i].buffer == buffer) {
-                       dev->tempBuffer[i].line = 0;
+               if (dev->temp_buffer[i].buffer == buffer) {
+                       dev->temp_buffer[i].line = 0;
                        return;
                }
        }
@@ -255,9 +255,9 @@ void yaffs_release_temp_buffer(yaffs_Device *dev, __u8 *buffer,
                /* assume it is an unmanaged one. */
                T(YAFFS_TRACE_BUFFERS,
                  (TSTR("Releasing unmanaged temp buffer in line %d" TENDSTR),
-                  lineNo));
+                  line_no));
                YFREE(buffer);
-               dev->unmanagedTempDeallocations++;
+               dev->unmanaged_buffer_deallocs++;
        }
 
 }
@@ -265,21 +265,21 @@ void yaffs_release_temp_buffer(yaffs_Device *dev, __u8 *buffer,
 /*
  * Determine if we have a managed buffer.
  */
-int yaffs_is_managed_tmp_buffer(yaffs_Device *dev, const __u8 *buffer)
+int yaffs_is_managed_tmp_buffer(yaffs_dev_t *dev, const __u8 *buffer)
 {
        int i;
 
        for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++) {
-               if (dev->tempBuffer[i].buffer == buffer)
+               if (dev->temp_buffer[i].buffer == buffer)
                        return 1;
        }
 
-       for (i = 0; i < dev->param.nShortOpCaches; i++) {
-               if (dev->srCache[i].data == buffer)
+       for (i = 0; i < dev->param.n_caches; i++) {
+               if (dev->cache[i].data == buffer)
                        return 1;
        }
 
-       if (buffer == dev->checkpointBuffer)
+       if (buffer == dev->checkpt_buffer)
                return 1;
 
        T(YAFFS_TRACE_ALWAYS,
@@ -309,14 +309,14 @@ static Y_INLINE int yaffs_hash_fn(int n)
  * Note that root might have a presence in NAND if permissions are set.
  */
 
-yaffs_Object *yaffs_Root(yaffs_Device *dev)
+yaffs_obj_t *yaffs_root(yaffs_dev_t *dev)
 {
-       return dev->rootDir;
+       return dev->root_dir;
 }
 
-yaffs_Object *yaffs_LostNFound(yaffs_Device *dev)
+yaffs_obj_t *yaffs_lost_n_found(yaffs_dev_t *dev)
 {
-       return dev->lostNFoundDir;
+       return dev->lost_n_found;
 }
 
 
@@ -324,10 +324,10 @@ yaffs_Object *yaffs_LostNFound(yaffs_Device *dev)
  *  Erased NAND checking functions
  */
 
-int yaffs_check_ff(__u8 *buffer, int nBytes)
+int yaffs_check_ff(__u8 *buffer, int n_bytes)
 {
        /* Horrible, slow implementation */
-       while (nBytes--) {
+       while (n_bytes--) {
                if (*buffer != 0xFF)
                        return 0;
                buffer++;
@@ -335,22 +335,22 @@ int yaffs_check_ff(__u8 *buffer, int nBytes)
        return 1;
 }
 
-static int yaffs_check_chunk_erased(struct yaffs_DeviceStruct *dev,
-                               int chunkInNAND)
+static int yaffs_check_chunk_erased(struct yaffs_dev_s *dev,
+                               int nand_chunk)
 {
        int retval = YAFFS_OK;
        __u8 *data = yaffs_get_temp_buffer(dev, __LINE__);
-       yaffs_ExtendedTags tags;
+       yaffs_ext_tags tags;
        int result;
 
-       result = yaffs_rd_chunk_tags_nand(dev, chunkInNAND, data, &tags);
+       result = yaffs_rd_chunk_tags_nand(dev, nand_chunk, data, &tags);
 
-       if (tags.eccResult > YAFFS_ECC_RESULT_NO_ERROR)
+       if (tags.ecc_result > YAFFS_ECC_RESULT_NO_ERROR)
                retval = YAFFS_FAIL;
 
-       if (!yaffs_check_ff(data, dev->nDataBytesPerChunk) || tags.chunkUsed) {
+       if (!yaffs_check_ff(data, dev->data_bytes_per_chunk) || tags.chunk_used) {
                T(YAFFS_TRACE_NANDACCESS,
-                 (TSTR("Chunk %d not erased" TENDSTR), chunkInNAND));
+                 (TSTR("Chunk %d not erased" TENDSTR), nand_chunk));
                retval = YAFFS_FAIL;
        }
 
@@ -361,21 +361,21 @@ static int yaffs_check_chunk_erased(struct yaffs_DeviceStruct *dev,
 }
 
 
-static int yaffs_verify_chunk_written(yaffs_Device *dev,
-                                       int chunkInNAND,
+static int yaffs_verify_chunk_written(yaffs_dev_t *dev,
+                                       int nand_chunk,
                                        const __u8 *data,
-                                       yaffs_ExtendedTags *tags)
+                                       yaffs_ext_tags *tags)
 {
        int retval = YAFFS_OK;
-       yaffs_ExtendedTags tempTags;
+       yaffs_ext_tags tempTags;
        __u8 *buffer = yaffs_get_temp_buffer(dev,__LINE__);
        int result;
        
-       result = yaffs_rd_chunk_tags_nand(dev,chunkInNAND,buffer,&tempTags);
-       if(memcmp(buffer,data,dev->nDataBytesPerChunk) ||
-               tempTags.objectId != tags->objectId ||
-               tempTags.chunkId  != tags->chunkId ||
-               tempTags.byteCount != tags->byteCount)
+       result = yaffs_rd_chunk_tags_nand(dev,nand_chunk,buffer,&tempTags);
+       if(memcmp(buffer,data,dev->data_bytes_per_chunk) ||
+               tempTags.obj_id != tags->obj_id ||
+               tempTags.chunk_id  != tags->chunk_id ||
+               tempTags.n_bytes != tags->n_bytes)
                retval = YAFFS_FAIL;
 
        yaffs_release_temp_buffer(dev, buffer, __LINE__);
@@ -383,9 +383,9 @@ static int yaffs_verify_chunk_written(yaffs_Device *dev,
        return retval;
 }
 
-static int yaffs_write_new_chunk(struct yaffs_DeviceStruct *dev,
+static int yaffs_write_new_chunk(struct yaffs_dev_s *dev,
                                        const __u8 *data,
-                                       yaffs_ExtendedTags *tags,
+                                       yaffs_ext_tags *tags,
                                        int useReserve)
 {
        int attempts = 0;
@@ -395,7 +395,7 @@ static int yaffs_write_new_chunk(struct yaffs_DeviceStruct *dev,
        yaffs2_checkpt_invalidate(dev);
 
        do {
-               yaffs_BlockInfo *bi = 0;
+               yaffs_block_info_t *bi = 0;
                int erasedOk = 0;
 
                chunk = yaffs_alloc_chunk(dev, useReserve, &bi);
@@ -431,10 +431,10 @@ static int yaffs_write_new_chunk(struct yaffs_DeviceStruct *dev,
                /* let's give it a try */
                attempts++;
 
-               if(dev->param.alwaysCheckErased)
-                       bi->skipErasedCheck = 0;
+               if(dev->param.always_check_erased)
+                       bi->skip_erased_check = 0;
 
-               if (!bi->skipErasedCheck) {
+               if (!bi->skip_erased_check) {
                        erasedOk = yaffs_check_chunk_erased(dev, chunk);
                        if (erasedOk != YAFFS_OK) {
                                T(YAFFS_TRACE_ERROR,
@@ -453,7 +453,7 @@ static int yaffs_write_new_chunk(struct yaffs_DeviceStruct *dev,
                writeOk = yaffs_wr_chunk_tags_nand(dev, chunk,
                                data, tags);
 
-               if(!bi->skipErasedCheck)
+               if(!bi->skip_erased_check)
                        writeOk = yaffs_verify_chunk_written(dev, chunk, data, tags);
 
                if (writeOk != YAFFS_OK) {
@@ -463,7 +463,7 @@ static int yaffs_write_new_chunk(struct yaffs_DeviceStruct *dev,
                        continue;
                }
 
-               bi->skipErasedCheck = 1;
+               bi->skip_erased_check = 1;
 
                /* Copy the data into the robustification buffer */
                yaffs_handle_chunk_wr_ok(dev, chunk, data, tags);
@@ -479,7 +479,7 @@ static int yaffs_write_new_chunk(struct yaffs_DeviceStruct *dev,
                        (TSTR("**>> yaffs write required %d attempts" TENDSTR),
                        attempts));
 
-               dev->nRetriedWrites += (attempts - 1);
+               dev->n_retired_writes += (attempts - 1);
        }
 
        return chunk;
@@ -491,43 +491,43 @@ static int yaffs_write_new_chunk(struct yaffs_DeviceStruct *dev,
  * Block retiring for handling a broken block.
  */
 
-static void yaffs_retire_block(yaffs_Device *dev, int blockInNAND)
+static void yaffs_retire_block(yaffs_dev_t *dev, int flash_block)
 {
-       yaffs_BlockInfo *bi = yaffs_get_block_info(dev, blockInNAND);
+       yaffs_block_info_t *bi = yaffs_get_block_info(dev, flash_block);
 
        yaffs2_checkpt_invalidate(dev);
        
        yaffs2_clear_oldest_dirty_seq(dev,bi);
 
-       if (yaffs_mark_bad(dev, blockInNAND) != YAFFS_OK) {
-               if (yaffs_erase_block(dev, blockInNAND) != YAFFS_OK) {
+       if (yaffs_mark_bad(dev, flash_block) != YAFFS_OK) {
+               if (yaffs_erase_block(dev, flash_block) != YAFFS_OK) {
                        T(YAFFS_TRACE_ALWAYS, (TSTR(
                                "yaffs: Failed to mark bad and erase block %d"
-                               TENDSTR), blockInNAND));
+                               TENDSTR), flash_block));
                } else {
-                       yaffs_ExtendedTags tags;
-                       int chunkId = blockInNAND * dev->param.nChunksPerBlock;
+                       yaffs_ext_tags tags;
+                       int chunk_id = flash_block * dev->param.chunks_per_block;
 
                        __u8 *buffer = yaffs_get_temp_buffer(dev, __LINE__);
 
-                       memset(buffer, 0xff, dev->nDataBytesPerChunk);
+                       memset(buffer, 0xff, dev->data_bytes_per_chunk);
                        yaffs_init_tags(&tags);
-                       tags.sequenceNumber = YAFFS_SEQUENCE_BAD_BLOCK;
-                       if (dev->param.writeChunkWithTagsToNAND(dev, chunkId -
-                               dev->chunkOffset, buffer, &tags) != YAFFS_OK)
+                       tags.seq_number = YAFFS_SEQUENCE_BAD_BLOCK;
+                       if (dev->param.write_chunk_tags_fn(dev, chunk_id -
+                               dev->chunk_offset, buffer, &tags) != YAFFS_OK)
                                T(YAFFS_TRACE_ALWAYS, (TSTR("yaffs: Failed to "
                                        TCONT("write bad block marker to block %d")
-                                       TENDSTR), blockInNAND));
+                                       TENDSTR), flash_block));
 
                        yaffs_release_temp_buffer(dev, buffer, __LINE__);
                }
        }
 
-       bi->blockState = YAFFS_BLOCK_STATE_DEAD;
-       bi->gcPrioritise = 0;
-       bi->needsRetiring = 0;
+       bi->block_state = YAFFS_BLOCK_STATE_DEAD;
+       bi->gc_prioritise = 0;
+       bi->needs_retiring = 0;
 
-       dev->nRetiredBlocks++;
+       dev->n_retired_blocks++;
 }
 
 /*
@@ -535,56 +535,56 @@ static void yaffs_retire_block(yaffs_Device *dev, int blockInNAND)
  *
  */
 
-static void yaffs_handle_chunk_wr_ok(yaffs_Device *dev, int chunkInNAND,
+static void yaffs_handle_chunk_wr_ok(yaffs_dev_t *dev, int nand_chunk,
                                const __u8 *data,
-                               const yaffs_ExtendedTags *tags)
+                               const yaffs_ext_tags *tags)
 {
        dev=dev;
-       chunkInNAND=chunkInNAND;
+       nand_chunk=nand_chunk;
        data=data;
        tags=tags;
 }
 
-static void yaffs_handle_chunk_update(yaffs_Device *dev, int chunkInNAND,
-                               const yaffs_ExtendedTags *tags)
+static void yaffs_handle_chunk_update(yaffs_dev_t *dev, int nand_chunk,
+                               const yaffs_ext_tags *tags)
 {
        dev=dev;
-       chunkInNAND=chunkInNAND;
+       nand_chunk=nand_chunk;
        tags=tags;
 }
 
-void yaffs_handle_chunk_error(yaffs_Device *dev, yaffs_BlockInfo *bi)
+void yaffs_handle_chunk_error(yaffs_dev_t *dev, yaffs_block_info_t *bi)
 {
-       if (!bi->gcPrioritise) {
-               bi->gcPrioritise = 1;
-               dev->hasPendingPrioritisedGCs = 1;
-               bi->chunkErrorStrikes++;
+       if (!bi->gc_prioritise) {
+               bi->gc_prioritise = 1;
+               dev->has_pending_prioritised_gc = 1;
+               bi->chunk_error_strikes++;
 
-               if (bi->chunkErrorStrikes > 3) {
-                       bi->needsRetiring = 1; /* Too many stikes, so retire this */
+               if (bi->chunk_error_strikes > 3) {
+                       bi->needs_retiring = 1; /* Too many stikes, so retire this */
                        T(YAFFS_TRACE_ALWAYS, (TSTR("yaffs: Block struck out" TENDSTR)));
 
                }
        }
 }
 
-static void yaffs_handle_chunk_wr_error(yaffs_Device *dev, int chunkInNAND,
+static void yaffs_handle_chunk_wr_error(yaffs_dev_t *dev, int nand_chunk,
                int erasedOk)
 {
-       int blockInNAND = chunkInNAND / dev->param.nChunksPerBlock;
-       yaffs_BlockInfo *bi = yaffs_get_block_info(dev, blockInNAND);
+       int flash_block = nand_chunk / dev->param.chunks_per_block;
+       yaffs_block_info_t *bi = yaffs_get_block_info(dev, flash_block);
 
        yaffs_handle_chunk_error(dev, bi);
 
        if (erasedOk) {
                /* Was an actual write failure, so mark the block for retirement  */
-               bi->needsRetiring = 1;
+               bi->needs_retiring = 1;
                T(YAFFS_TRACE_ERROR | YAFFS_TRACE_BAD_BLOCKS,
-                 (TSTR("**>> Block %d needs retiring" TENDSTR), blockInNAND));
+                 (TSTR("**>> Block %d needs retiring" TENDSTR), flash_block));
        }
 
        /* Delete the chunk */
-       yaffs_chunk_del(dev, chunkInNAND, 1, __LINE__);
+       yaffs_chunk_del(dev, nand_chunk, 1, __LINE__);
        yaffs_skip_rest_of_block(dev);
 }
 
@@ -612,24 +612,24 @@ static __u16 yaffs_calc_name_sum(const YCHAR *name)
        return sum;
 }
 
-void yaffs_set_obj_name(yaffs_Object *obj, const YCHAR *name)
+void yaffs_set_obj_name(yaffs_obj_t *obj, const YCHAR *name)
 {
 #ifdef CONFIG_YAFFS_SHORT_NAMES_IN_RAM
-       memset(obj->shortName, 0, sizeof(YCHAR) * (YAFFS_SHORT_NAME_LENGTH+1));
+       memset(obj->short_name, 0, sizeof(YCHAR) * (YAFFS_SHORT_NAME_LENGTH+1));
        if (name && yaffs_strnlen(name,YAFFS_SHORT_NAME_LENGTH+1) <= YAFFS_SHORT_NAME_LENGTH)
-               yaffs_strcpy(obj->shortName, name);
+               yaffs_strcpy(obj->short_name, name);
        else
-               obj->shortName[0] = _Y('\0');
+               obj->short_name[0] = _Y('\0');
 #endif
        obj->sum = yaffs_calc_name_sum(name);
 }
 
-void yaffs_set_obj_name_from_oh(yaffs_Object *obj, const yaffs_ObjectHeader *oh)
+void yaffs_set_obj_name_from_oh(yaffs_obj_t *obj, const yaffs_obj_header *oh)
 {
 #ifdef CONFIG_YAFFS_AUTO_UNICODE
        YCHAR tmpName[YAFFS_MAX_NAME_LENGTH+1];
        memset(tmpName,0,sizeof(tmpName));
-       yaffs_load_name_from_oh(obj->myDev,tmpName,oh->name,YAFFS_MAX_NAME_LENGTH+1);
+       yaffs_load_name_from_oh(obj->my_dev,tmpName,oh->name,YAFFS_MAX_NAME_LENGTH+1);
        yaffs_set_obj_name(obj,tmpName);
 #else
        yaffs_set_obj_name(obj,oh->name);
@@ -644,36 +644,36 @@ void yaffs_set_obj_name_from_oh(yaffs_Object *obj, const yaffs_ObjectHeader *oh)
  */
 
 
-yaffs_tnode_t *yaffs_get_tnode(yaffs_Device *dev)
+yaffs_tnode_t *yaffs_get_tnode(yaffs_dev_t *dev)
 {
        yaffs_tnode_t *tn = yaffs_alloc_raw_tnode(dev);
        if (tn){
-               memset(tn, 0, dev->tnodeSize);
-               dev->nTnodes++;
+               memset(tn, 0, dev->tnode_size);
+               dev->n_tnodes++;
        }
 
-       dev->nCheckpointBlocksRequired = 0; /* force recalculation*/
+       dev->checkpoint_blocks_required = 0; /* force recalculation*/
 
        return tn;
 }
 
 /* FreeTnode frees up a tnode and puts it back on the free list */
-static void yaffs_free_tnode(yaffs_Device *dev, yaffs_tnode_t *tn)
+static void yaffs_free_tnode(yaffs_dev_t *dev, yaffs_tnode_t *tn)
 {
        yaffs_free_raw_tnode(dev,tn);
-       dev->nTnodes--;
-       dev->nCheckpointBlocksRequired = 0; /* force recalculation*/
+       dev->n_tnodes--;
+       dev->checkpoint_blocks_required = 0; /* force recalculation*/
 }
 
-static void yaffs_deinit_tnodes_and_objs(yaffs_Device *dev)
+static void yaffs_deinit_tnodes_and_objs(yaffs_dev_t *dev)
 {
        yaffs_deinit_raw_tnodes_and_objs(dev);
-       dev->nObjects = 0;
-       dev->nTnodes = 0;
+       dev->n_obj = 0;
+       dev->n_tnodes = 0;
 }
 
 
-void yaffs_load_tnode_0(yaffs_Device *dev, yaffs_tnode_t *tn, unsigned pos,
+void yaffs_load_tnode_0(yaffs_dev_t *dev, yaffs_tnode_t *tn, unsigned pos,
                unsigned val)
 {
        __u32 *map = (__u32 *)tn;
@@ -683,27 +683,27 @@ void yaffs_load_tnode_0(yaffs_Device *dev, yaffs_tnode_t *tn, unsigned pos,
        __u32 mask;
 
        pos &= YAFFS_TNODES_LEVEL0_MASK;
-       val >>= dev->chunkGroupBits;
+       val >>= dev->chunk_grp_bits;
 
-       bitInMap = pos * dev->tnodeWidth;
+       bitInMap = pos * dev->tnode_width;
        wordInMap = bitInMap / 32;
        bitInWord = bitInMap & (32 - 1);
 
-       mask = dev->tnodeMask << bitInWord;
+       mask = dev->tnode_mask << bitInWord;
 
        map[wordInMap] &= ~mask;
        map[wordInMap] |= (mask & (val << bitInWord));
 
-       if (dev->tnodeWidth > (32 - bitInWord)) {
+       if (dev->tnode_width > (32 - bitInWord)) {
                bitInWord = (32 - bitInWord);
                wordInMap++;;
-               mask = dev->tnodeMask >> (/*dev->tnodeWidth -*/ bitInWord);
+               mask = dev->tnode_mask >> (/*dev->tnode_width -*/ bitInWord);
                map[wordInMap] &= ~mask;
                map[wordInMap] |= (mask & (val >> bitInWord));
        }
 }
 
-__u32 yaffs_get_group_base(yaffs_Device *dev, yaffs_tnode_t *tn,
+__u32 yaffs_get_group_base(yaffs_dev_t *dev, yaffs_tnode_t *tn,
                unsigned pos)
 {
        __u32 *map = (__u32 *)tn;
@@ -714,20 +714,20 @@ __u32 yaffs_get_group_base(yaffs_Device *dev, yaffs_tnode_t *tn,
 
        pos &= YAFFS_TNODES_LEVEL0_MASK;
 
-       bitInMap = pos * dev->tnodeWidth;
+       bitInMap = pos * dev->tnode_width;
        wordInMap = bitInMap / 32;
        bitInWord = bitInMap & (32 - 1);
 
        val = map[wordInMap] >> bitInWord;
 
-       if      (dev->tnodeWidth > (32 - bitInWord)) {
+       if      (dev->tnode_width > (32 - bitInWord)) {
                bitInWord = (32 - bitInWord);
                wordInMap++;;
                val |= (map[wordInMap] << bitInWord);
        }
 
-       val &= dev->tnodeMask;
-       val <<= dev->chunkGroupBits;
+       val &= dev->tnode_mask;
+       val <<= dev->chunk_grp_bits;
 
        return val;
 }
@@ -735,19 +735,19 @@ __u32 yaffs_get_group_base(yaffs_Device *dev, yaffs_tnode_t *tn,
 /* ------------------- End of individual tnode manipulation -----------------*/
 
 /* ---------Functions to manipulate the look-up tree (made up of tnodes) ------
- * The look up tree is represented by the top tnode and the number of topLevel
+ * The look up tree is represented by the top tnode and the number of top_level
  * in the tree. 0 means only the level 0 tnode is in the tree.
  */
 
 /* FindLevel0Tnode finds the level 0 tnode, if one exists. */
-yaffs_tnode_t *yaffs_find_tnode_0(yaffs_Device *dev,
-                                       yaffs_FileStructure *fStruct,
-                                       __u32 chunkId)
+yaffs_tnode_t *yaffs_find_tnode_0(yaffs_dev_t *dev,
+                                       yaffs_file_s *file_struct,
+                                       __u32 chunk_id)
 {
-       yaffs_tnode_t *tn = fStruct->top;
+       yaffs_tnode_t *tn = file_struct->top;
        __u32 i;
        int requiredTallness;
-       int level = fStruct->topLevel;
+       int level = file_struct->top_level;
 
        dev=dev;
 
@@ -755,24 +755,24 @@ yaffs_tnode_t *yaffs_find_tnode_0(yaffs_Device *dev,
        if (level < 0 || level > YAFFS_TNODES_MAX_LEVEL)
                return NULL;
 
-       if (chunkId > YAFFS_MAX_CHUNK_ID)
+       if (chunk_id > YAFFS_MAX_CHUNK_ID)
                return NULL;
 
-       /* First check we're tall enough (ie enough topLevel) */
+       /* First check we're tall enough (ie enough top_level) */
 
-       i = chunkId >> YAFFS_TNODES_LEVEL0_BITS;
+       i = chunk_id >> YAFFS_TNODES_LEVEL0_BITS;
        requiredTallness = 0;
        while (i) {
                i >>= YAFFS_TNODES_INTERNAL_BITS;
                requiredTallness++;
        }
 
-       if (requiredTallness > fStruct->topLevel)
+       if (requiredTallness > file_struct->top_level)
                return NULL; /* Not tall enough, so we can't find it */
 
        /* Traverse down to level 0 */
        while (level > 0 && tn) {
-               tn = tn->internal[(chunkId >>
+               tn = tn->internal[(chunk_id >>
                        (YAFFS_TNODES_LEVEL0_BITS +
                                (level - 1) *
                                YAFFS_TNODES_INTERNAL_BITS)) &
@@ -794,10 +794,10 @@ yaffs_tnode_t *yaffs_find_tnode_0(yaffs_Device *dev,
  *  be plugged into the ttree.
  */
 
-yaffs_tnode_t *yaffs_add_find_tnode_0(yaffs_Device *dev,
-                                       yaffs_FileStructure *fStruct,
-                                       __u32 chunkId,
-                                       yaffs_tnode_t *passedTn)
+yaffs_tnode_t *yaffs_add_find_tnode_0(yaffs_dev_t *dev,
+                                       yaffs_file_s *file_struct,
+                                       __u32 chunk_id,
+                                       yaffs_tnode_t *passed_tn)
 {
        int requiredTallness;
        int i;
@@ -808,15 +808,15 @@ yaffs_tnode_t *yaffs_add_find_tnode_0(yaffs_Device *dev,
 
 
        /* Check sane level and page Id */
-       if (fStruct->topLevel < 0 || fStruct->topLevel > YAFFS_TNODES_MAX_LEVEL)
+       if (file_struct->top_level < 0 || file_struct->top_level > YAFFS_TNODES_MAX_LEVEL)
                return NULL;
 
-       if (chunkId > YAFFS_MAX_CHUNK_ID)
+       if (chunk_id > YAFFS_MAX_CHUNK_ID)
                return NULL;
 
-       /* First check we're tall enough (ie enough topLevel) */
+       /* First check we're tall enough (ie enough top_level) */
 
-       x = chunkId >> YAFFS_TNODES_LEVEL0_BITS;
+       x = chunk_id >> YAFFS_TNODES_LEVEL0_BITS;
        requiredTallness = 0;
        while (x) {
                x >>= YAFFS_TNODES_INTERNAL_BITS;
@@ -824,16 +824,16 @@ yaffs_tnode_t *yaffs_add_find_tnode_0(yaffs_Device *dev,
        }
 
 
-       if (requiredTallness > fStruct->topLevel) {
+       if (requiredTallness > file_struct->top_level) {
                /* Not tall enough, gotta make the tree taller */
-               for (i = fStruct->topLevel; i < requiredTallness; i++) {
+               for (i = file_struct->top_level; i < requiredTallness; i++) {
 
                        tn = yaffs_get_tnode(dev);
 
                        if (tn) {
-                               tn->internal[0] = fStruct->top;
-                               fStruct->top = tn;
-                               fStruct->topLevel++;
+                               tn->internal[0] = file_struct->top;
+                               file_struct->top = tn;
+                               file_struct->top_level++;
                        } else {
                                T(YAFFS_TRACE_ERROR,
                                        (TSTR("yaffs: no more tnodes" TENDSTR)));
@@ -844,12 +844,12 @@ yaffs_tnode_t *yaffs_add_find_tnode_0(yaffs_Device *dev,
 
        /* Traverse down to level 0, adding anything we need */
 
-       l = fStruct->topLevel;
-       tn = fStruct->top;
+       l = file_struct->top_level;
+       tn = file_struct->top;
 
        if (l > 0) {
                while (l > 0 && tn) {
-                       x = (chunkId >>
+                       x = (chunk_id >>
                             (YAFFS_TNODES_LEVEL0_BITS +
                              (l - 1) * YAFFS_TNODES_INTERNAL_BITS)) &
                            YAFFS_TNODES_INTERNAL_MASK;
@@ -862,11 +862,11 @@ yaffs_tnode_t *yaffs_add_find_tnode_0(yaffs_Device *dev,
                                        return NULL;
                        } else if (l == 1) {
                                /* Looking from level 1 at level 0 */
-                               if (passedTn) {
+                               if (passed_tn) {
                                        /* If we already have one, then release it.*/
                                        if (tn->internal[x])
                                                yaffs_free_tnode(dev, tn->internal[x]);
-                                       tn->internal[x] = passedTn;
+                                       tn->internal[x] = passed_tn;
 
                                } else if (!tn->internal[x]) {
                                        /* Don't have one, none passed in */
@@ -881,31 +881,31 @@ yaffs_tnode_t *yaffs_add_find_tnode_0(yaffs_Device *dev,
                }
        } else {
                /* top is level 0 */
-               if (passedTn) {
-                       memcpy(tn, passedTn, (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8);
-                       yaffs_free_tnode(dev, passedTn);
+               if (passed_tn) {
+                       memcpy(tn, passed_tn, (dev->tnode_width * YAFFS_NTNODES_LEVEL0)/8);
+                       yaffs_free_tnode(dev, passed_tn);
                }
        }
 
        return tn;
 }
 
-static int yaffs_find_chunk_in_group(yaffs_Device *dev, int theChunk,
-                               yaffs_ExtendedTags *tags, int objectId,
-                               int chunkInInode)
+static int yaffs_find_chunk_in_group(yaffs_dev_t *dev, int theChunk,
+                               yaffs_ext_tags *tags, int obj_id,
+                               int inode_chunk)
 {
        int j;
 
-       for (j = 0; theChunk && j < dev->chunkGroupSize; j++) {
-               if (yaffs_check_chunk_bit(dev, theChunk / dev->param.nChunksPerBlock,
-                               theChunk % dev->param.nChunksPerBlock)) {
+       for (j = 0; theChunk && j < dev->chunk_grp_size; j++) {
+               if (yaffs_check_chunk_bit(dev, theChunk / dev->param.chunks_per_block,
+                               theChunk % dev->param.chunks_per_block)) {
                        
-                       if(dev->chunkGroupSize == 1)
+                       if(dev->chunk_grp_size == 1)
                                return theChunk;
                        else {
                                yaffs_rd_chunk_tags_nand(dev, theChunk, NULL,
                                                                tags);
-                               if (yaffs_tags_match(tags, objectId, chunkInInode)) {
+                               if (yaffs_tags_match(tags, obj_id, inode_chunk)) {
                                        /* found it; */
                                        return theChunk;
                                }
@@ -924,15 +924,15 @@ static int yaffs_find_chunk_in_group(yaffs_Device *dev, int theChunk,
  * Returns 0 if it stopped early due to hitting the limit and the delete is incomplete.
  */
 
-static int yaffs_del_worker(yaffs_Object *in, yaffs_tnode_t *tn, __u32 level,
-                             int chunkOffset, int *limit)
+static int yaffs_del_worker(yaffs_obj_t *in, yaffs_tnode_t *tn, __u32 level,
+                             int chunk_offset, int *limit)
 {
        int i;
-       int chunkInInode;
+       int inode_chunk;
        int theChunk;
-       yaffs_ExtendedTags tags;
+       yaffs_ext_tags tags;
        int foundChunk;
-       yaffs_Device *dev = in->myDev;
+       yaffs_dev_t *dev = in->my_dev;
 
        int allDone = 1;
 
@@ -951,7 +951,7 @@ static int yaffs_del_worker(yaffs_Object *in, yaffs_tnode_t *tn, __u32 level,
                                                                [i],
                                                                level -
                                                                1,
-                                                               (chunkOffset
+                                                               (chunk_offset
                                                                        <<
                                                                        YAFFS_TNODES_INTERNAL_BITS)
                                                                + i,
@@ -974,21 +974,21 @@ static int yaffs_del_worker(yaffs_Object *in, yaffs_tnode_t *tn, __u32 level,
                                theChunk = yaffs_get_group_base(dev, tn, i);
                                if (theChunk) {
 
-                                       chunkInInode = (chunkOffset <<
+                                       inode_chunk = (chunk_offset <<
                                                YAFFS_TNODES_LEVEL0_BITS) + i;
 
                                        foundChunk =
                                                yaffs_find_chunk_in_group(dev,
                                                                theChunk,
                                                                &tags,
-                                                               in->objectId,
-                                                               chunkInInode);
+                                                               in->obj_id,
+                                                               inode_chunk);
 
                                        if (foundChunk > 0) {
                                                yaffs_chunk_del(dev,
                                                                  foundChunk, 1,
                                                                  __LINE__);
-                                               in->nDataChunks--;
+                                               in->n_data_chunks--;
                                                if (limit) {
                                                        *limit = *limit - 1;
                                                        if (*limit <= 0)
@@ -1013,19 +1013,19 @@ static int yaffs_del_worker(yaffs_Object *in, yaffs_tnode_t *tn, __u32 level,
 
 #endif
 
-static void yaffs_soft_del_chunk(yaffs_Device *dev, int chunk)
+static void yaffs_soft_del_chunk(yaffs_dev_t *dev, int chunk)
 {
-       yaffs_BlockInfo *theBlock;
-       unsigned blockNo;
+       yaffs_block_info_t *theBlock;
+       unsigned block_no;
 
        T(YAFFS_TRACE_DELETION, (TSTR("soft delete chunk %d" TENDSTR), chunk));
 
-       blockNo =  chunk / dev->param.nChunksPerBlock;
-       theBlock = yaffs_get_block_info(dev, blockNo);
+       block_no =  chunk / dev->param.chunks_per_block;
+       theBlock = yaffs_get_block_info(dev, block_no);
        if (theBlock) {
-               theBlock->softDeletions++;
-               dev->nFreeChunks++;
-               yaffs2_update_oldest_dirty_seq(dev, blockNo, theBlock);
+               theBlock->soft_del_pages++;
+               dev->n_free_chunks++;
+               yaffs2_update_oldest_dirty_seq(dev, block_no, theBlock);
        }
 }
 
@@ -1035,13 +1035,13 @@ static void yaffs_soft_del_chunk(yaffs_Device *dev, int chunk)
  * Thus, essentially this is the same as DeleteWorker except that the chunks are soft deleted.
  */
 
-static int yaffs_soft_del_worker(yaffs_Object *in, yaffs_tnode_t *tn,
-                                 __u32 level, int chunkOffset)
+static int yaffs_soft_del_worker(yaffs_obj_t *in, yaffs_tnode_t *tn,
+                                 __u32 level, int chunk_offset)
 {
        int i;
        int theChunk;
        int allDone = 1;
-       yaffs_Device *dev = in->myDev;
+       yaffs_dev_t *dev = in->my_dev;
 
        if (tn) {
                if (level > 0) {
@@ -1054,7 +1054,7 @@ static int yaffs_soft_del_worker(yaffs_Object *in, yaffs_tnode_t *tn,
                                                                   tn->
                                                                   internal[i],
                                                                   level - 1,
-                                                                  (chunkOffset
+                                                                  (chunk_offset
                                                                    <<
                                                                    YAFFS_TNODES_INTERNAL_BITS)
                                                                   + i);
@@ -1093,25 +1093,25 @@ static int yaffs_soft_del_worker(yaffs_Object *in, yaffs_tnode_t *tn,
 
 }
 
-static void yaffs_soft_del_file(yaffs_Object *obj)
+static void yaffs_soft_del_file(yaffs_obj_t *obj)
 {
        if (obj->deleted &&
-           obj->variantType == YAFFS_OBJECT_TYPE_FILE && !obj->softDeleted) {
-               if (obj->nDataChunks <= 0) {
+           obj->variant_type == YAFFS_OBJECT_TYPE_FILE && !obj->soft_del) {
+               if (obj->n_data_chunks <= 0) {
                        /* Empty file with no duplicate object headers, just delete it immediately */
-                       yaffs_free_tnode(obj->myDev,
-                                       obj->variant.fileVariant.top);
-                       obj->variant.fileVariant.top = NULL;
+                       yaffs_free_tnode(obj->my_dev,
+                                       obj->variant.file_variant.top);
+                       obj->variant.file_variant.top = NULL;
                        T(YAFFS_TRACE_TRACING,
                          (TSTR("yaffs: Deleting empty file %d" TENDSTR),
-                          obj->objectId));
+                          obj->obj_id));
                        y