}
-
-
-
int dump_file_data(char *fn)
{
int h;
}
+void fill_n_file_test(const char *mountpt, int n, int syz)
+{
+ int i;
+ int l;
+
+ yaffs_start_up();
+
+ yaffs_format(mountpt, 0, 0, 0);
+ yaffs_mount(mountpt);
+
+
+ for(i = 0; i < n; i++)
+ {
+ int h;
+ char fname[200];
+
+ sprintf(fname, "%s/%d", mountpt, i);
+
+ h = yaffs_open(fname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
+
+ l = syz;
+
+ while(l > 0) {
+ yaffs_write(h, fname, sizeof(fname));
+ l -= sizeof(fname);
+ }
+
+ yaffs_close(h);
+
+ }
+
+}
+
+
void fill_files_test(const char *mountpt)
{
int i;
struct yaffs_utimbuf utb;
struct yaffs_stat st;
+ //setup
yaffs_start_up();
yaffs_mount(mountpt);
h = yaffs_open(name,O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
yaffs_fstat(h,&st);
- printf(" times %lu %lu %lu\n",
+ printf(" times before %lu %lu %lu\n",
st.yst_atime, st.yst_ctime, st.yst_mtime);
+ //here are the last access and modification times.
utb.actime = 1000;
utb.modtime = 2000;
+
+ //futime sets the last modification and access time of the file
result = yaffs_futime(h,&utb);
- printf("futime to a 1000 m 2000 result %d\n",result);
+ printf("setting times using the futime function to a 1000 m 2000 result %d\n",result);
+
+ //read the times from the file header
yaffs_fstat(h,&st);
printf(" times %lu %lu %lu\n",
st.yst_atime, st.yst_ctime, st.yst_mtime);
try_rmdir("/nand/z/");
}
+
+void dump_yaffs_malloc_usage(void)
+{
+ unsigned current;
+ unsigned high_water;
+
+ yaffsfs_get_malloc_values(¤t, &high_water);
+
+ printf("\n"
+ "***************************************\n"
+ "Dump of yaffs malloc usage during run\n"
+ "Currently allocated : %u bytes\n"
+ "High water allocated : %u bytes\n"
+ "Note, this is not accurate on all platforms\n",
+ current, high_water);
+
+}
+
+
int random_seed;
int simulate_power_failure;
int main(int argc, char *argv[])
{
+
+ //unlink("emfile-nand");
+
+
+ atexit(dump_yaffs_malloc_usage);
+
(void) argc;
(void) argv;
//link_test0("/nand");
//link_test1("yaffs2");
//scan_pattern_test("/flash",10000,10);
- short_scan_test("/yflash2",40000,200);
+ //short_scan_test("/yflash2",40000,200);
+ //short_scan_test("/nand128MB",40000,200);
//small_mount_test("/flash/flash",1000);
//small_overwrite_test("/flash/flash",1000);
//seek_overwrite_test("/flash/flash",1000);
//long_test_on_path("/ram2k");
// long_test_on_path("/flash");
//simple_rw_test("/flash/flash");
- //fill_disk_test("/flash/flash");
+ //fill_n_file_test("/nand128MB", 50, 128000000/50);
// rename_over_test("/flash");
//lookup_test("/flash");
//freespace_test("/flash/flash");
//large_file_test("/nand");
//readdir_test("/nand");
- //basic_utime_test("/nand");
+ basic_utime_test("/nand");
//case_insensitive_test("/nand");
//yy_test("/nand");