-
-#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
- {
-#ifdef CONFIG_YAFFS_MTD_ENABLED