linux-stable/tools/perf/util
Ian Munsie c055564217 perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR()
Parsing an option from the command line with OPT_BOOLEAN on a
bool data type would not work on a big-endian machine due to the
manner in which the boolean was being cast into an int and
incremented. For example, running 'perf probe --list' on a
PowerPC machine would fail to properly set the list_events bool
and would therefore print out the usage information and
terminate.

This patch makes OPT_BOOLEAN work as expected with a bool
datatype. For cases where the original OPT_BOOLEAN was
intentionally being used to increment an int each time it was
passed in on the command line, this patch introduces OPT_INCR
with the old behaviour of OPT_BOOLEAN (the verbose variable is
currently the only such example of this).

I have reviewed every use of OPT_BOOLEAN to verify that a true
C99 bool was passed. Where integers were used, I verified that
they were only being used for boolean logic and changed them to
bools to ensure that they would not be mistakenly used as ints.
The major exception was the verbose variable which now uses
OPT_INCR instead of OPT_BOOLEAN.

Signed-off-by: Ian Munsie <imunsie@au.ibm.com>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: <stable@kernel.org> # NOTE: wont apply to .3[34].x cleanly, please backport
Cc: Git development list <git@vger.kernel.org>
Cc: Ian Munsie <imunsie@au1.ibm.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Eric B Munson <ebmunson@us.ibm.com>
Cc: Valdis.Kletnieks@vt.edu
Cc: WANG Cong <amwang@redhat.com>
Cc: Thiago Farina <tfransosi@gmail.com>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: John Kacur <jkacur@redhat.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1271147857-11604-1-git-send-email-imunsie@au.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-04-14 11:26:44 +02:00
..
include perf tools: Move __used from perf.h to linux/compiler.h 2010-03-26 08:52:59 +01:00
scripting-engines perf/scripts: Tuple was set from long in both branches in python_process_event() 2010-04-02 21:32:16 +02:00
abspath.c perf: Enable more compiler warnings 2009-08-16 10:47:47 +02:00
alias.c perf_counter tools: Add more warnings and fix/annotate them 2009-07-01 12:49:48 +02:00
build-id.c perf build-id: Move the routine to find DSOs with hits to the lib 2010-02-04 09:33:26 +01:00
build-id.h perf build-id: Move the routine to find DSOs with hits to the lib 2010-02-04 09:33:26 +01:00
cache.h perf newt: Properly restore the screen when error exiting 2010-03-22 18:47:34 +01:00
callchain.c perf callchains: Store the map together with the symbol 2010-03-26 08:52:57 +01:00
callchain.h perf callchains: Store the map together with the symbol 2010-03-26 08:52:57 +01:00
color.c perf hist: Replace ->print() routines by ->snprintf() equivalents 2010-04-02 16:28:15 -03:00
color.h perf hist: Replace ->print() routines by ->snprintf() equivalents 2010-04-02 16:28:15 -03:00
config.c perf: Enable more compiler warnings 2009-08-16 10:47:47 +02:00
cpumap.c perf tools: Fix sparse CPU numbering related bugs 2010-03-11 13:36:53 +01:00
cpumap.h perf tools: Fix sparse CPU numbering related bugs 2010-03-11 13:36:53 +01:00
ctype.c perf tools: Move graph_line and graph_dotted_line from top 2009-11-23 21:55:20 +01:00
debug.c perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR() 2010-04-14 11:26:44 +02:00
debug.h perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR() 2010-04-14 11:26:44 +02:00
debugfs.c perf trace: Clean up find_debugfs() 2009-12-28 10:36:36 +01:00
debugfs.h perf tools: Mount debugfs automatically 2009-12-28 10:36:36 +01:00
environment.c
event.c perf symbols: Fill in pgoff in mmap synthesized events 2010-04-03 10:20:31 -03:00
event.h perf tools: Reorganize some structs to save space 2010-04-08 11:34:26 -03:00
exec_cmd.c perf: Enable more compiler warnings 2009-08-16 10:47:47 +02:00
exec_cmd.h perf tools: Protect header files with a consistent style 2009-09-24 21:27:51 +02:00
generate-cmdlist.sh
header.c perf tools: Clean up O_LARGEFILE et al usage 2010-02-04 10:03:03 +01:00
header.h perf tools: Reorganize some structs to save space 2010-04-08 11:34:26 -03:00
help.c perf_counter tools: Add more warnings and fix/annotate them 2009-07-01 12:49:48 +02:00
help.h perf tools: Protect header files with a consistent style 2009-09-24 21:27:51 +02:00
hist.c perf hist: Only allocate callchain_node if processing callchains 2010-04-02 16:28:28 -03:00
hist.h perf hist: Replace ->print() routines by ->snprintf() equivalents 2010-04-02 16:28:15 -03:00
levenshtein.c
levenshtein.h perf tools: Protect header files with a consistent style 2009-09-24 21:27:51 +02:00
map.c perf symbols: map_groups__find_symbol must return the map too 2010-04-02 16:27:43 -03:00
map.h perf symbols: map_groups__find_symbol must return the map too 2010-04-02 16:27:43 -03:00
newt.c perf TUI: Move "Yes" button to before "No" 2010-04-08 11:34:25 -03:00
pager.c perf_counter tools: Remove dead code 2009-06-27 06:06:39 +02:00
parse-events.c perf symbols: Move hex2u64 and strxfrchar to symbol.c 2010-03-26 08:52:59 +01:00
parse-events.h perf trace: Add filter Suppport 2009-10-15 11:35:23 +02:00
parse-options.c perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR() 2010-04-14 11:26:44 +02:00
parse-options.h perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR() 2010-04-14 11:26:44 +02:00
path.c perf: Enable more compiler warnings 2009-08-16 10:47:47 +02:00
PERF-VERSION-GEN perf tools: Allow specifying O= to build files in a separate directory 2010-04-02 16:28:03 -03:00
probe-event.c perf probe: Cleanup debuginfo related code 2010-03-22 18:47:35 +01:00
probe-event.h perf tools: Reorganize some structs to save space 2010-04-08 11:34:26 -03:00
probe-finder.c perf probe: Fix to close dwarf when failing to analyze it 2010-04-02 19:35:44 +02:00
probe-finder.h perf tools: Reorganize some structs to save space 2010-04-08 11:34:26 -03:00
quote.c perf: Fix read buffer overflow 2009-08-04 11:09:56 +02:00
quote.h perf tools: Protect header files with a consistent style 2009-09-24 21:27:51 +02:00
run-command.c perf: Enable more compiler warnings 2009-08-16 10:47:47 +02:00
run-command.h perf tools: Protect header files with a consistent style 2009-09-24 21:27:51 +02:00
session.c perf session: Remove one more exit() call from library code 2010-04-02 16:28:31 -03:00
session.h perf newt: Pass the input_name to perf_session__browse_hists 2010-04-03 11:54:35 -03:00
sigchain.c
sigchain.h perf tools: Protect header files with a consistent style 2009-09-24 21:27:51 +02:00
sort.c perf tools: sort_dimension__add shouldn't die 2010-04-02 16:28:35 -03:00
sort.h perf TUI: Add a "Zoom into COMM(PID) thread" and reverse operations 2010-04-03 22:45:00 -03:00
strbuf.c perf_counter tools: Add more warnings and fix/annotate them 2009-07-01 12:49:48 +02:00
strbuf.h perf tools: Protect header files with a consistent style 2009-09-24 21:27:51 +02:00
string.c perf: Swap inclusion order of util.h and string.h in util/string.c 2010-04-04 16:40:42 +02:00
strlist.c perf probe: Fix --del to update current event list 2009-12-15 20:22:01 +01:00
strlist.h perf tools: Add for_each macros for strlist 2009-12-15 20:22:02 +01:00
svghelper.c perf timechart: Improve the visual appearance of scheduler delays 2009-10-20 03:39:21 +02:00
svghelper.h perf tools: Protect header files with a consistent style 2009-09-24 21:27:51 +02:00
symbol.c perf symbols: Move hex2u64 and strxfrchar to symbol.c 2010-03-26 08:52:59 +01:00
symbol.h perf symbols: Move hex2u64 and strxfrchar to symbol.c 2010-03-26 08:52:59 +01:00
thread.c perf symbols: Move more map_groups methods to map.c 2010-04-02 16:27:39 -03:00
thread.h perf symbols: Move map related routines to map.c 2010-03-26 08:52:58 +01:00
trace-event-info.c perf tools: Convert getpagesize() uses to sysconf(_SC_GETPAGESIZE) 2010-01-16 10:58:46 +01:00
trace-event-parse.c perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR() 2010-04-14 11:26:44 +02:00
trace-event-read.c perf tools: Clean up O_LARGEFILE et al usage 2010-02-04 10:03:03 +01:00
trace-event-scripting.c perf/scripts: Add Python scripting engine 2010-02-25 04:07:29 +01:00
trace-event.h perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR() 2010-04-14 11:26:44 +02:00
types.h perf tools: Protect header files with a consistent style 2009-09-24 21:27:51 +02:00
usage.c perf top: Fall back to cpu-clock-tick hrtimer sampling if no cycle counter available 2009-06-07 17:31:52 +02:00
util.c perf: Fix implicit declaration of getline in util.c 2010-01-17 07:53:09 +01:00
util.h perf tools: Move the prototypes in util/string.h to util.h 2010-04-03 10:19:26 -03:00
values.c perf: Fix memory leak: counterwidth 2010-01-13 10:09:15 +01:00
values.h perf tools: Protect header files with a consistent style 2009-09-24 21:27:51 +02:00
wrapper.c perf tools: Remove unused wrapper routines 2009-11-24 16:37:03 +01:00