mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
In the dm_config_*get_* functions, make the actual value retrieval optional
(useful for just checking that a given key is of a given type).
This commit is contained in:
parent
5da88e5ba4
commit
864ec23ec0
@ -1111,6 +1111,7 @@ int dm_config_get_uint32(const struct dm_config_node *cn, const char *path,
|
||||
if (!n || !n->v || n->v->type != DM_CFG_INT)
|
||||
return 0;
|
||||
|
||||
if (result)
|
||||
*result = n->v->v.i;
|
||||
return 1;
|
||||
}
|
||||
@ -1125,6 +1126,7 @@ int dm_config_get_uint64(const struct dm_config_node *cn, const char *path,
|
||||
if (!n || !n->v || n->v->type != DM_CFG_INT)
|
||||
return 0;
|
||||
|
||||
if (result)
|
||||
*result = (uint64_t) n->v->v.i;
|
||||
return 1;
|
||||
}
|
||||
@ -1139,6 +1141,7 @@ int dm_config_get_str(const struct dm_config_node *cn, const char *path,
|
||||
if (!n || !n->v || n->v->type != DM_CFG_STRING)
|
||||
return 0;
|
||||
|
||||
if (result)
|
||||
*result = n->v->v.str;
|
||||
return 1;
|
||||
}
|
||||
@ -1154,6 +1157,7 @@ int dm_config_get_list(const struct dm_config_node *cn, const char *path,
|
||||
if (!n || !n->v)
|
||||
return 0;
|
||||
|
||||
if (result)
|
||||
*result = n->v;
|
||||
return 1;
|
||||
}
|
||||
@ -1167,6 +1171,7 @@ int dm_config_get_section(const struct dm_config_node *cn, const char *path,
|
||||
if (!n || n->v)
|
||||
return 0;
|
||||
|
||||
if (result)
|
||||
*result = n;
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user