aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-06-07 16:34:45 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-06-07 16:34:45 +0100
commit6ed5546fa7bf12c5b87ef76bafb86e1d77ed6e85 (patch)
tree856364b55688b61a141f32b6617aaa786177b258 /scripts
parent40eeb397c8b8008aa13bca3a8cb25d152eb5ab44 (diff)
parent30f549c2f30de65c7cbb30614b838d5478d6221b (diff)
Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2016-06-07' into staging
trivial patches for 2016-06-07 # gpg: Signature made Tue 07 Jun 2016 16:20:52 BST # gpg: using RSA key 0xBEE59D74A4C3D7DB # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" # gpg: aka "Michael Tokarev <mjt@corpit.ru>" # gpg: aka "Michael Tokarev <mjt@debian.org>" * remotes/mjt/tags/pull-trivial-patches-2016-06-07: (51 commits) hbitmap: Use DIV_ROUND_UP qemu-timer: Use DIV_ROUND_UP linux-user: Use DIV_ROUND_UP slirp: Use DIV_ROUND_UP usb: Use DIV_ROUND_UP rocker: Use DIV_ROUND_UP SPICE: Use DIV_ROUND_UP audio: Use DIV_ROUND_UP xen: Use DIV_ROUND_UP crypto: Use DIV_ROUND_UP block: Use DIV_ROUND_UP qed: Use DIV_ROUND_UP qcow/qcow2: Use DIV_ROUND_UP parallels: Use DIV_ROUND_UP coccinelle: use macro DIV_ROUND_UP instead of (((n) + (d) - 1) /(d)) thunk: Rename args and fields in host-target bitmask conversion code thunk: Drop unused NO_THUNK_TYPE_SIZE guards qemu-common.h: Drop WORDS_ALIGNED define host-utils: Prefer 'false' for bool type docs/multi-thread-compression: Fix wrong command string ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/clean-includes5
-rw-r--r--scripts/coccinelle/overflow_muldiv64.cocci16
-rw-r--r--scripts/coccinelle/remove_muldiv64.cocci6
-rw-r--r--scripts/coccinelle/round.cocci19
-rw-r--r--scripts/coccinelle/simplify_muldiv64.cocci11
-rw-r--r--scripts/coccinelle/swap_muldiv64.cocci13
-rwxr-xr-xscripts/create_config6
-rw-r--r--scripts/feature_to_c.sh6
-rw-r--r--scripts/make_device_config.sh4
-rw-r--r--scripts/qemu-binfmt-conf.sh2
-rwxr-xr-xscripts/update-linux-headers.sh2
11 files changed, 78 insertions, 12 deletions
diff --git a/scripts/clean-includes b/scripts/clean-includes
index 72b47f17f9..37b73b5433 100755
--- a/scripts/clean-includes
+++ b/scripts/clean-includes
@@ -39,7 +39,7 @@
# However some caution is required regarding files that might be part
# of the guest agent or standalone tests.
-# for i in `git ls-tree --name-only HEAD` ; do test -f $i && \
+# for i in $(git ls-tree --name-only HEAD) ; do test -f $i && \
# grep -E '^# *include' $i | head -1 | grep 'osdep.h' ; test $? != 0 && \
# echo $i ; done
@@ -104,6 +104,7 @@ for f in "$@"; do
;;
*include/qemu/osdep.h | \
*include/qemu/compiler.h | \
+ *include/glib-compat.h | \
*include/standard-headers/ )
# Removing include lines from osdep.h itself would be counterproductive.
echo "SKIPPING $f (special case header)"
@@ -143,7 +144,7 @@ for f in "$@"; do
<setjmp.h> <stdarg.h> <stddef.h> <stdbool.h> <stdint.h> <sys/types.h>
<stdlib.h> <stdio.h> <string.h> <strings.h> <inttypes.h>
<limits.h> <unistd.h> <time.h> <ctype.h> <errno.h> <fcntl.h>
- <sys/stat.h> <sys/time.h> <assert.h> <signal.h>
+ <sys/stat.h> <sys/time.h> <assert.h> <signal.h> <glib.h>
"sysemu/os-posix.h, sysemu/os-win32.h "glib-compat.h"
"qemu/typedefs.h"
))' "$f"
diff --git a/scripts/coccinelle/overflow_muldiv64.cocci b/scripts/coccinelle/overflow_muldiv64.cocci
new file mode 100644
index 0000000000..08ec4a8de0
--- /dev/null
+++ b/scripts/coccinelle/overflow_muldiv64.cocci
@@ -0,0 +1,16 @@
+// Find muldiv64(i64, i64, x) for potential overflow
+@filter@
+typedef uint64_t;
+typedef int64_t;
+{ uint64_t, int64_t, long, unsigned long } a, b;
+expression c;
+position p;
+@@
+
+muldiv64(a,b,c)@p
+
+@script:python@
+p << filter.p;
+@@
+
+cocci.print_main("potential muldiv64() overflow", p)
diff --git a/scripts/coccinelle/remove_muldiv64.cocci b/scripts/coccinelle/remove_muldiv64.cocci
new file mode 100644
index 0000000000..4c10bd57dd
--- /dev/null
+++ b/scripts/coccinelle/remove_muldiv64.cocci
@@ -0,0 +1,6 @@
+// replace muldiv64(a, 1, b) by "a / b"
+@@
+expression a, b;
+@@
+-muldiv64(a, 1, b)
++a / b
diff --git a/scripts/coccinelle/round.cocci b/scripts/coccinelle/round.cocci
new file mode 100644
index 0000000000..ed06773289
--- /dev/null
+++ b/scripts/coccinelle/round.cocci
@@ -0,0 +1,19 @@
+// Use macro DIV_ROUND_UP instead of (((n) + (d) - 1) /(d))
+@@
+expression e1;
+expression e2;
+@@
+(
+- ((e1) + e2 - 1) / (e2)
++ DIV_ROUND_UP(e1,e2)
+|
+- ((e1) + (e2 - 1)) / (e2)
++ DIV_ROUND_UP(e1,e2)
+)
+
+@@
+expression e1;
+expression e2;
+@@
+-(DIV_ROUND_UP(e1,e2))
++DIV_ROUND_UP(e1,e2)
diff --git a/scripts/coccinelle/simplify_muldiv64.cocci b/scripts/coccinelle/simplify_muldiv64.cocci
new file mode 100644
index 0000000000..3d7c9744aa
--- /dev/null
+++ b/scripts/coccinelle/simplify_muldiv64.cocci
@@ -0,0 +1,11 @@
+// replace muldiv64(i32, i32, x) by (uint64_t)i32 * i32 / x
+@@
+typedef uint32_t;
+typedef int32_t;
+{ uint32_t, int32_t, int, unsigned int } a, b;
+typedef uint64_t;
+expression c;
+@@
+
+-muldiv64(a,b,c)
++(uint64_t) a * b / c
diff --git a/scripts/coccinelle/swap_muldiv64.cocci b/scripts/coccinelle/swap_muldiv64.cocci
new file mode 100644
index 0000000000..b48b0d084a
--- /dev/null
+++ b/scripts/coccinelle/swap_muldiv64.cocci
@@ -0,0 +1,13 @@
+// replace muldiv64(i32, i64, x) by muldiv64(i64, i32, x)
+@@
+typedef uint64_t;
+typedef int64_t;
+typedef uint32_t;
+typedef int32_t;
+{ uint32_t, int32_t, int, unsigned int } a;
+{ uint64_t, int64_t, long, unsigned long } b;
+expression c;
+@@
+
+-muldiv64(a,b,c)
++muldiv64(b,a,c)
diff --git a/scripts/create_config b/scripts/create_config
index b2d2ebb452..b31ca9bca1 100755
--- a/scripts/create_config
+++ b/scripts/create_config
@@ -16,7 +16,7 @@ case $line in
qemu_*dir=*) # qemu-specific directory configuration
name=${line%=*}
value=${line#*=}
- define_name=`echo $name | LC_ALL=C tr '[a-z]' '[A-Z]'`
+ define_name=$(echo $name | LC_ALL=C tr '[a-z]' '[A-Z]')
eval "define_value=\"$value\""
echo "#define CONFIG_$define_name \"$define_value\""
# save for the next definitions
@@ -72,7 +72,7 @@ case $line in
;;
ARCH=*) # configuration
arch=${line#*=}
- arch_name=`echo $arch | LC_ALL=C tr '[a-z]' '[A-Z]'`
+ arch_name=$(echo $arch | LC_ALL=C tr '[a-z]' '[A-Z]')
echo "#define HOST_$arch_name 1"
;;
HOST_USB=*)
@@ -92,7 +92,7 @@ case $line in
;;
TARGET_BASE_ARCH=*) # configuration
target_base_arch=${line#*=}
- base_arch_name=`echo $target_base_arch | LC_ALL=C tr '[a-z]' '[A-Z]'`
+ base_arch_name=$(echo $target_base_arch | LC_ALL=C tr '[a-z]' '[A-Z]')
echo "#define TARGET_$base_arch_name 1"
;;
TARGET_XML_FILES=*)
diff --git a/scripts/feature_to_c.sh b/scripts/feature_to_c.sh
index e4387b7fcf..c8ce9b88f6 100644
--- a/scripts/feature_to_c.sh
+++ b/scripts/feature_to_c.sh
@@ -33,7 +33,7 @@ if test -e "$output"; then
fi
for input; do
- arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'`
+ arrayname=xml_feature_$(echo $input | sed 's,.*/,,; s/[-.]/_/g')
${AWK:-awk} 'BEGIN { n = 0
printf "#include \"qemu/osdep.h\"\n"
@@ -67,8 +67,8 @@ echo >> $output
echo "const char *const xml_builtin[][2] = {" >> $output
for input; do
- basename=`echo $input | sed 's,.*/,,'`
- arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'`
+ basename=$(echo $input | sed 's,.*/,,')
+ arrayname=xml_feature_$(echo $input | sed 's,.*/,,; s/[-.]/_/g')
echo " { \"$basename\", $arrayname }," >> $output
done
diff --git a/scripts/make_device_config.sh b/scripts/make_device_config.sh
index c1afb3ffaa..354af317b3 100644
--- a/scripts/make_device_config.sh
+++ b/scripts/make_device_config.sh
@@ -7,7 +7,7 @@
src=$1
dep=$2
target=$3
-src_dir=`dirname $src`
+src_dir=$(dirname $src)
all_includes=
process_includes () {
@@ -20,7 +20,7 @@ process_includes () {
f=$src
while [ -n "$f" ] ; do
- f=`cat $f | tr -d '\r' | awk '/^include / {printf "'$src_dir'/%s ", $2}'`
+ f=$(cat $f | tr -d '\r' | awk '/^include / {printf "'$src_dir'/%s ", $2}')
[ $? = 0 ] || exit 1
all_includes="$all_includes $f"
done
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index 289b1a3963..f5bba70d06 100644
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -10,7 +10,7 @@ if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
fi
# probe cpu type
-cpu=`uname -m`
+cpu=$(uname -m)
case "$cpu" in
i386|i486|i586|i686|i86pc|BePC|x86_64)
cpu="i386"
diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index f7d62d974f..08c4c4ae54 100755
--- a/scripts/update-linux-headers.sh
+++ b/scripts/update-linux-headers.sh
@@ -10,7 +10,7 @@
# This work is licensed under the terms of the GNU GPL version 2.
# See the COPYING file in the top-level directory.
-tmpdir=`mktemp -d`
+tmpdir=$(mktemp -d)
linux="$1"
output="$2"