mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
report: use report type description for report's name if using DM_REPORT_GROUP_BASIC output format
This commit is contained in:
parent
5b93db6566
commit
3e8e8ddb46
@ -3769,7 +3769,9 @@ void *report_init_for_selection(struct cmd_context *cmd,
|
|||||||
cmd);
|
cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *report_get_field_prefix(report_type_t report_type_id)
|
int report_get_prefix_and_desc(report_type_t report_type_id,
|
||||||
|
const char **report_prefix,
|
||||||
|
const char **report_desc)
|
||||||
{
|
{
|
||||||
const struct dm_report_object_type *report_types, *report_type;
|
const struct dm_report_object_type *report_types, *report_type;
|
||||||
|
|
||||||
@ -3781,11 +3783,15 @@ const char *report_get_field_prefix(report_type_t report_type_id)
|
|||||||
report_types = _report_types;
|
report_types = _report_types;
|
||||||
|
|
||||||
for (report_type = report_types; report_type->id; report_type++) {
|
for (report_type = report_types; report_type->id; report_type++) {
|
||||||
if (report_type_id & report_type->id)
|
if (report_type_id & report_type->id) {
|
||||||
return report_type->prefix;
|
*report_prefix = report_type->prefix;
|
||||||
|
*report_desc = report_type->desc;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
*report_prefix = *report_desc = "";
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -93,7 +93,9 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
|
|||||||
int report_get_single_selection(struct cmd_context *cmd, const char **selection);
|
int report_get_single_selection(struct cmd_context *cmd, const char **selection);
|
||||||
void *report_init_for_selection(struct cmd_context *cmd, report_type_t *report_type,
|
void *report_init_for_selection(struct cmd_context *cmd, report_type_t *report_type,
|
||||||
const char *selection);
|
const char *selection);
|
||||||
const char *report_get_field_prefix(report_type_t report_type);
|
int report_get_prefix_and_desc(report_type_t report_type_id,
|
||||||
|
const char **report_prefix,
|
||||||
|
const char **report_desc);
|
||||||
int report_for_selection(struct cmd_context *cmd,
|
int report_for_selection(struct cmd_context *cmd,
|
||||||
struct processing_handle *parent_handle,
|
struct processing_handle *parent_handle,
|
||||||
struct physical_volume *pv,
|
struct physical_volume *pv,
|
||||||
|
@ -985,9 +985,10 @@ int report_get_single_selection(struct cmd_context *cmd, const char **selection)
|
|||||||
return _do_report_get_selection(cmd, NULL, NULL, expected_idxs, selection);
|
return _do_report_get_selection(cmd, NULL, NULL, expected_idxs, selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _set_report_prefix_and_name(struct single_report_args *single_args)
|
static int _set_report_prefix_and_name(struct report_args *args,
|
||||||
|
struct single_report_args *single_args)
|
||||||
{
|
{
|
||||||
const char *report_prefix;
|
const char *report_prefix, *report_desc;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if (single_args->report_type == FULL) {
|
if (single_args->report_type == FULL) {
|
||||||
@ -996,7 +997,8 @@ static int _set_report_prefix_and_name(struct single_report_args *single_args)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
report_prefix = report_get_field_prefix(single_args->report_type);
|
(void) report_get_prefix_and_desc(single_args->report_type,
|
||||||
|
&report_prefix, &report_desc);
|
||||||
len = strlen(report_prefix);
|
len = strlen(report_prefix);
|
||||||
if (report_prefix[len - 1] == '_')
|
if (report_prefix[len - 1] == '_')
|
||||||
len--;
|
len--;
|
||||||
@ -1012,7 +1014,11 @@ static int _set_report_prefix_and_name(struct single_report_args *single_args)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
single_args->report_prefix[len] = '\0';
|
single_args->report_prefix[len] = '\0';
|
||||||
|
|
||||||
|
if (args->report_group_type != DM_REPORT_GROUP_BASIC)
|
||||||
single_args->report_name = single_args->report_prefix;
|
single_args->report_name = single_args->report_prefix;
|
||||||
|
else
|
||||||
|
single_args->report_name = report_desc;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1211,7 +1217,7 @@ out:
|
|||||||
args->single_args[REPORT_IDX_FULL_ ## type].report_type = type; \
|
args->single_args[REPORT_IDX_FULL_ ## type].report_type = type; \
|
||||||
args->single_args[REPORT_IDX_FULL_ ## type].keys = find_config_tree_str(cmd, report_ ## name ## _sort_full_CFG, NULL); \
|
args->single_args[REPORT_IDX_FULL_ ## type].keys = find_config_tree_str(cmd, report_ ## name ## _sort_full_CFG, NULL); \
|
||||||
args->single_args[REPORT_IDX_FULL_ ## type].options = find_config_tree_str(cmd, report_ ## name ## _cols_full_CFG, NULL); \
|
args->single_args[REPORT_IDX_FULL_ ## type].options = find_config_tree_str(cmd, report_ ## name ## _cols_full_CFG, NULL); \
|
||||||
if (!_set_report_prefix_and_name(&args->single_args[REPORT_IDX_FULL_ ## type])) \
|
if (!_set_report_prefix_and_name(args, &args->single_args[REPORT_IDX_FULL_ ## type])) \
|
||||||
return_0; \
|
return_0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -1228,7 +1234,7 @@ static int _config_report(struct cmd_context *cmd, struct report_args *args, str
|
|||||||
/* Check PV specifics and do extra changes/actions if needed. */
|
/* Check PV specifics and do extra changes/actions if needed. */
|
||||||
_check_pv_list(cmd, args, single_args);
|
_check_pv_list(cmd, args, single_args);
|
||||||
|
|
||||||
if (!_set_report_prefix_and_name(single_args))
|
if (!_set_report_prefix_and_name(args, single_args))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
switch (single_args->report_type) {
|
switch (single_args->report_type) {
|
||||||
@ -1472,7 +1478,7 @@ int report_format_init(struct cmd_context *cmd, dm_report_group_type_t *report_g
|
|||||||
* We reusing existing log report handle.
|
* We reusing existing log report handle.
|
||||||
* Just get report's name and prefix now.
|
* Just get report's name and prefix now.
|
||||||
*/
|
*/
|
||||||
if (!_set_report_prefix_and_name(single_args))
|
if (!_set_report_prefix_and_name(&args, single_args))
|
||||||
goto_bad;
|
goto_bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user