mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Misc: New function for reading lvm config file fields
Introduce 'dm_config_get_int', which will be used by the upcoming cachepool segment type.
This commit is contained in:
parent
6b73d21ba9
commit
94377dfd5e
@ -1661,6 +1661,7 @@ int dm_config_tree_find_bool(const struct dm_config_tree *cft, const char *path,
|
|||||||
int dm_config_find_bool(const struct dm_config_node *cn, const char *path, int fail);
|
int dm_config_find_bool(const struct dm_config_node *cn, const char *path, int fail);
|
||||||
int dm_config_value_is_bool(const struct dm_config_value *v);
|
int dm_config_value_is_bool(const struct dm_config_value *v);
|
||||||
|
|
||||||
|
int dm_config_get_int(const struct dm_config_node *cn, const char *path, int *result);
|
||||||
int dm_config_get_uint32(const struct dm_config_node *cn, const char *path, uint32_t *result);
|
int dm_config_get_uint32(const struct dm_config_node *cn, const char *path, uint32_t *result);
|
||||||
int dm_config_get_uint64(const struct dm_config_node *cn, const char *path, uint64_t *result);
|
int dm_config_get_uint64(const struct dm_config_node *cn, const char *path, uint64_t *result);
|
||||||
int dm_config_get_str(const struct dm_config_node *cn, const char *path, const char **result);
|
int dm_config_get_str(const struct dm_config_node *cn, const char *path, const char **result);
|
||||||
|
@ -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,
|
int dm_config_get_uint32(const struct dm_config_node *cn, const char *path,
|
||||||
uint32_t *result)
|
uint32_t *result)
|
||||||
|
Loading…
Reference in New Issue
Block a user