From fccc6ea2951686bc92bef40c5b87da9ee06cc4f6 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Tue, 8 May 2012 14:31:44 +0000 Subject: [PATCH] Log value chosen in _find_config_bool like other variable types do. --- WHATS_NEW_DM | 1 + libdm/libdm-config.c | 29 ++++++++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 28fd06d0e..6800b5a82 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.75 - ================================ + Log value chosen in _find_config_bool like other variable types do. Synchronize with dead of dmeventd. Rename (Blk)DevNames/DevNos dmsetup header to (Blk)DevNamesUsed/DevNosUsed. Add configure --with-veritysetup for independent veritysetup tool. diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c index 8683b5a57..d9d3882f2 100644 --- a/libdm/libdm-config.c +++ b/libdm/libdm-config.c @@ -842,22 +842,29 @@ static int _find_config_bool(const void *start, node_lookup_fn find, { const struct dm_config_node *n = find(start, path); const struct dm_config_value *v; + int b; - if (!n) - return fail; + if (n) { + v = n->v; - v = n->v; + switch (v->type) { + case DM_CFG_INT: + b = v->v.i ? 1 : 0; + log_very_verbose("Setting %s to %d", path, b); + return b; - switch (v->type) { - case DM_CFG_INT: - return v->v.i ? 1 : 0; - - case DM_CFG_STRING: - return _str_to_bool(v->v.str, fail); - default: - ; + case DM_CFG_STRING: + b = _str_to_bool(v->v.str, fail); + log_very_verbose("Setting %s to %d", path, b); + return b; + default: + ; + } } + log_very_verbose("%s not found in config: defaulting to %d", + path, fail); + return fail; }