Hi,
I used yaffs2 direct interface 2 years ago without problems (archive of 2010/06/11).
I updated to latest git version (linux style renaming and minor modifications).
But I meet a very strange issue:
When I don't yaffs_sync() after updating a file, then after rebooting, the partition is mounted without checkpoint.
In this case, the file system structure is perfectly OK (names, sizes), but reading the files gives null data.

I simulated on a PC with a file, and the result is the same.
What happens ?

Here a simple test, the "/boot" partition uses blocks 0 to 63 with packed tags 2 + ECC in the spare area.
Run it 2 times with normal mounting for append test.
Run it with read-only mounting for read test -> OK.
Run it with read-only, no checkpoint read -> null data.

const char* dev = "/boot";

    
int main(void)
{
	char* logfile = 0;
	struct yaffs_stat st;

	// Initialise File System
	yaffs_start_up();
	//yaffs_mount(dev);			// Normal
	yaffs_mount_common(dev, 1, 0);		// Read-only, read checkpoint
	//yaffs_mount_common(dev, 0, 1);	// Read-write, don't read checkpoint
	//yaffs_mount_common(dev, 1, 1);	// Read-only, don't read checkpoint

	// Logfile read test
	if (0)
	{
		int fd0 = yaffs_open("/boot/log0.txt", O_RDONLY, S_IREAD|S_IWRITE);
		if (fd0 >= 0)
		{
			yaffs_fstat(fd0, &st);
			logfile = malloc(st.st_size+1);
			yaffs_read(fd0, logfile, st.st_size);
			logfile[st.st_size] = '\0';
			yaffs_close(fd0);
		}
	}
	// Logfile append test
	if (1)
	{
		int fd0 = yaffs_open("/boot/log0.txt", O_CREAT|O_RDWR|O_APPEND, S_IREAD|S_IWRITE);
		if (fd0 >= 0)
		{
			const char* buf = "2012/05/31 13:41 Test\n";
			yaffs_write(fd0, buf, strlen(buf));
			yaffs_close(fd0);
		}
	}
 
	if (1)
	{
		yaffs_sync(dev);
		yaffs_unmount(dev);
	}
	return 0;
}

    

-- 
Stephane Lesage