예제 #1
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_rollback_process, ev, data)
{
  int fd = 0;

  PROCESS_BEGIN();

  fd = cfs_open(data, CFS_READ);

  if(fd < 0) {
    shell_output_str(&rollback_command,
             "rollback: could not open file for reading: ", data);
  } else {
    shell_output_str(&rollback_command, "rollback from: ", data);
    checkpoint_rollback(fd);
    cfs_close(fd);
  }

  PROCESS_END();
}
예제 #2
0
PROCESS_THREAD(checkpoint_button_process, ev, data)
{
  PROCESS_BEGIN();

  button_sensor.configure(SENSORS_ACTIVE, 1);

  while(1) {
    PROCESS_WAIT_EVENT();

    if(ev == sensors_event && data == &button_sensor) {
      int fd = 0;

      /* Rollback from Coffee file "cp_wdt" */
      fd = cfs_open("cp_wdt", CFS_READ);
      if(fd >= 0) {
        checkpoint_rollback(fd);
        cfs_close(fd);
      }
    }
  }

  PROCESS_END();
}