changeset 314:6bbc585bac00

Update for upstream changes
author wry
date Fri, 09 Oct 2009 14:28:39 +0000
parents ba05a98df7e4
children 31efcf0d9807
files packages/fs/yaffs/current/ChangeLog packages/fs/yaffs/current/src/ecos-yaffs.c
diffstat 2 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/packages/fs/yaffs/current/ChangeLog
+++ b/packages/fs/yaffs/current/ChangeLog
@@ -1,6 +1,7 @@
-2009-09-28  Ross Younger  <wry@ecoscentric.com>
+2009-10-09  Ross Younger  <wry@ecoscentric.com>
 
 	* tests/fops.c: Don't make unreasonable use of stack.
+	* Update for latest upstream snapshot (yaffs_FlushFile)
 
 2009-09-24  Ross Younger  <wry@ecoscentric.com>
 
--- a/packages/fs/yaffs/current/src/ecos-yaffs.c
+++ b/packages/fs/yaffs/current/src/ecos-yaffs.c
@@ -355,7 +355,8 @@ static int eyaffs_fo_ioctl   (struct CYG
 static int eyaffs_fo_fsync   (struct CYG_FILE_TAG *fp, int mode )
 {
     yaffs_Object *node = (yaffs_Object*) fp->f_data;
-    YER(yaffs_FlushFile(node,1));
+    int ymode = (mode == CYG_FDATASYNC) ? 1 : 0;
+    YER(yaffs_FlushFile(node,1,ymode));
     return ENOERR;
 }
 
@@ -364,7 +365,7 @@ static int eyaffs_fo_close   (struct CYG
     yaffs_Object *node = (yaffs_Object*) fp->f_data;
 
     if (node->inUse) {
-        YER(yaffs_FlushFile(node,1));
+        YER(yaffs_FlushFile(node,1,0));
         node->inUse--;
         if (node->inUse <= 0 && node->unlinked) {
             YER(yaffs_DeleteObject(node));
@@ -993,17 +994,22 @@ static int eyaffs_getinfo( cyg_mtab_entr
     }
 }
 
+static int eyaffs_do_sync_fs(yaffs_Device * y)
+{
+    yaffs_FlushEntireDeviceCache(y);
+    // TODO: If there were a convenient way to enumerate all the open
+    // files in a filesystem, we could fsync them all here.
+    // This might involve code similar to cyg_fd_filesys_close().
+    yaffs_CheckpointSave(y);
+    return ENOERR;
+}
+
 static int eyaffs_setinfo( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
                            int key, void *buf, int len )
 {
     switch (key) {
         case FS_INFO_SYNC:
-            {
-                yaffs_Device *y = (yaffs_Device*) mte->data;
-                yaffs_FlushEntireDeviceCache(y);
-                yaffs_CheckpointSave(y);
-                return ENOERR;
-            }
+            return eyaffs_do_sync_fs( (yaffs_Device*) mte->data );
     }
     return EINVAL;
 }