1 #include <linux/compiler.h>
5 #include "parse-options.h"
7 typedef int (*data_cmd_fn_t)(int argc, const char **argv, const char *prefix);
15 static struct data_cmd data_cmds[];
17 #define for_each_cmd(cmd) \
18 for (cmd = data_cmds; cmd && cmd->name; cmd++)
20 static const struct option data_options[] = {
24 static const char * const data_usage[] = {
25 "perf data [<common options>] <command> [<options>]",
29 static void print_usage(void)
34 printf("\t%s\n\n", data_usage[0]);
35 printf("\tAvailable commands:\n");
38 printf("\t %s\t- %s\n", cmd->name, cmd->summary);
44 static struct data_cmd data_cmds[] = {
48 int cmd_data(int argc, const char **argv, const char *prefix)
53 /* No command specified. */
57 argc = parse_options(argc, argv, data_options, data_usage,
58 PARSE_OPT_STOP_AT_NON_OPTION);
65 if (strcmp(cmd->name, cmdstr))
68 return cmd->fn(argc, argv, prefix);
71 pr_err("Unknown command: %s\n", cmdstr);