X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fconf-journal.c;h=1cd51a6aa1eee859ed786d7d503f55877ac077b0;hb=984b27ee84b371d605c1402784039b3803a25983;hp=75af51ad69d3021743cf796945901c9663a8e818;hpb=0ca8c151f5afe1680e98f3bfbe9d5c752d8a2924;p=libucw.git diff --git a/ucw/conf-journal.c b/ucw/conf-journal.c index 75af51ad..1cd51a6a 100644 --- a/ucw/conf-journal.c +++ b/ucw/conf-journal.c @@ -28,11 +28,19 @@ struct cf_journal_item { byte copy[0]; }; +void +cf_set_journalling(int enable) +{ + struct cf_context *cc = cf_get_context(); + ASSERT(!cc->journal); + cc->enable_journal = enable; +} + void cf_journal_block(void *ptr, uns len) { struct cf_context *cc = cf_get_context(); - if (!cc->need_journal) + if (!cc->enable_journal) return; struct cf_journal_item *ji = cf_malloc(sizeof(struct cf_journal_item) + len); ji->prev = cc->journal; @@ -97,8 +105,8 @@ void cf_journal_rollback_transaction(uns new_pool, struct cf_journal_item *oldj) { struct cf_context *cc = cf_get_context(); - if (!cc->need_journal) - die("Cannot rollback the configuration, because the journal is disabled."); + if (!cc->enable_journal) + return; cf_journal_swap(); cc->journal = oldj; if (new_pool) @@ -118,5 +126,3 @@ cf_journal_delete(void) mp_delete(p->pool); } } - -/* TODO: more space efficient journal */