cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

generate-cmdlist.sh (1221B)


      1#!/bin/sh
      2# SPDX-License-Identifier: GPL-2.0
      3
      4echo "/* Automatically generated by $0 */
      5struct cmdname_help
      6{
      7    char name[16];
      8    char help[80];
      9};
     10
     11static struct cmdname_help common_cmds[] = {"
     12
     13sed -n -e 's/^perf-\([^ 	]*\)[ 	].* common.*/\1/p' command-list.txt |
     14sort |
     15while read cmd
     16do
     17     sed -n '
     18     /^NAME/,/perf-'"$cmd"'/H
     19     ${
     20            x
     21            s/.*perf-'"$cmd"' - \(.*\)/  {"'"$cmd"'", "\1"},/
     22	    p
     23     }' "Documentation/perf-$cmd.txt"
     24done
     25
     26echo "#ifdef HAVE_LIBELF_SUPPORT"
     27sed -n -e 's/^perf-\([^ 	]*\)[ 	].* full.*/\1/p' command-list.txt |
     28sort |
     29while read cmd
     30do
     31     sed -n '
     32     /^NAME/,/perf-'"$cmd"'/H
     33     ${
     34            x
     35            s/.*perf-'"$cmd"' - \(.*\)/  {"'"$cmd"'", "\1"},/
     36	    p
     37     }' "Documentation/perf-$cmd.txt"
     38done
     39echo "#endif /* HAVE_LIBELF_SUPPORT */"
     40
     41echo "#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT)"
     42sed -n -e 's/^perf-\([^ 	]*\)[ 	].* audit*/\1/p' command-list.txt |
     43sort |
     44while read cmd
     45do
     46     sed -n '
     47     /^NAME/,/perf-'"$cmd"'/H
     48     ${
     49            x
     50            s/.*perf-'"$cmd"' - \(.*\)/  {"'"$cmd"'", "\1"},/
     51	    p
     52     }' "Documentation/perf-$cmd.txt"
     53done
     54echo "#endif /* HAVE_LIBELF_SUPPORT */"
     55echo "};"