Tighten compilation flags and clean up. More to follow...
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
CFLAGS = -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2
CFLAGS += -DCONFIG_YAFFS_PROVIDE_DEFS -DCONFIG_YAFFSFS_PROVIDE_VALUES -DNO_Y_INLINE
-CFLAGS += -Wall -g $(EXTRA_COMPILE_FLAGS) -Wstrict-aliasing
+CFLAGS += -Wall -g $(EXTRA_COMPILE_FLAGS) -Werror=strict-aliasing
#CFLAGS += -fno-strict-aliasing
CFLAGS += -O0
#CFLAGS += -DVALGRIND_TEST
-#CFLAGS+= -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations
-#CFLAGS+= -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline
+CFLAGS+= -Wshadow -Werror=pointer-arith -Werror=write-strings
+CFLAGS+= -Werror=strict-prototypes -Werror=missing-parameter-type
+CFLAGS+= -Werror=redundant-decls -Werror=nested-externs -Winline
+CFLAGS+= -Werror=undef
COMMONTESTOBJS = yaffscfg2k.o yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsfs.o yaffs_guts.o \
yaffs_packedtags1.o yaffs_ramdisk.o yaffs_ramem2k.o \
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
+#include <time.h>
#include "yaffsfs.h"
void dumpDir(const char *dname);
-char xx[600];
-
-void copy_in_a_file(char *yaffsName,char *inName)
+void copy_in_a_file(const char *yaffsName,const char *inName)
{
int inh,outh;
unsigned char buffer[100];
close(inh);
}
-void make_a_file(char *yaffsName,char bval,int sizeOfFile)
+void make_a_file(const char *yaffsName,char bval,int sizeOfFile)
{
int outh;
int i;
int n;
int result;
int f;
-
+
+ static char xx[600];
char str[50];
for(n = 0; n < nfiles; n++)
}
}
-void leave_unlinked_file(char *path,int maxIterations,int siz)
+void leave_unlinked_file(const char *path,int maxIterations,int siz)
{
int i;
char str[50];
char name[300];
int result = 0;
- int d,f;
+ int f;
// Make a 256 byte name
memset(name,0,sizeof(name));
void link_test0(const char *mountpt)
{
- int i;
char namea[300];
char nameb[300];
int result = 0;
void seek_overwrite_test(const char *mountpt,int nmounts)
{
-
+ static char xx[5000];
char a[30];
int i;
int h;
int result;
int val1;
- int valread;
yaffs_StartUp();
int h;
int result;
char val[1000];
- char valread[1000];
yaffs_StartUp();
int yramdisk_EraseBlockInNAND(yaffs_Device *dev, int blockNumber);
int yramdisk_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_ExtendedTags *tags);
int yramdisk_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_ExtendedTags *tags);
-int yramdisk_EraseBlockInNAND(yaffs_Device *dev, int blockNumber);
int yramdisk_InitialiseNAND(yaffs_Device *dev);
int yramdisk_MarkNANDBlockBad(yaffs_Device *dev,int blockNumber);
int yramdisk_QueryNANDBlock(yaffs_Device *dev, int blockNo, yaffs_BlockState *state, int *sequenceNumber);
m18_1Dev.param.initialiseNAND = ynorif1_InitialiseNAND;
m18_1Dev.param.deinitialiseNAND = ynorif1_DeinitialiseNAND;
+// m18_1Dev.param.disableSoftDelete = 1;
+
yaffs_AddDevice(&m18_1Dev);
// /yaffs2 yaffs2 file emulation
-// NAND RAM Simulator for testing YAFFS
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
+ *
+ * Copyright (C) 2002-2010 Aleph One Ltd.
+ * for Toby Churchill Ltd and Brightstar Engineering
+ *
+ * Created by Charles Manning <charles@aleph1.co.uk>
+ *
+ * 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.
+ */
+
+/* NAND RAM Simulator for testing YAFFS */
+
#ifndef __YAFFS_RAM_SIM_H__
#define __YAFFS_RAM_SIM_H__
#define N_RAM_SIM_DEVS 2
-struct yaffs_DeviceStruct *yramsim_CreateSim(const YCHAR *name,
+struct yaffs_DeviceStruct *yramsim_CreateRamSim(const YCHAR *name,
__u32 devId, __u32 nBlocks,
__u32 startBlock, __u32 endBlock);
#endif
+
+
int yflash_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_ExtendedTags *tags);
int yflash_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare);
int yflash_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_ExtendedTags *tags);
-int yflash_EraseBlockInNAND(yaffs_Device *dev, int blockNumber);
int yflash_InitialiseNAND(yaffs_Device *dev);
int yflash_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo);
int yflash_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, yaffs_BlockState *state, __u32 *sequenceNumber);
{
unsigned chunkNo;
yaffs_ExtendedTags tags;
- ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driverContext);
*sequenceNumber = 0;
static yaffsfs_Inode yaffsfs_inode[YAFFSFS_N_HANDLES];
static yaffsfs_Handle yaffsfs_handle[YAFFSFS_N_HANDLES];
+static int yaffsfs_handlesInitialised;
/*
* yaffsfs_InitHandle
* Inilitalise handle management on start-up.
*/
-static int yaffsfs_InitHandles(void)
+static void yaffsfs_InitHandles(void)
{
int i;
+ if(yaffsfs_handlesInitialised)
+ return;
+
memset(yaffsfs_inode,0,sizeof(yaffsfs_inode));
memset(yaffsfs_handle,0,sizeof(yaffsfs_handle));
for(i = 0; i < YAFFSFS_N_HANDLES; i++)
yaffsfs_handle[i].inodeId = -1;
-
- return 0;
}
yaffsfs_Handle *yaffsfs_GetHandlePointer(int h)
int yaffsfs_IsPathDivider(YCHAR ch)
{
- YCHAR *str = YAFFS_PATH_DIVIDERS;
+ const YCHAR *str = YAFFS_PATH_DIVIDERS;
while(*str){
if(*str == ch)
T(YAFFS_TRACE_ALWAYS,(TSTR("yaffs: Mounting %s" TENDSTR),path));
yaffsfs_Lock();
+
+ yaffsfs_InitHandles();
+
dev = yaffsfs_FindDevice(path,&dummy);
if(dev){
if(!dev->isMounted){
/* Function only for debugging */
void * yaffs_getdev(const YCHAR *path);
+int yaffs_DumpDevStruct(const YCHAR *path);
#endif
static int yaffs_CheckStructures(void);
static int yaffs_DoGenericObjectDeletion(yaffs_Object *in);
-static yaffs_BlockInfo *yaffs_GetBlockInfo(yaffs_Device *dev, int blockNo);
-
-
static int yaffs_CheckChunkErased(struct yaffs_DeviceStruct *dev,
int chunkInNAND);
int newChunkId;
yaffs_ExtendedTags newTags;
yaffs_ExtendedTags oldTags;
- YCHAR *alias = NULL;
+ const YCHAR *alias = NULL;
__u8 *buffer = NULL;
YCHAR oldName[YAFFS_MAX_NAME_LENGTH + 1];
int x_offs = sizeof(yaffs_ObjectHeader);
int x_size = dev->nDataBytesPerChunk - sizeof(yaffs_ObjectHeader);
- __u8 * x_buffer;
+ char * x_buffer;
int retval = 0;
return 0;
}
- buffer = yaffs_GetTempBuffer(dev, __LINE__);
+ buffer = (char *) yaffs_GetTempBuffer(dev, __LINE__);
if(!buffer)
return -ENOMEM;
- result = yaffs_ReadChunkWithTagsFromNAND(dev,obj->hdrChunk, buffer, &tags);
+ result = yaffs_ReadChunkWithTagsFromNAND(dev,obj->hdrChunk, (__u8 *)buffer, &tags);
if(result != YAFFS_OK)
retval = -ENOENT;
else
retval = nval_list(x_buffer, x_size, value,size);
}
- yaffs_ReleaseTempBuffer(dev,buffer,__LINE__);
+ yaffs_ReleaseTempBuffer(dev,(__u8 *)buffer,__LINE__);
return retval;
}
void yaffs_GutsTest(yaffs_Device *dev);
/* A few useful functions to be used within the core files*/
-void yaffs_InitialiseTags(yaffs_ExtendedTags *tags);
void yaffs_DeleteChunk(yaffs_Device *dev, int chunkId, int markNAND, int lyn);
int yaffs_CheckFF(__u8 *buffer, int nBytes);
void yaffs_HandleChunkError(yaffs_Device *dev, yaffs_BlockInfo *bi);
yaffs_FileStructure *fStruct,
__u32 chunkId,
yaffs_Tnode *passedTn);
-void yaffs_VerifyObjects(yaffs_Device *dev);
-void yaffs_VerifyBlocks(yaffs_Device *dev);
-void yaffs_VerifyFreeChunks(yaffs_Device *dev);
+
int yaffs_DoWriteDataToFile(yaffs_Object *in, const __u8 *buffer, loff_t offset,
int nBytes, int writeThrough);
void yaffs_ResizeDown( yaffs_Object *obj, loff_t newSize);
#include "yaffs_qsort.h"
#include "yaffs_nand.h"
#include "yaffs_getblockinfo.h"
+#include "yaffs_verify.h"
/*
* Checkpoints are really no benefit on very small partitions.