From: "Michael S. Tsirkin" <mst@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: cornelia.huck@de.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 3/4] update-linux-headers: copy standard-headers files one by one
Date: Thu, 10 Sep 2015 12:43:27 +0300 [thread overview]
Message-ID: <20150910124319-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1441877978-31156-4-git-send-email-pbonzini@redhat.com>
On Thu, Sep 10, 2015 at 11:39:37AM +0200, Paolo Bonzini wrote:
> 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.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> scripts/update-linux-headers.sh | 69 +++++++++++++++++++++--------------------
> 1 file changed, 36 insertions(+), 33 deletions(-)
>
> diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
> index 7f7b592..6a75678 100755
> --- a/scripts/update-linux-headers.sh
> +++ b/scripts/update-linux-headers.sh
> @@ -28,39 +28,32 @@ if [ -z "$output" ]; then
> output="$PWD"
> fi
>
> -cp_virtio() {
> - from=$1
> +cp_portable() {
> + f=$1
> to=$2
> - virtio=$(find "$from" -name '*virtio*h' -o -name "input.h" -o -name "pci_regs.h")
> - if [ "$virtio" ]; then
> - rm -rf "$to"
> - mkdir -p "$to"
> - for f in $virtio; do
> - if
> - grep '#include' "$f" | grep -v -e 'linux/virtio' \
> - -e 'linux/types' \
> - -e 'stdint' \
> - -e 'linux/if_ether' \
> - -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
> + if
> + grep '#include' "$f" | grep -v -e 'linux/virtio' \
> + -e 'linux/types' \
> + -e 'stdint' \
> + -e 'linux/if_ether' \
> + -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";
> }
>
> # 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/"
> 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
>
> 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"
> 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
> #include <stdint.h>
> --
> 2.4.3
>
next prev parent reply other threads:[~2015-09-10 9:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-10 9:39 [Qemu-devel] [PATCH v3 0/2] update-linux-headers changes Paolo Bonzini
2015-09-10 9:39 ` [Qemu-devel] [PATCH v3 1/4] pci: remove Link Training error from AER error list Paolo Bonzini
2015-09-10 9:41 ` Michael S. Tsirkin
2015-09-10 9:39 ` [Qemu-devel] [PATCH v3 2/4] update Linux headers to 4.2 Paolo Bonzini
2015-09-10 9:43 ` Michael S. Tsirkin
2015-09-10 10:35 ` Cornelia Huck
2015-09-10 9:39 ` [Qemu-devel] [PATCH v3 3/4] update-linux-headers: copy standard-headers files one by one Paolo Bonzini
2015-09-10 9:43 ` Michael S. Tsirkin [this message]
2015-09-10 10:33 ` Cornelia Huck
2015-09-10 9:39 ` [Qemu-devel] [PATCH v3 4/4] target-i386: move asm-x86/hyperv.h to standard-headers Paolo Bonzini
2015-09-10 9:43 ` Michael S. Tsirkin
2015-09-10 10:36 ` Cornelia Huck
2015-09-11 11:58 ` [Qemu-devel] [PATCH v3 0/2] update-linux-headers changes Denis V. Lunev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150910124319-mutt-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).