~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/headers_install.sh

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /scripts/headers_install.sh (Version linux-6.11.5) and /scripts/headers_install.sh (Version linux-4.12.14)


  1 #!/bin/sh                                           1 #!/bin/sh
  2 # SPDX-License-Identifier: GPL-2.0             << 
  3                                                     2 
  4 if [ $# -ne 2 ]                                !!   3 if [ $# -lt 2 ]
  5 then                                                4 then
  6         echo "Usage: headers_install.sh INFILE !!   5         echo "Usage: headers_install.sh OUTDIR SRCDIR [FILES...]"
  7         echo                                        6         echo
  8         echo "Prepares kernel header files for      7         echo "Prepares kernel header files for use by user space, by removing"
  9         echo "all compiler.h definitions and #      8         echo "all compiler.h definitions and #includes, removing any"
 10         echo "#ifdef __KERNEL__ sections, and       9         echo "#ifdef __KERNEL__ sections, and putting __underscores__ around"
 11         echo "asm/inline/volatile keywords."       10         echo "asm/inline/volatile keywords."
 12         echo                                       11         echo
 13         echo "INFILE: header file to operate o !!  12         echo "OUTDIR: directory to write each userspace header FILE to."
 14         echo "OUTFILE: output file which the p !!  13         echo "SRCDIR: source directory where files are picked."
                                                   >>  14         echo "FILES:  list of header files to operate on."
 15                                                    15 
 16         exit 1                                     16         exit 1
 17 fi                                                 17 fi
 18                                                    18 
 19 # Grab arguments                                   19 # Grab arguments
 20 INFILE=$1                                      << 
 21 OUTFILE=$2                                     << 
 22 TMPFILE=$OUTFILE.tmp                           << 
 23                                                << 
 24 trap 'rm -f $OUTFILE $TMPFILE' EXIT            << 
 25                                                << 
 26 # SPDX-License-Identifier with GPL variants mu << 
 27 if [ -n "$(sed -n -e "/SPDX-License-Identifier << 
 28         echo "error: $INFILE: missing \"WITH L << 
 29         exit 1                                 << 
 30 fi                                             << 
 31                                                << 
 32 sed -E -e '                                    << 
 33         s/([[:space:](])(__user|__force|__iome << 
 34         s/__attribute_const__([[:space:]]|$)/\ << 
 35         s@^#include <linux/compiler(|_types).h << 
 36         s/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9 << 
 37         s/(^|[[:space:](])(inline|asm|volatile << 
 38         s@#(ifndef|define|endif[[:space:]]*/[* << 
 39 ' $INFILE > $TMPFILE || exit 1                 << 
 40                                                << 
 41 scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEAD << 
 42 [ $? -gt 1 ] && exit 1                         << 
 43                                                << 
 44 # Remove /* ... */ style comments, and find CO << 
 45 configs=$(sed -e '                             << 
 46 :comment                                       << 
 47         s:/\*[^*][^*]*:/*:                     << 
 48         s:/\*\*\**\([^/]\):/*\1:               << 
 49         t comment                              << 
 50         s:/\*\*/: :                            << 
 51         t comment                              << 
 52         /\/\*/! b check                        << 
 53         N                                      << 
 54         b comment                              << 
 55 :print                                         << 
 56         P                                      << 
 57         D                                      << 
 58 :check                                         << 
 59         s:^\(CONFIG_[[:alnum:]_]*\):\1\n:      << 
 60         t print                                << 
 61         s:^[[:alnum:]_][[:alnum:]_]*::         << 
 62         s:^[^[:alnum:]_][^[:alnum:]_]*::       << 
 63         t check                                << 
 64         d                                      << 
 65 ' $OUTFILE)                                    << 
 66                                                << 
 67 # The entries in the following list do not res << 
 68 # Please do not add a new entry. This list is  << 
 69 # The list will be reduced gradually, and dele << 
 70 #                                              << 
 71 # The format is <file-name>:<CONFIG-option> in << 
 72 config_leak_ignores="                          << 
 73 arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PA << 
 74 arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PA << 
 75 arch/arc/include/uapi/asm/swab.h:CONFIG_ARC_HA << 
 76 arch/arm/include/uapi/asm/ptrace.h:CONFIG_CPU_ << 
 77 arch/nios2/include/uapi/asm/swab.h:CONFIG_NIOS << 
 78 arch/nios2/include/uapi/asm/swab.h:CONFIG_NIOS << 
 79 arch/x86/include/uapi/asm/auxvec.h:CONFIG_IA32 << 
 80 arch/x86/include/uapi/asm/auxvec.h:CONFIG_X86_ << 
 81 "                                              << 
 82                                                    20 
 83 for c in $configs                              !!  21 OUTDIR="$1"
                                                   >>  22 shift
                                                   >>  23 SRCDIR="$1"
                                                   >>  24 shift
                                                   >>  25 
                                                   >>  26 # Iterate through files listed on command line
                                                   >>  27 
                                                   >>  28 FILE=
                                                   >>  29 trap 'rm -f "$OUTDIR/$FILE" "$OUTDIR/$FILE.sed"' EXIT
                                                   >>  30 for i in "$@"
 84 do                                                 31 do
 85         leak_error=1                           !!  32         FILE="$(basename "$i")"
 86                                                !!  33         sed -r \
 87         for ignore in $config_leak_ignores     !!  34                 -e 's/([ \t(])(__user|__force|__iomem)[ \t]/\1/g' \
 88         do                                     !!  35                 -e 's/__attribute_const__([ \t]|$)/\1/g' \
 89                 if echo "$INFILE:$c" | grep -q !!  36                 -e 's@^#include <linux/compiler.h>@@' \
 90                         leak_error=            !!  37                 -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
 91                         break                  !!  38                 -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \
 92                 fi                             !!  39                 -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \
 93         done                                   !!  40                 "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
 94                                                !!  41         scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \
 95         if [ "$leak_error" = 1 ]; then         !!  42                 > "$OUTDIR/$FILE"
 96                 echo "error: $INFILE: leak $c  !!  43         [ $? -gt 1 ] && exit 1
 97                 exit 1                         !!  44         rm -f "$OUTDIR/$FILE.sed"
 98         fi                                     << 
 99 done                                               45 done
100                                                << 
101 rm -f $TMPFILE                                 << 
102 trap - EXIT                                        46 trap - EXIT
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php