Index: linux-2.6.9/fs/yaffs/yaffs_fs.c
===================================================================
--- linux-2.6.9.orig/fs/yaffs/yaffs_fs.c
+++ linux-2.6.9/fs/yaffs/yaffs_fs.c
@@ -103,7 +103,9 @@
static void yaffs_put_super(struct super_block *sb);
+#if !defined(CONFIG_YAFFS_USE_GENERIC_RW)
static ssize_t yaffs_file_read(struct file *f, char *buf, size_t n, loff_t *pos);
+#endif
static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n, loff_t *pos);
static int yaffs_file_flush(struct file* file);
@@ -141,19 +143,25 @@
#endif
static void yaffs_read_inode (struct inode *inode);
+#ifdef CONFIG_YAFFS_MTD_ENABLED
//#if defined(CONFIG_KERNEL_2_5)
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
static struct super_block *yaffs_read_super(struct file_system_type * fs, int flags, const char *dev_name, void *data);
#else
static struct super_block *yaffs_read_super(struct super_block * sb, void * data, int silent);
#endif
+#endif
static void yaffs_put_inode (struct inode *inode);
static void yaffs_delete_inode(struct inode *);
static void yaffs_clear_inode(struct inode *);
static int yaffs_readpage(struct file *file, struct page * page);
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+static int yaffs_writepage(struct page *page, struct writeback_control *wbc);
+#else
static int yaffs_writepage(struct page *page);
+#endif
static int yaffs_prepare_write(struct file *f, struct page *pg, unsigned offset, unsigned to);
static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset, unsigned to);
@@ -499,7 +507,11 @@
// writepage inspired by/stolen from smbfs
//
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+static int yaffs_writepage(struct page *page, struct writeback_control *wbc)
+#else
static int yaffs_writepage(struct page *page)
+#endif
{
struct address_space *mapping = page->mapping;
struct inode *inode;
@@ -677,6 +689,7 @@
return inode;
}
+#if !defined(CONFIG_YAFFS_USE_GENERIC_RW)
static ssize_t yaffs_file_read(struct file *f, char *buf, size_t n, loff_t *pos)
{
yaffs_Object *obj;
@@ -720,6 +733,7 @@
return nRead;
}
+#endif
static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n, loff_t *pos)
@@ -1330,6 +1344,10 @@
yaffsram_dev = dev;
+#else
+ /* Resolve compile warning that dev might not be initialized. */
+ printk(KERN_ERR "yaffs: not RAM_ENABLED but useRam true");
+ return NULL;
#endif
}
@@ -1438,6 +1456,10 @@
yaffs_dev = dev;
+#else
+ /* Resolve compile warning that dev might not be initialized. */
+ printk(KERN_ERR "yaffs: not MTD_ENABLED but useRam false");
+ return NULL;
#endif
}
@@ -1478,14 +1500,19 @@
return sb;
}
+#ifdef CONFIG_YAFFS_RAM_ENABLED
static int yaffs_internal_read_super_ram(struct super_block * sb, void * data, int silent)
{
return yaffs_internal_read_super(1,sb,data,silent) ? 0 : -1;
}
+#endif
+
+#ifdef CONFIG_YAFFS_MTD_ENABLED
static int yaffs_internal_read_super_mtd(struct super_block * sb, void * data, int silent)
{
return yaffs_internal_read_super(0,sb,data,silent) ? 0 : -1;
}
+#endif
#ifdef CONFIG_YAFFS_MTD_ENABLED
@@ -1551,7 +1578,9 @@
static struct proc_dir_entry *my_proc_entry;
+#if 0
static struct proc_dir_entry *my_proc_ram_write_entry;
+#endif
static char * yaffs_dump_dev(char *buf,yaffs_Device *dev,char *name)
{
@@ -1616,6 +1645,7 @@
}
+#if 0
static int yaffs_proc_ram_write(
char *page,
char **start,
@@ -1629,6 +1659,7 @@
printk(KERN_DEBUG "yaffs write size %d\n",count);
return count;
}
+#endif
static int __init init_yaffs_fs(void)
{
Index: linux-2.6.9/fs/yaffs/yaffs_guts.c
===================================================================
--- linux-2.6.9.orig/fs/yaffs/yaffs_guts.c
+++ linux-2.6.9/fs/yaffs/yaffs_guts.c
@@ -69,7 +69,7 @@
// Local prototypes
-static int yaffs_CheckObjectHashSanity(yaffs_Device *dev);
+static void yaffs_CheckObjectHashSanity(yaffs_Device *dev);
static void yaffs_LoadTagsIntoSpare(yaffs_Spare *sparePtr, yaffs_Tags *tagsPtr);
static void yaffs_GetTagsFromSpare(yaffs_Device *dev, yaffs_Spare *sparePtr,yaffs_Tags *tagsPtr);
static int yaffs_PutChunkIntoFile(yaffs_Object *in,int chunkInInode, int chunkInNAND, int inScan);
@@ -92,7 +92,9 @@
static void yaffs_HandleWriteChunkOk(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_Spare *spare);
static void yaffs_HandleUpdateChunk(yaffs_Device *dev,int chunkInNAND, const yaffs_Spare *spare);
+#ifndef CONFIG_YAFFS_DISABLE_CHUNK_ERASED_CHECK
static int yaffs_CheckChunkErased(struct yaffs_DeviceStruct *dev,int chunkInNAND);
+#endif
static int yaffs_UnlinkWorker(yaffs_Object *obj);
static void yaffs_AbortHalfCreatedObject(yaffs_Object *obj);
@@ -118,6 +120,18 @@
static void yaffs_InvalidateWholeChunkCache(yaffs_Object *in);
static void yaffs_InvalidateChunkCache(yaffs_Object *object, int chunkId);
+
+#undef DEBUG_OBJECT_TEST
+#ifndef DEBUG_OBJECT_TEST
+static __inline__ void yaffs_CheckObjectHashSanity(yaffs_Device *dev)
+{
+}
+
+void __inline__ yaffs_ObjectTest(yaffs_Device *dev)
+{
+}
+#endif
+
// Chunk bitmap manipulations
static __inline __u8 *yaffs_BlockBits(yaffs_Device *dev, int blk)
@@ -316,6 +330,7 @@
}
+#ifndef CONFIG_YAFFS_DISABLE_CHUNK_ERASED_CHECK
static int yaffs_CheckChunkErased(struct yaffs_DeviceStruct *dev,int chunkInNAND)
{
@@ -340,6 +355,7 @@
return YAFFS_OK;
}
+#endif
@@ -452,6 +468,7 @@
+#if 0
static int yaffs_RewriteBufferedBlock(yaffs_Device *dev)
{
dev->doingBufferedBlockRewrite = 1;
@@ -464,6 +481,7 @@
return 1;
}
+#endif
static void yaffs_HandleReadDataError(yaffs_Device *dev,int chunkInNAND)
@@ -480,10 +498,11 @@
// NB recursion
}
-
+#if 0
static void yaffs_CheckWrittenBlock(yaffs_Device *dev,int chunkInNAND)
{
}
+#endif
static void yaffs_HandleWriteChunkOk(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_Spare *spare)
{
@@ -1118,12 +1137,8 @@
static int yaffs_SoftDeleteWorker(yaffs_Object *in, yaffs_Tnode *tn, __u32 level, int chunkOffset)
{
int i;
- int chunkInInode;
int theChunk;
yaffs_BlockInfo *theBlock;
- yaffs_Tags tags;
- int found;
- int chunkDeleted;
int allDone = 1;
@@ -1571,7 +1586,7 @@
__u32 n = (__u32)bucket;
- //yaffs_CheckObjectHashSanity();
+ yaffs_CheckObjectHashSanity(dev);
while(!found)
{
@@ -1914,7 +1929,8 @@
-static int yaffs_CheckObjectHashSanity(yaffs_Device *dev)
+#ifdef DEBUG_OBJECT_TEST
+static void yaffs_CheckObjectHashSanity(yaffs_Device *dev)
{
// Scan the buckets and check that the lists
// have as many members as the count says there are
@@ -1938,11 +1954,8 @@
ok = YAFFS_FAIL;
}
}
-
- return ok;
}
-#if 0
void yaffs_ObjectTest(yaffs_Device *dev)
{
yaffs_Object *in[1000];
@@ -1998,7 +2011,6 @@
}
}
-
#endif
/////////////////////////// Block Management and Page Allocation ///////////////////
@@ -2338,6 +2350,7 @@
}
+#if 0
static yaffs_Object *yaffs_FindDeletedUnlinkedFile(yaffs_Device *dev)
{
// find a file to delete
@@ -2359,8 +2372,10 @@
}
return NULL;
}
+#endif
+#if 0
static void yaffs_DoUnlinkedFileDeletion(yaffs_Device *dev)
{
// This does background deletion on unlinked files.. only deleted ones.
@@ -2396,6 +2411,7 @@
}
}
}
+#endif
#if 0
@@ -3139,13 +3155,16 @@
int i;
yaffs_ChunkCache *cache;
int chunkWritten;
+#if 0
int nBytes;
+#endif
int nCaches = obj->myDev->nShortOpCaches;
if (nCaches > 0)
{
do{
cache = NULL;
+ lowest = YAFFS_MAX_CHUNK_ID; /* eliminate compile warning */
// Find the dirty cache for this object with the lowest chunk id.
for(i = 0; i < nCaches; i++)
Index: linux-2.6.9/fs/yaffs/yaffs_fileem.c
===================================================================
--- linux-2.6.9.orig/fs/yaffs/yaffs_fileem.c
+++ linux-2.6.9/fs/yaffs/yaffs_fileem.c
@@ -30,10 +30,10 @@
// #define YAFFS_ERROR_TESTING
-#define BLOCK_SIZE (32 * 528)
+#define NAND_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 * BLOCK_SIZE)
+#define FILE_SIZE_IN_BYTES (FILE_SIZE_IN_BLOCKS * NAND_BLOCK_SIZE)
static int h;
@@ -250,7 +250,7 @@
printf("Erasing block %d\n",blockInNAND);
}
- lseek(h,blockInNAND * BLOCK_SIZE,SEEK_SET);
+ lseek(h,blockInNAND * NAND_BLOCK_SIZE,SEEK_SET);
for(i = 0; i < 32; i++)
{
write(h,ffChunk,528);
Index: linux-2.6.9/fs/yaffs/yaffs_ramem.c
===================================================================
--- linux-2.6.9.orig/fs/yaffs/yaffs_ramem.c
+++ linux-2.6.9/fs/yaffs/yaffs_ramem.c
@@ -35,10 +35,10 @@
#define EM_SIZE_IN_MEG 2
-#define BLOCK_SIZE (32 * 528)
+#define NAND_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 * BLOCK_SIZE)
+#define FILE_SIZE_IN_BYTES (FILE_SIZE_IN_BLOCKS * NAND_BLOCK_SIZE)
Index: linux-2.6.9/fs/yaffs/devextras.h
===================================================================
--- linux-2.6.9.orig/fs/yaffs/devextras.h
+++ linux-2.6.9/fs/yaffs/devextras.h
@@ -201,6 +201,7 @@
+#ifndef DT_UNKNOWN
/*
* File types
*/
@@ -213,6 +214,7 @@
#define DT_LNK 10
#define DT_SOCK 12
#define DT_WHT 14
+#endif
#ifndef WIN32
#include <sys/stat.h>