qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 03/24] update-linux-headers: copy standard-headers files one by one
Date: Wed, 16 Sep 2015 14:29:34 +0200	[thread overview]
Message-ID: <1442406595-14296-4-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1442406595-14296-1-git-send-email-pbonzini@redhat.com>

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>
---
 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.5.0

  parent reply	other threads:[~2015-09-16 12:30 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 12:29 [Qemu-devel] [PULL 00/24] Misc patches for 2015-09-16 Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 01/24] pci: remove Link Training error from AER error list Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 02/24] update Linux headers to 4.3-rc1 Paolo Bonzini
2015-09-16 12:29 ` Paolo Bonzini [this message]
2015-09-16 12:29 ` [Qemu-devel] [PULL 04/24] target-i386: move asm-x86/hyperv.h to standard-headers Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 05/24] cpu: Add crash_occurred flag into CPUState Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 06/24] kvm: Add kvm system event crash handler Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 07/24] i386/kvm: Hyper-v crash msrs set/get'ers and migration Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 08/24] hmp-commands-info: move info_cmds content out of monitor.c Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 09/24] monitor: remove target-specific code from monitor.c Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 10/24] hmp-commands.hx: fix end of table info Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 11/24] monitor: added generation of documentation for hmp-commands-info.hx Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 12/24] qemu-char: Use g_new() & friends where that makes obvious sense Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 13/24] cpu-exec: Migrate some generic fns to cpu-exec-common Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 14/24] translate-all: Move tcg_handle_interrupt() to -common Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 15/24] tcg: split tcg_op_defs " Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 16/24] tcg: Move tci_tb_ptr " Paolo Bonzini
2015-09-16 17:50   ` Stefan Weil
2015-09-16 19:14     ` Peter Crosthwaite
2015-09-16 19:58       ` Stefan Weil
2015-09-17  1:04         ` Peter Crosthwaite
2015-09-16 12:29 ` [Qemu-devel] [PULL 17/24] translate: move real_host_page setting " Paolo Bonzini
2015-09-18 18:52   ` Dr. David Alan Gilbert
2015-09-18 20:38     ` Peter Crosthwaite
2015-09-16 12:29 ` [Qemu-devel] [PULL 18/24] cputlb: move CPU_LOOP() for tlb_reset() to exec.c Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 19/24] cputlb: Change tlb_set_dirty() arg to cpu Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 20/24] include/exec: Move cputlb exec.c defs out Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 21/24] monitor: uninclude cpu_ldst Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 22/24] checkpatch: Escape left braces in regex Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 23/24] nbd: release exp->blk after all clients are closed Paolo Bonzini
2015-09-16 12:29 ` [Qemu-devel] [PULL 24/24] Revert "rcu: init rcu_registry_lock after fork" Paolo Bonzini
2015-09-16 14:28 ` [Qemu-devel] [PULL 00/24] Misc patches for 2015-09-16 Eric Blake
2015-09-16 15:08 ` Peter Maydell
2015-09-16 15:41   ` Paolo Bonzini

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=1442406595-14296-4-git-send-email-pbonzini@redhat.com \
    --to=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).