X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fconf-journal.c;h=7d3ccdce1e7f83347ebe73d8db4de0681cdb3dfa;hb=6c4c397f94ec5f5df6bcc178fb5fa4e84d3505fc;hp=6412328acaf9017f32f545167e747d52d463554e;hpb=8c23d507cbb0af5452d6d4e16b1750adfbb7d28d;p=libucw.git diff --git a/ucw/conf-journal.c b/ucw/conf-journal.c index 6412328a..7d3ccdce 100644 --- a/ucw/conf-journal.c +++ b/ucw/conf-journal.c @@ -24,7 +24,7 @@ struct old_pools { struct cf_journal_item { struct cf_journal_item *prev; byte *ptr; - uns len; + uint len; byte copy[0]; }; @@ -33,14 +33,14 @@ cf_set_journalling(int enable) { struct cf_context *cc = cf_get_context(); ASSERT(!cc->journal); - cc->need_journal = enable; + cc->enable_journal = enable; } void -cf_journal_block(void *ptr, uns len) +cf_journal_block(void *ptr, uint 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; @@ -60,7 +60,7 @@ cf_journal_swap(void) { prev = curr->prev; curr->prev = next; - for (uns i=0; ilen; i++) + for (uint i=0; ilen; i++) { byte x = curr->copy[i]; curr->copy[i] = curr->ptr[i]; @@ -71,7 +71,7 @@ cf_journal_swap(void) } struct cf_journal_item * -cf_journal_new_transaction(uns new_pool) +cf_journal_new_transaction(uint new_pool) { struct cf_context *cc = cf_get_context(); if (new_pool) @@ -82,7 +82,7 @@ cf_journal_new_transaction(uns new_pool) } void -cf_journal_commit_transaction(uns new_pool, struct cf_journal_item *oldj) +cf_journal_commit_transaction(uint new_pool, struct cf_journal_item *oldj) { struct cf_context *cc = cf_get_context(); if (new_pool) @@ -102,11 +102,11 @@ cf_journal_commit_transaction(uns new_pool, struct cf_journal_item *oldj) } void -cf_journal_rollback_transaction(uns new_pool, struct cf_journal_item *oldj) +cf_journal_rollback_transaction(uint 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) @@ -126,5 +126,3 @@ cf_journal_delete(void) mp_delete(p->pool); } } - -/* TODO: more space efficient journal */