1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-30 17:18:21 +03:00

config: make it possible to set default unconfigured_value for settings of all types, not just strings

The @something@ used for unconfigured default value is not bound to
CFG_TYPE_STRING settings defined in config_settings.h, it can be
used for any other config type too.
This commit is contained in:
Peter Rajnoha 2015-04-28 13:50:23 +02:00
parent de6deec3b8
commit afcf472464

View File

@ -1675,7 +1675,10 @@ static struct dm_config_node *_add_def_node(struct dm_config_tree *cft,
cn->id = def->id;
if (!(def->type & CFG_TYPE_ARRAY)) {
if (spec->unconfigured && def->unconfigured_value) {
cn->v->type = DM_CFG_STRING;
cn->v->v.str = def->unconfigured_value;
} else if (!(def->type & CFG_TYPE_ARRAY)) {
switch (def->type) {
case CFG_TYPE_SECTION:
cn->v = NULL;
@ -1697,9 +1700,6 @@ static struct dm_config_node *_add_def_node(struct dm_config_tree *cft,
if (!(str = cfg_def_get_default_value_hint(spec->cmd, def, CFG_TYPE_STRING, NULL)))
str = "";
cn->v->v.str = str;
if (spec->unconfigured && def->unconfigured_value)
cn->v->v.str = def->unconfigured_value;
break;
default:
log_error(INTERNAL_ERROR "_add_def_node: unknown type");