projects
/
yaffs2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b75aa4d
)
Some tinkering on test harness and st_xxx to yst_xxx changes
author
charles
<charles>
Mon, 18 Jul 2005 23:12:00 +0000
(23:12 +0000)
committer
charles
<charles>
Mon, 18 Jul 2005 23:12:00 +0000
(23:12 +0000)
direct/Makefile
patch
|
blob
|
history
direct/dtest.c
patch
|
blob
|
history
direct/yaffs_fileem2k.c
patch
|
blob
|
history
direct/yaffs_fileem2k.h
patch
|
blob
|
history
direct/yaffscfg2k.c
patch
|
blob
|
history
direct/yaffsfs.c
patch
|
blob
|
history
direct/yaffsfs.h
patch
|
blob
|
history
diff --git
a/direct/Makefile
b/direct/Makefile
index cb76c590a6c50bb8e4a2be64e413b6ca233c138e..3d7c263a8673633a7ac1a775200ef54377196440 100644
(file)
--- a/
direct/Makefile
+++ b/
direct/Makefile
@@
-10,18
+10,22
@@
#
# NB Warning this Makefile does not include header dependencies.
#
#
# 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
#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
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 \
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 \
diff --git
a/direct/dtest.c
b/direct/dtest.c
index 4d9cb894566d6a5c0cd8d986255fd45d2396517d..8100406266e582141b5834377d78c28d94d933bc 100644
(file)
--- a/
direct/dtest.c
+++ b/
direct/dtest.c
@@
-321,7
+321,7
@@
void fill_disk(char *path,int nfiles)
while ((result = yaffs_write(h,xx,600)) == 600)
{
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);
}
result = yaffs_close(h);
printf(" close %d\n",result);
@@
-1241,6
+1241,20
@@
int truncate_test(void)
+
+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];
void scan_deleted_files_test(const char *mountpt)
{
char fn[100];
@@
-1316,7
+1330,7
@@
int main(int argc, char *argv[])
//long_test_on_path("/ram2k");
//long_test_on_path("/flash");
//long_test_on_path("/ram2k");
//long_test_on_path("/flash");
-
scan_deleted_files
_test("/flash");
+
fill_disk
_test("/flash");
diff --git
a/direct/yaffs_fileem2k.c
b/direct/yaffs_fileem2k.c
index 786094b349a307c5ab28ba41feb05f068086e1b4..4c5e200ed9f0c5384efbdb136175b59f4abdd7d2 100644
(file)
--- a/
direct/yaffs_fileem2k.c
+++ b/
direct/yaffs_fileem2k.c
@@
-15,7
+15,7
@@
// This provides a YAFFS nand emulation on a file for emulating 2kB pages.
// THis is only intended as test code to test persistence etc.
// 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"
#include "yportenv.h"
@@
-55,7
+55,7
@@
typedef struct
static yflash_Device filedisk;
static yflash_Device filedisk;
-static int CheckInit(
yaffs_Device *dev
)
+static int CheckInit(
void
)
{
static int initialised = 0;
{
static int initialised = 0;
@@
-107,16
+107,28
@@
static int CheckInit(yaffs_Device *dev)
}
}
}
}
}
}
+ else
+ {
+ filedisk.nBlocks = fSize/(BLOCK_SIZE);
+ }
return 1;
}
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;
int yflash_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, yaffs_ExtendedTags *tags)
{
int written;
int pos;
- CheckInit(
dev
);
+ CheckInit();
@@
-160,7
+172,7
@@
int yflash_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
yaffs_PackedTags2 pt;
yaffs_PackedTags2 pt;
- CheckInit(
dev
);
+ CheckInit();
memset(&pt,0,sizeof(pt));
lseek(filedisk.handle,(blockNo * dev->nChunksPerBlock) * PAGE_SIZE + PAGE_DATA_SIZE,SEEK_SET);
memset(&pt,0,sizeof(pt));
lseek(filedisk.handle,(blockNo * dev->nChunksPerBlock) * PAGE_SIZE + PAGE_DATA_SIZE,SEEK_SET);
@@
-190,7
+202,7
@@
int yflash_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *da
int nread;
int pos;
int nread;
int pos;
- CheckInit(
dev
);
+ CheckInit();
@@
-240,7
+252,7
@@
int yflash_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
int i;
int i;
- CheckInit(
dev
);
+ CheckInit();
if(blockNumber < 0 || blockNumber >= filedisk.nBlocks)
{
if(blockNumber < 0 || blockNumber >= filedisk.nBlocks)
{
@@
-271,7
+283,7
@@
int yflash_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
int yflash_InitialiseNAND(yaffs_Device *dev)
{
int yflash_InitialiseNAND(yaffs_Device *dev)
{
- CheckInit(
dev
);
+ CheckInit();
return YAFFS_OK;
}
return YAFFS_OK;
}
diff --git
a/direct/yaffs_fileem2k.h
b/direct/yaffs_fileem2k.h
index febbf84dbec02dc267aaa485541845b5dff0e036..222df53ef07a503b8ee2ef1b0cf5d657feee0c1e 100644
(file)
--- a/
direct/yaffs_fileem2k.h
+++ b/
direct/yaffs_fileem2k.h
@@
-41,5
+41,8
@@
#endif
#endif
+
+int yflash_GetNumberOfBlocks(void);
+
#endif
#endif
diff --git
a/direct/yaffscfg2k.c
b/direct/yaffscfg2k.c
index 7a67df0072ddbc1155f12948e12dffc7563c8073..9c45524774993f7097c7821faa58057cebc5455b 100644
(file)
--- a/
direct/yaffscfg2k.c
+++ b/
direct/yaffscfg2k.c
@@
-118,9
+118,9
@@
int yaffs_StartUp(void)
flashDev.nBytesPerChunk = 2048;
flashDev.nChunksPerBlock = 64;
flashDev.nReservedBlocks = 5;
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 = 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.
flashDev.isYaffs2 = 1;
flashDev.nShortOpCaches = 10; // Use caches
flashDev.genericDevice = (void *) 2; // Used to identify the device in fstat.
diff --git
a/direct/yaffsfs.c
b/direct/yaffsfs.c
index 9109da7f1df5d635de725d95b590a4806159e65e..821848ec805a9344911cfd0e25ace4a72227e877 100644
(file)
--- a/
direct/yaffsfs.c
+++ b/
direct/yaffsfs.c
@@
-25,7
+25,7
@@
#endif
#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;
// configurationList is the list of devices that are supported
static yaffsfs_DeviceConfiguration *yaffsfs_configurationList;
@@
-410,19
+410,19
@@
int yaffs_open(const char *path, int oflag, int mode)
// Check file permissions
if( (oflag & (O_RDWR | O_WRONLY)) == 0 && // ie O_RDONLY
// Check file permissions
if( (oflag & (O_RDWR | O_WRONLY)) == 0 && // ie O_RDONLY
- !(obj->st_mode & S_IREAD))
+ !(obj->
y
st_mode & S_IREAD))
{
openDenied = 1;
}
if( (oflag & O_RDWR) &&
{
openDenied = 1;
}
if( (oflag & O_RDWR) &&
- !(obj->st_mode & S_IREAD))
+ !(obj->
y
st_mode & S_IREAD))
{
openDenied = 1;
}
if( (oflag & (O_RDWR | O_WRONLY)) &&
{
openDenied = 1;
}
if( (oflag & (O_RDWR | O_WRONLY)) &&
- !(obj->st_mode & S_IWRITE))
+ !(obj->
y
st_mode & S_IWRITE))
{
openDenied = 1;
}
{
openDenied = 1;
}
@@
-835,7
+835,7
@@
static int yaffsfs_DoStat(yaffs_Object *obj,struct yaffs_stat *buf)
{
buf->st_dev = (int)obj->myDev->genericDevice;
buf->st_ino = obj->objectId;
{
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->
y
st_mode & ~S_IFMT; // clear out file type bits
if(obj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY)
{
if(obj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY)
{
@@
-853,13
+853,13
@@
static int yaffsfs_DoStat(yaffs_Object *obj,struct yaffs_stat *buf)
buf->st_nlink = yaffs_GetObjectLinkCount(obj);
buf->st_uid = 0;
buf->st_gid = 0;;
buf->st_nlink = yaffs_GetObjectLinkCount(obj);
buf->st_uid = 0;
buf->st_gid = 0;;
- buf->st_rdev = obj->st_rdev;
+ buf->st_rdev = obj->
y
st_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_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->y
st_atime;
+ buf->
yst_ctime = obj->y
st_ctime;
+ buf->
yst_mtime = obj->y
st_mtime;
retVal = 0;
}
return retVal;
retVal = 0;
}
return retVal;
@@
-940,7
+940,7
@@
static int yaffsfs_DoChMod(yaffs_Object *obj,mode_t mode)
if(obj)
{
if(obj)
{
- obj->st_mode = mode;
+ obj->
y
st_mode = mode;
obj->dirty = 1;
result = yaffs_FlushFile(obj,0);
}
obj->dirty = 1;
result = yaffs_FlushFile(obj,0);
}
diff --git
a/direct/yaffsfs.h
b/direct/yaffsfs.h
index 2a6ae2720cdf036b4f0199da75c5c5688ad4bbfb..b670f11690282531e9c213566707342576ffe345 100644
(file)
--- a/
direct/yaffsfs.h
+++ b/
direct/yaffsfs.h
@@
-155,6
+155,7
@@
typedef struct yaffs_dirent yaffs_dirent;
typedef struct __opaque yaffs_DIR;
typedef struct __opaque yaffs_DIR;
+
struct yaffs_stat{
int st_dev; /* device */
int st_ino; /* inode */
struct yaffs_stat{
int st_dev; /* device */
int st_ino; /* inode */
@@
-166,9
+167,9
@@
struct yaffs_stat{
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 */
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
y
st_atime; /* time of last access */
+ unsigned long
y
st_mtime; /* time of last modification */
+ unsigned long
y
st_ctime; /* time of last change */
};
int yaffs_open(const char *path, int oflag, int mode) ;
};
int yaffs_open(const char *path, int oflag, int mode) ;