pahole: Fix -m/--nr_methods - Number of functions operating on a type pointer

We had to use the same hack as in pfunct, as implemented in ccf3eebfcd9c
("btf_loader: Add support for BTF_KIND_FUNC"), will hide that 'struct
ftype' (aka function prototype) indirection behind the parameter
iterator (function__for_each_parameter).

For now, here is the top 10 Linux kernel data structures in terms of
number of functions receiving as one of its parameters a pointer to it,
using /sys/kernel/btf/vmlinux to look at all the vmlinux types and
functions (the ones visible in kallsyms, but with the parameters and its
types):

  $ pahole -m | sort -k2 -nr | head
  device	955
  sock		568
  sk_buff	541
  task_struct	437
  inode		421
  pci_dev	390
  page		351
  net_device	347
  file		315
  net		312
  $
  $ pahole --help |& grep -- -m
    -m, --nr_methods           show number of methods
  $

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 file changed