162306a36Sopenharmony_ci#!/bin/sh 262306a36Sopenharmony_ci# SPDX-License-Identifier: LGPL-2.1 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ciprintf "static const char *kvm_ioctl_cmds[] = {\n" 762306a36Sopenharmony_ciregex='^#[[:space:]]*define[[:space:]]+KVM_(\w+)[[:space:]]+_IO[RW]*\([[:space:]]*KVMIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*' 862306a36Sopenharmony_cigrep -E $regex ${header_dir}/kvm.h | \ 962306a36Sopenharmony_ci sed -r "s/$regex/\2 \1/g" | \ 1062306a36Sopenharmony_ci grep -E -v " ((ARM|PPC|S390)_|[GS]ET_(DEBUGREGS|PIT2|XSAVE|TSC_KHZ)|CREATE_SPAPR_TCE_64)" | \ 1162306a36Sopenharmony_ci sort | xargs printf "\t[%s] = \"%s\",\n" 1262306a36Sopenharmony_ciprintf "};\n" 13