summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2012-07-31 16:18:01 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2012-07-31 16:18:01 +0200
commitf64f22e2d657346197fcd0b8e97e87b6d290ab2b (patch)
tree41ec520fc4b8a56427b2401f1c70c200bcb0908b
parent8791d01fee7f5977b037400020db97a40821b94a (diff)
downloadlvm2-f64f22e2d657346197fcd0b8e97e87b6d290ab2b.tar.gz
lvm2-f64f22e2d657346197fcd0b8e97e87b6d290ab2b.tar.xz
lvm2-f64f22e2d657346197fcd0b8e97e87b6d290ab2b.zip
lvm2app: add lvm_config_find_bool function
To effectively retrieve the setting of anything that could be enabled or disabled.
-rw-r--r--WHATS_NEW1
-rw-r--r--liblvm/lvm2app.h22
-rw-r--r--liblvm/lvm_base.c5
3 files changed, 28 insertions, 0 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index cb3ed90c..5208da9a 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 dd200e3e..72c0d79f 100644
--- a/liblvm/lvm2app.h
+++ b/liblvm/lvm2app.h
@@ -303,6 +303,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.
*
* \memberof lvm_t
diff --git a/liblvm/lvm_base.c b/liblvm/lvm_base.c
index 599c859a..2f39b462 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();