#
# NB Warning this Makefile does not include header dependencies.
#
-# $Id: Makefile,v 1.6 2005-07-03 05:48:11 charles Exp $
+# $Id: Makefile,v 1.7 2005-07-18 23:12:00 charles Exp $
-CFLAGS = -Wall -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2 -g
+EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC
+
+CFLAGS = -Wall -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2 -g $(EXTRA_COMPILE_FLAGS)
#CFLAGS+= -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations
#CFLAGS+= -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline
-DIRECTTESTOBJS = dtest.o yaffscfg2k.o yaffs_ecc.o yaffs_fileem2k.o yaffsfs.o yaffs_guts.o yaffs_packedtags1.o yaffs_ramdisk.o yaffs_tagscompat.o yaffs_packedtags2.o yaffs_tagsvalidity.o
+DIRECTTESTOBJS = dtest.o yaffscfg2k.o yaffs_ecc.o yaffs_fileem2k.o yaffsfs.o yaffs_guts.o yaffs_packedtags1.o yaffs_ramdisk.o yaffs_ramem2k.o yaffs_tagscompat.o yaffs_packedtags2.o yaffs_tagsvalidity.o
BOOTTESTOBJS = bootldtst.o yboot.o yaffs_fileem.o nand_ecc.o
-ALLOBJS = dtest.o nand_ecc.o yaffscfg.o yaffs_fileem.o yaffsfs.o yaffs_ramdisk.o bootldtst.o yboot.o yaffs_ramem2k.o
+#ALLOBJS = dtest.o nand_ecc.o yaffscfg.o yaffs_fileem.o yaffsfs.o yaffs_ramdisk.o bootldtst.o yboot.o yaffs_ramem2k.o
+
+ALLOBJS = $(DIRECTTESTOBJS) $(BOOTTESTOBJS)
SYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffsinterface.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \
yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h yaffs_ramem2k.c yaffs_nandemul2k.h \
while ((result = yaffs_write(h,xx,600)) == 600)
{
- f = yaffs_freespace("/boot");
+ f = yaffs_freespace(path);
}
result = yaffs_close(h);
printf(" close %d\n",result);
+
+void fill_disk_test(const char *mountpt)
+{
+ int i;
+ yaffs_StartUp();
+
+ for(i = 0; i < 5; i++)
+ {
+ yaffs_mount(mountpt);
+ fill_disk_and_delete(mountpt,100,i+1);
+ yaffs_unmount(mountpt);
+ }
+
+}
void scan_deleted_files_test(const char *mountpt)
{
char fn[100];
//long_test_on_path("/ram2k");
//long_test_on_path("/flash");
- scan_deleted_files_test("/flash");
+ fill_disk_test("/flash");
// This provides a YAFFS nand emulation on a file for emulating 2kB pages.
// THis is only intended as test code to test persistence etc.
-const char *yaffs_flashif_c_version = "$Id: yaffs_fileem2k.c,v 1.3 2005-07-03 05:48:11 charles Exp $";
+const char *yaffs_flashif_c_version = "$Id: yaffs_fileem2k.c,v 1.4 2005-07-18 23:12:00 charles Exp $";
#include "yportenv.h"
static yflash_Device filedisk;
-static int CheckInit(yaffs_Device *dev)
+static int CheckInit(void)
{
static int initialised = 0;
}
}
}
+ else
+ {
+ filedisk.nBlocks = fSize/(BLOCK_SIZE);
+ }
return 1;
}
+
+int yflash_GetNumberOfBlocks(void)
+{
+ CheckInit();
+
+ return filedisk.nBlocks;
+}
+
int yflash_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, yaffs_ExtendedTags *tags)
{
int written;
int pos;
- CheckInit(dev);
+ CheckInit();
yaffs_PackedTags2 pt;
- CheckInit(dev);
+ CheckInit();
memset(&pt,0,sizeof(pt));
lseek(filedisk.handle,(blockNo * dev->nChunksPerBlock) * PAGE_SIZE + PAGE_DATA_SIZE,SEEK_SET);
int nread;
int pos;
- CheckInit(dev);
+ CheckInit();
int i;
- CheckInit(dev);
+ CheckInit();
if(blockNumber < 0 || blockNumber >= filedisk.nBlocks)
{
int yflash_InitialiseNAND(yaffs_Device *dev)
{
- CheckInit(dev);
+ CheckInit();
return YAFFS_OK;
}
#endif
+
+int yflash_GetNumberOfBlocks(void);
+
#endif
flashDev.nBytesPerChunk = 2048;
flashDev.nChunksPerBlock = 64;
flashDev.nReservedBlocks = 5;
- flashDev.startBlock = 64; // First block after /boot
+ flashDev.startBlock = 0;
//flashDev.endBlock = 127; // Last block in 16MB
- flashDev.endBlock = (32 * 1024 * 1024)/(flashDev.nBytesPerChunk * flashDev.nChunksPerBlock) - 1; // Last block in 512MB
+ flashDev.endBlock = yflash_GetNumberOfBlocks()-1;
flashDev.isYaffs2 = 1;
flashDev.nShortOpCaches = 10; // Use caches
flashDev.genericDevice = (void *) 2; // Used to identify the device in fstat.
#endif
-const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.4 2005-07-03 05:48:11 charles Exp $";
+const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.5 2005-07-18 23:12:00 charles Exp $";
// configurationList is the list of devices that are supported
static yaffsfs_DeviceConfiguration *yaffsfs_configurationList;
// Check file permissions
if( (oflag & (O_RDWR | O_WRONLY)) == 0 && // ie O_RDONLY
- !(obj->st_mode & S_IREAD))
+ !(obj->yst_mode & S_IREAD))
{
openDenied = 1;
}
if( (oflag & O_RDWR) &&
- !(obj->st_mode & S_IREAD))
+ !(obj->yst_mode & S_IREAD))
{
openDenied = 1;
}
if( (oflag & (O_RDWR | O_WRONLY)) &&
- !(obj->st_mode & S_IWRITE))
+ !(obj->yst_mode & S_IWRITE))
{
openDenied = 1;
}
{
buf->st_dev = (int)obj->myDev->genericDevice;
buf->st_ino = obj->objectId;
- buf->st_mode = obj->st_mode & ~S_IFMT; // clear out file type bits
+ buf->st_mode = obj->yst_mode & ~S_IFMT; // clear out file type bits
if(obj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY)
{
buf->st_nlink = yaffs_GetObjectLinkCount(obj);
buf->st_uid = 0;
buf->st_gid = 0;;
- buf->st_rdev = obj->st_rdev;
+ buf->st_rdev = obj->yst_rdev;
buf->st_size = yaffs_GetObjectFileLength(obj);
buf->st_blksize = obj->myDev->nBytesPerChunk;
buf->st_blocks = (buf->st_size + buf->st_blksize -1)/buf->st_blksize;
- buf->st_atime = obj->st_atime;
- buf->st_ctime = obj->st_ctime;
- buf->st_mtime = obj->st_mtime;
+ buf->yst_atime = obj->yst_atime;
+ buf->yst_ctime = obj->yst_ctime;
+ buf->yst_mtime = obj->yst_mtime;
retVal = 0;
}
return retVal;
if(obj)
{
- obj->st_mode = mode;
+ obj->yst_mode = mode;
obj->dirty = 1;
result = yaffs_FlushFile(obj,0);
}
typedef struct __opaque yaffs_DIR;
+
struct yaffs_stat{
int st_dev; /* device */
int st_ino; /* inode */
off_t st_size; /* total size, in bytes */
unsigned long st_blksize; /* blocksize for filesystem I/O */
unsigned long st_blocks; /* number of blocks allocated */
- unsigned long st_atime; /* time of last access */
- unsigned long st_mtime; /* time of last modification */
- unsigned long st_ctime; /* time of last change */
+ unsigned long yst_atime; /* time of last access */
+ unsigned long yst_mtime; /* time of last modification */
+ unsigned long yst_ctime; /* time of last change */
};
int yaffs_open(const char *path, int oflag, int mode) ;