예제 #1
0
/*
 * Create timeshift directories (for a given instance)
 */
int timeshift_filemgr_makedirs ( int index, char *buf, size_t len )
{
  if (timeshift_filemgr_get_root(buf, len))
    return 1;
  snprintf(buf+strlen(buf), len-strlen(buf), "/%d", index);
  return makedirs(buf, 0700, -1, -1);
}
예제 #2
0
/*
 * Terminate
 */
void timeshift_filemgr_term ( void )
{
  char path[512];

  /* Wait for thread */
  pthread_mutex_lock(&timeshift_reaper_lock);
  timeshift_reaper_run = 0;
  pthread_cond_signal(&timeshift_reaper_cond);
  pthread_mutex_unlock(&timeshift_reaper_lock);
  pthread_join(timeshift_reaper_thread, NULL);

  /* Remove the lot */
  timeshift_filemgr_get_root(path, sizeof(path));
  rmtree(path);
}
예제 #3
0
/*
 * Initialise global structures
 */
void timeshift_filemgr_init ( void )
{
  char path[512];

  /* Try to remove any rubbish left from last run */
  timeshift_filemgr_get_root(path, sizeof(path));
  rmtree(path);

  /* Start the reaper thread */
  timeshift_reaper_run = 1;
  pthread_mutex_init(&timeshift_reaper_lock, NULL);
  pthread_cond_init(&timeshift_reaper_cond, NULL);
  TAILQ_INIT(&timeshift_reaper_list);
  pthread_create(&timeshift_reaper_thread, NULL,
                 timeshift_reaper_callback, NULL);
}