linux/tools/perf/util
Sasha Levin b67bfe0d42 hlist: drop the node parameter from iterators
I'm not sure why, but the hlist for each entry iterators were conceived

        list_for_each_entry(pos, head, member)

The hlist ones were greedy and wanted an extra parameter:

        hlist_for_each_entry(tpos, pos, head, member)

Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.

Besides the semantic patch, there was some manual work required:

 - Fix up the actual hlist iterators in linux/list.h
 - Fix up the declaration of other iterators based on the hlist ones.
 - A very small amount of places were using the 'node' parameter, this
 was modified to use 'obj->member' instead.
 - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
 properly, so those had to be fixed up manually.

The semantic patch which is mostly the work of Peter Senna Tschudin is here:

@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

type T;
expression a,c,d,e;
identifier b;
statement S;
@@

-T b;
    <+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
    ...+>

[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 19:10:24 -08:00
..
include perf tools: Fix PMU format parsing test failure 2013-01-24 16:40:47 -03:00
scripting-engines perf script: hook up perf_scripting_context->pevent 2013-01-24 16:40:52 -03:00
abspath.c
alias.c perf tools: Use __maybe_used for unused variables 2012-09-11 12:19:15 -03:00
annotate.c perf annotate: Fix warning message on a missing vmlinux 2013-02-14 14:59:27 -03:00
annotate.h perf gtk/annotate: Support multiple event annotation 2013-02-14 14:59:28 -03:00
bitmap.c
build-id.c perf tools: Move build_id__sprintf into build-id object 2012-10-29 11:34:46 -02:00
build-id.h perf tools: Move BUILD_ID_SIZE into build-id object 2012-10-29 11:35:32 -02:00
cache.h perf ui: Always compile browser setup code 2012-11-14 16:53:03 -03:00
callchain.c perf tools: Fix calloc argument ordering 2013-02-06 18:09:28 -03:00
callchain.h perf record: Export the callchain parsing routine and help 2012-12-11 17:22:14 -03:00
cgroup.c perf tools: Use __maybe_used for unused variables 2012-09-11 12:19:15 -03:00
cgroup.h
color.c
color.h
config.c perf tools: Use __maybe_used for unused variables 2012-09-11 12:19:15 -03:00
cpumap.c perf tools: Add cpu_map processor socket level functions 2013-02-06 18:09:26 -03:00
cpumap.h perf tools: Add cpu_map processor socket level functions 2013-02-06 18:09:26 -03:00
ctype.c
debug.c perf tools: Fix TUI helpline output 2012-12-09 08:46:07 -03:00
debug.h perf evsel: Introduce perf_evsel__open_strerror method 2013-01-24 16:40:09 -03:00
debugfs.c
debugfs.h
dso.c perf symbols: Generalize filter in __fprintf_buildid methods 2012-12-09 08:46:07 -03:00
dso.h perf symbols: Generalize filter in __fprintf_buildid methods 2012-12-09 08:46:07 -03:00
dwarf-aux.c perf probe: Print an enum type variable in "enum variable-name" format when showing accessible variables 2012-09-27 10:58:57 -03:00
dwarf-aux.h
environment.c
event.c perf tools: Fix memory leak on error 2013-01-30 10:40:05 -03:00
event.h perf tools: Move BUILD_ID_SIZE into build-id object 2012-10-29 11:35:32 -02:00
evlist.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
evlist.h perf evlist: Make event_copy local to mmaps 2013-02-06 18:09:26 -03:00
evsel.c perf evlist: Pass the event_group info via perf_attr_details 2013-02-06 18:09:28 -03:00
evsel.h perf evlist: Pass the event_group info via perf_attr_details 2013-02-06 18:09:28 -03:00
exec_cmd.c
exec_cmd.h
generate-cmdlist.sh perf tools: Convert to LIBELF_SUPPORT 2012-09-28 21:07:36 -03:00
header.c perf tools: Fix calloc argument ordering 2013-02-06 18:09:28 -03:00
header.h perf header: Add HEADER_GROUP_DESC feature 2013-01-31 13:07:44 -03:00
help.c perf tools: Use __maybe_used for unused variables 2012-09-11 12:19:15 -03:00
help.h
hist.c perf hists: Resort hist entries using group members for output 2013-01-31 13:07:45 -03:00
hist.h perf session: There is no need for a per session hists instance 2013-01-24 16:40:12 -03:00
hweight.c
intlist.c perf tools: Allow passing a list to intlist__new 2013-01-24 16:40:53 -03:00
intlist.h perf tools: Allow passing a list to intlist__new 2013-01-24 16:40:53 -03:00
levenshtein.c
levenshtein.h
machine.c perf machine: Introduce struct machines 2013-01-24 16:40:12 -03:00
machine.h perf machine: Introduce struct machines 2013-01-24 16:40:12 -03:00
map.c perf tools: Use memdup in map__clone 2013-01-25 12:49:28 -03:00
map.h perf tools: Stop using 'self' in map.[ch] 2013-01-25 12:49:28 -03:00
pager.c
parse-events.c perf tools: Fix perf_evsel::exclude_GH handling 2013-02-06 18:09:27 -03:00
parse-events.h perf tools: Keep group information 2013-01-31 13:07:43 -03:00
parse-events.l perf tools: Add basic event modifier sanity check 2012-11-14 16:52:24 -03:00
parse-events.y perf tools: Fix build with bison 2.3 and older. 2013-02-14 16:12:34 -03:00
parse-options.c perf tools: Long option completion support for each subcommands 2012-10-02 18:36:44 -03:00
parse-options.h perf tools: Long option completion support for each subcommands 2012-10-02 18:36:44 -03:00
path.c perf tools: Convert to HAVE_STRLCPY 2012-10-02 18:36:24 -03:00
perf_regs.h perf tools: Convert to LIBUNWIND_SUPPORT 2012-10-02 17:56:01 -03:00
PERF-VERSION-GEN perf tools: Do not include PERF-VERSION-FILE to Makefile 2013-01-24 16:40:45 -03:00
pmu.c perf pmu: Privatize perf_pmu_{format,alias} structs 2013-01-24 16:40:51 -03:00
pmu.h perf pmu: Privatize perf_pmu_{format,alias} structs 2013-01-24 16:40:51 -03:00
pmu.l
pmu.y perf tools: Fix build with bison 2.3 and older. 2013-02-14 16:12:34 -03:00
probe-event.c perf tools: remove sscanf extension %as 2012-09-24 11:49:31 -03:00
probe-event.h
probe-finder.c perf probe: Allow of casting an array of char to string 2013-01-24 16:40:20 -03:00
probe-finder.h
pstack.c perf tools: Stop using 'self' in pstack 2012-11-14 16:50:38 -03:00
pstack.h
python-ext-sources perf python: Link with sysfs.o 2013-02-06 18:09:28 -03:00
python.c perf python: Fix breakage introduced by the test_attr infrastructure 2013-01-24 16:40:09 -03:00
quote.c
quote.h
rblist.c Account the nr_entries in rblist properly 2012-10-24 14:20:11 -02:00
rblist.h
run-command.c
run-command.h
session.c perf machine: Simplify accessing the host machine 2013-01-24 16:40:13 -03:00
session.h perf machine: Simplify accessing the host machine 2013-01-24 16:40:13 -03:00
setup.py perf python: Properly link with libtraceevent 2012-10-20 02:43:08 +02:00
sigchain.c
sigchain.h
sort.c perf sort: Check return value of strdup() 2013-02-06 18:09:26 -03:00
sort.h perf sort: Make setup_sorting returns an error code 2013-02-06 18:09:26 -03:00
stat.c perf stat: Move stats related code to util/stat.c 2012-09-17 13:10:03 -03:00
stat.h perf stat: Move stats related code to util/stat.c 2012-09-17 13:10:03 -03:00
strbuf.c perf tools: Fix strbuf_addf() when the buffer needs to grow 2012-10-30 10:32:56 -02:00
strbuf.h
strfilter.c
strfilter.h
string.c perf tools: Move ltrim() to util/string.c 2013-01-24 16:40:49 -03:00
strlist.c perf tools: Stop using 'self' in strlist 2013-01-25 12:49:28 -03:00
strlist.h perf tools: Stop using 'self' in strlist 2013-01-25 12:49:28 -03:00
svghelper.c
svghelper.h
symbol-elf.c perf symbols: Include elf.h header regardless LIBELF_SUPPORT 2013-01-24 16:40:18 -03:00
symbol-minimal.c perf symbols: Include elf.h header regardless LIBELF_SUPPORT 2013-01-24 16:40:18 -03:00
symbol.c perf symbols: Mark vmlinux filename as allocated 2013-01-24 16:40:32 -03:00
symbol.h perf report: Make another loop for linking group hists 2013-01-31 13:07:44 -03:00
sysfs.c perf tools: Fix possible (unlikely) buffer overflow 2013-01-24 16:40:18 -03:00
sysfs.h
target.c perf tools: Replace mempcpy with memcpy 2012-09-05 19:35:21 -03:00
target.h
thread_map.c
thread_map.h
thread.c perf machine: Move more machine methods to machine.c 2012-12-09 08:46:08 -03:00
thread.h perf machine: Move more machine methods to machine.c 2012-12-09 08:46:08 -03:00
tool.h
top.c perf top: Use perf_evlist__config() 2012-12-11 17:22:39 -03:00
top.h perf evsel: Do missing feature fallbacks in just one place 2013-01-24 16:40:08 -03:00
trace-event-info.c
trace-event-parse.c perf tools: remove sscanf extension %as 2012-09-24 11:49:31 -03:00
trace-event-read.c perf tools: Have the page size value available for all tools 2012-10-06 16:33:14 -03:00
trace-event-scripting.c perf tools: Use __maybe_used for unused variables 2012-09-11 12:19:15 -03:00
trace-event.h
types.h
unwind.c perf tools: Use __maybe_used for unused variables 2012-09-11 12:19:15 -03:00
unwind.h perf tools: Convert to LIBUNWIND_SUPPORT 2012-10-02 17:56:01 -03:00
usage.c
util.c perf tools: Move get_term_dimensions from top to util.c 2013-01-24 16:40:34 -03:00
util.h perf tools: Move ltrim() to util/string.c 2013-01-24 16:40:49 -03:00
values.c
values.h
vdso.c perf tools: Back [vdso] DSO with real data 2012-09-11 12:08:30 -03:00
vdso.h perf tools: Back [vdso] DSO with real data 2012-09-11 12:08:30 -03:00
wrapper.c perf tools: Use __maybe_used for unused variables 2012-09-11 12:19:15 -03:00
xyarray.c
xyarray.h