Loading...
1#!/bin/sh
2
3vhost_virtio_header_dir=$1
4
5printf "static const char *vhost_virtio_ioctl_cmds[] = {\n"
6regex='^#[[:space:]]*define[[:space:]]+VHOST_(\w+)[[:space:]]+_IOW?\([[:space:]]*VHOST_VIRTIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*'
7egrep $regex ${vhost_virtio_header_dir}/vhost.h | \
8 sed -r "s/$regex/\2 \1/g" | \
9 sort | xargs printf "\t[%s] = \"%s\",\n"
10printf "};\n"
11
12printf "static const char *vhost_virtio_ioctl_read_cmds[] = {\n"
13regex='^#[[:space:]]*define[[:space:]]+VHOST_(\w+)[[:space:]]+_IOW?R\([[:space:]]*VHOST_VIRTIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*'
14egrep $regex ${vhost_virtio_header_dir}/vhost.h | \
15 sed -r "s/$regex/\2 \1/g" | \
16 sort | xargs printf "\t[%s] = \"%s\",\n"
17printf "};\n"