/*
* YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
*
- * Copyright (C) 2002-2010 Aleph One Ltd.
+ * Copyright (C) 2002-2011 Aleph One Ltd.
* for Toby Churchill Ltd and Brightstar Engineering
*
* Created by Charles Manning <charles@aleph1.co.uk>
#include "yaffs_ramdisk.h"
#include "yaffs_guts.h"
-#include "devextras.h"
#include "yaffs_packedtags1.h"
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;
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;
}
{
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;
}
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));
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);
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
return YAFFS_OK;
}
-