linux/scripts/atomic/check-atomics.sh
<<
>>
Prefs
   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
  20EOF
  21while read header; do
  22        OLDSUM="$(tail -n 1 ${LINUXDIR}/include/${header})"
  23        OLDSUM="${OLDSUM#// }"
  24
  25        NEWSUM="$(sed '$d' ${LINUXDIR}/include/${header} | sha1sum)"
  26        NEWSUM="${NEWSUM%% *}"
  27
  28        if [ "${OLDSUM}" != "${NEWSUM}" ]; then
  29                printf "warning: generated include/${header} has been modified.\n"
  30        fi
  31done
  32
  33exit 0
  34