3 vhost_virtio_header_dir
=$1
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 ${vhost_virtio_header_dir}/vhost.h | \
8 sed -r "s/$regex/\2 \1/g" | \
9 sort |
xargs printf "\t[%s] = \"%s\",\n"
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 ${vhost_virtio_header_dir}/vhost.h | \
15 sed -r "s/$regex/\2 \1/g" | \
16 sort |
xargs printf "\t[%s] = \"%s\",\n"