objtool: Collate parse_options() users
Ensure there's a single place that parses check_options, in preparation for extending where to get options from. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lkml.kernel.org/r/20210226110004.193108106@infradead.org
This commit is contained in:
committed by
Ingo Molnar
parent
8ad15c6900
commit
a2f605f9ff
@@ -42,17 +42,21 @@ const struct option check_options[] = {
|
|||||||
OPT_END(),
|
OPT_END(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int cmd_parse_options(int argc, const char **argv, const char * const usage[])
|
||||||
|
{
|
||||||
|
argc = parse_options(argc, argv, check_options, usage, 0);
|
||||||
|
if (argc != 1)
|
||||||
|
usage_with_options(usage, check_options);
|
||||||
|
return argc;
|
||||||
|
}
|
||||||
|
|
||||||
int cmd_check(int argc, const char **argv)
|
int cmd_check(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
const char *objname;
|
const char *objname;
|
||||||
struct objtool_file *file;
|
struct objtool_file *file;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
argc = parse_options(argc, argv, check_options, check_usage, 0);
|
argc = cmd_parse_options(argc, argv, check_usage);
|
||||||
|
|
||||||
if (argc != 1)
|
|
||||||
usage_with_options(check_usage, check_options);
|
|
||||||
|
|
||||||
objname = argv[0];
|
objname = argv[0];
|
||||||
|
|
||||||
file = objtool_open_read(objname);
|
file = objtool_open_read(objname);
|
||||||
|
|||||||
@@ -34,10 +34,7 @@ int cmd_orc(int argc, const char **argv)
|
|||||||
struct objtool_file *file;
|
struct objtool_file *file;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
argc = parse_options(argc, argv, check_options, orc_usage, 0);
|
argc = cmd_parse_options(argc, argv, orc_usage);
|
||||||
if (argc != 1)
|
|
||||||
usage_with_options(orc_usage, check_options);
|
|
||||||
|
|
||||||
objname = argv[0];
|
objname = argv[0];
|
||||||
|
|
||||||
file = objtool_open_read(objname);
|
file = objtool_open_read(objname);
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ extern const struct option check_options[];
|
|||||||
extern bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats,
|
extern bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats,
|
||||||
validate_dup, vmlinux, mcount, noinstr, backup;
|
validate_dup, vmlinux, mcount, noinstr, backup;
|
||||||
|
|
||||||
|
extern int cmd_parse_options(int argc, const char **argv, const char * const usage[]);
|
||||||
|
|
||||||
extern int cmd_check(int argc, const char **argv);
|
extern int cmd_check(int argc, const char **argv);
|
||||||
extern int cmd_orc(int argc, const char **argv);
|
extern int cmd_orc(int argc, const char **argv);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user