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