1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 20:25:52 +03:00

lvmconfig: allow --withversions alone with --type list

Before this patch:

$ lvmconfig --type list --withversions --withsummary global/use_lvmetad
global/use_lvmetad - Use lvmetad to cache metadata and reduce disk scanning. [2.2.93]

$ lvmconfig --type list --withversions global/use_lvmetad
global/use_lvmetad

With this patch applied:

$ lvmconfig --type list --withversions --withsummary global/use_lvmetad
global/use_lvmetad - Use lvmetad to cache metadata and reduce disk scanning. [2.2.93]

$ lvmconfig --type list --withversions global/use_lvmetad
global/use_lvmetad - [2.2.93]
This commit is contained in:
Peter Rajnoha 2015-04-30 14:18:14 +02:00
parent 4388ab477c
commit d2c2718c11

View File

@ -1624,18 +1624,20 @@ static int _out_line_fn(const struct dm_config_node *cn, const char *line, void
return 1;
if (!_cfg_def_make_path(config_path, CFG_PATH_MAX_LEN, cfg_def->id, cfg_def, 1))
return_0;
if (out->tree_spec->withsummary) {
summary[0] = '\0';
if (cfg_def->comment)
_copy_one_line(cfg_def->comment, summary, &pos, strlen(cfg_def->comment));
if (out->tree_spec->withversions && !_get_config_node_version(version, cfg_def))
return_0;
fprintf(out->fp, "%s - %s%s%s%s\n", config_path, summary,
out->tree_spec->withversions ? " [" : "",
out->tree_spec->withversions ? version : "",
out->tree_spec->withversions ? "]" : "");
} else
fprintf(out->fp, "%s\n", config_path);
if (out->tree_spec->withversions && !_get_config_node_version(version, cfg_def))
return_0;
summary[0] = '\0';
if (out->tree_spec->withsummary && cfg_def->comment)
_copy_one_line(cfg_def->comment, summary, &pos, strlen(cfg_def->comment));
fprintf(out->fp, "%s%s%s%s%s%s%s\n", config_path,
*summary || out->tree_spec->withversions ? " - ": "",
*summary ? summary : "",
*summary ? " " : "",
out->tree_spec->withversions ? "[" : "",
out->tree_spec->withversions ? version : "",
out->tree_spec->withversions ? "]" : "");
return 1;
}