yaffs Added some more tests to timothy_tests.
[yaffs2.git] / direct / basic-test / yaffs_ramem2k.c
index 7028a82..e86760b 100644 (file)
@@ -31,7 +31,6 @@ const char *yaffs_ramem2k_c_version = "$Id: yaffs_ramem2k.c,v 1.8 2010-02-18 01:
 
 #include "yaffs_nandemul2k.h"
 #include "yaffs_guts.h"
-#include "devextras.h"
 #include "yaffs_packedtags2.h"
 
 
@@ -136,7 +135,7 @@ static int  CheckInit(void)
        ned.nBlocks = nBlocks = nandemul2k_CalcNBlocks();
 
        
-       ned.block = YMALLOC(sizeof(nandemul_Block*) * nBlocks );
+       ned.block = malloc(sizeof(nandemul_Block*) * nBlocks );
        
        if(!ned.block) return YAFFS_FAIL;
        
@@ -149,7 +148,7 @@ static int  CheckInit(void)
                
                nandemul_Block *blk;
                
-               if(!(blk = ned.block[i] = YMALLOC(sizeof(nandemul_Block))))
+               if(!(blk = ned.block[i] = malloc(sizeof(nandemul_Block))))
                {
                 fail = 1;
                }  
@@ -157,7 +156,7 @@ static int  CheckInit(void)
                {
                        for(j = 0; j < PAGES_PER_BLOCK; j++)
                        {
-                               if((blk->page[j] = YMALLOC(sizeof(nandemul_Page))) == 0)
+                               if((blk->page[j] = malloc(sizeof(nandemul_Page))) == 0)
                                {
                                        fail = 1;
                                }
@@ -174,12 +173,13 @@ static int  CheckInit(void)
                
                for(i = 0; i < nAllocated; i++)
                {
-                       YFREE(ned.block[i]);
+                       kfree(ned.block[i]);
                }
-               YFREE(ned.block);
+               kfree(ned.block);
                
-               T(YAFFS_TRACE_ALWAYS,("Allocation failed, could only allocate %dMB of %dMB requested.\n",
-                  nAllocated/64,sizeInMB));
+               yaffs_trace(YAFFS_TRACE_ALWAYS,
+                       "Allocation failed, could only allocate %dMB of %dMB requested.\n",
+                       nAllocated/64,sizeInMB);
                return 0;
        }
        
@@ -190,7 +190,7 @@ static int  CheckInit(void)
        return 1;
 }
 
-int nandemul2k_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_ext_tags *tags)
+int nandemul2k_WriteChunkWithTagsToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const struct yaffs_ext_tags *tags)
 {
        int blk;
        int pg;
@@ -220,7 +220,7 @@ int nandemul2k_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const u8
        {
                x = &ned.block[blk]->page[pg]->data[PAGE_DATA_SIZE];
                
-               yaffs_pack_tags2((yaffs_packed_tags2 *)x,tags, !dev->param.no_tags_ecc);
+               yaffs_pack_tags2((struct yaffs_packed_tags2 *)x,tags, !dev->param.no_tags_ecc);
                        
        }
        
@@ -233,7 +233,7 @@ int nandemul2k_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const u8
 }
 
 
-int nandemul2k_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_ext_tags *tags)
+int nandemul2k_ReadChunkWithTagsFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, struct yaffs_ext_tags *tags)
 {
        int blk;
        int pg;
@@ -256,14 +256,14 @@ int nandemul2k_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *da
        {
                x = &ned.block[blk]->page[pg]->data[PAGE_DATA_SIZE];
                
-               yaffs_unpack_tags2(tags,(yaffs_packed_tags2 *)x, !dev->param.no_tags_ecc);
+               yaffs_unpack_tags2(tags,(struct yaffs_packed_tags2 *)x, !dev->param.no_tags_ecc);
        }
 
        return YAFFS_OK;
 }
 
 
-static int nandemul2k_CheckChunkErased(yaffs_dev_t *dev,int nand_chunk)
+static int nandemul2k_CheckChunkErased(struct yaffs_dev *dev,int nand_chunk)
 {
        int blk;
        int pg;
@@ -287,17 +287,21 @@ static int nandemul2k_CheckChunkErased(yaffs_dev_t *dev,int nand_chunk)
 
 }
 
-int nandemul2k_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber)
+int nandemul2k_EraseBlockInNAND(struct yaffs_dev *dev, int blockNumber)
 {
        
        
        if(blockNumber < 0 || blockNumber >= ned.nBlocks)
        {
-               T(YAFFS_TRACE_ALWAYS,("Attempt to erase non-existant block %d\n",blockNumber));
+               yaffs_trace(YAFFS_TRACE_ALWAYS,
+                       "Attempt to erase non-existant block %d\n",
+                       blockNumber);
        }
        else if(ned.block[blockNumber]->damaged)
        {
-               T(YAFFS_TRACE_ALWAYS,("Attempt to erase damaged block %d\n",blockNumber));
+               yaffs_trace(YAFFS_TRACE_ALWAYS,
+                       "Attempt to erase damaged block %d\n",
+                       blockNumber);
        }
        else
        {
@@ -307,29 +311,29 @@ int nandemul2k_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber)
        return YAFFS_OK;
 }
 
-int nandemul2k_InitialiseNAND(yaffs_dev_t *dev)
+int nandemul2k_InitialiseNAND(struct yaffs_dev *dev)
 {
        CheckInit();
        return YAFFS_OK;
 }
  
-int nandemul2k_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no)
+int nandemul2k_MarkNANDBlockBad(struct yaffs_dev *dev, int block_no)
 {
        
        u8 *x;
        
        x = &ned.block[block_no]->page[0]->data[PAGE_DATA_SIZE];
        
-       memset(x,0,sizeof(yaffs_packed_tags2));
+       memset(x,0,sizeof(struct yaffs_packed_tags2));
        
        
        return YAFFS_OK;
        
 }
 
-int nandemul2k_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, u32  *seq_number)
+int nandemul2k_QueryNANDBlock(struct yaffs_dev *dev, int block_no, enum yaffs_block_state *state, u32  *seq_number)
 {
-       yaffs_ext_tags tags;
+       struct yaffs_ext_tags tags;
        int chunkNo;
 
        *seq_number = 0;