yaffs large file support: Saves and restores large files fine under yaffs direct.
authorCharles Manning <cdhmanning@gmail.com>
Wed, 21 Dec 2011 03:14:58 +0000 (16:14 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Wed, 21 Dec 2011 03:14:58 +0000 (16:14 +1300)
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
direct/basic-test/dtest.c
direct/yaffsfs.c
direct/yaffsfs.h
yaffs_vfs_multi.c

index edf9d63e4b0b82f229a11dbaaedf82deeed0f766..247aa480c69dee4303ae8b63618dc7fa8f06130f 100644 (file)
@@ -2884,6 +2884,9 @@ void large_file_test(const char *mountpt)
         dumpDir(mountpt);
 
        sprintf(fullname, "%s/%s", mountpt, "big-test-file");
+
+       handle = yaffs_open(fullname, O_RDONLY, 0);
+
        handle = yaffs_open(fullname, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);
 
        if(handle < 0) {
@@ -2894,9 +2897,25 @@ void large_file_test(const char *mountpt)
        write_big_sparse_file(handle);
        verify_big_sparse_file(handle);
 
+       yaffs_close(handle);
+
        printf("Job done\n");
        yaffs_unmount(mountpt);
 
+       yaffs_mount(mountpt);
+       printf("mounted again\n");
+        dumpDir(mountpt);
+       handle = yaffs_open(fullname, O_RDONLY, 0);
+       verify_big_sparse_file(handle);
+       yaffs_unmount(mountpt);
+
+
+       yaffs_mount_common(mountpt, 0, 1);
+       printf("mounted with no checkpt\n");
+        dumpDir(mountpt);
+       handle = yaffs_open(fullname, O_RDONLY, 0);
+       verify_big_sparse_file(handle);
+       yaffs_unmount(mountpt);
 
 }
 
index 290bcf7ecdade668275c0a4565f20c57813cf09a..014bfc57020478d3b9a647cffae8741068b38616 100644 (file)
@@ -2425,7 +2425,7 @@ void * yaffs_getdev(const YCHAR *path)
        return (void *)dev;
 }
 
-int yaffs_mount2(const YCHAR *path,int read_only)
+int yaffs_mount_common(const YCHAR *path,int read_only, int skip_checkpt)
 {
        int retVal=-1;
        int result=YAFFS_FAIL;
@@ -2451,7 +2451,15 @@ int yaffs_mount2(const YCHAR *path,int read_only)
        if(dev){
                if(!dev->is_mounted){
                        dev->read_only = read_only ? 1 : 0;
-                       result = yaffs_guts_initialise(dev);
+                       if(skip_checkpt) {
+                               u8 skip = dev->param.skip_checkpt_rd;
+                               dev->param.skip_checkpt_rd = 1;
+                               result = yaffs_guts_initialise(dev);
+                               dev->param.skip_checkpt_rd = skip;
+                       } else {
+                               result = yaffs_guts_initialise(dev);
+                       }
+
                        if(result == YAFFS_FAIL)
                                yaffsfs_SetError(-ENOMEM);
                        retVal = result ? 0 : -1;
@@ -2467,9 +2475,13 @@ int yaffs_mount2(const YCHAR *path,int read_only)
 
 }
 
+int yaffs_mount2(const YCHAR *path, int readonly)
+{
+       return yaffs_mount_common(path, readonly, 0);
+}
 int yaffs_mount(const YCHAR *path)
 {
-       return yaffs_mount2(path,0);
+       return yaffs_mount_common(path, 0, 0);
 }
 
 int yaffs_sync(const YCHAR *path)
index 4310316cd87878677a520742a8bf1a3c199977ec..0bcf23ec025cda2ade8d9edc908d50fa7b8d22ab 100644 (file)
@@ -154,6 +154,8 @@ int yaffs_closedir(yaffs_DIR *dirp) ;
 
 int yaffs_mount(const YCHAR *path) ;
 int yaffs_mount2(const YCHAR *path, int read_only);
+int yaffs_mount_common(const YCHAR *path, int read_only, int skip_checkpt);
+
 int yaffs_unmount(const YCHAR *path) ;
 int yaffs_unmount2(const YCHAR *path, int force);
 int yaffs_remount(const YCHAR *path, int force, int read_only);
index ec0641833eb5f7c8ea60a1968ad4b26e49980623..70ddce9bc5f770faa0f638912352a9e29be6be28 100644 (file)
@@ -2815,7 +2815,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
        sb->u.generic_sbp = dev;
 #endif
 
-       sb->s_maxbytes = 32000000000UL;
+       sb->s_maxbytes = 35000000000LL;
 
        dev->driver_context = mtd;
        param->name = mtd->name;