access_ipmask_t *ai;
char ubuf[UUID_HEX_SIZE];
+ idnode_save_check(&ae->ae_id, delconf);
+
if (delconf)
hts_settings_remove("accesscontrol/%s", idnode_uuid_as_str(&ae->ae_id, ubuf));
if (pw == NULL)
return;
+ idnode_save_check(&pw->pw_id, delconf);
+
if (delconf)
hts_settings_remove("passwd/%s", idnode_uuid_as_str(&pw->pw_id, ubuf));
TAILQ_REMOVE(&passwd_entries, pw, pw_link);
}
static void
-ipblock_entry_destroy(ipblock_entry_t *ib)
+ipblock_entry_destroy(ipblock_entry_t *ib, int delconf)
{
if (ib == NULL)
return;
+ idnode_save_check(&ib->ib_id, delconf);
TAILQ_REMOVE(&ipblock_entries, ib, ib_link);
idnode_unlink(&ib->ib_id);
free(ib->ib_comment);
char ubuf[UUID_HEX_SIZE];
hts_settings_remove("ipblock/%s", idnode_uuid_as_str(&ib->ib_id, ubuf));
- ipblock_entry_destroy(ib);
+ ipblock_entry_destroy(ib, 1);
}
static int
while ((pw = TAILQ_FIRST(&passwd_entries)) != NULL)
passwd_entry_destroy(pw, 0);
while ((ib = TAILQ_FIRST(&ipblock_entries)) != NULL)
- ipblock_entry_destroy(ib);
+ ipblock_entry_destroy(ib, 0);
free((void *)superuser_username);
superuser_username = NULL;
free((void *)superuser_password);
return;
RB_REMOVE(&bouquets, bq, bq_link);
+ idnode_save_check(&bq->bq_id, 1);
idnode_unlink(&bq->bq_id);
if ((bqd = bq->bq_download) != NULL) {
lock_assert(&global_lock);
+ idnode_save_check(&ch->ch_id, delconf);
+
if (delconf)
tvhinfo("channel", "%s - deleting", channel_get_name(ch));
idnode_list_mapping_t *ilm;
char ubuf[UUID_HEX_SIZE];
+ idnode_save_check(&ct->ct_id, delconf);
+
while((ilm = LIST_FIRST(&ct->ct_ctms)) != NULL)
channel_tag_mapping_destroy(ilm, delconf ? ilm->ilm_in1 : NULL);
{
char ubuf[UUID_HEX_SIZE];
+ idnode_save_check(&cac->cac_id, delconf);
cac->cac_enabled = 0;
cac->cac_conf_changed(cac);
if (delconf)
{
char ubuf[UUID_HEX_SIZE];
+ idnode_save_check(&dae->dae_id, delconf);
+
dvr_autorec_purge_spawns(dae, delconf, 0);
if (delconf)
{
char ubuf[UUID_HEX_SIZE];
+ idnode_save_check(&cfg->dvr_id, delconf);
+
if (delconf) {
tvhinfo("dvr", "Deleting configuration '%s'", cfg->dvr_config_name);
hts_settings_remove("dvr/config/%s", idnode_uuid_as_str(&cfg->dvr_id, ubuf));
return;
}
+ idnode_save_check(&de->de_id, 1);
+
idnode_unlink(&de->de_id);
if(de->de_autorec != NULL)
{
char ubuf[UUID_HEX_SIZE];
+ idnode_save_check(&de->de_id, delconf);
+
if (delconf)
hts_settings_remove("dvr/log/%s", idnode_uuid_as_str(&de->de_id, ubuf));
{
char ubuf[UUID_HEX_SIZE];
+ idnode_save_check(&dte->dte_id, delconf);
+
dvr_timerec_purge_spawn(dte, delconf);
if (delconf)
pthread_mutex_lock(&global_lock);
while ((mod = LIST_FIRST(&epggrab_modules)) != NULL) {
+ idnode_save_check(&mod->idnode, 1);
idnode_unlink(&mod->idnode);
LIST_REMOVE(mod, link);
pthread_mutex_unlock(&global_lock);
if (ec == NULL) return;
+ idnode_save_check(&ec->idnode, delconf);
+
/* Already linked */
epggrab_channel_links_delete(ec, 0);
if (rb_remove)
if (delconf)
hts_settings_remove("esfilter/%s", idnode_uuid_as_str(&esf->esf_id, ubuf));
TAILQ_REMOVE(&esfilters[esf->esf_class], esf, esf_link);
+ idnode_save_check(&esf->esf_id, delconf);
idnode_unlink(&esf->esf_id);
free(esf->esf_comment);
free(esf);
RB_REMOVE(in->in_domain, in, in_domain_link);
tvhtrace("idnode", "unlink node %s", idnode_uuid_as_str(in, ubuf));
idnode_notify(in, "delete");
-
- if (in->in_save) {
- TAILQ_REMOVE(&idnodes_save, in->in_save, ise_link);
- in->in_save = NULL;
- }
+ assert(in->in_save == NULL);
}
/**
self->in_save = ise;
}
+void
+idnode_save_check ( idnode_t *self, int weak )
+{
+ char filename[PATH_MAX];
+ htsmsg_t *m;
+
+ if (self->in_save == NULL)
+ return;
+
+ TAILQ_REMOVE(&idnodes_save, self->in_save, ise_link);
+ free(self->in_save);
+ self->in_save = NULL;
+
+ if (weak)
+ return;
+
+ m = idnode_savefn(self, filename, sizeof(filename));
+ if (m) {
+ hts_settings_save(m, "%s", filename);
+ htsmsg_destroy(m);
+ }
+}
+
int
idnode_write0 ( idnode_t *self, htsmsg_t *c, int optmask, int dosave )
{
htsmsg_t *idnode_serialize0 (idnode_t *self, htsmsg_t *list, int optmask, const char *lang);
void idnode_read0 (idnode_t *self, htsmsg_t *m, htsmsg_t *list, int optmask, const char *lang);
int idnode_write0 (idnode_t *self, htsmsg_t *m, int optmask, int dosave);
+void idnode_save_check (idnode_t *self, int weak);
#define idclass_serialize(idc, lang) idclass_serialize0(idc, NULL, 0, lang)
#define idnode_serialize(in, lang) idnode_serialize0(in, NULL, 0, lang)
break;
}
if (!th) return;
+
+ idnode_save_check(&la->th_id, 1);
/* Delete the frontends */
for (lfe = LIST_FIRST(&la->la_frontends); lfe != NULL; lfe = next) {
linuxdvb_satconf_ele_destroy ( linuxdvb_satconf_ele_t *ls )
{
TAILQ_REMOVE(&ls->lse_parent->ls_elements, ls, lse_link);
+ idnode_save_check(&ls->lse_id, 1);
idnode_unlink(&ls->lse_id);
if (ls->lse_lnb) linuxdvb_lnb_destroy(ls->lse_lnb);
if (ls->lse_switch) linuxdvb_switch_destroy(ls->lse_switch);
nxt = TAILQ_NEXT(lse, lse_link);
linuxdvb_satconf_ele_destroy(lse);
}
+ idnode_save_check(&ls->ls_id, 1);
idnode_unlink(&ls->ls_id);
free(ls);
}
void
linuxdvb_diseqc_destroy ( linuxdvb_diseqc_t *ld )
{
+ idnode_save_check(&ld->ld_id, 1);
idnode_unlink(&ld->ld_id);
free((void *)ld->ld_type);
}
/* Early shutdown flag */
mi->mi_running = 0;
+ idnode_save_check(&mi->ti_id, delconf);
+
/* Remove networks */
while ((mnl = LIST_FIRST(&mi->mi_networks)))
mpegts_input_del_network(mnl);
{
mpegts_mux_instance_t *mmi = (mpegts_mux_instance_t *)tii;
+ idnode_save_check(&tii->tii_id, 1);
idnode_unlink(&tii->tii_id);
LIST_REMOVE(mmi, mmi_mux_link);
LIST_REMOVE(tii, tii_input_link);
th_subscription_t *ths;
char buf[256];
+ idnode_save_check(&mm->mm_id, delconf);
+
mpegts_mux_nice_name(mm, buf, sizeof(buf));
tvhinfo("mpegts", "%s (%p) - deleting", buf, mm);
gtimer_disarm(&sd->sd_destroy_timer);
+ idnode_save_check(&sd->th_id, 1);
+
while ((lfe = TAILQ_FIRST(&sd->sd_frontends)) != NULL)
satip_frontend_delete(lfe);
{
satip_frontend_t *lfe = sfc->sfc_lfe;
TAILQ_REMOVE(&lfe->sf_satconf, sfc, sfc_link);
+ idnode_save_check(&sfc->sfc_id, 1);
idnode_unlink(&sfc->sfc_id);
idnode_set_free(sfc->sfc_networks);
free(sfc->sfc_name);
gtimer_disarm(&hd->hd_destroy_timer);
+ idnode_save_check(&hd->th_id, 1);
+
tvhlog(LOG_INFO, "tvhdhomerun", "Releasing locks for devices");
while ((lfe = TAILQ_FIRST(&hd->hd_frontends)) != NULL) {
tvhdhomerun_frontend_delete(lfe);
profile_delete(profile_t *pro, int delconf)
{
char ubuf[UUID_HEX_SIZE];
+ idnode_save_check(&pro->pro_id, delconf);
pro->pro_enabled = 0;
if (pro->pro_conf_changed)
pro->pro_conf_changed(pro);
lock_assert(&global_lock);
+ idnode_save_check(&t->s_id, delconf);
+
if(t->s_delete != NULL)
t->s_delete(t, delconf);