mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
dmsetup: more const strings
More strings into .rodata segment.
This commit is contained in:
parent
5561f2a530
commit
7c016506a2
@ -4702,8 +4702,8 @@ FIELD_F(STATS_META, STR, "ObjType", 7, dm_stats_object_type, "obj_type", "Type o
|
|||||||
#undef NUM
|
#undef NUM
|
||||||
#undef SIZ
|
#undef SIZ
|
||||||
|
|
||||||
static const char *_default_report_options = "name,major,minor,attr,open,segments,events,uuid";
|
static const char _default_report_options[] = "name,major,minor,attr,open,segments,events,uuid";
|
||||||
static const char *_splitname_report_options = "vg_name,lv_name,lv_layer";
|
static const char _splitname_report_options[] = "vg_name,lv_name,lv_layer";
|
||||||
|
|
||||||
/* Stats counters & derived metrics. */
|
/* Stats counters & derived metrics. */
|
||||||
#define RD_COUNTERS "read_count,reads_merged_count,read_sector_count,read_time,read_ticks"
|
#define RD_COUNTERS "read_count,reads_merged_count,read_sector_count,read_time,read_ticks"
|
||||||
@ -4727,22 +4727,23 @@ static const char *_splitname_report_options = "vg_name,lv_name,lv_layer";
|
|||||||
#define STATS_HIST STATS_REGION_INFO ",util,await"
|
#define STATS_HIST STATS_REGION_INFO ",util,await"
|
||||||
|
|
||||||
/* Default stats report options. */
|
/* Default stats report options. */
|
||||||
static const char *_stats_default_report_options = STATS_DEV_INFO "," STATS_AREA_INFO "," METRICS;
|
static const char _stats_default_report_options[] = STATS_DEV_INFO "," STATS_AREA_INFO "," METRICS;
|
||||||
static const char *_stats_raw_report_options = STATS_DEV_INFO "," STATS_AREA_INFO "," COUNTERS;
|
static const char _stats_raw_report_options[] = STATS_DEV_INFO "," STATS_AREA_INFO "," COUNTERS;
|
||||||
static const char *_stats_list_options = STATS_REGION_INFO ",program_id";
|
static const char _stats_list_options[] = STATS_REGION_INFO ",program_id";
|
||||||
static const char *_stats_area_list_options = STATS_AREA_INFO_FULL ",program_id";
|
static const char _stats_area_list_options[] = STATS_AREA_INFO_FULL ",program_id";
|
||||||
static const char *_stats_hist_list_options = STATS_REGION_INFO ",hist_bins,hist_bounds";
|
static const char _stats_hist_list_options[] = STATS_REGION_INFO ",hist_bins,hist_bounds";
|
||||||
static const char *_stats_hist_area_list_options = STATS_AREA_INFO_FULL ",hist_bins,hist_bounds";
|
static const char _stats_hist_area_list_options[] = STATS_AREA_INFO_FULL ",hist_bins,hist_bounds";
|
||||||
static const char *_stats_hist_options = STATS_HIST ",hist_count_bounds";
|
static const char _stats_hist_options[] = STATS_HIST ",hist_count_bounds";
|
||||||
static const char *_stats_hist_relative_options = STATS_HIST ",hist_percent_bounds";
|
static const char _stats_hist_relative_options[] = STATS_HIST ",hist_percent_bounds";
|
||||||
|
|
||||||
static int _report_init(const struct command *cmd, const char *subcommand)
|
static int _report_init(const struct command *cmd, const char *subcommand)
|
||||||
{
|
{
|
||||||
char *options = (char *) _default_report_options;
|
const char *options = _default_report_options;
|
||||||
char *opt_fields = NULL; /* optional fields from command line */
|
char *opt_fields = NULL; /* optional fields from command line */
|
||||||
const char *keys = "";
|
const char *keys = "";
|
||||||
const char *separator = " ";
|
const char *separator = " ";
|
||||||
const char *selection = NULL;
|
const char *selection = NULL;
|
||||||
|
char *tmpopts = NULL;
|
||||||
int aligned = 1, headings = 1, buffered = 1, field_prefixes = 0;
|
int aligned = 1, headings = 1, buffered = 1, field_prefixes = 0;
|
||||||
int quoted = 1, columns_as_rows = 0;
|
int quoted = 1, columns_as_rows = 0;
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
@ -4758,20 +4759,20 @@ static int _report_init(const struct command *cmd, const char *subcommand)
|
|||||||
_report_type |= DR_STATS_META;
|
_report_type |= DR_STATS_META;
|
||||||
if (!strcmp(subcommand, "list")) {
|
if (!strcmp(subcommand, "list")) {
|
||||||
if (!_switches[HISTOGRAM_ARG])
|
if (!_switches[HISTOGRAM_ARG])
|
||||||
options = (char *) ((_switches[VERBOSE_ARG])
|
options = ((_switches[VERBOSE_ARG])
|
||||||
? _stats_area_list_options
|
? _stats_area_list_options
|
||||||
: _stats_list_options);
|
: _stats_list_options);
|
||||||
else
|
else
|
||||||
options = (char *) ((_switches[VERBOSE_ARG])
|
options = ((_switches[VERBOSE_ARG])
|
||||||
? _stats_hist_area_list_options
|
? _stats_hist_area_list_options
|
||||||
: _stats_hist_list_options);
|
: _stats_hist_list_options);
|
||||||
} else {
|
} else {
|
||||||
if (_switches[HISTOGRAM_ARG])
|
if (_switches[HISTOGRAM_ARG])
|
||||||
options = (char *) ((_switches[RELATIVE_ARG])
|
options = ((_switches[RELATIVE_ARG])
|
||||||
? _stats_hist_relative_options
|
? _stats_hist_relative_options
|
||||||
: _stats_hist_options);
|
: _stats_hist_options);
|
||||||
else
|
else
|
||||||
options = (char *) ((!_switches[RAW_ARG])
|
options = ((!_switches[RAW_ARG])
|
||||||
? _stats_default_report_options
|
? _stats_default_report_options
|
||||||
: _stats_raw_report_options);
|
: _stats_raw_report_options);
|
||||||
_report_type |= DR_STATS;
|
_report_type |= DR_STATS;
|
||||||
@ -4779,7 +4780,7 @@ static int _report_init(const struct command *cmd, const char *subcommand)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cmd && !strcmp(cmd->name, "list")) {
|
if (cmd && !strcmp(cmd->name, "list")) {
|
||||||
options = (char *) _stats_list_options;
|
options = _stats_list_options;
|
||||||
_report_type |= DR_STATS_META;
|
_report_type |= DR_STATS_META;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4825,7 +4826,6 @@ static int _report_init(const struct command *cmd, const char *subcommand)
|
|||||||
if (*_string_args[OPTIONS_ARG] != '+')
|
if (*_string_args[OPTIONS_ARG] != '+')
|
||||||
options = _string_args[OPTIONS_ARG];
|
options = _string_args[OPTIONS_ARG];
|
||||||
else {
|
else {
|
||||||
char *tmpopts;
|
|
||||||
opt_fields = _string_args[OPTIONS_ARG] + 1;
|
opt_fields = _string_args[OPTIONS_ARG] + 1;
|
||||||
len = strlen(options) + strlen(opt_fields) + 2;
|
len = strlen(options) + strlen(opt_fields) + 2;
|
||||||
if (!(tmpopts = malloc(len))) {
|
if (!(tmpopts = malloc(len))) {
|
||||||
@ -4903,8 +4903,7 @@ static int _report_init(const struct command *cmd, const char *subcommand)
|
|||||||
dm_report_set_output_field_name_prefix(_report, "dm_");
|
dm_report_set_output_field_name_prefix(_report, "dm_");
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (len)
|
free(tmpopts);
|
||||||
free(options);
|
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user