update-linux-headers: copy standard-headers files one by one
cp_virtio is called for both the asm-s390/ and linux/ directories, so it looks for pci_regs.h and input.h files in asm-s390/ too. This makes little sense. In the next patch we will have the opposite problem; we want to add asm-x86/hyperv.h, and there's also a linux/hyperv.h file with unwanted dependencies on additional Linux uapi headers. We do not want to copy linux/hyperv.h. The solution is to make cp_virtio (now renamed to cp_portable) copy one file only, instead of using the "find" command, and call it multiple times. The new function is really just a reindentation of the old one. Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
120758fba4
commit
eddb4de3cc
|
@ -28,39 +28,32 @@ if [ -z "$output" ]; then
|
||||||
output="$PWD"
|
output="$PWD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp_virtio() {
|
cp_portable() {
|
||||||
from=$1
|
f=$1
|
||||||
to=$2
|
to=$2
|
||||||
virtio=$(find "$from" -name '*virtio*h' -o -name "input.h" -o -name "pci_regs.h")
|
if
|
||||||
if [ "$virtio" ]; then
|
grep '#include' "$f" | grep -v -e 'linux/virtio' \
|
||||||
rm -rf "$to"
|
-e 'linux/types' \
|
||||||
mkdir -p "$to"
|
-e 'stdint' \
|
||||||
for f in $virtio; do
|
-e 'linux/if_ether' \
|
||||||
if
|
-e 'sys/' \
|
||||||
grep '#include' "$f" | grep -v -e 'linux/virtio' \
|
> /dev/null
|
||||||
-e 'linux/types' \
|
then
|
||||||
-e 'stdint' \
|
echo "Unexpected #include in input file $f".
|
||||||
-e 'linux/if_ether' \
|
exit 2
|
||||||
-e 'sys/' \
|
|
||||||
> /dev/null
|
|
||||||
then
|
|
||||||
echo "Unexpected #include in input file $f".
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
header=$(basename "$f");
|
|
||||||
sed -e 's/__u\([0-9][0-9]*\)/uint\1_t/g' \
|
|
||||||
-e 's/__s\([0-9][0-9]*\)/int\1_t/g' \
|
|
||||||
-e 's/__le\([0-9][0-9]*\)/uint\1_t/g' \
|
|
||||||
-e 's/__be\([0-9][0-9]*\)/uint\1_t/g' \
|
|
||||||
-e 's/<linux\/\([^>]*\)>/"standard-headers\/linux\/\1"/' \
|
|
||||||
-e 's/__bitwise__//' \
|
|
||||||
-e 's/__attribute__((packed))/QEMU_PACKED/' \
|
|
||||||
-e 's/__inline__/inline/' \
|
|
||||||
-e '/sys\/ioctl.h/d' \
|
|
||||||
"$f" > "$to/$header";
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
header=$(basename "$f");
|
||||||
|
sed -e 's/__u\([0-9][0-9]*\)/uint\1_t/g' \
|
||||||
|
-e 's/__s\([0-9][0-9]*\)/int\1_t/g' \
|
||||||
|
-e 's/__le\([0-9][0-9]*\)/uint\1_t/g' \
|
||||||
|
-e 's/__be\([0-9][0-9]*\)/uint\1_t/g' \
|
||||||
|
-e 's/<linux\/\([^>]*\)>/"standard-headers\/linux\/\1"/' \
|
||||||
|
-e 's/__bitwise__//' \
|
||||||
|
-e 's/__attribute__((packed))/QEMU_PACKED/' \
|
||||||
|
-e 's/__inline__/inline/' \
|
||||||
|
-e '/sys\/ioctl.h/d' \
|
||||||
|
"$f" > "$to/$header";
|
||||||
}
|
}
|
||||||
|
|
||||||
# This will pick up non-directories too (eg "Kconfig") but we will
|
# This will pick up non-directories too (eg "Kconfig") but we will
|
||||||
|
@ -93,7 +86,12 @@ for arch in $ARCHLIST; do
|
||||||
cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/"
|
cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp_virtio "$tmpdir/include/asm" "$output/include/standard-headers/asm-$arch"
|
rm -rf "$output/include/standard-headers/asm-$arch"
|
||||||
|
mkdir -p "$output/include/standard-headers/asm-$arch"
|
||||||
|
if [ $arch = s390 ]; then
|
||||||
|
cp_portable "$tmpdir/include/asm/kvm_virtio.h" "$output/include/standard-headers/asm-s390/"
|
||||||
|
cp_portable "$tmpdir/include/asm/virtio-ccw.h" "$output/include/standard-headers/asm-s390/"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -rf "$output/linux-headers/linux"
|
rm -rf "$output/linux-headers/linux"
|
||||||
|
@ -120,7 +118,12 @@ cat <<EOF >$output/linux-headers/linux/virtio_ring.h
|
||||||
#include "standard-headers/linux/virtio_ring.h"
|
#include "standard-headers/linux/virtio_ring.h"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cp_virtio "$tmpdir/include/linux/" "$output/include/standard-headers/linux"
|
rm -rf "$output/include/standard-headers/linux"
|
||||||
|
mkdir -p "$output/include/standard-headers/linux"
|
||||||
|
for i in "$tmpdir"/include/linux/*virtio*.h "$tmpdir/include/linux/input.h" \
|
||||||
|
"$tmpdir/include/linux/pci_regs.h"; do
|
||||||
|
cp_portable "$i" "$output/include/standard-headers/linux"
|
||||||
|
done
|
||||||
|
|
||||||
cat <<EOF >$output/include/standard-headers/linux/types.h
|
cat <<EOF >$output/include/standard-headers/linux/types.h
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
Loading…
Reference in a new issue