yaffs_mount(path);
}
+char xxzz[2000];
+
+
+void yaffs_device_flush_test(const char *path)
+{
+ char fn[100];
+ int h;
+ int i;
+
+ yaffs_StartUp();
+
+ yaffs_mount(path);
+
+ do_some_file_stuff(path);
+
+ // Open and add some data to a few files
+ for(i = 0; i < 10; i++) {
+
+ sprintf(fn,"%s/ff%d",path,i);
+
+ h = yaffs_open(fn, O_CREAT | O_RDWR | O_TRUNC, S_IWRITE | S_IREAD);
+ yaffs_write(h,xxzz,2000);
+ yaffs_write(h,xxzz,2000);
+ }
+ yaffs_unmount(path);
+
+ yaffs_mount(path);
+}
+
void short_scan_test(const char *path, int fsize, int niterations)
//huge_directory_test_on_path("/ram2k");
- //yaffs_backward_scan_test("/flash") ;
+ //yaffs_backward_scan_test("/flash/flash");
+ yaffs_device_flush_test("/flash/flash");
+
//scan_pattern_test("/flash",10000,10);
//short_scan_test("/flash",40000,200);
//lookup_test("/flash");
//freespace_test("/flash/flash");
- link_test("/flash/flash");
+ //link_test("/flash/flash");
#endif
-const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.9 2006-03-01 08:18:09 charles Exp $";
+const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.10 2006-03-08 07:59:20 charles Exp $";
// configurationList is the list of devices that are supported
static yaffsfs_DeviceConfiguration *yaffsfs_configurationList;
{
int i;
int inUse;
+
+ yaffs_FlushEntireDeviceCache(dev);
+
for(i = inUse = 0; i < YAFFSFS_N_HANDLES && !inUse; i++)
{
if(yaffsfs_handle[i].inUse && yaffsfs_handle[i].obj->myDev == dev)
*/
const char *yaffs_fs_c_version =
- "$Id: yaffs_fs.c,v 1.42 2006-02-08 07:52:51 charles Exp $";
+ "$Id: yaffs_fs.c,v 1.43 2006-03-08 07:59:20 charles Exp $";
extern const char *yaffs_guts_c_version;
#include <linux/config.h>
yaffs_Device *dev = yaffs_SuperToDevice(sb);
yaffs_GrossLock(dev);
+
+ yaffs_FlushEntireDeviceCache(dev);
+
if (dev->putSuperFunc) {
dev->putSuperFunc(sb);
}
*/
const char *yaffs_guts_c_version =
- "$Id: yaffs_guts.c,v 1.30 2006-03-01 08:14:32 charles Exp $";
+ "$Id: yaffs_guts.c,v 1.31 2006-03-08 07:59:20 charles Exp $";
#include "yportenv.h"
}
+/*yaffs_FlushEntireDeviceCache(dev)
+ *
+ *
+ */
+
+void yaffs_FlushEntireDeviceCache(yaffs_Device *dev)
+{
+ yaffs_Object *obj;
+ int nCaches = dev->nShortOpCaches;
+ int i;
+
+ /* Find a dirty object in the cache and flush it...
+ * until there are no further dirty objects.
+ */
+ do {
+ obj = NULL;
+ for( i = 0; i < nCaches && !obj; i++) {
+ if (dev->srCache[i].object &&
+ dev->srCache[i].dirty)
+ obj = dev->srCache[i].object;
+
+ }
+ if(obj)
+ yaffs_FlushFilesChunkCache(obj);
+
+ } while(obj);
+
+}
+
+
/* Grab us a cache chunk for use.
* First look for an empty one.
* Then look for the least recently used non-dirty one.
*
* Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
*
- * $Id: yaffs_guts.h,v 1.19 2006-03-01 08:15:45 charles Exp $
+ * $Id: yaffs_guts.h,v 1.20 2006-03-08 07:59:20 charles Exp $
*/
#ifndef __YAFFS_GUTS_H__
int yaffs_GutsInitialise(yaffs_Device * dev);
void yaffs_Deinitialise(yaffs_Device * dev);
+void yaffs_FlushEntireDeviceCache(yaffs_Device *dev);
+
int yaffs_GetNumberOfFreeChunks(yaffs_Device * dev);
int yaffs_RenameObject(yaffs_Object * oldDir, const YCHAR * oldName,