mount_flags.sh 763 B

123456789101112131415
  1. #!/bin/sh
  2. # SPDX-License-Identifier: LGPL-2.1
  3. [ $# -eq 1 ] && beauty_uapi_linux_dir=$1 || beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
  4. printf "static const char *mount_flags[] = {\n"
  5. regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MS_([[:alnum:]_]+)[[:space:]]+([[:digit:]]+)[[:space:]]*.*'
  6. grep -E $regex ${beauty_uapi_linux_dir}/mount.h | grep -E -v '(MSK|VERBOSE|MGC_VAL)\>' | \
  7. sed -r "s/$regex/\2 \2 \1/g" | sort -n | \
  8. xargs printf "\t[%s ? (ilog2(%s) + 1) : 0] = \"%s\",\n"
  9. regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MS_([[:alnum:]_]+)[[:space:]]+\(1<<([[:digit:]]+)\)[[:space:]]*.*'
  10. grep -E $regex ${beauty_uapi_linux_dir}/mount.h | \
  11. sed -r "s/$regex/\2 \1/g" | \
  12. xargs printf "\t[%s + 1] = \"%s\",\n"
  13. printf "};\n"