vhost_virtio_ioctl.sh 840 B

123456789101112131415161718
  1. #!/bin/sh
  2. # SPDX-License-Identifier: LGPL-2.1
  3. [ $# -eq 1 ] && beauty_uapi_linux_dir=$1 || beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux
  4. printf "static const char *vhost_virtio_ioctl_cmds[] = {\n"
  5. regex='^#[[:space:]]*define[[:space:]]+VHOST_(\w+)[[:space:]]+_IOW?\([[:space:]]*VHOST_VIRTIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*'
  6. grep -E $regex ${beauty_uapi_linux_dir}/vhost.h | \
  7. sed -r "s/$regex/\2 \1/g" | \
  8. sort | xargs printf "\t[%s] = \"%s\",\n"
  9. printf "};\n"
  10. printf "static const char *vhost_virtio_ioctl_read_cmds[] = {\n"
  11. regex='^#[[:space:]]*define[[:space:]]+VHOST_(\w+)[[:space:]]+_IOW?R\([[:space:]]*VHOST_VIRTIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*'
  12. grep -E $regex ${beauty_uapi_linux_dir}/vhost.h | \
  13. sed -r "s/$regex/\2 \1/g" | \
  14. sort | xargs printf "\t[%s] = \"%s\",\n"
  15. printf "};\n"