g10: Improve TOFU batch update code.
authorNeal H. Walfield <neal@g10code.com>
Tue, 30 Aug 2016 13:37:45 +0000 (15:37 +0200)
committerNeal H. Walfield <neal@g10code.com>
Tue, 30 Aug 2016 14:06:40 +0000 (16:06 +0200)
commit371ae66e9d5c7524431773c4a479fcae1ea3b652
treefeee07534e809ded6fdf158c6bcbd3c63aee055a
parent3beeaa70bdbde65f93adbb30d52b9c376963ac42
g10: Improve TOFU batch update code.

* g10/gpg.h (tofu): Rename field batch_update_ref to
batch_updated_wanted.
* g10/tofu.c (struct tofu_dbs_s): Rename field batch_update to
in_batch_transaction.
(begin_transaction): Only end an extant batch transaction if we are
not in a normal transaction.  When ending a batch transaction, really
end it.  Update ctrl->tofu.batch_update_started when starting a batch
transaction.
(end_transaction): Only release a batch transaction if ONLY_BATCH is
true.  When releasing a batch transaction, assert that there is no
open normal transaction.  Only allow DBS to be NULL if ONLY_BATCH is
true.
(tofu_begin_batch_update): Don't update
ctrl->tofu.batch_update_started.
(opendbs): Call end_transaction unconditionally.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
g10/gpg.h
g10/tofu.c