[Yaffs] [PATCH] Remove support of yaffsram

Top Page
Attachments:
Message as email
+ (text/plain)
+ remove-yaffsram.diff (text/plain)
Delete this message
Reply to this message
Author: Luc Van Oostenryck
Date:  
To: yaffs-list
Subject: [Yaffs] [PATCH] Remove support of yaffsram
This patch remove the support for yaffsram and yaffs2ram.

diff --git a/fs/yaffs2/yaffs_fs.c b/fs/yaffs2/yaffs_fs.c
--- a/fs/yaffs2/yaffs_fs.c
+++ b/fs/yaffs2/yaffs_fs.c
@@ -75,25 +75,13 @@ extern const char *yaffs_guts_c_version;

unsigned yaffs_traceMask = YAFFS_TRACE_ALWAYS | YAFFS_TRACE_BAD_BLOCKS;
//unsigned yaffs_traceMask = 0xFFFFFFFF;


-#ifdef CONFIG_YAFFS_RAM_ENABLED
-#include "yaffs_nandemul.h"
-// 2 MB of RAM for emulation
-#define YAFFS_RAM_EMULATION_SIZE 0x200000
-#endif //CONFIG_YAFFS_RAM_ENABLED
-
-#if CONFIG_YAFFS2_RAM_ENABLED
-#include "yaffs_nandemul2k.h"
-#endif
-
-#ifdef CONFIG_YAFFS_MTD_ENABLED
#include <linux/mtd/mtd.h>
#include "yaffs_mtdif.h"
#include "yaffs_mtdif2.h"
-#endif //CONFIG_YAFFS_MTD_ENABLED

//#define T(x) printk x



@@ -1301,12 +1289,10 @@ static void yaffs_put_super(struct super
        
     kfree(dev);
 }



-#ifdef CONFIG_YAFFS_MTD_ENABLED
-
static void yaffs_MTDPutSuper(struct super_block *sb)
{
    
     struct mtd_info *mtd = yaffs_SuperToDevice(sb)->genericDevice;

    
@@ -1316,12 +1302,10 @@ static void  yaffs_MTDPutSuper(struct su
     }

    
     put_mtd_device(mtd);
 }


-#endif
-

 static struct super_block *yaffs_internal_read_super(int yaffsVersion,int useRam, struct super_block * sb, void * data, int silent)
 {
     int nBlocks;
     struct inode * inode = NULL;
@@ -1358,72 +1342,11 @@ static struct super_block *yaffs_interna
     T(YAFFS_TRACE_OS,("yaffs: Write verification disabled. All guarantees null and void\n"));
 #endif



    
-    if(useRam)
     {
-
-#ifdef CONFIG_YAFFS_RAM_ENABLED
-        // Set the yaffs_Device up for ram emulation
-
-        
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-        sb->s_fs_info =    dev = kmalloc(sizeof(yaffs_Device),GFP_KERNEL);
-#else
-        sb->u.generic_sbp = dev = kmalloc(sizeof(yaffs_Device),GFP_KERNEL);
-#endif
-
-        if(!dev)
-        {
-            // Deep shit could not allocate device structure
-            T(YAFFS_TRACE_OS,("yaffs_read_super: Failed trying to allocate yaffs_Device.\n"));
-            return NULL;
-        }
-
-        memset(dev,0,sizeof(yaffs_Device));
-        dev->genericDevice = NULL; // Not used for RAM emulation.
-
-        nBlocks = YAFFS_RAM_EMULATION_SIZE / (YAFFS_CHUNKS_PER_BLOCK * YAFFS_BYTES_PER_CHUNK);
-        dev->startBlock = 0;  
-        dev->endBlock = nBlocks - 1;
-        dev->nChunksPerBlock = YAFFS_CHUNKS_PER_BLOCK;
-        dev->nBytesPerChunk = YAFFS_BYTES_PER_CHUNK;
-        dev->nReservedBlocks = 5;
-        
-        if(yaffsVersion == 2)
-        {
-            dev->writeChunkWithTagsToNAND  = nandemul2k_WriteChunkWithTagsToNAND;
-            dev->readChunkWithTagsFromNAND = nandemul2k_ReadChunkWithTagsFromNAND;
-            dev->markNANDBlockBad          = nandemul2k_MarkNANDBlockBad;
-            dev->queryNANDBlock            = nandemul2k_QueryNANDBlock;
-            dev->eraseBlockInNAND          = nandemul2k_EraseBlockInNAND;
-            dev->initialiseNAND            = nandemul2k_InitialiseNAND;
-            dev->isYaffs2 = 1;
-            dev->nChunksPerBlock = nandemul2k_GetChunksPerBlock();
-            dev->nBytesPerChunk =  nandemul2k_GetBytesPerChunk();;
-            nBlocks = nandemul2k_GetNumberOfBlocks();
-            dev->startBlock = 0;
-            dev->endBlock = nBlocks - 1;
-        }
-        else
-        {
-            dev->writeChunkToNAND = nandemul_WriteChunkToNAND;
-            dev->readChunkFromNAND = nandemul_ReadChunkFromNAND;
-            dev->eraseBlockInNAND = nandemul_EraseBlockInNAND;
-            dev->initialiseNAND = nandemul_InitialiseNAND;
-            dev->isYaffs2 = 0;
-        }
-        
-        yaffsram_dev = dev;
-        
-#endif
-
-    }
-    else
-    {    
-#if defined(CONFIG_YAFFS_MTD_ENABLED) || defined(CONFIG_YAFFS2_MTD_ENABLED)
         struct mtd_info *mtd;

        
         T(YAFFS_TRACE_ALWAYS,("yaffs: Attempting MTD mount on %u.%u, \"%s\"\n",
          MAJOR(sb->s_dev),MINOR(sb->s_dev), yaffs_devname(sb, devname_buf)));

            
@@ -1573,11 +1496,10 @@ static struct super_block *yaffs_interna
         dev->useNANDECC = 1;
 #endif


         yaffs_dev = dev;

        
-#endif
     }


     init_MUTEX(&dev->grossLock);

    
    
@@ -1688,76 +1610,10 @@ static DECLARE_FSTYPE(yaffs2_fs_type, "y
#endif

#endif // CONFIG_YAFFS2_MTD_ENABLED


-#ifdef CONFIG_YAFFS_RAM_ENABLED
-
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-static int yaffs_internal_read_super_ram(struct super_block * sb, void * data, int silent)
-{
-     return yaffs_internal_read_super(1,1,sb,data,silent) ? 0 : -1;
-}
-
-static struct super_block *yaffs_ram_read_super(struct file_system_type * fs, int flags, const char *dev_name, void *data)
-{
-
-    return get_sb_nodev(fs, flags, data, yaffs_internal_read_super_ram);
-}
-
-
-static struct file_system_type yaffs_ram_fs_type = {
-    .owner        = THIS_MODULE,
-    .name        = "yaffsram",
-    .get_sb        = yaffs_ram_read_super,
-    .kill_sb    = kill_litter_super,
-    .fs_flags    = 0 ,
-};
-#else
-static struct super_block *yaffs_ram_read_super(struct super_block * sb, void * data, int silent)
-{
-    return yaffs_internal_read_super(1,1,sb,data,silent);
-}
-
-static DECLARE_FSTYPE(yaffs_ram_fs_type, "yaffsram", yaffs_ram_read_super, FS_SINGLE);
-#endif
-
-#endif // CONFIG_YAFFS_RAM_ENABLED
-
-#ifdef CONFIG_YAFFS2_RAM_ENABLED
-
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-static int yaffs2_internal_read_super_ram(struct super_block * sb, void * data, int silent)
-{
-     return yaffs_internal_read_super(2,1,sb,data,silent) ? 0 : -1;
-}
-
-static struct super_block *yaffs2_ram_read_super(struct file_system_type * fs, int flags, const char *dev_name, void *data)
-{
-
-    return get_sb_nodev(fs, flags, data, yaffs2_internal_read_super_ram);
-}
-
-
-static struct file_system_type yaffs2_ram_fs_type = {
-    .owner        = THIS_MODULE,
-    .name        = "yaffs2ram",
-    .get_sb        = yaffs2_ram_read_super,
-    .kill_sb    = kill_litter_super,
-    .fs_flags    = 0 ,
-};
-#else
-static struct super_block *yaffs2_ram_read_super(struct super_block * sb, void * data, int silent)
-{
-    return yaffs_internal_read_super(2,1,sb,data,silent);
-}
-
-static DECLARE_FSTYPE(yaffs2_ram_fs_type, "yaffs2ram", yaffs2_ram_read_super, FS_SINGLE);
-#endif
-
-#endif // CONFIG_YAFFS2_RAM_ENABLED
-



static struct proc_dir_entry *my_proc_entry;

 static char * yaffs_dump_dev(char *buf,yaffs_Device *dev,char *name)
@@ -1832,16 +1688,10 @@ struct file_system_to_install
    int installed;
 };


 static struct file_system_to_install fs_to_install[] =
 {
-#ifdef CONFIG_YAFFS_RAM_ENABLED
-     { &yaffs_ram_fs_type, 0},
-#endif
-#ifdef CONFIG_YAFFS2_RAM_ENABLED
-     { &yaffs2_ram_fs_type,0},
-#endif
 #ifdef CONFIG_YAFFS_MTD_ENABLED
      { &yaffs_fs_type,0},
 #endif
 #ifdef CONFIG_YAFFS2_MTD_ENABLED
      { &yaffs2_fs_type,0},
diff --git a/fs/yaffs2/yaffs_nandemul.h b/fs/yaffs2/yaffs_nandemul.h
deleted file mode 100644
--- a/fs/yaffs2/yaffs_nandemul.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * YAFFS: Yet another FFS. A NAND-flash specific file system. 
- *
- * Copyright (C) 2002 Aleph One Ltd.
- *   for Toby Churchill Ltd and Brightstar Engineering
- *
- * Created by Charles Manning <>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 2.1 as
- * published by the Free Software Foundation.
- *
- *
- * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
- *
- * yaffs_nandemul.h: Interface to emulated NAND functions
- *
- * $Id: yaffs_nandemul.h,v 1.2 2005/07/19 20:41:59 charles Exp $
- */
- 
-#ifndef __YAFFS_NANDEMUL_H__
-#define __YAFFS_NANDEMUL_H__
-
-#include "yaffs_guts.h" 
- 
- 
-/* WriteChunkToNAND and ReadChunkFromNAND are used with two pointers. 
- * If either of these pointers are null, then that field will not be 
- * transferred.
- */
- 
-int nandemul_WriteChunkToNAND(struct yaffs_DeviceStruct *dev,int chunkInNAND, const __u8 *data, const yaffs_Spare *spare);
-int nandemul_ReadChunkFromNAND(struct yaffs_DeviceStruct *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare);
-int nandemul_EraseBlockInNAND(struct yaffs_DeviceStruct *dev,int blockInNAND);
-int nandemul_InitialiseNAND(struct yaffs_DeviceStruct *dev);
-
-#endif
-
diff --git a/fs/yaffs2/yaffs_ramem.c b/fs/yaffs2/yaffs_ramem.c
deleted file mode 100644
--- a/fs/yaffs2/yaffs_ramem.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * YAFFS: Yet another FFS. A NAND-flash specific file system. 
- * yaffs_ramem.c  NAND emulation on top of a chunk of RAM
- *
- * Copyright (C) 2002 Aleph One Ltd.
- *   for Toby Churchill Ltd and Brightstar Engineering
- *
- * Created by Charles Manning <>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
- //yaffs_ramem.c
- // Since this creates the RAM block at start up it is pretty useless for testing the scanner.
-
-const char *yaffs_ramem_c_version = "$Id: yaffs_ramem.c,v 1.2 2005/07/19 20:41:59 charles Exp $";
-
-#ifndef __KERNEL__
-#define CONFIG_YAFFS_RAM_ENABLED
-#else
-#include <linux/config.h>
-#endif
-
-#ifdef CONFIG_YAFFS_RAM_ENABLED
-
-#include "yportenv.h"
-
-#include "yaffs_nandemul.h"
-#include "yaffs_guts.h"
-#include "yaffsinterface.h"
-#include "devextras.h"
-
-
-#define EM_SIZE_IN_MEG 2
-
-#define YAFFS_BLOCK_SIZE (32 * 528)
-#define BLOCKS_PER_MEG ((1024*1024)/(32 * 512))
-#define FILE_SIZE_IN_BLOCKS (FILE_SIZE_IN_MEG * BLOCKS_PER_MEG)
-#define FILE_SIZE_IN_BYTES (FILE_SIZE_IN_BLOCKS * YAFFS_BLOCK_SIZE)
-
-
-
-#define DEFAULT_SIZE_IN_MB 2
-
-typedef struct 
-{
-    __u8 data[528]; // Data + spare
-    int count[3];   // The programming count for each area of
-            // the page (0..255,256..511,512..527
-    int empty;      // is this empty?
-} nandemul_Page;
-
-typedef struct
-{
-    nandemul_Page page[32]; // The pages in the block
-    __u8 damaged;         // Is the block damaged?
-    
-} nandemul_Block;
-
-
-
-typedef struct
-{
-    nandemul_Block **block;
-    int nBlocks;
-} nandemul_Device;
-
-static nandemul_Device ned;
-
-static int sizeInMB = DEFAULT_SIZE_IN_MB;
-
-
-static void nandemul_yield(int n)
-{
-#ifdef __KERNEL__
-    if(n > 0) schedule_timeout(n);
-#endif
-
-}
-
-
-static void nandemul_ReallyEraseBlock(int blockNumber)
-{
-    int i;
-    
-    nandemul_Block *theBlock = ned.block[blockNumber];
-    
-    for(i = 0; i < 32; i++)
-    {
-        memset(theBlock->page[i].data,0xff,528);
-        theBlock->page[i].count[0] = 0;
-        theBlock->page[i].count[1] = 0;
-        theBlock->page[i].count[2] = 0;
-        theBlock->page[i].empty = 1;
-        nandemul_yield(2);
-    }
-
-}
-
-
-static int nandemul_CalcNBlocks(void)
-{
-        switch(sizeInMB)
-        {
-            case 8:
-            case 16:
-            case 32:
-            case 64:
-            case 128:
-            case 256:
-            case 512:
-                break;
-            default:
-                sizeInMB = DEFAULT_SIZE_IN_MB;
-        }
-    return sizeInMB * 64;
-}
-
-
-
-static int  CheckInit(void)
-{
-    static int initialised = 0;
-    
-    int i;
-    int fail = 0;
-    int nBlocks; 
-    int nAllocated = 0;
-    
-    if(initialised) 
-    {
-        return YAFFS_OK;
-    }
-    
-    
-    nBlocks = nandemul_CalcNBlocks();
-    
-    ned.block = YMALLOC(sizeof(nandemul_Block *) * nBlocks);
-    
-    if(!ned.block) return 0;
-    
-    for(i=0; i <nBlocks; i++)
-    {
-        ned.block[i] = NULL;
-    }
-    
-    for(i=0; i <nBlocks && !fail; i++)
-    {
-        if((ned.block[i] = YMALLOC(sizeof(nandemul_Block))) == 0)
-        {
-            fail = 1;
-        }
-        else
-        {
-            nandemul_ReallyEraseBlock(i);
-            ned.block[i]->damaged = 0;
-            nAllocated++;
-        }
-    }
-    
-    if(fail)
-    {
-        for(i = 0; i < nAllocated; i++)
-        {
-            YFREE(ned.block[i]);
-        }
-        YFREE(ned.block);
-        
-        T(YAFFS_TRACE_ALWAYS,("Allocation failed, could only allocate %dMB of %dMB requested.\n",
-           nAllocated/64,sizeInMB));
-        return 0;
-    }
-    
-    ned.nBlocks = nBlocks;
-    
-    initialised = 1;
-    
-    return 1;
-}
-
-int nandemul_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_Spare *spare)
-{
-    int blk;
-    int pg;
-    int i;
-    
-    __u8 *x;
-    
-    __u8 *spareAsBytes = (__u8 *)spare;
-
-    
-    CheckInit();
-    
-    blk = chunkInNAND/32;
-    pg = chunkInNAND%32;
-    
-    
-    if(data)
-    {
-        x = ned.block[blk]->page[pg].data;
-        
-        for(i = 0; i < 512; i++)
-        {
-            x[i] &=data[i];
-        }
-        
-        ned.block[blk]->page[pg].count[0]++;
-        ned.block[blk]->page[pg].count[1]++;
-        ned.block[blk]->page[pg].empty = 0;
-    }
-    
-    
-    if(spare)
-    {
-        x = &ned.block[blk]->page[pg].data[512];
-            
-        for(i = 0; i < 16; i++)
-        {
-            x[i] &=spareAsBytes[i];
-        }
-        ned.block[blk]->page[pg].count[2]++;
-    }
-    
-    if(spare || data)
-    {
-        nandemul_yield(1);
-    }
-
-    return YAFFS_OK;
-}
-
-
-int nandemul_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare)
-{
-    int blk;
-    int pg;
-
-    
-    CheckInit();
-    
-    blk = chunkInNAND/32;
-    pg = chunkInNAND%32;
-    
-    
-    if(data)
-    {
-        memcpy(data,ned.block[blk]->page[pg].data,512);
-    }
-    
-    
-    if(spare)
-    {
-        memcpy(spare,&ned.block[blk]->page[pg].data[512],16);
-    }
-
-    return YAFFS_OK;
-}
-
-
-static int nandemul_CheckChunkErased(yaffs_Device *dev,int chunkInNAND)
-{
-    int blk;
-    int pg;
-    int i;
-
-    
-    CheckInit();
-    
-    blk = chunkInNAND/32;
-    pg = chunkInNAND%32;
-    
-    
-    for(i = 0; i < 528; i++)
-    {
-        if(ned.block[blk]->page[pg].data[i] != 0xFF)
-        {
-            return YAFFS_FAIL;
-        }
-    }
-
-    return YAFFS_OK;
-
-}
-
-int nandemul_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
-{
-    
-    CheckInit();
-    
-    if(blockNumber < 0 || blockNumber >= ned.nBlocks)
-    {
-        T(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));
-    }
-    else
-    {
-        nandemul_ReallyEraseBlock(blockNumber);
-    }
-    
-    return YAFFS_OK;
-}
-
-int nandemul_InitialiseNAND(yaffs_Device *dev)
-{
-    return YAFFS_OK;
-}
-
-#endif //YAFFS_RAM_ENABLED
-
diff --git a/fs/yaffs2/yaffs_ramem2k.c b/fs/yaffs2/yaffs_ramem2k.c
deleted file mode 100644
--- a/fs/yaffs2/yaffs_ramem2k.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * YAFFS: Yet another FFS. A NAND-flash specific file system. 
- * yaffs_ramem.c  NAND emulation on top of a chunk of RAM
- *
- * Copyright (C) 2002 Aleph One Ltd.
- *   for Toby Churchill Ltd and Brightstar Engineering
- *
- * Created by Charles Manning <>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
- //yaffs_ramem2k.c: RAM emulation in-kernel for 2K pages (YAFFS2)
-
-
-const char *yaffs_ramem2k_c_version = "$Id: yaffs_ramem2k.c,v 1.2 2005/04/24 09:26:08 charles Exp $";
-
-#ifndef __KERNEL__
-#define CONFIG_YAFFS_RAM_ENABLED
-#else
-#include <linux/config.h>
-#endif
-
-#ifdef CONFIG_YAFFS_RAM_ENABLED
-
-#include "yportenv.h"
-
-#include "yaffs_nandemul2k.h"
-#include "yaffs_guts.h"
-#include "yaffsinterface.h"
-#include "devextras.h"
-#include "yaffs_packedtags2.h"
-
-
-
-#define EM_SIZE_IN_MEG (32)
-#define PAGE_DATA_SIZE  (2048)
-#define PAGE_SPARE_SIZE (64)
-#define PAGES_PER_BLOCK (64)
-
-
-
-#define EM_SIZE_IN_BYTES (EM_SIZE_IN_MEG * (1<<20))
-
-#define PAGE_TOTAL_SIZE (PAGE_DATA_SIZE+PAGE_SPARE_SIZE)
-
-#define BLOCK_TOTAL_SIZE (PAGES_PER_BLOCK * PAGE_TOTAL_SIZE)
-
-#define BLOCKS_PER_MEG ((1<<20)/(PAGES_PER_BLOCK * PAGE_DATA_SIZE))
-
-
-typedef struct 
-{
-    __u8 data[PAGE_TOTAL_SIZE]; // Data + spare
-    int empty;      // is this empty?
-} nandemul_Page;
-
-
-typedef struct
-{
-    nandemul_Page *page[PAGES_PER_BLOCK];
-    int damaged;    
-} nandemul_Block;
-
-
-
-typedef struct
-{
-    nandemul_Block**block;
-    int nBlocks;
-} nandemul_Device;
-
-static nandemul_Device ned;
-
-static int sizeInMB = EM_SIZE_IN_MEG;
-
-
-static void nandemul_yield(int n)
-{
-#ifdef __KERNEL__
-    if(n > 0) schedule_timeout(n);
-#endif
-
-}
-
-
-static void nandemul_ReallyEraseBlock(int blockNumber)
-{
-    int i;
-    
-    nandemul_Block *blk;
-    
-    if(blockNumber < 0 || blockNumber >= ned.nBlocks)
-    {
-        return;
-    }
-    
-    blk = ned.block[blockNumber];
-    
-    for(i = 0; i < PAGES_PER_BLOCK; i++)
-    {
-        memset(blk->page[i],0xff,sizeof(nandemul_Page));
-        blk->page[i]->empty = 1;
-    }
-    nandemul_yield(2);
-}
-
-
-static int nandemul2k_CalcNBlocks(void)
-{
-    return EM_SIZE_IN_MEG * BLOCKS_PER_MEG;
-}
-
-
-
-static int  CheckInit(void)
-{
-    static int initialised = 0;
-    
-    int i,j;
-    
-    int fail = 0;
-    int nBlocks; 
-
-    int nAllocated = 0;
-    
-    if(initialised) 
-    {
-        return YAFFS_OK;
-    }
-    
-    
-    ned.nBlocks = nBlocks = nandemul2k_CalcNBlocks();
-
-    
-    ned.block = YMALLOC(sizeof(nandemul_Block*) * nBlocks );
-    
-    if(!ned.block) return YAFFS_FAIL;
-    
-    
-    
-
-        
-    for(i=fail=0; i <nBlocks; i++)
-    {
-        
-        nandemul_Block *blk;
-        
-        if(!(blk = ned.block[i] = YMALLOC(sizeof(nandemul_Block))))
-        {
-         fail = 1;
-        }  
-        else
-        {
-            for(j = 0; j < PAGES_PER_BLOCK; j++)
-            {
-                if((blk->page[j] = YMALLOC(sizeof(nandemul_Page))) == 0)
-                {
-                    fail = 1;
-                }
-            }
-            nandemul_ReallyEraseBlock(i);
-            ned.block[i]->damaged = 0;
-            nAllocated++;
-        }
-    }
-    
-    if(fail)
-    {
-        //Todo thump pages
-        
-        for(i = 0; i < nAllocated; i++)
-        {
-            YFREE(ned.block[i]);
-        }
-        YFREE(ned.block);
-        
-        T(YAFFS_TRACE_ALWAYS,("Allocation failed, could only allocate %dMB of %dMB requested.\n",
-           nAllocated/64,sizeInMB));
-        return 0;
-    }
-    
-    ned.nBlocks = nBlocks;
-    
-    initialised = 1;
-    
-    return 1;
-}
-
-int nandemul2k_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, yaffs_ExtendedTags *tags)
-{
-    int blk;
-    int pg;
-    int i;
-    
-    __u8 *x;
-
-    
-    blk = chunkInNAND/PAGES_PER_BLOCK;
-    pg = chunkInNAND%PAGES_PER_BLOCK;
-    
-    
-    if(data)
-    {
-        x = ned.block[blk]->page[pg]->data;
-        
-        for(i = 0; i < PAGE_DATA_SIZE; i++)
-        {
-            x[i] &=data[i];
-        }
-
-        ned.block[blk]->page[pg]->empty = 0;
-    }
-    
-    
-    if(tags)
-    {
-        x = &ned.block[blk]->page[pg]->data[PAGE_DATA_SIZE];
-        
-        yaffs_PackTags2((yaffs_PackedTags2 *)x,tags);
-            
-    }
-    
-    if(tags || data)
-    {
-        nandemul_yield(1);
-    }
-
-    return YAFFS_OK;
-}
-
-
-int nandemul2k_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_ExtendedTags *tags)
-{
-    int blk;
-    int pg;
-    
-    __u8 *x;
-
-    
-    
-    blk = chunkInNAND/PAGES_PER_BLOCK;
-    pg = chunkInNAND%PAGES_PER_BLOCK;
-    
-    
-    if(data)
-    {
-        memcpy(data,ned.block[blk]->page[pg]->data,PAGE_DATA_SIZE);
-    }
-    
-    
-    if(tags)
-    {
-        x = &ned.block[blk]->page[pg]->data[PAGE_DATA_SIZE];
-        
-        yaffs_UnpackTags2(tags,(yaffs_PackedTags2 *)x);
-    }
-
-    return YAFFS_OK;
-}
-
-
-static int nandemul2k_CheckChunkErased(yaffs_Device *dev,int chunkInNAND)
-{
-    int blk;
-    int pg;
-    int i;
-
-    
-    
-    blk = chunkInNAND/PAGES_PER_BLOCK;
-    pg = chunkInNAND%PAGES_PER_BLOCK;
-    
-    
-    for(i = 0; i < PAGE_TOTAL_SIZE; i++)
-    {
-        if(ned.block[blk]->page[pg]->data[i] != 0xFF)
-        {
-            return YAFFS_FAIL;
-        }
-    }
-
-    return YAFFS_OK;
-
-}
-
-int nandemul2k_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
-{
-    
-    
-    if(blockNumber < 0 || blockNumber >= ned.nBlocks)
-    {
-        T(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));
-    }
-    else
-    {
-        nandemul_ReallyEraseBlock(blockNumber);
-    }
-    
-    return YAFFS_OK;
-}
-
-int nandemul2k_InitialiseNAND(yaffs_Device *dev)
-{
-    CheckInit();
-    return YAFFS_OK;
-}
- 
-int nandemul2k_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
-{
-    
-    __u8 *x;
-    
-    x = &ned.block[blockNo]->page[0]->data[PAGE_DATA_SIZE];
-    
-    memset(x,0,sizeof(yaffs_PackedTags2));
-    
-    
-    return YAFFS_OK;
-    
-}
-
-int nandemul2k_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, yaffs_BlockState *state, int *sequenceNumber)
-{
-    yaffs_ExtendedTags tags;
-    int chunkNo;
-
-    *sequenceNumber = 0;
-    
-    chunkNo = blockNo * dev->nChunksPerBlock;
-    
-    nandemul2k_ReadChunkWithTagsFromNAND(dev,chunkNo,NULL,&tags);
-    if(tags.blockBad)
-    {
-        *state = YAFFS_BLOCK_STATE_DEAD;
-    }
-    else if(!tags.chunkUsed)
-    {
-        *state = YAFFS_BLOCK_STATE_EMPTY;
-    }
-    else if(tags.chunkUsed)
-    {
-        *state = YAFFS_BLOCK_STATE_NEEDS_SCANNING;
-        *sequenceNumber = tags.sequenceNumber;
-    }
-    return YAFFS_OK;
-}
-
-int nandemul2k_GetBytesPerChunk(void) { return PAGE_DATA_SIZE;}
-
-int nandemul2k_GetChunksPerBlock(void) { return PAGES_PER_BLOCK; }
-int nandemul2k_GetNumberOfBlocks(void) {return nandemul2k_CalcNBlocks();}
-
-
-#endif //YAFFS_RAM_ENABLED
-