Mandriva/Mageia and SUSE have been adding an #error statement to the
/usr/include/linux/version.h header and it does trigger with broken out
of tree modules occasionally. Adding it to all exported headers should
not hurt and is easier to implement.

Signed-off-by: Michal Marek <mma...@suse.cz>
---
 scripts/headers_install.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
index 5de5660..1c787da 100644
--- a/scripts/headers_install.sh
+++ b/scripts/headers_install.sh
@@ -30,16 +30,19 @@ trap 'rm -f "$OUTDIR/$FILE" "$OUTDIR/$FILE.sed"' EXIT
 for i in "$@"
 do
        FILE="$(basename "$i")"
+       scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$SRCDIR/$i" \
+               > "$OUTDIR/$FILE.sed"
        sed -r \
+               -e '1i #ifdef __KERNEL__' \
+               -e '1i #error Kernel modules must not include files from 
/usr/include/' \
+               -e '1i #endif' \
                -e 's/([ \t(])(__user|__force|__iomem)[ \t]/\1/g' \
                -e 's/__attribute_const__([ \t]|$)/\1/g' \
                -e 's@^#include <linux/compiler.h>@@' \
                -e 
's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
                -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \
                -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \
-               "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
-       scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" 
\
-               > "$OUTDIR/$FILE"
+               "$OUTDIR/$FILE.sed" >"$OUTDIR/$FILE" || exit 1
        [ $? -gt 1 ] && exit 1
        rm -f "$OUTDIR/$FILE.sed"
 done
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to