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

usbdevfs_ioctl.sh (1001B)


      1#!/bin/sh
      2# SPDX-License-Identifier: LGPL-2.1
      3
      4[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
      5
      6# also as:
      7# #define USBDEVFS_CONNINFO_EX(len)  _IOC(_IOC_READ, 'U', 32, len)
      8
      9printf "static const char *usbdevfs_ioctl_cmds[] = {\n"
     10regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)(\(\w+\))?[[:space:]]+_IO[CWR]{0,2}\([[:space:]]*(_IOC_\w+,[[:space:]]*)?'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
     11egrep "$regex" ${header_dir}/usbdevice_fs.h | egrep -v 'USBDEVFS_\w+32[[:space:]]' | \
     12	sed -r "s/$regex/\4 \1/g"	| \
     13	sort | xargs printf "\t[%s] = \"%s\",\n"
     14printf "};\n\n"
     15printf "#if 0\n"
     16printf "static const char *usbdevfs_ioctl_32_cmds[] = {\n"
     17regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
     18egrep $regex ${header_dir}/usbdevice_fs.h | egrep 'USBDEVFS_\w+32[[:space:]]' | \
     19	sed -r "s/$regex/\2 \1/g"	| \
     20	sort | xargs printf "\t[%s] = \"%s\",\n"
     21printf "};\n"
     22printf "#endif\n"