Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[linux-2.6-microblaze.git] / tools / perf / trace / beauty / usbdevfs_ioctl.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: LGPL-2.1
3
4 [ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
5
6 # also as:
7 # #define USBDEVFS_CONNINFO_EX(len)  _IOC(_IOC_READ, 'U', 32, len)
8
9 printf "static const char *usbdevfs_ioctl_cmds[] = {\n"
10 regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)(\(\w+\))?[[:space:]]+_IO[CWR]{0,2}\([[:space:]]*(_IOC_\w+,[[:space:]]*)?'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
11 egrep "$regex" ${header_dir}/usbdevice_fs.h | egrep -v 'USBDEVFS_\w+32[[:space:]]' | \
12         sed -r "s/$regex/\4 \1/g"       | \
13         sort | xargs printf "\t[%s] = \"%s\",\n"
14 printf "};\n\n"
15 printf "#if 0\n"
16 printf "static const char *usbdevfs_ioctl_32_cmds[] = {\n"
17 regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
18 egrep $regex ${header_dir}/usbdevice_fs.h | egrep 'USBDEVFS_\w+32[[:space:]]' | \
19         sed -r "s/$regex/\2 \1/g"       | \
20         sort | xargs printf "\t[%s] = \"%s\",\n"
21 printf "};\n"
22 printf "#endif\n"