aboutsummaryrefslogtreecommitdiff
path: root/report_ops.h
diff options
context:
space:
mode:
authorTuukka Tikkanen <tuukka.tikkanen@linaro.org>2014-12-10 15:21:31 +0200
committerTuukka Tikkanen <tuukka.tikkanen@linaro.org>2014-12-12 08:57:27 +0200
commite648fabb41c1c672ac6ff0bd8a07f39d199a8053 (patch)
tree2a6848ae7d14723f784f8b39b410b01e846de147 /report_ops.h
parentf18b1b7a4df9dec114386d9839a2c1e408fb0556 (diff)
report_ops: Change way of referring to different report formats
The initial implementation of default, boxless and csv report formats required making the report format ops structures global. Getoptions() referred directly to these structures when assigning the active ops pointer. This patch adds a name field to the structures and places pointers to the structures in a special segment so that the list of ops structures can be iterated like an array without having to create such an array explicitly. Getoptions() is modified to record only the name and main() will then obtain the actual structure pointer by name. The ops array head and sentinel is combined into the same source files that have been used for trace file ops arrays. The files are renamed to ops_head.c and ops_tail.c. Command line options parsing now checks that there is only one specification of report format. Usage function lists the available formats. -C and -B are retained as shortcuts for -r csv and -r boxless, respectively. Signed-off-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org>
Diffstat (limited to 'report_ops.h')
-rw-r--r--report_ops.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/report_ops.h b/report_ops.h
index fe6100e..2c659e3 100644
--- a/report_ops.h
+++ b/report_ops.h
@@ -7,6 +7,7 @@ struct cpufreq_pstate;
struct wakeup_irq;
struct report_ops {
+ const char *name;
int (*check_options)(struct program_options *);
int (*check_output)(struct program_options *, void *);
@@ -32,8 +33,15 @@ struct report_ops {
void (*wakeup_end_cpu)(void *);
};
-extern struct report_ops default_report_ops;
-extern struct report_ops csv_report_ops;
-extern struct report_ops boxless_report_ops;
+extern void list_report_formats_to_stderr(void);
+extern struct report_ops *get_report_ops(const char *name);
+
+#define EXPORT_REPORT_OPS(reporttype_name) \
+ static const struct report_ops \
+ __attribute__ ((__used__)) \
+ __attribute__ ((__section__ ("__report_ops"))) \
+ * reporttype_name ## _report_ptr = &reporttype_name##_report_ops
+
+extern const struct report_ops *report_ops_head;
#endif