check-headers.sh 2.7 KB
Newer Older
1
#!/bin/sh
2
# SPDX-License-Identifier: GPL-2.0
3 4

HEADERS='
5 6
include/uapi/drm/drm.h
include/uapi/drm/i915_drm.h
7
include/uapi/linux/fcntl.h
8
include/uapi/linux/kcmp.h
9
include/uapi/linux/kvm.h
10
include/uapi/linux/in.h
11
include/uapi/linux/perf_event.h
12
include/uapi/linux/prctl.h
13
include/uapi/linux/sched.h
14
include/uapi/linux/stat.h
15
include/uapi/linux/vhost.h
16
include/uapi/sound/asound.h
17 18 19 20 21 22 23 24
include/linux/hash.h
include/uapi/linux/hw_breakpoint.h
arch/x86/include/asm/disabled-features.h
arch/x86/include/asm/required-features.h
arch/x86/include/asm/cpufeatures.h
arch/arm/include/uapi/asm/perf_regs.h
arch/arm64/include/uapi/asm/perf_regs.h
arch/powerpc/include/uapi/asm/perf_regs.h
25
arch/s390/include/uapi/asm/perf_regs.h
26 27 28 29
arch/x86/include/uapi/asm/perf_regs.h
arch/x86/include/uapi/asm/kvm.h
arch/x86/include/uapi/asm/kvm_perf.h
arch/x86/include/uapi/asm/svm.h
30
arch/x86/include/uapi/asm/unistd.h
31 32 33 34
arch/x86/include/uapi/asm/vmx.h
arch/powerpc/include/uapi/asm/kvm.h
arch/s390/include/uapi/asm/kvm.h
arch/s390/include/uapi/asm/kvm_perf.h
35
arch/s390/include/uapi/asm/ptrace.h
36 37 38
arch/s390/include/uapi/asm/sie.h
arch/arm/include/uapi/asm/kvm.h
arch/arm64/include/uapi/asm/kvm.h
39
arch/arm64/include/uapi/asm/unistd.h
40 41 42 43 44 45 46
arch/alpha/include/uapi/asm/errno.h
arch/mips/include/asm/errno.h
arch/mips/include/uapi/asm/errno.h
arch/parisc/include/uapi/asm/errno.h
arch/powerpc/include/uapi/asm/errno.h
arch/sparc/include/uapi/asm/errno.h
arch/x86/include/uapi/asm/errno.h
47
arch/powerpc/include/uapi/asm/unistd.h
48 49 50 51 52 53
include/asm-generic/bitops/arch_hweight.h
include/asm-generic/bitops/const_hweight.h
include/asm-generic/bitops/__fls.h
include/asm-generic/bitops/fls.h
include/asm-generic/bitops/fls64.h
include/linux/coresight-pmu.h
54 55
include/uapi/asm-generic/errno.h
include/uapi/asm-generic/errno-base.h
56
include/uapi/asm-generic/ioctls.h
57
include/uapi/asm-generic/mman-common.h
58
include/uapi/asm-generic/unistd.h
59 60
'

61 62 63
check_2 () {
  file1=$1
  file2=$2
64

65
  shift
66 67
  shift

68
  cmd="diff $* $file1 $file2 > /dev/null"
69

70
  test -f $file2 &&
71
  eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2
72 73
}

74 75 76 77 78 79 80
check () {
  file=$1

  shift

  check_2 ../$file ../../$file $*
}
81

82 83 84 85 86
# Check if we have the kernel headers (tools/perf/../../include), else
# we're probably on a detached tarball, so no point in trying to check
# differences.
test -d ../../include || exit 0

87 88 89 90 91 92
# simple diff check
for i in $HEADERS; do
  check $i -B
done

# diff with extra ignore lines
93 94 95 96
check arch/x86/lib/memcpy_64.S        '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"'
check arch/x86/lib/memset_64.S        '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"'
check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common.h>"'
check include/uapi/linux/mman.h       '-I "^#include <\(uapi/\)*asm/mman.h>"'