sync_file_range.sh 502 B

1234567891011121314151617
  1. #!/bin/sh
  2. # SPDX-License-Identifier: LGPL-2.1
  3. if [ $# -ne 1 ] ; then
  4. linux_header_dir=tools/perf/trace/beauty/include/uapi/linux/
  5. else
  6. linux_header_dir=$1
  7. fi
  8. linux_fs=${linux_header_dir}/fs.h
  9. printf "static const char *sync_file_range_flags[] = {\n"
  10. regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+SYNC_FILE_RANGE_([[:alnum:]_]+)[[:space:]]+([[:xdigit:]]+)[[:space:]]*.*'
  11. grep -E $regex ${linux_fs} | \
  12. sed -r "s/$regex/\2 \1/g" | \
  13. xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n"
  14. printf "};\n"