yaffs direct: Clean up and handle names that are to long
[yaffs2.git] / direct / fsx_test / yaffs_fsx.c
index 1e110b9b725242356477aa2cccf9e5b732528318..d3d3149b05206b0ea02b42e55581960a80c51ece 100644 (file)
@@ -67,6 +67,7 @@
 #include <unistd.h>
 #include <stdarg.h>
 #include <errno.h>
+#include <time.h>
 
 #include "yaffsfs.h"
 
@@ -129,7 +130,7 @@ int writebdy = 1;                   /* -w flag */
 long   monitorstart = -1;              /* -m flag */
 long   monitorend = -1;                /* -m flag */
 int    lite = 0;                       /* -L flag */
-long   numops = -1;                    /* -N flag */
+long   numops = /*-1 */ 10000000;                      /* -N flag */
 int    randomoplen = 1;                /* -O flag disables it */
 int    seed = 1;                       /* -S flag */
 
@@ -421,14 +422,14 @@ check_trunc_hack(void)
 {
        struct yaffs_stat statbuf;
 
-       yaffs_truncate(fd, (off_t)0);
-       yaffs_truncate(fd, (off_t)100000);
+       yaffs_ftruncate(fd, (off_t)0);
+       yaffs_ftruncate(fd, (off_t)100000);
        yaffs_fstat(fd, &statbuf);
        if (statbuf.st_size != (off_t)100000) {
                prt("no extend on truncate! not posix!\n");
                exit(130);
        }
-       yaffs_truncate(fd, (off_t)0);
+       yaffs_ftruncate(fd, (off_t)0);
 }
 
 
@@ -579,7 +580,7 @@ dotruncate(unsigned size)
            (debug && (monitorstart == -1 || monitorend == -1 ||
                       size <= monitorend)))
                prt("%lu trunc\tfrom 0x%x to 0x%x\n", testcalls, oldsize, size);
-       if (yaffs_truncate(fd, (off_t)size) == -1) {
+       if (yaffs_ftruncate(fd, (off_t)size) == -1) {
                prt("ftruncate1: %x\n", size);
                prterr("dotruncate: ftruncate");
                report_failure(160);
@@ -605,7 +606,7 @@ writefileimage()
                            iret, (unsigned long long)file_size);
                report_failure(172);
        }
-       if (lite ? 0 : yaffs_truncate(fd, file_size) == -1) {
+       if (lite ? 0 : yaffs_ftruncate(fd, file_size) == -1) {
                prt("ftruncate2: %llx\n", (unsigned long long)file_size);
                prterr("writefileimage: ftruncate");
                report_failure(173);
@@ -773,6 +774,11 @@ getnum(char *s, char **e)
 }
 
 
+#define BASE_NAME "/M18-1"
+
+int random_seed = 999;
+int simulate_power_failure = 0;
+
 int
 main(int argc, char **argv)
 {
@@ -913,10 +919,10 @@ main(int argc, char **argv)
        argc -= optind;
        argv += optind;
 
-       yaffs_StartUp();
-       yaffs_mount("/flash/flash");
+       yaffs_start_up();
+       yaffs_mount(BASE_NAME);
        
-       fname = "/flash/flash/fsxdata";
+       fname = BASE_NAME "/fsxdata";
 
        signal(SIGHUP,  cleanup);
        signal(SIGINT,  cleanup);
@@ -998,7 +1004,7 @@ main(int argc, char **argv)
        
        yaffs_close(fsxgoodfd);
        
-       yaffs_unmount("flash/flash");
+       yaffs_unmount(BASE_NAME);
        prt("All operations completed A-OK!\n");
 
        exit(0);