summaryrefslogtreecommitdiff
path: root/libdm/libdm-config.c
diff options
context:
space:
mode:
authorJonathan Brassow <jbrassow@redhat.com>2014-01-27 05:26:19 -0600
committerJonathan Brassow <jbrassow@redhat.com>2014-01-27 05:26:19 -0600
commit94377dfd5ee7bbbdeb8836eeeea2198bc32c07f5 (patch)
treef0e46e7a6d88a6d8cf885f076271fb554d68a34c /libdm/libdm-config.c
parent6b73d21ba940804ebe91641343ee76f52d6a138e (diff)
downloadlvm2-94377dfd5ee7bbbdeb8836eeeea2198bc32c07f5.tar.gz
Misc: New function for reading lvm config file fields
Introduce 'dm_config_get_int', which will be used by the upcoming cachepool segment type.
Diffstat (limited to 'libdm/libdm-config.c')
-rw-r--r--libdm/libdm-config.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c
index ea1af2f90..32976217c 100644
--- a/libdm/libdm-config.c
+++ b/libdm/libdm-config.c
@@ -1047,6 +1047,20 @@ int dm_config_tree_find_bool(const struct dm_config_tree *cft, const char *path,
/************************************/
+int dm_config_get_int(const struct dm_config_node *cn, const char *path,
+ int *result)
+{
+ const struct dm_config_node *n;
+
+ n = _find_config_node(cn, path);
+
+ if (!n || !n->v || n->v->type != DM_CFG_INT)
+ return 0;
+
+ if (result)
+ *result = n->v->v.i;
+ return 1;
+}
int dm_config_get_uint32(const struct dm_config_node *cn, const char *path,
uint32_t *result)