Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[sfrench/cifs-2.6.git] / tools / perf / trace / beauty / vhost_virtio_ioctl.sh
1 #!/bin/sh
2
3 [ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
4
5 printf "static const char *vhost_virtio_ioctl_cmds[] = {\n"
6 regex='^#[[:space:]]*define[[:space:]]+VHOST_(\w+)[[:space:]]+_IOW?\([[:space:]]*VHOST_VIRTIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*'
7 egrep $regex ${header_dir}/vhost.h | \
8         sed -r "s/$regex/\2 \1/g"       | \
9         sort | xargs printf "\t[%s] = \"%s\",\n"
10 printf "};\n"
11
12 printf "static const char *vhost_virtio_ioctl_read_cmds[] = {\n"
13 regex='^#[[:space:]]*define[[:space:]]+VHOST_(\w+)[[:space:]]+_IOW?R\([[:space:]]*VHOST_VIRTIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*'
14 egrep $regex ${header_dir}/vhost.h | \
15         sed -r "s/$regex/\2 \1/g"       | \
16         sort | xargs printf "\t[%s] = \"%s\",\n"
17 printf "};\n"