From: Peter Rajnoha Date: Tue, 31 Jul 2012 14:18:01 +0000 (+0200) Subject: lvm2app: add lvm_config_find_bool function X-Git-Tag: v2_02_97~24 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=f64f22e2d657346197fcd0b8e97e87b6d290ab2b;p=lvm2.git lvm2app: add lvm_config_find_bool function To effectively retrieve the setting of anything that could be enabled or disabled. --- diff --git a/WHATS_NEW b/WHATS_NEW index cb3ed90cd..5208da9a7 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.97 - =============================== + Add lvm_config_find_bool lvm2app fn to retrieve bool value from config tree. Respect --test also when using lvmetad. No longer capitalise first LV attribute char for invalid snapshots. Allow vgextend to add PVs to a VG that is missing PVs. diff --git a/liblvm/lvm2app.h b/liblvm/lvm2app.h index dd200e3e3..72c0d79ff 100644 --- a/liblvm/lvm2app.h +++ b/liblvm/lvm2app.h @@ -302,6 +302,28 @@ int lvm_config_reload(lvm_t libh); */ int lvm_config_override(lvm_t libh, const char *config_string); +/** + * Find a boolean value in the LVM configuration. + * + * \memberof lvm_t + * + * This function finds a boolean value associated with a path + * in current LVM configuration. + * + * \param libh + * Handle obtained from lvm_init(). + * + * \param config_path + * A path in LVM configuration + * + * \param fail + * Value to return if the path is not found. + * + * \return + * boolean value for 'config_path' (success) or the value of 'fail' (error) + */ +int lvm_config_find_bool(lvm_t libh, const char *config_path, int fail); + /** * Return stored error no describing last LVM API error. * diff --git a/liblvm/lvm_base.c b/liblvm/lvm_base.c index 599c859a3..2f39b4623 100644 --- a/liblvm/lvm_base.c +++ b/liblvm/lvm_base.c @@ -94,6 +94,11 @@ int lvm_config_override(lvm_t libh, const char *config_settings) return 0; } +int lvm_config_find_bool(lvm_t libh, const char *config_path, int fail) +{ + return find_config_tree_bool((struct cmd_context *)libh, config_path, fail); +} + int lvm_errno(lvm_t libh) { return stored_errno();