1 #!/bin/sh 1 #!/bin/sh 2 # SPDX-License-Identifier: LGPL-2.1 2 # SPDX-License-Identifier: LGPL-2.1 3 3 4 [ $# -eq 1 ] && beauty_uapi_linux_dir=$1 || be 4 [ $# -eq 1 ] && beauty_uapi_linux_dir=$1 || beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/ 5 5 6 # also as: 6 # also as: 7 # #define USBDEVFS_CONNINFO_EX(len) _IOC(_IOC 7 # #define USBDEVFS_CONNINFO_EX(len) _IOC(_IOC_READ, 'U', 32, len) 8 8 9 printf "static const char *usbdevfs_ioctl_cmds 9 printf "static const char *usbdevfs_ioctl_cmds[] = {\n" 10 regex="^#[[:space:]]*define[[:space:]]+USBDEVF 10 regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)(\(\w+\))?[[:space:]]+_IO[CWR]{0,2}\([[:space:]]*(_IOC_\w+,[[:space:]]*)?'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*" 11 grep -E "$regex" ${beauty_uapi_linux_dir}/usbd 11 grep -E "$regex" ${beauty_uapi_linux_dir}/usbdevice_fs.h | grep -E -v 'USBDEVFS_\w+32[[:space:]]' | \ 12 sed -r "s/$regex/\4 \1/g" | \ 12 sed -r "s/$regex/\4 \1/g" | \ 13 sort | xargs printf "\t[%s] = \"%s\",\ 13 sort | xargs printf "\t[%s] = \"%s\",\n" 14 printf "};\n\n" 14 printf "};\n\n" 15 printf "#if 0\n" 15 printf "#if 0\n" 16 printf "static const char *usbdevfs_ioctl_32_c 16 printf "static const char *usbdevfs_ioctl_32_cmds[] = {\n" 17 regex="^#[[:space:]]*define[[:space:]]+USBDEVF 17 regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*" 18 grep -E $regex ${beauty_uapi_linux_dir}/usbdev 18 grep -E $regex ${beauty_uapi_linux_dir}/usbdevice_fs.h | grep -E 'USBDEVFS_\w+32[[:space:]]' | \ 19 sed -r "s/$regex/\2 \1/g" | \ 19 sed -r "s/$regex/\2 \1/g" | \ 20 sort | xargs printf "\t[%s] = \"%s\",\ 20 sort | xargs printf "\t[%s] = \"%s\",\n" 21 printf "};\n" 21 printf "};\n" 22 printf "#endif\n" 22 printf "#endif\n"
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.