summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2015-10-22 13:27:59 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2015-10-30 15:47:56 +0100
commitbb4d3fa7a70881b72ddf61cba02760b89cf07b53 (patch)
tree645c480c6ca4c790330ee694006abecc9fb8e0bc
parent3e18b101a0845f826de29cfd0c554c5e2be2baa5 (diff)
downloadlvm2-bb4d3fa7a70881b72ddf61cba02760b89cf07b53.tar.gz
report: add report_get_field_prefix function
-rw-r--r--lib/report/report.c15
-rw-r--r--lib/report/report.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/report/report.c b/lib/report/report.c
index dea66eee3..911c96eff 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -3396,6 +3396,21 @@ void *report_init_for_selection(struct cmd_context *cmd,
cmd);
}
+const char *report_get_field_prefix(report_type_t report_type_id)
+{
+ const struct dm_report_object_type *report_types, *report_type;
+
+ report_types = report_type_id & DEVTYPES ? _devtypes_report_types
+ : _report_types;
+
+ for (report_type = report_types; report_type->id; report_type++) {
+ if (report_type_id & report_type->id)
+ return report_type->prefix;
+ }
+
+ return "";
+}
+
/*
* Create a row of data for an object
*/
diff --git a/lib/report/report.h b/lib/report/report.h
index 84c5f91d1..6c8b02634 100644
--- a/lib/report/report.h
+++ b/lib/report/report.h
@@ -71,6 +71,7 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
int quoted, int columns_as_rows, const char *selection);
void *report_init_for_selection(struct cmd_context *cmd, report_type_t *report_type,
const char *selection);
+const char *report_get_field_prefix(report_type_t report_type);
int report_for_selection(struct cmd_context *cmd,
struct selection_handle *sh,
struct physical_volume *pv,