yaffs Merge branch 'namechange'
authorCharles Manning <cdhmanning@gmail.com>
Mon, 11 Oct 2010 22:35:05 +0000 (11:35 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Mon, 11 Oct 2010 22:35:05 +0000 (11:35 +1300)
Merge in first set of yaffs name changes

Conflicts:
direct/python/yaffs_python_helper.c
direct/yaffsfs.c

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
76 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/yaffsnewcfg.c
direct/basic-test/ynorsim.c
direct/basic-test/ynorsim.h
direct/basic-test/yramsim.c
direct/basic-test/yramsim.h
direct/fsx_test/yaffs_fsx.c
direct/python/examples.py
direct/python/yaffs_python_helper.c
direct/python/yaffsfs.py
direct/tests/nor_stress.c
direct/tests/yaffs_test.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
direct/ydirectenv.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_trace.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
yaffsinterface.h
yportenv.h

index fe485e2..db38cb5 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "yaffs_guts.h" /* Only for dumping device innards */
 
-extern int yaffs_traceMask;
+extern int yaffs_trace_mask;
 
 void dumpDir(const char *dname);
 
@@ -278,7 +278,7 @@ void yaffs_backward_scan_test(const char *path)
 {
        char fn[100];
        
-       yaffs_StartUp();        
+       yaffs_start_up();       
        
        yaffs_mount(path);
        
@@ -299,7 +299,7 @@ void null_name_test(const char *path)
 {
        char fn[100];
        int h;
-       yaffs_StartUp();
+       yaffs_start_up();
 
        yaffs_mount(path);
 
@@ -320,7 +320,7 @@ void yaffs_device_flush_test(const char *path)
        int h;
        int i;
        
-       yaffs_StartUp();        
+       yaffs_start_up();       
        
        yaffs_mount(path);
        
@@ -349,7 +349,7 @@ void short_scan_test(const char *path, int fsize, int niterations)
        
        sprintf(fn,"%s/%s",path,"f1");
        
-       yaffs_StartUp();
+       yaffs_start_up();
        for(i = 0; i < niterations; i++)
        {
                printf("\n*****************\nIteration %d\n",i);
@@ -374,7 +374,7 @@ void scan_pattern_test(const char *path, int fsize, int niterations)
        sprintf(fn[1],"%s/%s",path,"f1");
        sprintf(fn[2],"%s/%s",path,"f2");
        
-       yaffs_StartUp();
+       yaffs_start_up();
        
        for(i = 0; i < niterations; i++)
        {
@@ -656,7 +656,7 @@ int long_test(int argc, char *argv[])
        mode_t temp_mode;
        struct yaffs_stat ystat;
        
-       yaffs_StartUp();
+       yaffs_start_up();
        
        yaffs_mount("/boot");
        yaffs_mount("/data");
@@ -866,11 +866,11 @@ int long_test(int argc, char *argv[])
        yaffs_unlink("/boot/zlf");
        
        
-       yaffs_DumpDevStruct("/boot");
+       yaffs_dump_dev("/boot");
        
        fill_disk_and_delete("/boot",20,20);
        
-       yaffs_DumpDevStruct("/boot");
+       yaffs_dump_dev("/boot");
        
        fill_files("/boot",1,10000,0);
        fill_files("/boot",1,10000,5000);
@@ -884,8 +884,8 @@ int long_test(int argc, char *argv[])
        leave_unlinked_file("/data",20000,5000);
        leave_unlinked_file("/data",20000,5000);
        
-       yaffs_DumpDevStruct("/boot");
-       yaffs_DumpDevStruct("/data");
+       yaffs_dump_dev("/boot");
+       yaffs_dump_dev("/data");
        
                
                
@@ -909,7 +909,7 @@ int huge_directory_test_on_path(char *path)
        char str[100];
 
        
-       yaffs_StartUp();
+       yaffs_start_up();
        
        yaffs_mount(path);
        
@@ -967,7 +967,7 @@ void rename_over_test(const char *mountpt)
        sprintf(b,"%s/b",mountpt);
        sprintf(c,"%s/c",mountpt);
        
-       yaffs_StartUp();
+       yaffs_start_up();
        
        yaffs_mount(mountpt);
        
@@ -1004,7 +1004,7 @@ int resize_stress_test(const char *path)
    char abuffer[1000];
    char bbuffer[1000];
    
-   yaffs_StartUp();
+   yaffs_start_up();
    
    yaffs_mount(path);
    
@@ -1065,7 +1065,7 @@ int overwrite_test(const char *path)
    int j;   
    int a;
    int b;
-   yaffs_StartUp();
+   yaffs_start_up();
    
    yaffs_mount(path);
    
@@ -1090,7 +1090,7 @@ int root_perm_remount(const char *path)
 {
    struct yaffs_stat s;
    
-   yaffs_StartUp();
+   yaffs_start_up();
    
    yaffs_mount(path);
    
@@ -1121,7 +1121,7 @@ int resize_stress_test_no_grow_complex(const char *path,int iters)
    char bbuffer[1000];
 
    
-   yaffs_StartUp();
+   yaffs_start_up();
    
    yaffs_mount(path);
    
@@ -1195,7 +1195,7 @@ int resize_stress_test_no_grow(const char *path,int iters)
    char abuffer[1000];
    char bbuffer[1000];
    
-   yaffs_StartUp();
+   yaffs_start_up();
    
    yaffs_mount(path);
    
@@ -1260,7 +1260,7 @@ int resize_stress_test_no_grow(const char *path,int iters)
 int directory_rename_test(void)
 {
        int r;
-       yaffs_StartUp();
+       yaffs_start_up();
        
        yaffs_mount("/ram");
        yaffs_mkdir("/ram/a",0);
@@ -1300,7 +1300,7 @@ int cache_read_test(void)
        int sizeOfFiles = 500000;
        char buffer[100];
        
-       yaffs_StartUp();
+       yaffs_start_up();
        
        yaffs_mount("/boot");
        
@@ -1339,7 +1339,7 @@ int cache_bypass_bug_test(void)
        memset(buffer1,0,sizeof(buffer1));
        memset(buffer2,0,sizeof(buffer2));
                
-       yaffs_StartUp();
+       yaffs_start_up();
        
        yaffs_mount("/boot");
        
@@ -1379,7 +1379,7 @@ int free_space_check(void)
 {
        int f;
        
-               yaffs_StartUp();
+               yaffs_start_up();
                yaffs_mount("/boot");
            fill_disk("/boot/",2);
            f = yaffs_freespace("/boot");
@@ -1397,7 +1397,7 @@ int truncate_test(void)
 
        char y[10];
 
-       yaffs_StartUp();
+       yaffs_start_up();
        yaffs_mount("/boot");
 
        yaffs_unlink("/boot/trunctest");
@@ -1435,7 +1435,7 @@ int truncate_test(void)
 void fill_disk_test(const char *mountpt)
 {
        int i;
-       yaffs_StartUp();
+       yaffs_start_up();
        
        for(i = 0; i < 5; i++)
        {
@@ -1450,7 +1450,7 @@ void fill_disk_test(const char *mountpt)
 void fill_files_test(const char *mountpt)
 {
        int i;
-       yaffs_StartUp();
+       yaffs_start_up();
        
        for(i = 0; i < 5; i++)
        {
@@ -1464,7 +1464,7 @@ void fill_files_test(const char *mountpt)
 void fill_empty_files_test(const char *mountpt)
 {
        int i;
-       yaffs_StartUp();
+       yaffs_start_up();
        char name[100];
        int result = 0;
        
@@ -1493,7 +1493,7 @@ void fill_empty_files_test(const char *mountpt)
 void long_name_test(const char *mountpt)
 {
        int i;
-       yaffs_StartUp();
+       yaffs_start_up();
        char fullName[1000];
        char name[300];
        int result = 0;
@@ -1548,7 +1548,7 @@ void lookup_test(const char *mountpt)
        yaffs_DIR *d;
        yaffs_dirent *de;
 
-       yaffs_StartUp();
+       yaffs_start_up();
        
        yaffs_mount(mountpt);
                                
@@ -1607,7 +1607,7 @@ void link_test0(const char *mountpt)
        int result = 0;
        
 
-       yaffs_StartUp();
+       yaffs_start_up();
        yaffs_mount(mountpt);
        
                
@@ -1656,7 +1656,7 @@ void link_test1(const char *mountpt)
        sprintf(b,"%s/bbb",mountpt);
        sprintf(c,"%s/ccc",mountpt);
        
-       yaffs_StartUp();
+       yaffs_start_up();
        
        yaffs_mount(mountpt);
        
@@ -1691,7 +1691,7 @@ void handle_test(const char *mountpt)
 
        sprintf(a,"%s/aaa",mountpt);
        
-       yaffs_StartUp();
+       yaffs_start_up();
        
        yaffs_mount(mountpt);
 
@@ -1725,7 +1725,7 @@ void freespace_test(const char *mountpt)
        int f3;
        sprintf(a,"%s/aaa",mountpt);
        
-       yaffs_StartUp();
+       yaffs_start_up();
        
        yaffs_mount(mountpt);
        
@@ -1766,7 +1766,7 @@ void simple_rw_test(const char *mountpt)
 
        sprintf(a,"%s/aaa",mountpt);
        
-       yaffs_StartUp();
+       yaffs_start_up();
        
        yaffs_mount(mountpt);
        
@@ -1819,7 +1819,7 @@ void scan_deleted_files_test(const char *mountpt)
        int h;
        
        sprintf(sub,"%s/sdir",mountpt);
-       yaffs_StartUp();
+       yaffs_start_up();
        
        for(j = 0; j < 10; j++)
        {
@@ -1952,7 +1952,7 @@ void check_resize_gc_bug(const char *mountpt)
 
        
        
-       yaffs_StartUp();
+       yaffs_start_up();
        yaffs_mount(mountpt);
        yaffs_unlink(a);
        yaffs_unlink(b);
@@ -1982,7 +1982,7 @@ void multi_mount_test(const char *mountpt,int nmounts)
        
        sprintf(a,"%s/a",mountpt);
 
-       yaffs_StartUp();
+       yaffs_start_up();
        
        for(i = 0; i < nmounts; i++){
                int h0;
@@ -2059,7 +2059,7 @@ void small_mount_test(const char *mountpt,int nmounts)
        
        sprintf(a,"%s/a",mountpt);
 
-       yaffs_StartUp();
+       yaffs_start_up();
        
        
        
@@ -2131,7 +2131,7 @@ void small_overwrite_test(const char *mountpt,int nmounts)
        
        sprintf(a,"%s/a",mountpt);
 
-       yaffs_StartUp();
+       yaffs_start_up();
        
        
        
@@ -2186,7 +2186,7 @@ void seek_overwrite_test(const char *mountpt,int nmounts)
        
        sprintf(a,"%s/f",mountpt);
 
-       yaffs_StartUp();
+       yaffs_start_up();
        
        yaffs_mount(mountpt);
        
@@ -2232,7 +2232,7 @@ void checkpoint_fill_test(const char *mountpt,int nmounts)
 
        
        
-       yaffs_StartUp();
+       yaffs_start_up();
        
        for(i = 0; i < nmounts; i++){
                printf("############### Iteration %d   Start\n",i);
@@ -2306,7 +2306,7 @@ void checkpoint_upgrade_test(const char *mountpt,int nmounts)
        
        
        printf("Create start condition\n");
-       yaffs_StartUp();
+       yaffs_start_up();
        yaffs_mount(mountpt);
        yaffs_mkdir(a,0);
        sprintf(b,"%s/zz",a);
@@ -2361,7 +2361,7 @@ void huge_array_test(const char *mountpt,int n)
        
 
        
-       yaffs_StartUp();
+       yaffs_start_up();
 
        yaffs_mount(mountpt);
        
@@ -2436,7 +2436,7 @@ void random_small_file_test(const char *mountpt,int iterations)
        int r;
        
        
-       yaffs_StartUp();
+       yaffs_start_up();
 
        yaffs_mount(mountpt);
        
@@ -2495,7 +2495,7 @@ void random_small_file_test(const char *mountpt,int iterations)
 void rmdir_test(const char *mountpt)
 {
        char name[100];
-       yaffs_StartUp();
+       yaffs_start_up();
        
        yaffs_mount(mountpt);
        
@@ -2556,7 +2556,7 @@ void basic_xattr_test(const char *mountpt)
        int result;
        int val1;
 
-       yaffs_StartUp();
+       yaffs_start_up();
 
        yaffs_mount(mountpt);
 
@@ -2606,7 +2606,7 @@ void big_xattr_test(const char *mountpt)
        int result;
        char val[1000];
 
-       yaffs_StartUp();
+       yaffs_start_up();
 
        yaffs_mount(mountpt);
 
@@ -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,11 +2658,11 @@ void test_flash_traffic(const char *mountpt)
        char name0[100];
        char name1[100];
        int i;
-       yaffs_Device *dev;
+       yaffs_dev_t *dev;
 
-       yaffs_traceMask = 0;
+       yaffs_trace_mask = 0;
 
-       yaffs_StartUp();
+       yaffs_start_up();
 
        yaffs_mount(mountpt);
        
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 84b7eb8..ad76c01 100644 (file)
@@ -62,7 +62,7 @@ typedef struct
 
 static yflash_Device filedisk;
 
-int yaffs_testPartialWrite = 0;
+int yaffs_test_partial_write = 0;
 
 extern int random_seed;
 extern int simulate_power_failure;
@@ -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,30 +180,30 @@ 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_testPartialWrite){
+               if(yaffs_test_partial_write){
                        close(h);
                        exit(1);
                }
                
-               if(written != dev->param.totalBytesPerChunk) return YAFFS_FAIL;
+               if(written != dev->param.total_bytes_per_chunk) return YAFFS_FAIL;
 
 
        }
@@ -215,60 +215,60 @@ 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_testPartialWrite){
+                       if(yaffs_test_partial_write){
                                close(h);
                                exit(1);
                        }
 
 
-                       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,59 +294,59 @@ 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_testPartialWrite){
+                       if(yaffs_test_partial_write){
                                close(h);
                                exit(1);
                        }
 
 
-                       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,14 +364,14 @@ int yflash2_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u
                        }
                }
                
-               yflash2_MaybePowerFail(chunkInNAND,3);
+               yflash2_MaybePowerFail(nand_chunk,3);
        
        }
        return YAFFS_OK;        
 
 }
 
-int yaffs_CheckAllFF(const __u8 *ptr, int n)
+int yaffs_check_all_ff(const __u8 *ptr, int n)
 {
        while(n)
        {
@@ -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,39 +397,39 @@ 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;
-                       data = yaffs_GetTempBuffer(dev,__LINE__);
+                       data = yaffs_get_temp_buffer(dev,__LINE__);
                }
 
                
                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_UnpackTags2TagsPart(tags,pt2tp);
+               yaffs_unpack_tags2tags_part(tags,pt2tp);
                
-               if(nread != dev->param.totalBytesPerChunk)
+               if(nread != dev->param.total_bytes_per_chunk)
                        retval = YAFFS_FAIL;
                        
                if(localData)
-                       yaffs_ReleaseTempBuffer(dev,data,__LINE__);
+                       yaffs_release_temp_buffer(dev,data,__LINE__);
 
 
 
@@ -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_CheckAllFF((__u8 *)tags,sizeof(yaffs_ExtendedTags)))
+                               if(yaffs_check_all_ff((__u8 *)tags,sizeof(yaffs_ext_tags)))
                                {
-                                       yaffs_InitialiseTags(tags);
+                                       yaffs_init_tags(tags);
                                }
                                else
                                {
-                                       tags->chunkUsed = 1;
+                                       tags->chunk_used = 1;
                                }
                        }
                        else
                        {
                                yaffs_PackedTags2 pt;
                                nread= read(h,&pt,sizeof(pt));
-                               yaffs_UnpackTags2(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 ff86747..5657c00 100644 (file)
@@ -70,12 +70,12 @@ const char *yaffs_norif1_c_version = "$Id: yaffs_norif1.c,v 1.6 2010-02-18 01:18
 
 /* Compile this for a simulation */
 #include "ynorsim.h"
-#define ynorif1_FlashInit() ynorsim_Initialise()
-#define ynorif1_FlashDeinit() ynorsim_Shutdown()
-#define ynorif1_FlashWrite32(addr,buf,nwords) ynorsim_Write32(addr,buf,nwords) 
-#define ynorif1_FlashRead32(addr,buf,nwords) ynorsim_Read32(addr,buf,nwords) 
-#define ynorif1_FlashEraseBlock(addr) ynorsim_EraseBlock(addr)
-#define DEVICE_BASE     ynorsim_GetBase()
+#define ynorif1_FlashInit() ynorsim_initialise()
+#define ynorif1_FlashDeinit() ynorsim_shutdown()
+#define ynorif1_FlashWrite32(addr,buf,nwords) ynorsim_wr32(addr,buf,nwords) 
+#define ynorif1_FlashRead32(addr,buf,nwords) ynorsim_rd32(addr,buf,nwords) 
+#define ynorif1_FlashEraseBlock(addr) ynorsim_erase(addr)
+#define DEVICE_BASE     ynorsim_get_base()
 #else
 
 /* Compile this for running on blob, hacked for yaffs access */
@@ -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 d44c3da..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 $";
@@ -43,25 +43,25 @@ const char *yaffs_ramdisk_c_version = "$Id: yaffs_ramdisk.c,v 1.6 2010-01-11 04:
 typedef struct 
 {
        __u8 data[528]; // Data + spare
-} yramdisk_Page;
+} yramdisk_page;
 
 typedef struct
 {
-       yramdisk_Page page[32]; // The pages in the block
+       yramdisk_page page[32]; // The pages in the block
        
-} yramdisk_Block;
+} yramdisk_block;
 
 
 
 typedef struct
 {
-       yramdisk_Block **block;
+       yramdisk_block **block;
        int nBlocks;
-} yramdisk_Device;
+} yramdisk_device;
 
-static yramdisk_Device ramdisk;
+static yramdisk_device ramdisk;
 
-static int  CheckInit(yaffs_Device *dev)
+static int  CheckInit(yaffs_dev_t *dev)
 {
        static int initialised = 0;
        
@@ -80,7 +80,7 @@ static int  CheckInit(yaffs_Device *dev)
        
        ramdisk.nBlocks = (SIZE_IN_MB * 1024 * 1024)/(16 * 1024);
        
-       ramdisk.block = YMALLOC(sizeof(yramdisk_Block *) * ramdisk.nBlocks);
+       ramdisk.block = YMALLOC(sizeof(yramdisk_block *) * ramdisk.nBlocks);
        
        if(!ramdisk.block) return 0;
        
@@ -91,13 +91,13 @@ static int  CheckInit(yaffs_Device *dev)
        
        for(i=0; i <ramdisk.nBlocks && !fail; i++)
        {
-               if((ramdisk.block[i] = YMALLOC(sizeof(yramdisk_Block))) == 0)
+               if((ramdisk.block[i] = YMALLOC(sizeof(yramdisk_block))) == 0)
                {
                        fail = 1;
                }
                else
                {
-                       yramdisk_EraseBlockInNAND(dev,i);
+                       yramdisk_erase(dev,i);
                        nAllocated++;
                }
        }
@@ -119,7 +119,7 @@ static int  CheckInit(yaffs_Device *dev)
        return 1;
 }
 
-int yramdisk_WriteChunkWithTagsToNAND(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_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,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_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __
 }
 
 
-int yramdisk_ReadChunkWithTagsFromNAND(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_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *
        
        CheckInit(dev);
        
-       blk = chunkInNAND/32;
-       pg = chunkInNAND%32;
+       blk = nand_chunk/32;
+       pg = nand_chunk%32;
        
        
        if(data)
@@ -173,7 +173,7 @@ int yramdisk_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *
                yaffs_PackedTags1 pt;
                
                memcpy(&pt,&ramdisk.block[blk]->page[pg].data[512],sizeof(pt));
-               yaffs_UnpackTags1(tags,&pt);
+               yaffs_unpack_tags1(tags,&pt);
                
        }
 
@@ -181,7 +181,7 @@ int yramdisk_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *
 }
 
 
-int yramdisk_CheckChunkErased(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_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++)
@@ -206,7 +206,7 @@ int yramdisk_CheckChunkErased(yaffs_Device *dev,int chunkInNAND)
 
 }
 
-int yramdisk_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
+int yramdisk_erase(yaffs_dev_t *dev, int blockNumber)
 {
        
        CheckInit(dev);
@@ -218,15 +218,15 @@ int yramdisk_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
        }
        else
        {
-               memset(ramdisk.block[blockNumber],0xFF,sizeof(yramdisk_Block));
+               memset(ramdisk.block[blockNumber],0xFF,sizeof(yramdisk_block));
                return YAFFS_OK;
        }
        
 }
 
-int yramdisk_InitialiseNAND(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 cc62fd7..c250bcc 100644 (file)
 
 
 #include "yaffs_guts.h"
-int yramdisk_EraseBlockInNAND(yaffs_Device *dev, int blockNumber);
-int yramdisk_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_ExtendedTags *tags);
-int yramdisk_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_ExtendedTags *tags);
-int yramdisk_InitialiseNAND(yaffs_Device *dev);
-int yramdisk_MarkNANDBlockBad(yaffs_Device *dev,int blockNumber);
-int yramdisk_QueryNANDBlock(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 b3a8724..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_UnpackTags2(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 a235bb2..590cb87 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "yramsim.h"
 
-unsigned yaffs_traceMask = 0xFFFFFFFF;
+unsigned yaffs_trace_mask = 0xFFFFFFFF;
 
 
 void yaffsfs_SetError(int err)
@@ -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[] = {
 
@@ -87,7 +87,7 @@ static yaffsfs_DeviceConfiguration yaffsfs_config[] = {
 };
 
 
-int yaffs_StartUp(void)
+int yaffs_start_up(void)
 {
        // Stuff to configure YAFFS
        // Stuff to initialise anything special (eg lock semaphore).
@@ -99,46 +99,46 @@ int yaffs_StartUp(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_WriteChunkWithTagsToNAND;
-       ramDev.readChunkWithTagsFromNAND = yramdisk_ReadChunkWithTagsFromNAND;
-       ramDev.eraseBlockInNAND = yramdisk_EraseBlockInNAND;
-       ramDev.initialiseNAND = yramdisk_InitialiseNAND;
+       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 bfd502e..de8953e 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <errno.h>
 
-unsigned yaffs_traceMask = 
+unsigned yaffs_trace_mask = 
 
        YAFFS_TRACE_SCAN |  
        YAFFS_TRACE_GC |
@@ -106,11 +106,11 @@ 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_StartUp(void)
+int yaffs_start_up(void)
 {
        // Stuff to configure YAFFS
        // Stuff to initialise anything special (eg lock semaphore).
@@ -120,68 +120,68 @@ int yaffs_StartUp(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_WriteChunkWithTagsToNAND;
-       ram1Dev.param.readChunkWithTagsFromNAND = yramdisk_ReadChunkWithTagsFromNAND;
-       ram1Dev.param.eraseBlockInNAND = yramdisk_EraseBlockInNAND;
-       ram1Dev.param.initialiseNAND = yramdisk_InitialiseNAND;
+       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_AddDevice(&ram1Dev);
+       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;
-
-       yaffs_AddDevice(&m18_1Dev);
+       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);
 
        // /yaffs2  yaffs2 file emulation
        // 2kpage/64chunk per block
        //
        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;
-
-       yaffs_AddDevice(&flashDev);
+       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);
 
 // todo        yaffs_initialise(yaffsfs_config);
        
index fa99342..a3548ef 100644 (file)
@@ -23,7 +23,7 @@
 #include "yaffs_trace.h"
 #include "yramsim.h"
 
-unsigned yaffs_traceMask = 
+unsigned yaffs_trace_mask = 
 
        YAFFS_TRACE_SCAN |  
        YAFFS_TRACE_GC |
@@ -96,7 +96,7 @@ void yaffsfs_LocalInitialisation(void)
 // Configuration
 
 
-int yaffs_StartUp(void)
+int yaffs_start_up(void)
 {
        // Stuff to configure YAFFS
        // Stuff to initialise anything special (eg lock semaphore).
index 0c691a6..17fedb7 100644 (file)
@@ -48,14 +48,14 @@ static void NorError(void)
   while(1){}
 }
 
-static void ynorsim_SaveImage(void)
+static void ynorsim_save_image(void)
 {
   int h = open(YNORSIM_FNAME, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
   write(h,word,sizeof(word));
   close(h);
 }
 
-static void ynorsim_RestoreImage(void)
+static void ynorsim_restore_image(void)
 {
   int h = open(YNORSIM_FNAME, O_RDONLY, S_IREAD | S_IWRITE);
   memset(word,0xFF,sizeof(word));
@@ -64,9 +64,9 @@ static void ynorsim_RestoreImage(void)
 }
 
 
-static void ynorsim_PowerFail(void)
+static void ynorsim_power_fail(void)
 {
-  ynorsim_SaveImage();
+  ynorsim_save_image();
   exit(1);
 }
 
@@ -76,7 +76,7 @@ static int nops_so_far;
 
 int ops_multiplier = 500;
 
-static void ynorsim_MaybePowerFail(void)
+static void ynorsim_maybe_power_fail(void)
 {
 
    nops_so_far++;
@@ -86,21 +86,21 @@ static void ynorsim_MaybePowerFail(void)
    if(simulate_power_failure &&
       remaining_ops < 1){
        printf("Simulated power failure after %d operations\n",nops_so_far);
-       ynorsim_PowerFail();
+       ynorsim_power_fail();
   }
 }
 
-static void ynorsim_Ready(void)
+static void ynorsim_ready(void)
 {
   if(initialised) 
     return;
   srand(random_seed);
   remaining_ops = 1000000000;
   remaining_ops = (rand() % 10000) * ops_multiplier * YNORSIM_BIT_CHANGES;
-  ynorsim_RestoreImage();
+  ynorsim_restore_image();
 }
 
-void ynorsim_Read32(__u32 *addr,__u32 *buf, int nwords)
+void ynorsim_rd32(__u32 *addr,__u32 *buf, int nwords)
 { 
    while(nwords > 0){
      *buf = *addr;
@@ -110,7 +110,7 @@ void ynorsim_Read32(__u32 *addr,__u32 *buf, int nwords)
    }
 }
 
-void ynorsim_WriteOneWord32(__u32 *addr,__u32 val)
+void ynorsim_wr_one_word32(__u32 *addr,__u32 val)
 {
   __u32 tmp;
   __u32 m;
@@ -128,43 +128,43 @@ void ynorsim_WriteOneWord32(__u32 *addr,__u32 val)
     if(!(m & val)){
       tmp &= ~m;
       *addr = tmp;
-      ynorsim_MaybePowerFail();
+      ynorsim_maybe_power_fail();
     }
        
   }
   
   *addr = tmp & val;
-  ynorsim_MaybePowerFail();
+  ynorsim_maybe_power_fail();
 }
 
-void ynorsim_Write32(__u32 *addr, __u32 *buf, int nwords)
+void ynorsim_wr32(__u32 *addr, __u32 *buf, int nwords)
 {
   while(nwords >0){
-    ynorsim_WriteOneWord32(addr,*buf);
+    ynorsim_wr_one_word32(addr,*buf);
     addr++;
     buf++;
     nwords--;
   }
 }
 
-void ynorsim_EraseBlock(__u32 *addr)
+void ynorsim_erase(__u32 *addr)
 {
   /* Todo... bit flipping */
   memset(addr,0xFF,YNORSIM_BLOCK_SIZE_U32 * 4);
 }
 
-void ynorsim_Initialise(void)
+void ynorsim_initialise(void)
 {
-  ynorsim_Ready();
+  ynorsim_ready();
 }
 
-void ynorsim_Shutdown(void)
+void ynorsim_shutdown(void)
 {
-  ynorsim_SaveImage();
+  ynorsim_save_image();
   initialised=0;
 }
 
-__u32 *ynorsim_GetBase(void)
+__u32 *ynorsim_get_base(void)
 {
   return word;
 }
index 2c70ad9..d7ec44f 100644 (file)
@@ -4,11 +4,11 @@
 
 #include "yaffs_guts.h"
 
-void ynorsim_Read32(__u32 *addr, __u32 *data, int nwords);
-void ynorsim_Write32(__u32 *addr, __u32 *data, int nwords);
-void ynorsim_EraseBlock(__u32 *addr);
-void ynorsim_Shutdown(void);
-void ynorsim_Initialise(void);
-__u32 * ynorsim_GetBase(void);
+void ynorsim_rd32(__u32 *addr, __u32 *data, int nwords);
+void ynorsim_wr32(__u32 *addr, __u32 *data, int nwords);
+void ynorsim_erase(__u32 *addr);
+void ynorsim_shutdown(void);
+void ynorsim_initialise(void);
+__u32 * ynorsim_get_base(void);
 
 #endif
index caa1aac..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;
 }
@@ -39,7 +39,7 @@ static void CheckInitialised(void)
 
 }
 
-static int yramsim_EraseBlockInternal(SimData *sim, unsigned blockId,int force)
+static int yramsim_erase_internal(SimData *sim, unsigned blockId,int force)
 {
        if(blockId < 0 || blockId >= sim->nBlocks){
                return 0;
@@ -62,7 +62,7 @@ static int yramsim_EraseBlockInternal(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_ReadChunk (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_ReadChunk (yaffs_Device *dev, unsigned pageId,
        return 1;
 }
 
-static int yramsim_WriteChunk (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,15 +142,15 @@ static int yramsim_WriteChunk (yaffs_Device *dev,unsigned pageId,
 }
 
 
-static int yramsim_EraseBlock(yaffs_Device *dev,unsigned blockId)
+static int yramsim_erase(yaffs_dev_t *dev,unsigned blockId)
 {
        SimData *sim = DevToSim(dev);
 
        CheckInitialised();
-       return yramsim_EraseBlockInternal(sim,blockId,0);
+       return yramsim_erase_internal(sim,blockId,0);
 }
 
-static int yramsim_CheckBlockOk(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_CheckBlockOk(yaffs_Device *dev,unsigned blockId)
        return blockList[blockId]->blockOk ? 1 : 0;
 }
 
-static int yramsim_MarkBlockBad(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;
@@ -175,7 +175,7 @@ static int yramsim_MarkBlockBad(yaffs_Device *dev,unsigned blockId)
 }
 
 
-static SimData *yramsim_AllocSimData(__u32 devId, __u32 nBlocks)
+static SimData *yramsim_alloc_sim_data(__u32 devId, __u32 nBlocks)
 {
        int ok = 1;
 
@@ -214,7 +214,7 @@ static SimData *yramsim_AllocSimData(__u32 devId, __u32 nBlocks)
                b=  malloc(sizeof(Block));
                if(b){
                        blockList[i] = b;
-                       yramsim_EraseBlockInternal(sim,i,1);
+                       yramsim_erase_internal(sim,i,1);
                }
                else
                        ok = 0;
@@ -236,14 +236,14 @@ static SimData *yramsim_AllocSimData(__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;
 
-       sim = yramsim_AllocSimData(devId, nBlocks);
+       sim = yramsim_alloc_sim_data(devId, nBlocks);
 
        g = YMALLOC(sizeof(ynandif_Geometry));
 
@@ -253,28 +253,28 @@ 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;
-       g->readChunk = yramsim_ReadChunk,
-       g->writeChunk = yramsim_WriteChunk,
-       g->eraseBlock = yramsim_EraseBlock,
-       g->checkBlockOk = yramsim_CheckBlockOk,
-       g->markBlockBad = yramsim_MarkBlockBad,
+       g->initialise = yramsim_initialise;
+       g->deinitialise = yramsim_deinitialise;
+       g->readChunk = yramsim_rd_chunk,
+       g->writeChunk = yramsim_wr_chunk,
+       g->eraseBlock = yramsim_erase,
+       g->checkBlockOk = yramsim_check_block_ok,
+       g->markBlockBad = yramsim_mark_block_bad,
        g->privateData = (void *)sim;
 
-       return yaffs_AddDeviceFromGeometry(name,g);
+       return yaffs_add_dev_from_geometry(name,g);
 }
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 484241b..d3d3149 100644 (file)
@@ -919,7 +919,7 @@ main(int argc, char **argv)
        argc -= optind;
        argv += optind;
 
-       yaffs_StartUp();
+       yaffs_start_up();
        yaffs_mount(BASE_NAME);
        
        fname = BASE_NAME "/fsxdata";
index 6b0c045..0f42c17 100644 (file)
@@ -73,7 +73,7 @@ def yaffs_o_excl_test(dir):
     
 root = "/yaffs2"
 
-yaffs_StartUp()
+yaffs_start_up()
 yaffs_mount(root)
 
 yaffs_mkdir(root+"/dd",0666)
index 14e894b..b7c6047 100644 (file)
@@ -45,8 +45,8 @@ int yaffs_O_WRONLY(void) { return O_WRONLY;}
 int yaffs_O_RDWR(void) { return O_RDWR;}
 int yaffs_O_TRUNC(void) { return O_TRUNC;}
 
-int yaffs_set_trace(unsigned int tm) { return yaffs_traceMask=tm; }
-int yaffs_get_trace(void) { return yaffs_traceMask; }
+int yaffs_set_trace(unsigned int tm) { return yaffs_trace_mask=tm; }
+int yaffs_get_trace(void) { return yaffs_trace_mask; }
 
 int yaffs_S_IFMT(void){return S_IFMT;}
 int yaffs_S_IFLNK(void){return S_IFLNK;}
index 7704820..1d0c8ff 100644 (file)
@@ -240,10 +240,10 @@ yaffs_n_handles = ylib.yaffs_n_handles
 yaffs_n_handles.argtypes = [c_char_p]
 yaffs_n_handles.restype = c_int
 
-#int yaffs_StartUp(void)
-yaffs_StartUp = ylib.yaffs_StartUp
-yaffs_StartUp.argtypes = []
-yaffs_StartUp.restype = c_int
+#int yaffs_start_up(void)
+yaffs_start_up = ylib.yaffs_start_up
+yaffs_start_up.argtypes = []
+yaffs_start_up.restype = c_int
 
 yaffs_O_CREAT=ylib.yaffs_O_CREAT()
 yaffs_O_RDONLY=ylib.yaffs_O_RDONLY()
index 6f6b4ce..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;
@@ -258,7 +258,7 @@ static void dump_directory_tree(const char *dname)
 
 static unsigned xx[XX_SIZE];
 
-static int yWriteFile(const char *fname, unsigned sz32)
+static int y_wr_file(const char *fname, unsigned sz32)
 {
        int h;
        int r;
@@ -317,7 +317,7 @@ WRITE_ERROR:
        
 }
 
-static int yVerifyFile(const char *fName)
+static int y_verify_file(const char *fName)
 {
        unsigned checksum = 0;
        unsigned totalSize;
@@ -400,7 +400,7 @@ static void DoUpdateMainFile(void)
         int sz32;
         sz32 = (myrand() % 1000)   + 20;
         
-       result = yWriteFile(fullTempMainName,sz32);
+       result = y_wr_file(fullTempMainName,sz32);
        FSX();
        if(!no_verification && result)
            FatalError(__LINE__);
@@ -414,7 +414,7 @@ static void DoVerifyMainFile(void)
         int result;
        if(no_verification)
                return;
-       result = yVerifyFile(fullMainName);
+       result = y_verify_file(fullMainName);
        if(result)
            FatalError(__LINE__);
 
index 825cf18..b35c750 100644 (file)
@@ -45,7 +45,7 @@ int n_cycles = -1;
 int fuzz_test=0;
 
 
-int yaffs_test_maxMallocs;
+int yaffs_test_max_mallocs;
 
 extern int ops_multiplier;
 
@@ -227,7 +227,7 @@ int main(int argc, char **argv)
                        n_cycles = atoi(optarg);
                        break;
                case 't':
-                       yaffs_traceMask = strtol(optarg,NULL,0);
+                       yaffs_trace_mask = strtol(optarg,NULL,0);
                        break;
                case 'z':fuzz_test=1;
                        break;
@@ -239,7 +239,7 @@ int main(int argc, char **argv)
        argv += optind;
        
        if(random_mallocs){
-               yaffs_test_maxMallocs = 0xFFF & random_seed;
+               yaffs_test_max_mallocs = 0xFFF & random_seed;
        }
        
        if(argc == 1) {
@@ -257,7 +257,7 @@ int main(int argc, char **argv)
                        simulate_power_failure ? "power_fail" : "",
                        random_seed, n_cycles);
 
-               yaffs_StartUp();
+               yaffs_start_up();
                result = yaffs_mount(mount_point);
                if(result < 0){
                        printf("Mount of %s failed\n",mount_point);
index 0a46739..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)
@@ -160,14 +160,14 @@ int yflash_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *da
        {
                yaffs_PackedTags pt;
                memcpy(&pt,&ramdisk.block[blk]->page[pg].data[512],sizeof(yaffs_PackedTags));
-               yaffs_UnpackTags(tags,&pt);
+               yaffs_unpack_tags(tags,&pt);
        }
 
        return YAFFS_OK;
 }
 
 
-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 26d4f69..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,21 +79,21 @@ 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;
-                       data = yaffs_GetTempBuffer(dev,__LINE__);
+                       data = yaffs_get_temp_buffer(dev,__LINE__);
                }
                spare = NULL;
                spareSize = 0;
@@ -103,73 +103,73 @@ 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];    
-                       yaffs_UnpackTags2TagsPart(tags,pt2tp);
+                       pt2tp = (yaffs_PackedTags2TagsPart *)&data[dev->data_bytes_per_chunk];  
+                       yaffs_unpack_tags2tags_part(tags,pt2tp);
                }
        }
        else {
                if (tags){
-                       yaffs_UnpackTags2(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)
-               yaffs_ReleaseTempBuffer(dev,data,__LINE__);
+               yaffs_release_temp_buffer(dev,data,__LINE__);
        
        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,37 +212,37 @@ int ynandif_DeinitialiseNAND(yaffs_Device *dev)
 }
 
 
-struct yaffs_DeviceStruct * 
-       yaffs_AddDeviceFromGeometry(const YCHAR *name,
+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;
-
-               yaffs_AddDevice(dev);
+               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);
 
                return dev;
        }
index cf4562c..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 * 
-       yaffs_AddDeviceFromGeometry(const YCHAR *name,
+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 2294888..f95c199 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, int getEquiv);
-static void yaffsfs_RemoveObjectCallback(yaffs_Object *obj);
+static yaffs_obj_t *yaffsfs_FindObject(yaffs_obj_t *relativeDirectory, const YCHAR *path, int symDepth, int getEquiv);
+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,13 +117,13 @@ 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;
        
        if(obj)
-               obj = yaffs_GetEquivalentObject(obj);
+               obj = yaffs_get_equivalent_obj(obj);
 
        /* Look for it in open inode table*/
        for(i = 0; i < YAFFSFS_N_HANDLES && ret < 0; i++){
@@ -137,14 +137,14 @@ 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;
        yaffsfs_Inode *in = NULL;
        
        if(obj)
-               obj = yaffs_GetEquivalentObject(obj);
+               obj = yaffs_get_equivalent_obj(obj);
 
         ret = yaffsfs_FindInodeIdForObject(obj);
 
@@ -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_DeleteObject(obj);
+               yaffs_del_obj(obj);
        
-       obj->myInode = NULL;
+       obj->my_inode = NULL;
        in->iObj = NULL;
 
 }
@@ -227,7 +227,7 @@ static int yaffsfs_GetNewHandle(void)
 }
 
 /*
- * yaffs_GetHandle
+ * yaffs_get_handle
  * Increase use of handle when reading/writing a file
  */
 static int yaffsfs_GetHandle(int handle)
@@ -241,7 +241,7 @@ static int yaffsfs_GetHandle(int handle)
 }
 
 /*
- * yaffs_PutHandle
+ * yaffs_put_handle
  * Let go of a handle when closing a file or aborting an open or
  * ending a read or write.
  */
@@ -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,26 +413,26 @@ 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)
 {
 
        if(obj)
-               obj = yaffs_GetEquivalentObject(obj);
+               obj = yaffs_get_equivalent_obj(obj);
 
-       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 */
@@ -451,10 +451,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;
@@ -501,12 +501,11 @@ static yaffs_Object *yaffsfs_DoFindDirectory(yaffs_Object *startDir,
                        else if(yaffs_strcmp(str,_Y("..")) == 0)
                                dir = dir->parent;
                        else{
-                               dir = yaffs_FindObjectByName(dir,str);
+                               dir = yaffs_find_by_name(dir,str);
 
                                dir = yaffsfs_FollowLink(dir,symDepth);
 
-
-                               if(dir && dir->variantType != YAFFS_OBJECT_TYPE_DIRECTORY)
+                               if(dir && dir->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY)
                                        dir = NULL;
                        }
                }
@@ -515,7 +514,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);
@@ -524,20 +523,21 @@ 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,int getEquiv)
+static yaffs_obj_t *yaffsfs_FindObject(yaffs_obj_t *relativeDirectory, const YCHAR *path,int symDepth, int getEquiv)
 {
-       yaffs_Object *dir;
-       yaffs_Object *obj;
+       yaffs_obj_t *dir;
+       yaffs_obj_t *obj;
        YCHAR *name;
 
        dir = yaffsfs_FindDirectory(relativeDirectory,path,&name,symDepth);
 
        if(dir && *name)
-               obj = yaffs_FindObjectByName(dir,name);
+               obj = yaffs_find_by_name(dir,name);
        else
                obj = dir;
+
        if(getEquiv)
-               obj = yaffs_GetEquivalentObject(obj);
+               obj = yaffs_get_equivalent_obj(obj);
 
        return obj;
 }
@@ -573,8 +573,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 *yh = NULL;
@@ -615,8 +615,8 @@ int yaffs_open_sharing(const YCHAR *path, int oflag, int mode, int sharing)
                obj = yaffsfs_FollowLink(obj,symDepth++);
 
                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){
@@ -624,7 +624,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;
@@ -692,11 +692,11 @@ 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)
-                               obj = yaffs_MknodFile(dir,name,mode,0,0);
+                               obj = yaffs_create_file(dir,name,mode,0,0);
                        else {
                                yaffsfs_SetError(-ENOTDIR);
                                errorReported = 1;
@@ -722,10 +722,10 @@ int yaffs_open_sharing(const YCHAR *path, int oflag, int mode, int sharing)
                        yh->shareWrite = shareWrite;
 
                        /* Hook inode to object */
-                        obj->myInode = (void*) &yaffsfs_inode[inodeId];
+                        obj->my_inode = (void*) &yaffsfs_inode[inodeId];
 
                         if((oflag & O_TRUNC) && yh->writing)
-                                yaffs_ResizeFile(obj,0);
+                                yaffs_resize_file(obj,0);
                } else {
                        yaffsfs_PutHandle(handle);
                        if(!errorReported) {
@@ -757,7 +757,7 @@ int yaffs_Dofsync(int fd,int datasync)
 
        if(h && h->useCount > 0)
                /* flush the file */
-               yaffs_FlushFile(yaffsfs_inode[h->inodeId].iObj,1,datasync);
+               yaffs_flush_file(yaffsfs_inode[h->inodeId].iObj,1,datasync);
        else {
                /* bad handle */
                yaffsfs_SetError(-EBADF);
@@ -795,7 +795,7 @@ int yaffs_close(int fd)
 
        if(h && h->useCount > 0) {
                /* clean up */
-               yaffs_FlushFile(yaffsfs_inode[h->inodeId].iObj,1,0);
+               yaffs_flush_file(yaffsfs_inode[h->inodeId].iObj,1,0);
                yaffsfs_PutHandle(fd);
                retVal = 0;
        } else {
@@ -814,7 +814,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;
@@ -839,8 +839,8 @@ int yaffsfs_do_read(int fd, void *vbuf, unsigned int nbyte, int isPread, int off
 
                pos = startPos;
                                        
-               if(yaffs_GetObjectFileLength(obj) > pos)
-                       maxRead = yaffs_GetObjectFileLength(obj) - pos;
+               if(yaffs_get_obj_length(obj) > pos)
+                       maxRead = yaffs_get_obj_length(obj) - pos;
                else
                        maxRead = 0;
 
@@ -854,7 +854,7 @@ int yaffsfs_do_read(int fd, void *vbuf, unsigned int nbyte, int isPread, int off
                        nToRead = YAFFSFS_RW_SIZE - (pos & (YAFFSFS_RW_SIZE -1));
                        if(nToRead > nbyte)
                                nToRead = nbyte;
-                       nRead = yaffs_ReadDataFromFile(obj,buf,pos,nToRead);
+                       nRead = yaffs_file_rd(obj,buf,pos,nToRead);
 
                        if(nRead > 0){
                                totalRead += nRead;
@@ -906,12 +906,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;
 
@@ -923,12 +923,12 @@ 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){
                if(h->append)
-                       startPos = yaffs_GetObjectFileLength(obj);
+                       startPos = yaffs_get_obj_length(obj);
                else if(isPwrite)
                        startPos = offset;
                else
@@ -941,7 +941,7 @@ int yaffsfs_do_write(int fd, const void *vbuf, unsigned int nbyte, int isPwrite,
                        if(nToWrite > nbyte)
                                nToWrite = nbyte;
 
-                       nWritten = yaffs_WriteDataToFile(obj,buf,pos,nToWrite,writeThrough);
+                       nWritten = yaffs_wr_file(obj,buf,pos,nToWrite,write_trhrough);
                        if(nWritten > 0){
                                totalWritten += nWritten;
                                pos += nWritten;
@@ -991,9 +991,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();
@@ -1002,12 +1002,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_ResizeFile(obj,newSize);
+               result = yaffs_resize_file(obj,new_size);
 
        yaffsfs_Unlock();
 
@@ -1015,10 +1015,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();
@@ -1028,11 +1028,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_ResizeFile(obj,newSize);
+               result = yaffs_resize_file(obj,new_size);
        yaffsfs_Unlock();
 
 
@@ -1043,7 +1043,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;
 
@@ -1063,7 +1063,7 @@ off_t yaffs_lseek(int fd, off_t offset, int whence)
                        pos = (h->position + offset);
        }
        else if(whence == SEEK_END) {
-               fSize = yaffs_GetObjectFileLength(obj);
+               fSize = yaffs_get_obj_length(obj);
                if(fSize >= 0 && (fSize + offset) >= 0)
                        pos = fSize + offset;
        }
@@ -1083,8 +1083,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;
 
@@ -1096,14 +1096,14 @@ 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_Unlink(dir,name);
+               result = yaffs_unlinker(dir,name);
 
                if(result == YAFFS_FAIL && isDirectory)
                        yaffsfs_SetError(-ENOTEMPTY);
@@ -1129,13 +1129,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();
 
@@ -1146,35 +1146,35 @@ 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)
-               result = yaffs_RenameObject(olddir,oldname,newdir,newname);
+       if(rename_allowed)
+               result = yaffs_rename_obj(olddir,oldname,newdir,newname);
 
        yaffsfs_Unlock();
 
@@ -1182,30 +1182,30 @@ 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;
 
-       obj = yaffs_GetEquivalentObject(obj);
+       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_GetObjectLinkCount(obj);
+               buf->st_nlink = yaffs_get_obj_link_count(obj);
                buf->st_uid = 0;
                buf->st_gid = 0;;
                buf->st_rdev = obj->yst_rdev;
-               buf->st_size = yaffs_GetObjectFileLength(obj);
-               buf->st_blksize = obj->myDev->nDataBytesPerChunk;
+               buf->st_size = yaffs_get_obj_length(obj);
+               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;
 
@@ -1261,7 +1261,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;
 
@@ -1285,7 +1285,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;
 
@@ -1297,7 +1297,7 @@ static int yaffs_do_setxattr(const YCHAR *path, const char *name, const void *da
                obj = yaffsfs_FollowLink(obj,0);
 
        if(obj) {
-               retVal = yaffs_SetXAttribute(obj,name,data,size,flags);
+               retVal = yaffs_set_xattrib(obj,name,data,size,flags);
                if(retVal< 0){
                        yaffsfs_SetError(retVal);
                        retVal = -1;
@@ -1326,7 +1326,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;
 
@@ -1334,7 +1334,7 @@ int yaffs_fsetxattr(int fd, const char *name, const void *data, int size, int fl
        obj = yaffsfs_GetHandleObject(fd);
 
        if(obj) {
-               retVal = yaffs_SetXAttribute(obj,name,data,size,flags);
+               retVal = yaffs_set_xattrib(obj,name,data,size,flags);
                if(retVal< 0){
                        yaffsfs_SetError(retVal);
                        retVal = -1;
@@ -1350,7 +1350,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;
 
@@ -1362,7 +1362,7 @@ static int yaffs_do_getxattr(const YCHAR *path, const char *name, void *data, in
                obj = yaffsfs_FollowLink(obj,0);
 
        if(obj) {
-               retVal = yaffs_GetXAttribute(obj,name,data,size);
+               retVal = yaffs_get_xattrib(obj,name,data,size);
                if(retVal< 0){
                        yaffsfs_SetError(retVal);
                        retVal = -1;
@@ -1390,7 +1390,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;
 
@@ -1398,7 +1398,7 @@ int yaffs_fgetxattr(int fd, const char *name, void *data, int size)
        obj = yaffsfs_GetHandleObject(fd);
 
        if(obj) {
-               retVal = yaffs_GetXAttribute(obj,name,data,size);
+               retVal = yaffs_get_xattrib(obj,name,data,size);
                if(retVal< 0){
                        yaffsfs_SetError(retVal);
                        retVal = -1;
@@ -1414,7 +1414,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;
 
@@ -1426,7 +1426,7 @@ static int yaffs_do_listxattr(const YCHAR *path, char *data, int size, int follo
                obj = yaffsfs_FollowLink(obj,0);
 
        if(obj) {
-               retVal = yaffs_ListXAttributes(obj, data,size);
+               retVal = yaffs_list_xattrib(obj, data,size);
                if(retVal< 0){
                        yaffsfs_SetError(retVal);
                        retVal = -1;
@@ -1453,7 +1453,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;
 
@@ -1461,7 +1461,7 @@ int yaffs_flistxattr(int fd, char *data, int size)
        obj = yaffsfs_GetHandleObject(fd);
 
        if(obj) {
-               retVal = yaffs_ListXAttributes(obj,data,size);
+               retVal = yaffs_list_xattrib(obj,data,size);
                if(retVal< 0){
                        yaffsfs_SetError(retVal);
                        retVal = -1;
@@ -1477,7 +1477,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;
 
@@ -1489,7 +1489,7 @@ static int yaffs_do_removexattr(const YCHAR *path, const char *name, int follow)
                obj = yaffsfs_FollowLink(obj,0);
 
        if(obj) {
-               retVal = yaffs_RemoveXAttribute(obj,name);
+               retVal = yaffs_remove_xattrib(obj,name);
                if(retVal< 0){
                        yaffsfs_SetError(retVal);
                        retVal = -1;
@@ -1516,7 +1516,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;
 
@@ -1524,7 +1524,7 @@ int yaffs_fremovexattr(int fd, const char *name)
        obj = yaffsfs_GetHandleObject(fd);
 
        if(obj){
-               retVal = yaffs_RemoveXAttribute(obj,name);
+               retVal = yaffs_remove_xattrib(obj,name);
                if(retVal< 0){
                        yaffsfs_SetError(retVal);
                        retVal = -1;
@@ -1542,7 +1542,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;
 
@@ -1581,7 +1581,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;
 
@@ -1604,7 +1604,7 @@ int yaffs_set_wince_times(int fd,
                 }
 
                 obj->dirty = 1;
-                result = yaffs_FlushFile(obj,0,0);
+                result = yaffs_flush_file(obj,0,0);
                 retVal = 0;
         } else
                /* bad handle */
@@ -1618,17 +1618,17 @@ 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;
 
        if(obj)
-               obj = yaffs_GetEquivalentObject(obj);
+               obj = yaffs_get_equivalent_obj(obj);
 
        if(obj) {
                obj->yst_mode = mode;
                obj->dirty = 1;
-               result = yaffs_FlushFile(obj,0,0);
+               result = yaffs_flush_file(obj,0,0);
        }
 
        return result == YAFFS_OK ? 0 : -1;
@@ -1637,7 +1637,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;
 
@@ -1674,7 +1674,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;
 
@@ -1684,7 +1684,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);
@@ -1698,7 +1698,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;
 
@@ -1707,7 +1707,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);
@@ -1720,8 +1720,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;
 
@@ -1730,17 +1730,17 @@ 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)
-                       dir = yaffs_MknodDirectory(parent,name,mode,0,0);
+                       dir = yaffs_create_dir(parent,name,mode,0,0);
                if(dir)
                        retVal = 0;
                else {
                        if(!parent)
                                yaffsfs_SetError(-ENOENT); /* missing path */
-                       else if (yaffs_FindObjectByName(parent,name))
+                       else if (yaffs_find_by_name(parent,name))
                                yaffsfs_SetError(-EEXIST); /* the name already exists */
                        else
                                yaffsfs_SetError(-ENOSPC); /* just assume no space */
@@ -1755,17 +1755,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));
@@ -1776,9 +1776,9 @@ int yaffs_mount2(const YCHAR *path,int readOnly)
 
        dev = yaffsfs_FindDevice(path,&dummy);
        if(dev){
-               if(!dev->isMounted){
-                       dev->readOnly = readOnly ? 1 : 0;
-                       result = yaffs_GutsInitialise(dev);
+               if(!dev->is_mounted){
+                       dev->read_only = read_only ? 1 : 0;
+                       result = yaffs_guts_initialise(dev);
                        if(result == YAFFS_FAIL)
                                /* todo error - mount failed */
                                yaffsfs_SetError(-ENOMEM);
@@ -1805,16 +1805,16 @@ 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_FlushEntireDeviceCache(dev);
-                        yaffs_CheckpointSave(dev);
+                        yaffs_flush_whole_cache(dev);
+                        yaffs_checkpoint_save(dev);
                         retVal = 0;
                         
                 } else
@@ -1830,30 +1830,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_FlushEntireDeviceCache(dev);
+                       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)
-                                       yaffs_CheckpointSave(dev);
-                               dev->readOnly =  readOnly ? 1 : 0;
+                               if(read_only)
+                                       yaffs_checkpoint_save(dev);
+                               dev->read_only =  read_only ? 1 : 0;
                                retVal = 0;
                        } else
                                yaffsfs_SetError(-EBUSY);
@@ -1873,26 +1873,26 @@ 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;
 
-                       yaffs_FlushEntireDeviceCache(dev);
-                       yaffs_CheckpointSave(dev);
+                       yaffs_flush_whole_cache(dev);
+                       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 */
                        }
 
                        if(!inUse || force){
-                               yaffs_Deinitialise(dev);
+                               yaffs_deinitialise(dev);
 
                                retVal = 0;
                        } else
@@ -1921,14 +1921,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){
-               retVal = yaffs_GetNumberOfFreeChunks(dev);
-               retVal *= dev->nDataBytesPerChunk;
+       if(dev  && dev->is_mounted){
+               retVal = yaffs_get_n_free_chunks(dev);
+               retVal *= dev->data_bytes_per_chunk;
 
        } else
                yaffsfs_SetError(-EINVAL);
@@ -1940,15 +1940,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);
@@ -1960,15 +1960,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)
@@ -1979,20 +1979,20 @@ int yaffs_inodecount(const YCHAR *path)
 }
 
 
-void yaffs_AddDevice(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_RemoveDevice(yaffs_Device *dev)
+void yaffs_remove_device(yaffs_dev_t *dev)
 {
-       ylist_del_init(&dev->devList);
+       ylist_del_init(&dev->dev_list);
 }
 
 
@@ -2012,8 +2012,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;
@@ -2027,15 +2027,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! */
        }
@@ -2045,25 +2045,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;
@@ -2090,14 +2090,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,1);
 
-       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;
@@ -2133,10 +2133,10 @@ 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_GetEquivalentObject(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_GetObjectName(dsc->nextReturn,dsc->de.d_name,NAME_MAX);
+                       yaffs_get_obj_name(dsc->nextReturn,dsc->de.d_name,NAME_MAX);
                        if(yaffs_strnlen(dsc->de.d_name,NAME_MAX+1) == 0)
                        {
                                /* this should not happen! */
@@ -2186,18 +2186,18 @@ 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_MknodSymLink(parent,name,mode,0,0,oldpath);
+               obj = yaffs_create_symlink(parent,name,mode,0,0,oldpath);
                if(obj)
                        retVal = 0;
                else{
@@ -2217,7 +2217,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;
 
 
@@ -2228,11 +2228,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;
@@ -2244,10 +2244,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();
@@ -2258,15 +2258,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;
 
@@ -2275,23 +2275,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{
@@ -2319,35 +2319,35 @@ 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,1);
 
        return yaffsfs_CountHandles(obj);
 }
 
-int yaffs_DumpDevStruct(const YCHAR *path)
+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 36b7e5a..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,15 +166,15 @@ 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_AddDevice(struct yaffs_DeviceStruct *dev);
+struct yaffs_dev_s;
+void yaffs_add_device(struct yaffs_dev_s *dev);
 
-int yaffs_StartUp(void);
+int yaffs_start_up(void);
 
 
 /* Function only for debugging */
 void * yaffs_getdev(const YCHAR *path);
-int yaffs_DumpDevStruct(const YCHAR *path);
+int yaffs_dump_dev(const YCHAR *path);
 
 #endif
 
index 677ab8a..824ce20 100644 (file)
@@ -84,7 +84,7 @@
 #define YAFFS_ROOT_MODE                                0666
 #define YAFFS_LOSTNFOUND_MODE          0666
 
-#define yaffs_SumCompare(x,y) ((x) == (y))
+#define yaffs_sum_cmp(x,y) ((x) == (y))
 #define yaffs_strcmp(a,b) strcmp(a,b)
 
 #include "yaffsfs.h"
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 8f73ac4..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 =
@@ -185,7 +185,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
        }
 
        if (tags)
-               yaffs_UnpackTags2(tags, &pt);
+               yaffs_unpack_tags2(tags, &pt);
 
        if (retval == 0)
                return YAFFS_OK;
@@ -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 b5f9606..df9b044 100644 (file)
@@ -37,7 +37,7 @@
 #include "yaffs_tagsvalidity.h"
 #include "yaffs_packedtags2.h"
 
-unsigned yaffs_traceMask=0;
+unsigned yaffs_trace_mask=0;
 
 #define MAX_OBJECTS 10000
 
@@ -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,32 +145,32 @@ 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_TagsUnion * tags = (yaffs_TagsUnion* )tagsPtr; // Work in bytes.
-    yaffs_TagsUnion   temp;
+    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];
 #endif
 }
 
@@ -181,27 +181,27 @@ 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];
 
        if (write(outFile,data,chunkSize) != chunkSize)
                fatal("write");
 
-       yaffs_InitialiseTags(&t);
+       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 e8434e8..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;
 
@@ -113,7 +113,7 @@ static int find_obj_in_list(dev_t dev, ino_t ino)
 }
 
 // NCB added 10/9/2002
-static __u16 yaffs_CalcNameSum(const char *name)
+static __u16 yaffs_calc_name_sum(const char *name)
 {
        __u16 sum = 0;
        __u16 i = 1;
@@ -130,16 +130,16 @@ static __u16 yaffs_CalcNameSum(const char *name)
 }
 
 
-static void yaffs_CalcECC(const __u8 *data, yaffs_Spare *spare)
+static void yaffs_calc_ecc(const __u8 *data, yaffs_spare *spare)
 {
-       yaffs_ECCCalculate(data , spare->ecc1);
-       yaffs_ECCCalculate(&data[256] , spare->ecc2);
+       yaffs_ecc_cacl(data , spare->ecc1);
+       yaffs_ecc_cacl(&data[256] , spare->ecc2);
 }
 
-static void yaffs_CalcTagsECC(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_TagsUnion *)tags)->asBytes;
+       unsigned char *b = ((yaffs_tags_union_t *)tags)->as_bytes;
        unsigned  i,j;
        unsigned  ecc = 0;
        unsigned bit = 0;
@@ -181,81 +181,81 @@ static void yaffs_CalcTagsECC(yaffs_Tags *tags)
         b[7] |= ((ecc & 0x3F) << 2);
     }
 }
-static void yaffs_LoadTagsIntoSpare(yaffs_Spare *sparePtr, yaffs_Tags *tagsPtr)
+static void yaffs_load_tags_to_spare(yaffs_spare *sparePtr, yaffs_tags_t *tagsPtr)
 {
-       yaffs_TagsUnion *tu = (yaffs_TagsUnion *)tagsPtr;
-       
-       //yaffs_CalcTagsECC(tagsPtr);
-       
-       sparePtr->tagByte0 = tu->asBytes[0];
-       sparePtr->tagByte1 = tu->asBytes[1];
-       sparePtr->tagByte2 = tu->asBytes[2];
-       sparePtr->tagByte3 = tu->asBytes[3];
-       sparePtr->tagByte4 = tu->asBytes[4];
-       sparePtr->tagByte5 = tu->asBytes[5];
-       sparePtr->tagByte6 = tu->asBytes[6];
-       sparePtr->tagByte7 = tu->asBytes[7];
+       yaffs_tags_union_t *tu = (yaffs_tags_union_t *)tagsPtr;
+       
+       //yaffs_calc_tags_ecc(tagsPtr);
+       
+       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_TagsUnion * tags = (yaffs_TagsUnion* )tagsPtr; // Work in bytes.
-    yaffs_TagsUnion   temp;
+    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)
     {
         little_to_big_endian(&t);
     }
        
-       yaffs_CalcTagsECC(&t);
-       yaffs_LoadTagsIntoSpare(&s,&t);
-       yaffs_CalcECC(data,&s);
+       yaffs_calc_tags_ecc(&t);
+       yaffs_load_tags_to_spare(&s,&t);
+       yaffs_calc_ecc(data,&s);
        
        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 ab44bc7..c0513d5 100644 (file)
 
 #ifdef CONFIG_YAFFS_YMALLOC_ALLOCATOR
 
-void yaffs_DeinitialiseRawTnodesAndObjects(yaffs_Device *dev)
+void yaffs_deinit_raw_tnodes_and_objs(yaffs_dev_t *dev)
 {
        dev = dev;
 }
 
-void yaffs_InitialiseRawTnodesAndObjects(yaffs_Device *dev)
+void yaffs_init_raw_tnodes_and_objs(yaffs_dev_t *dev)
 {
        dev = dev;
 }
 
-yaffs_Tnode *yaffs_AllocateRawTnode(yaffs_Device *dev)
+yaffs_tnode_t *yaffs_alloc_raw_tnode(yaffs_dev_t *dev)
 {
-       return (yaffs_Tnode *)YMALLOC(dev->tnodeSize);
+       return (yaffs_tnode_t *)YMALLOC(dev->tnode_size);
 }
 
-void yaffs_FreeRawTnode(yaffs_Device *dev, yaffs_Tnode *tn)
+void yaffs_free_raw_tnode(yaffs_dev_t *dev, yaffs_tnode_t *tn)
 {
        dev = dev;
        YFREE(tn);
 }
 
-void yaffs_InitialiseRawObjects(yaffs_Device *dev)
+void yaffs_init_raw_objs(yaffs_dev_t *dev)
 {
        dev = dev;
 }
 
-void yaffs_DeinitialiseRawObjects(yaffs_Device *dev)
+void yaffs_deinit_raw_objs(yaffs_dev_t *dev)
 {
        dev = dev;
 }
 
-yaffs_Object *yaffs_AllocateRawObject(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_FreeRawObject(yaffs_Device *dev, yaffs_Object *obj)
+void yaffs_free_raw_obj(yaffs_dev_t *dev, yaffs_obj_t *obj)
 {
 
        dev = dev;
@@ -68,43 +68,43 @@ void yaffs_FreeRawObject(yaffs_Device *dev, yaffs_Object *obj)
 
 #else
 
-struct yaffs_TnodeList_struct {
-       struct yaffs_TnodeList_struct *next;
-       yaffs_Tnode *tnodes;
+struct yaffs_tnode_list {
+       struct yaffs_tnode_list *next;
+       yaffs_tnode_t *tnodes;
 };
 
-typedef struct yaffs_TnodeList_struct yaffs_TnodeList;
+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;
-       yaffs_Tnode *freeTnodes;
+       int n_tnodesCreated;
+       yaffs_tnode_t *freeTnodes;
        int nFreeTnodes;
-       yaffs_TnodeList *allocatedTnodeList;
+       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_DeinitialiseRawTnodes(yaffs_Device *dev)
+static void yaffs_deinit_raw_tnodes(yaffs_dev_t *dev)
 {
 
        yaffs_Allocator *allocator = (yaffs_Allocator *)dev->allocator;
 
-       yaffs_TnodeList *tmp;
+       yaffs_tnodelist_t *tmp;
 
        if(!allocator){
                YBUG();
@@ -122,10 +122,10 @@ static void yaffs_DeinitialiseRawTnodes(yaffs_Device *dev)
 
        allocator->freeTnodes = NULL;
        allocator->nFreeTnodes = 0;
-       allocator->nTnodesCreated = 0;
+       allocator->n_tnodesCreated = 0;
 }
 
-static void yaffs_InitialiseRawTnodes(yaffs_Device *dev)
+static void yaffs_init_raw_tnodes(yaffs_dev_t *dev)
 {
        yaffs_Allocator *allocator = dev->allocator;
 
@@ -133,33 +133,33 @@ static void yaffs_InitialiseRawTnodes(yaffs_Device *dev)
                allocator->allocatedTnodeList = NULL;
                allocator->freeTnodes = NULL;
                allocator->nFreeTnodes = 0;
-               allocator->nTnodesCreated = 0;
+               allocator->n_tnodesCreated = 0;
        } else
                YBUG();
 }
 
-static int yaffs_CreateTnodes(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;
-       yaffs_Tnode *newTnodes;
+       yaffs_tnode_t *newTnodes;
        __u8 *mem;
-       yaffs_Tnode *curr;
-       yaffs_Tnode *next;
-       yaffs_TnodeList *tnl;
+       yaffs_tnode_t *curr;
+       yaffs_tnode_t *next;
+       yaffs_tnodelist_t *tnl;
 
        if(!allocator){
                YBUG();
                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,25 +169,25 @@ static int yaffs_CreateTnodes(yaffs_Device *dev, int nTnodes)
        }
 
        /* New hookup for wide tnodes */
-       for (i = 0; i < nTnodes - 1; i++) {
-               curr = (yaffs_Tnode *) &mem[i * dev->tnodeSize];
-               next = (yaffs_Tnode *) &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 *) &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 *)mem;
+       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
         * but it just means we can't free this bunch of tnodes later.
         */
 
-       tnl = YMALLOC(sizeof(yaffs_TnodeList));
+       tnl = YMALLOC(sizeof(yaffs_tnodelist_t));
        if (!tnl) {
                T(YAFFS_TRACE_ERROR,
                  (TSTR
@@ -205,10 +205,10 @@ static int yaffs_CreateTnodes(yaffs_Device *dev, int nTnodes)
 }
 
 
-yaffs_Tnode *yaffs_AllocateRawTnode(yaffs_Device *dev)
+yaffs_tnode_t *yaffs_alloc_raw_tnode(yaffs_dev_t *dev)
 {
        yaffs_Allocator *allocator = (yaffs_Allocator *)dev->allocator;
-       yaffs_Tnode *tn = NULL;
+       yaffs_tnode_t *tn = NULL;
 
        if(!allocator){
                YBUG();
@@ -217,7 +217,7 @@ yaffs_Tnode *yaffs_AllocateRawTnode(yaffs_Device *dev)
 
        /* If there are none left make more */
        if (!allocator->freeTnodes)
-               yaffs_CreateTnodes(dev, YAFFS_ALLOCATION_NTNODES);
+               yaffs_create_tnodes(dev, YAFFS_ALLOCATION_NTNODES);
 
        if (allocator->freeTnodes) {
                tn = allocator->freeTnodes;
@@ -229,7 +229,7 @@ yaffs_Tnode *yaffs_AllocateRawTnode(yaffs_Device *dev)
 }
 
 /* FreeTnode frees up a tnode and puts it back on the free list */
-void yaffs_FreeRawTnode(yaffs_Device *dev, yaffs_Tnode *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_FreeRawTnode(yaffs_Device *dev, yaffs_Tnode *tn)
                allocator->freeTnodes = tn;
                allocator->nFreeTnodes++;
        }
-       dev->nCheckpointBlocksRequired = 0; /* force recalculation*/
+       dev->checkpoint_blocks_required = 0; /* force recalculation*/
 }
 
 
 
-static void yaffs_InitialiseRawObjects(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_InitialiseRawObjects(yaffs_Device *dev)
                YBUG();
 }
 
-static void yaffs_DeinitialiseRawObjects(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_DeinitialiseRawObjects(yaffs_Device *dev)
 
        allocator->freeObjects = NULL;
        allocator->nFreeObjects = 0;
-       allocator->nObjectsCreated = 0;
+       allocator->n_objCreated = 0;
 }
 
 
-static int yaffs_CreateFreeObjects(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_CreateFreeObjects(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_CreateFreeObjects(yaffs_Device *dev, int nObjects)
        return YAFFS_OK;
 }
 
-yaffs_Object *yaffs_AllocateRawObject(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) {
@@ -350,12 +350,12 @@ yaffs_Object *yaffs_AllocateRawObject(yaffs_Device *dev)
 
        /* If there are none left make more */
        if (!allocator->freeObjects)
-               yaffs_CreateFreeObjects(dev, YAFFS_ALLOCATION_NOBJECTS);
+               yaffs_create_free_objs(dev, YAFFS_ALLOCATION_NOBJECTS);
 
        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_AllocateRawObject(yaffs_Device *dev)
 }
 
 
-void yaffs_FreeRawObject(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,11 +378,11 @@ void yaffs_FreeRawObject(yaffs_Device *dev, yaffs_Object *obj)
        }
 }
 
-void yaffs_DeinitialiseRawTnodesAndObjects(yaffs_Device *dev)
+void yaffs_deinit_raw_tnodes_and_objs(yaffs_dev_t *dev)
 {
        if(dev->allocator){
-               yaffs_DeinitialiseRawTnodes(dev);
-               yaffs_DeinitialiseRawObjects(dev);
+               yaffs_deinit_raw_tnodes(dev);
+               yaffs_deinit_raw_objs(dev);
 
                YFREE(dev->allocator);
                dev->allocator=NULL;
@@ -390,7 +390,7 @@ void yaffs_DeinitialiseRawTnodesAndObjects(yaffs_Device *dev)
                YBUG();
 }
 
-void yaffs_InitialiseRawTnodesAndObjects(yaffs_Device *dev)
+void yaffs_init_raw_tnodes_and_objs(yaffs_dev_t *dev)
 {
        yaffs_Allocator *allocator;
 
@@ -398,8 +398,8 @@ void yaffs_InitialiseRawTnodesAndObjects(yaffs_Device *dev)
                allocator = YMALLOC(sizeof(yaffs_Allocator));
                if(allocator){
                        dev->allocator = allocator;
-                       yaffs_InitialiseRawTnodes(dev);
-                       yaffs_InitialiseRawObjects(dev);
+                       yaffs_init_raw_tnodes(dev);
+                       yaffs_init_raw_objs(dev);
                }
        } else
                YBUG();
index b0a5d11..777f3b0 100644 (file)
 
 #include "yaffs_guts.h"
 
-void yaffs_InitialiseRawTnodesAndObjects(yaffs_Device *dev);
-void yaffs_DeinitialiseRawTnodesAndObjects(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 *yaffs_AllocateRawTnode(yaffs_Device *dev);
-void yaffs_FreeRawTnode(yaffs_Device *dev, yaffs_Tnode *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_AllocateRawObject(yaffs_Device *dev);
-void yaffs_FreeRawObject(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 c7e9e8c..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_VerifyChunkBitId(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,44 +40,44 @@ void yaffs_VerifyChunkBitId(yaffs_Device *dev, int blk, int chunk)
        }
 }
 
-void yaffs_ClearChunkBits(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_ClearChunkBit(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);
 
-       yaffs_VerifyChunkBitId(dev, blk, chunk);
+       yaffs_verify_chunk_bit_id(dev, blk, chunk);
 
        blkBits[chunk / 8] &= ~(1 << (chunk & 7));
 }
 
-void yaffs_SetChunkBit(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);
 
-       yaffs_VerifyChunkBitId(dev, blk, chunk);
+       yaffs_verify_chunk_bit_id(dev, blk, chunk);
 
        blkBits[chunk / 8] |= (1 << (chunk & 7));
 }
 
-int yaffs_CheckChunkBit(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_VerifyChunkBitId(dev, blk, chunk);
+       yaffs_verify_chunk_bit_id(dev, blk, chunk);
 
        return (blkBits[chunk / 8] & (1 << (chunk & 7))) ? 1 : 0;
 }
 
-int yaffs_StillSomeChunkBits(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_StillSomeChunkBits(yaffs_Device *dev, int blk)
        return 0;
 }
 
-int yaffs_CountChunkBits(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 a0ad130..c11ca2f 100644 (file)
 
 #include "yaffs_guts.h"
 
-void yaffs_VerifyChunkBitId(yaffs_Device *dev, int blk, int chunk);
-void yaffs_ClearChunkBits(yaffs_Device *dev, int blk);
-void yaffs_ClearChunkBit(yaffs_Device *dev, int blk, int chunk);
-void yaffs_SetChunkBit(yaffs_Device *dev, int blk, int chunk);
-int yaffs_CheckChunkBit(yaffs_Device *dev, int blk, int chunk);
-int yaffs_StillSomeChunkBits(yaffs_Device *dev, int blk);
-int yaffs_CountChunkBits(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 16c9f84..d46f563 100644 (file)
@@ -14,9 +14,9 @@
 #include "yaffs_checkptrw.h"
 #include "yaffs_getblockinfo.h"
 
-static int yaffs2_CheckpointSpaceOk(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_CheckpointSpaceOk(yaffs_Device *dev)
 }
 
 
-static int yaffs2_CheckpointErase(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_GetBlockInfo(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_CheckpointFindNextErasedBlock(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_GetBlockInfo(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_CheckpointFindNextErasedBlock(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_CheckpointFindNextCheckpointBlock(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_CheckpointFindNextCheckpointBlock(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_CheckpointOpen(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_CheckpointSpaceOk(dev))
+       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;
-               return yaffs2_CheckpointErase(dev);
+               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_GetCheckpointSum(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_CheckpointFlushBuffer(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) {
-               yaffs2_CheckpointFindNextErasedBlock(dev);
-               dev->checkpointCurrentChunk = 0;
+       if (dev->checkpt_cur_block < 0) {
+               yaffs2_checkpt_find_erased_block(dev);
+               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_GetBlockInfo(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_CheckpointWrite(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_CheckpointWrite(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)
-                       ok = yaffs2_CheckpointFlushBuffer(dev);
+               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_CheckpointRead(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,116 +285,116 @@ int yaffs2_CheckpointRead(yaffs_Device *dev, void *data, int nBytes)
 
        __u8 *dataBytes = (__u8 *)data;
 
-       if (!dev->checkpointBuffer)
+       if (!dev->checkpt_buffer)
                return 0;
 
- &n