示例#1
0
/*
 * Intialise global file manager
 */
void timeshift_init ( void )
{
  htsmsg_t *m;
  const char *str;
  uint32_t u32;

  timeshift_filemgr_init();

  /* Defaults */
  timeshift_enabled          = 0;                       // Disabled
  timeshift_ondemand         = 0;                       // Permanent
  timeshift_path             = NULL;                    // setting dir
  timeshift_unlimited_period = 0;
  timeshift_max_period       = 3600;                    // 1Hr
  timeshift_unlimited_size   = 0;
  timeshift_max_size         = 10000 * (size_t)1048576; // 10G

  /* Load settings */
  if ((m = hts_settings_load("timeshift/config"))) {
    if (!htsmsg_get_u32(m, "enabled", &u32))
      timeshift_enabled = u32 ? 1 : 0;
    if (!htsmsg_get_u32(m, "ondemand", &u32))
      timeshift_ondemand = u32 ? 1 : 0;
    if ((str = htsmsg_get_str(m, "path")))
      timeshift_path = strdup(str);
    if (!htsmsg_get_u32(m, "unlimited_period", &u32))
      timeshift_unlimited_period = u32 ? 1 : 0;
    htsmsg_get_u32(m, "max_period", &timeshift_max_period);
    if (!htsmsg_get_u32(m, "unlimited_size", &u32))
      timeshift_unlimited_size = u32 ? 1 : 0;
    if (!htsmsg_get_u32(m, "max_size", &u32))
      timeshift_max_size = 1048576LL * u32;
    htsmsg_destroy(m);
  }
}
示例#2
0
/*
 * Intialise global file manager
 */
void timeshift_init ( void )
{
  htsmsg_t *m;

  timeshift_filemgr_init();

  /* Defaults */
  memset(&timeshift_conf, 0, sizeof(timeshift_conf));
  timeshift_conf.idnode.in_class = &timeshift_conf_class;
  timeshift_conf.max_period       = 60;                      // Hr (60mins)
  timeshift_conf.max_size         = 10000 * (size_t)1048576; // 10G

  /* Load settings */
  if ((m = hts_settings_load("timeshift/config"))) {
    idnode_load(&timeshift_conf.idnode, m);
    htsmsg_destroy(m);
    timeshift_fixup();
  }
}