Arnaldo Carvalho de Melo
96395cbbc7
tools lib string: Adopt prefixcmp() from perf and subcmd
...
Both had copies originating from git.git, move those to
tools/lib/string.c, getting both tools/lib/subcmd/ and tools/perf/ to
use it.
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Josh Poimboeuf <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-04-26 15:49:21 -03:00
Arnaldo Carvalho de Melo
b988971662
tools lib subcmd: Make it an error to pass a signed value to OPTION_UINTEGER
...
Options marked OPTION_UINTEGER or OPTION_U64 clearly indicates that an
unsigned value is expected, so just error out when a negative value is
passed, instead of returning something undesired to the tool.
E.g.:
# perf bench futex hash -t -4
# Running 'futex/hash' benchmark:
Error: switch `t' expects an unsigned numerical value
Usage: perf bench futex hash <options>
-t, --threads <n> Specify amount of threads
#
Cc: Adrian Hunter <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Davidlohr Bueso <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Josh Poimboeuf <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-02-14 15:19:17 -03:00
Jiri Olsa
b66fb1da5a
tools lib subcmd: Add OPT_STRING_OPTARG_SET option
...
To allow string options with a default argument and variable set when
the option is used.
Signed-off-by: Jiri Olsa <[email protected] >
Tested-by: Wang Nan <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Josh Poimboeuf <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2017-01-03 11:10:38 -03:00
Namhyung Kim
369a247897
tools lib subcmd: Suppport cascading options
...
Sometimes subcommand have common options and it can only handled in the
upper level command unless it duplicates the options.
This patch adds a parent field and fallback to the parent if the given
argument was not found in the current options.
Signed-off-by: Namhyung Kim <[email protected] >
Acked-by: Jiri Olsa <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Josh Poimboeuf <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Wang Nan <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2016-10-25 10:12:16 -03:00
Josh Poimboeuf
4b6ab94eab
perf subcmd: Create subcmd library
...
Move the subcommand-related files from perf to a new library named
libsubcmd.a.
Since we're moving files anyway, go ahead and rename 'exec_cmd.*' to
'exec-cmd.*' to be consistent with the naming of all the other files.
Signed-off-by: Josh Poimboeuf <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/c0a838d4c878ab17fee50998811612b2281355c1.1450193761.git.jpoimboe@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2015-12-17 14:27:14 -03:00