Mark Rutland | 8d32588 | 2018-09-04 11:48:29 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | # |
| 4 | # Check if atomic headers are up-to-date |
| 5 | |
| 6 | ATOMICDIR=$(dirname $0) |
| 7 | ATOMICTBL=${ATOMICDIR}/atomics.tbl |
| 8 | LINUXDIR=${ATOMICDIR}/../.. |
| 9 | |
Mark Rutland | 0cf264b | 2019-02-11 13:20:35 +0000 | [diff] [blame] | 10 | echo '' | sha1sum - > /dev/null 2>&1 |
| 11 | if [ $? -ne 0 ]; then |
| 12 | printf "sha1sum not available, skipping atomic header checks.\n" |
| 13 | exit 0 |
| 14 | fi |
| 15 | |
Mark Rutland | 8d32588 | 2018-09-04 11:48:29 +0100 | [diff] [blame] | 16 | cat <<EOF | |
Mark Rutland | e3d18ce | 2021-07-13 11:52:51 +0100 | [diff] [blame] | 17 | linux/atomic/atomic-instrumented.h |
| 18 | linux/atomic/atomic-long.h |
| 19 | linux/atomic/atomic-arch-fallback.h |
Mark Rutland | 8d32588 | 2018-09-04 11:48:29 +0100 | [diff] [blame] | 20 | EOF |
Mark Rutland | 0cf264b | 2019-02-11 13:20:35 +0000 | [diff] [blame] | 21 | while read header; do |
| 22 | OLDSUM="$(tail -n 1 ${LINUXDIR}/include/${header})" |
| 23 | OLDSUM="${OLDSUM#// }" |
| 24 | |
Michael Forney | ebf8d82 | 2019-06-17 22:33:06 -0700 | [diff] [blame] | 25 | NEWSUM="$(sed '$d' ${LINUXDIR}/include/${header} | sha1sum)" |
Mark Rutland | 0cf264b | 2019-02-11 13:20:35 +0000 | [diff] [blame] | 26 | NEWSUM="${NEWSUM%% *}" |
| 27 | |
| 28 | if [ "${OLDSUM}" != "${NEWSUM}" ]; then |
| 29 | printf "warning: generated include/${header} has been modified.\n" |
Mark Rutland | 8d32588 | 2018-09-04 11:48:29 +0100 | [diff] [blame] | 30 | fi |
| 31 | done |
Mark Rutland | 0cf264b | 2019-02-11 13:20:35 +0000 | [diff] [blame] | 32 | |
| 33 | exit 0 |