fadvise.sh (597473720f4dc69749542bfcfed4a927a43d935e) | fadvise.sh (818448e9cf92e5c6b3c10320372eefcbe4174e4f) |
---|---|
1#!/bin/sh 2# SPDX-License-Identifier: LGPL-2.1 3 4[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/ 5 6printf "static const char *fadvise_advices[] = {\n" 7regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+POSIX_FADV_(\w+)[[:space:]]+([[:digit:]]+)[[:space:]]+.*' 8 | 1#!/bin/sh 2# SPDX-License-Identifier: LGPL-2.1 3 4[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/ 5 6printf "static const char *fadvise_advices[] = {\n" 7regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+POSIX_FADV_(\w+)[[:space:]]+([[:digit:]]+)[[:space:]]+.*' 8 |
9egrep $regex ${header_dir}/fadvise.h | \ | 9grep -E $regex ${header_dir}/fadvise.h | \ |
10 sed -r "s/$regex/\2 \1/g" | \ 11 sort | xargs printf "\t[%s] = \"%s\",\n" | \ 12 grep -v "[6].*DONTNEED" | grep -v "[7].*NOREUSE" 13printf "};\n" 14 15# XXX Fix this properly: 16 17# The grep 6/7 DONTNEED/NOREUSE are a hack to filter out the s/390 oddity See 18# tools/include/uapi/linux/fadvise.h for details. 19 20# Probably fix this when generating the string tables per arch so that We can 21# reliably process on arch FOO a perf.data file collected by 'perf trace 22# record' on arch BAR, e.g. collect on s/390 and process on x86. | 10 sed -r "s/$regex/\2 \1/g" | \ 11 sort | xargs printf "\t[%s] = \"%s\",\n" | \ 12 grep -v "[6].*DONTNEED" | grep -v "[7].*NOREUSE" 13printf "};\n" 14 15# XXX Fix this properly: 16 17# The grep 6/7 DONTNEED/NOREUSE are a hack to filter out the s/390 oddity See 18# tools/include/uapi/linux/fadvise.h for details. 19 20# Probably fix this when generating the string tables per arch so that We can 21# reliably process on arch FOO a perf.data file collected by 'perf trace 22# record' on arch BAR, e.g. collect on s/390 and process on x86. |