yaffs Added some more tests to timothy_tests.
[yaffs2.git] / direct / basic-test / yaffs_ramdisk.c
index e9fe6dcbc6417e317c291d07a64d3261f155f004..5d389b973f5a57c9ef9f57d67552646b255b1e5d 100644 (file)
@@ -26,7 +26,6 @@ const char *yaffs_ramdisk_c_version = "$Id: yaffs_ramdisk.c,v 1.6 2010-01-11 04:
 
 #include "yaffs_ramdisk.h"
 #include "yaffs_guts.h"
-#include "devextras.h"
 #include "yaffs_packedtags1.h"
 
 
@@ -80,7 +79,7 @@ static int  CheckInit(struct yaffs_dev *dev)
        
        ramdisk.nBlocks = (SIZE_IN_MB * 1024 * 1024)/(16 * 1024);
        
-       ramdisk.block = YMALLOC(sizeof(yramdisk_block *) * ramdisk.nBlocks);
+       ramdisk.block = malloc(sizeof(yramdisk_block *) * ramdisk.nBlocks);
        
        if(!ramdisk.block) return 0;
        
@@ -91,7 +90,7 @@ static int  CheckInit(struct yaffs_dev *dev)
        
        for(i=0; i <ramdisk.nBlocks && !fail; i++)
        {
-               if((ramdisk.block[i] = YMALLOC(sizeof(yramdisk_block))) == 0)
+               if((ramdisk.block[i] = malloc(sizeof(yramdisk_block))) == 0)
                {
                        fail = 1;
                }
@@ -106,12 +105,13 @@ static int  CheckInit(struct yaffs_dev *dev)
        {
                for(i = 0; i < nAllocated; i++)
                {
-                       YFREE(ramdisk.block[i]);
+                       kfree(ramdisk.block[i]);
                }
-               YFREE(ramdisk.block);
+               kfree(ramdisk.block);
                
-               T(YAFFS_TRACE_ALWAYS,("Allocation failed, could only allocate %dMB of %dMB requested.\n",
-                  nAllocated/64,ramdisk.nBlocks * 528));
+               yaffs_trace(YAFFS_TRACE_ALWAYS,
+                       "Allocation failed, could only allocate %dMB of %dMB requested.\n",
+                       nAllocated/64,ramdisk.nBlocks * 528);
                return 0;
        }
        
@@ -139,7 +139,7 @@ int yramdisk_wr_chunk(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const
        
        if(tags)
        {
-               yaffs_packed_tags1 pt;
+               struct yaffs_packed_tags1 pt;
                
                yaffs_pack_tags1(&pt,tags);
                memcpy(&ramdisk.block[blk]->page[pg].data[512],&pt,sizeof(pt));
@@ -170,7 +170,7 @@ int yramdisk_rd_chunk(struct yaffs_dev *dev,int nand_chunk, u8 *data, struct yaf
        
        if(tags)
        {
-               yaffs_packed_tags1 pt;
+               struct yaffs_packed_tags1 pt;
                
                memcpy(&pt,&ramdisk.block[blk]->page[pg].data[512],sizeof(pt));
                yaffs_unpack_tags1(tags,&pt);
@@ -213,7 +213,9 @@ int yramdisk_erase(struct yaffs_dev *dev, int blockNumber)
        
        if(blockNumber < 0 || blockNumber >= ramdisk.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);
                return YAFFS_FAIL;
        }
        else
@@ -232,4 +234,3 @@ int yramdisk_initialise(struct yaffs_dev *dev)
        return YAFFS_OK;
 }
 
-