• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3#
4# Check if atomic headers are up-to-date
5
6ATOMICDIR=$(dirname $0)
7ATOMICTBL=${ATOMICDIR}/atomics.tbl
8LINUXDIR=${ATOMICDIR}/../..
9
10echo '' | sha1sum - > /dev/null 2>&1
11if [ $? -ne 0 ]; then
12	printf "sha1sum not available, skipping atomic header checks.\n"
13	exit 0
14fi
15
16cat <<EOF |
17asm-generic/atomic-instrumented.h
18asm-generic/atomic-long.h
19linux/atomic-arch-fallback.h
20linux/atomic-fallback.h
21EOF
22while read header; do
23	OLDSUM="$(tail -n 1 ${LINUXDIR}/include/${header})"
24	OLDSUM="${OLDSUM#// }"
25
26	NEWSUM="$(sed '$d' ${LINUXDIR}/include/${header} | sha1sum)"
27	NEWSUM="${NEWSUM%% *}"
28
29	if [ "${OLDSUM}" != "${NEWSUM}" ]; then
30		printf "warning: generated include/${header} has been modified.\n"
31	fi
32done
33
34exit 0
35