2 * YAFFS: Yet another FFS. A NAND-flash specific file system.
4 * Copyright (C) 2002-2011 Aleph One Ltd.
5 * for Toby Churchill Ltd and Brightstar Engineering
7 * Created by Charles Manning <charles@aleph1.co.uk>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
24 const char *mp="yaffs2";
25 const char *fn = "yaffs2/fn";
28 void run_step(int test_type)
36 printf("\n\n\nTest type %d\n", test_type);
41 printf("Regular mount\n");
45 printf("mount ro checkpt\n");
46 yaffs_mount_common(mp, 1, 0);
49 printf("mount ro no-checkpt\n");
50 yaffs_mount_common(mp, 1, 1);
56 fd = yaffs_open(fn, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);
58 fd = yaffs_open(fn, O_CREAT | O_RDWR | O_APPEND, S_IREAD | S_IWRITE);
61 printf("open failed\n");
64 n = yaffs_write(fd, "foo bar ", 8);
65 printf("write returned %d\n", n);
69 n = yaffs_stat(fn, &s);
71 printf("yaffs_stat returned %d\n", n);
73 printf("file length %d\n", (int)s.st_size);
75 fd = yaffs_open(fn, O_RDONLY, 0);
77 for(i = 0; i < (int)s.st_size; i++) {
78 yaffs_read(fd, &x, 1);
85 n = yaffs_unmount(mp);
87 printf("unmount returned %d\n", n);
92 int simulate_power_failure;
94 int main(int argc, char *argv[])