8 #define YAFFS_MOUNT_POINT "/yflash2/"
9 #define FILE_PATH "/yflash2/foo.txt"
12 int simulate_power_failure = 0;
18 if (yaffs_mount(YAFFS_MOUNT_POINT) < 0) {
19 printf("failed to mount %s/n", YAFFS_MOUNT_POINT);
25 int shared_create(int argc, char *argv[]){
28 printf("wrong number of arguments\n");
29 printf("requires $ create file_name time\n");
34 uint time = atoi(argv[2]);
35 char *file_path = argv[1];
36 if (yaffs_open(FILE_PATH, O_CREAT | O_RDWR, S_IREAD |S_IWRITE)) {
37 printf("failed to open the file %s/n", FILE_PATH);
40 printf("created file: %s, with time: %d\n", file_path, time);
43 int main(int argc, char *argv[] ){
44 return shared_create(argc, argv);