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 edf9d63..247aa48 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 290bcf7..014bfc5 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 4310316..0bcf23e 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 ec06418..70ddce9 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;