]>
Commit | Line | Data |
---|---|---|
f1e6f933 | 1 | #!/usr/bin/env bash |
1315ce31 ILG |
2 | # SPDX-License-Identifier: LGPL-2.1-or-later |
3 | set -eu | |
4 | set -o pipefail | |
5 | ||
6 | cpp="$1" | |
7 | filesystems_gperf="$2" | |
8 | shift 2 | |
9 | ||
10 | includes="" | |
11 | for i in "$@"; do | |
12 | includes="$includes -include $i" | |
13 | done | |
14 | ||
15 | error=false | |
16 | ||
17 | # shellcheck disable=SC2086 | |
18 | for fs in $($cpp -dM $includes - </dev/null | \ | |
19 | grep -E '_MAGIC' | \ | |
20 | grep -vE 'LINUX_MAGIC' | \ | |
21 | awk '/^#define[ \t]+[A-Z0-9_]+MAGIC[ \t]+/ { print $2; }'); do | |
22 | if ! grep -E "\{.*$fs.*\}" "$filesystems_gperf" >/dev/null; then | |
23 | # STACK_END_MAGIC doesn't refer to a filesystem | |
24 | # mtd_inode was removed in 2015 | |
25 | # futexfs was removed in 2018 | |
26 | if [[ "$fs" =~ ^(STACK_END_MAGIC|MTD_INODE_FS_MAGIC|FUTEXFS_SUPER_MAGIC)$ ]]; then | |
27 | continue | |
28 | fi | |
29 | echo "Filesystem found in kernel header but not in $(basename "$filesystems_gperf"): $fs"; | |
30 | error=true | |
31 | fi | |
32 | done | |
33 | ||
34 | if $error; then | |
35 | exit 1 | |
36 | fi |