diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2016-06-07 16:34:45 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-06-07 16:34:45 +0100 |
commit | 6ed5546fa7bf12c5b87ef76bafb86e1d77ed6e85 (patch) | |
tree | 856364b55688b61a141f32b6617aaa786177b258 | |
parent | 40eeb397c8b8008aa13bca3a8cb25d152eb5ab44 (diff) | |
parent | 30f549c2f30de65c7cbb30614b838d5478d6221b (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>
218 files changed, 312 insertions, 406 deletions
diff --git a/block/dmg.c b/block/dmg.c index 1ea5f22d82..06eb5138f3 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -32,7 +32,6 @@ #ifdef CONFIG_BZIP2 #include <bzlib.h> #endif -#include <glib.h> enum { /* Limit chunk sizes to prevent unreasonable amounts of memory being used diff --git a/block/parallels.c b/block/parallels.c index 99fc0f77ef..b9b5c6dc3d 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -204,7 +204,7 @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num, return -EINVAL; } - to_allocate = (sector_num + *pnum + s->tracks - 1) / s->tracks - idx; + to_allocate = DIV_ROUND_UP(sector_num + *pnum, s->tracks) - idx; space = to_allocate * s->tracks; if (s->data_end + space > bdrv_getlength(bs->file->bs) >> BDRV_SECTOR_BITS) { int ret; diff --git a/block/qcow.c b/block/qcow.c index cb4bf0299f..c5cf813469 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -868,8 +868,8 @@ static int qcow_create(const char *filename, QemuOpts *opts, Error **errp) } tmp = g_malloc0(BDRV_SECTOR_SIZE); - for (i = 0; i < ((sizeof(uint64_t)*l1_size + BDRV_SECTOR_SIZE - 1)/ - BDRV_SECTOR_SIZE); i++) { + for (i = 0; i < DIV_ROUND_UP(sizeof(uint64_t) * l1_size, BDRV_SECTOR_SIZE); + i++) { ret = blk_pwrite(qcow_blk, header_size + BDRV_SECTOR_SIZE * i, tmp, BDRV_SECTOR_SIZE, 0); if (ret != BDRV_SECTOR_SIZE) { diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 892e0fbfbf..c73797378e 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -1868,8 +1868,8 @@ int qcow2_expand_zero_clusters(BlockDriverState *bs, } for (i = 0; i < s->nb_snapshots; i++) { - int l1_sectors = (s->snapshots[i].l1_size * sizeof(uint64_t) + - BDRV_SECTOR_SIZE - 1) / BDRV_SECTOR_SIZE; + int l1_sectors = DIV_ROUND_UP(s->snapshots[i].l1_size * + sizeof(uint64_t), BDRV_SECTOR_SIZE); l1_table = g_realloc(l1_table, l1_sectors * BDRV_SECTOR_SIZE); diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 7fa972a383..66f187a74b 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -490,14 +490,12 @@ static int alloc_refcount_block(BlockDriverState *bs, uint64_t table_clusters = size_to_clusters(s, table_size * sizeof(uint64_t)); blocks_clusters = 1 + - ((table_clusters + s->refcount_block_size - 1) - / s->refcount_block_size); + DIV_ROUND_UP(table_clusters, s->refcount_block_size); uint64_t meta_clusters = table_clusters + blocks_clusters; last_table_size = table_size; table_size = next_refcount_table_size(s, blocks_used + - ((meta_clusters + s->refcount_block_size - 1) - / s->refcount_block_size)); + DIV_ROUND_UP(meta_clusters, s->refcount_block_size)); } while (last_table_size != table_size); diff --git a/block/qed-check.c b/block/qed-check.c index 622f308976..dcd4f036b8 100644 --- a/block/qed-check.c +++ b/block/qed-check.c @@ -234,8 +234,7 @@ int qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix) } check.result->bfi.total_clusters = - (s->header.image_size + s->header.cluster_size - 1) / - s->header.cluster_size; + DIV_ROUND_UP(s->header.image_size, s->header.cluster_size); ret = qed_check_l1_table(&check, s->l1_table); if (ret == 0) { /* Only check for leaks if entire image was scanned successfully */ diff --git a/block/qed.c b/block/qed.c index b591d4a3fc..0f621924f8 100644 --- a/block/qed.c +++ b/block/qed.c @@ -143,8 +143,7 @@ static void qed_write_header(BDRVQEDState *s, BlockCompletionFunc cb, * them, and write back. */ - int nsectors = (sizeof(QEDHeader) + BDRV_SECTOR_SIZE - 1) / - BDRV_SECTOR_SIZE; + int nsectors = DIV_ROUND_UP(sizeof(QEDHeader), BDRV_SECTOR_SIZE); size_t len = nsectors * BDRV_SECTOR_SIZE; QEDWriteHeaderCB *write_header_cb = gencb_alloc(sizeof(*write_header_cb), cb, opaque); diff --git a/block/vhdx.c b/block/vhdx.c index c0d24a24ee..f5605a2ff4 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -27,7 +27,6 @@ #include "migration/migration.h" #include <uuid/uuid.h> -#include <glib.h> /* Options for VHDX creation */ diff --git a/block/vmdk.c b/block/vmdk.c index 372e5edc15..2205cc888f 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -34,7 +34,6 @@ #include "migration/migration.h" #include "qemu/cutils.h" #include <zlib.h> -#include <glib.h> #define VMDK3_MAGIC (('C' << 24) | ('O' << 16) | ('W' << 8) | 'D') #define VMDK4_MAGIC (('K' << 24) | ('D' << 16) | ('M' << 8) | 'V') diff --git a/block/vvfat.c b/block/vvfat.c index a39dbe67e2..6d2e21ce11 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -1960,8 +1960,7 @@ DLOG(fprintf(stderr, "check direntry %d:\n", i); print_direntry(direntries + i)) /* check file size with FAT */ cluster_count = get_cluster_count_for_direntry(s, direntries + i, path2); if (cluster_count != - (le32_to_cpu(direntries[i].size) + s->cluster_size - - 1) / s->cluster_size) { + DIV_ROUND_UP(le32_to_cpu(direntries[i].size), s->cluster_size)) { DLOG(fprintf(stderr, "Cluster count mismatch\n")); goto fail; } @@ -31,6 +31,7 @@ TMPCXX="${TMPDIR1}/${TMPB}.cxx" TMPL="${TMPDIR1}/${TMPB}.lo" TMPA="${TMPDIR1}/lib${TMPB}.la" TMPE="${TMPDIR1}/${TMPB}.exe" +TMPMO="${TMPDIR1}/${TMPB}.mo" rm -f config.log @@ -164,7 +165,7 @@ have_backend () { } # default parameters -source_path=`dirname "$0"` +source_path=$(dirname "$0") cpu="" iasl="iasl" interp_prefix="/usr/gnemul/qemu-%M" @@ -323,7 +324,7 @@ jemalloc="no" # parse CC options first for opt do - optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` + optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') case "$opt" in --cross-prefix=*) cross_prefix="$optarg" ;; @@ -398,7 +399,7 @@ if test "$debug_info" = "yes"; then fi # make source path absolute -source_path=`cd "$source_path"; pwd` +source_path=$(cd "$source_path"; pwd) # running configure in the source tree? # we know that's the case if configure is there. @@ -443,7 +444,7 @@ elif check_define __sun__ ; then elif check_define __HAIKU__ ; then targetos='Haiku' else - targetos=`uname -s` + targetos=$(uname -s) fi # Some host OSes need non-standard checks for which CPU to use. @@ -461,7 +462,7 @@ Darwin) fi ;; SunOS) - # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo + # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then cpu="x86_64" fi @@ -507,7 +508,7 @@ elif check_define __aarch64__ ; then elif check_define __hppa__ ; then cpu="hppa" else - cpu=`uname -m` + cpu=$(uname -m) fi ARCH= @@ -627,7 +628,7 @@ SunOS) ld="gld" smbd="${SMBD-/usr/sfw/sbin/smbd}" needs_libsunmath="no" - solarisrev=`uname -r | cut -f2 -d.` + solarisrev=$(uname -r | cut -f2 -d.) if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then if test "$solarisrev" -le 9 ; then if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then @@ -722,7 +723,7 @@ fi werror="" for opt do - optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` + optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') case "$opt" in --help|-h) show_help=yes ;; @@ -846,9 +847,9 @@ for opt do ;; --audio-drv-list=*) audio_drv_list="$optarg" ;; - --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` + --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') ;; - --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` + --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') ;; --enable-debug-tcg) debug_tcg="yes" ;; @@ -943,7 +944,7 @@ for opt do ;; --enable-cocoa) cocoa="yes" ; - audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" + audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)" ;; --disable-system) softmmu="no" ;; @@ -1388,7 +1389,7 @@ fi # Consult white-list to determine whether to enable werror # by default. Only enable by default for git builds -z_version=`cut -f3 -d. $source_path/VERSION` +z_version=$(cut -f3 -d. $source_path/VERSION) if test -z "$werror" ; then if test -d "$source_path/.git" -a \ @@ -1617,7 +1618,7 @@ if test "$solaris" = "yes" ; then "install fileutils from www.blastwave.org using pkg-get -i fileutils" \ "to get ginstall which is used by default (which lives in /opt/csw/bin)" fi - if test "`path_of $install`" = "/usr/sbin/install" ; then + if test "$(path_of $install)" = "/usr/sbin/install" ; then error_exit "Solaris /usr/sbin/install is not an appropriate install program." \ "try ginstall from the GNU fileutils available from www.blastwave.org" \ "using pkg-get -i fileutils, or use --install=/usr/ucb/install" @@ -1636,7 +1637,7 @@ fi if test -z "${target_list+xxx}" ; then target_list="$default_target_list" else - target_list=`echo "$target_list" | sed -e 's/,/ /g'` + target_list=$(echo "$target_list" | sed -e 's/,/ /g') fi # Check that we recognised the target name; this allows a more @@ -1886,8 +1887,8 @@ if test "$seccomp" != "no" ; then if test "$libseccomp_minver" != "" && $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then - libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`" - QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`" + libs_softmmu="$libs_softmmu $($pkg_config --libs libseccomp)" + QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags libseccomp)" seccomp="yes" else if test "$seccomp" = "yes" ; then @@ -2127,8 +2128,8 @@ fi x11_cflags= x11_libs=-lX11 if $pkg_config --exists "x11"; then - x11_cflags=`$pkg_config --cflags x11` - x11_libs=`$pkg_config --libs x11` + x11_cflags=$($pkg_config --cflags x11) + x11_libs=$($pkg_config --libs x11) fi ########################################## @@ -2155,9 +2156,9 @@ if test "$gtk" != "no"; then gtkversion="2.18.0" fi if $pkg_config --exists "$gtkpackage >= $gtkversion"; then - gtk_cflags=`$pkg_config --cflags $gtkpackage` - gtk_libs=`$pkg_config --libs $gtkpackage` - gtk_version=`$pkg_config --modversion $gtkpackage` + gtk_cflags=$($pkg_config --cflags $gtkpackage) + gtk_libs=$($pkg_config --libs $gtkpackage) + gtk_version=$($pkg_config --modversion $gtkpackage) if $pkg_config --exists "$gtkx11package >= $gtkversion"; then gtk_cflags="$gtk_cflags $x11_cflags" gtk_libs="$gtk_libs $x11_libs" @@ -2195,8 +2196,8 @@ gnutls_gcrypt=no gnutls_nettle=no if test "$gnutls" != "no"; then if gnutls_works; then - gnutls_cflags=`$pkg_config --cflags gnutls` - gnutls_libs=`$pkg_config --libs gnutls` + gnutls_cflags=$($pkg_config --cflags gnutls) + gnutls_libs=$($pkg_config --libs gnutls) libs_softmmu="$gnutls_libs $libs_softmmu" libs_tools="$gnutls_libs $libs_tools" QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" @@ -2220,7 +2221,7 @@ if test "$gnutls" != "no"; then gnutls_gcrypt=no gnutls_nettle=yes elif $pkg_config --exists 'gnutls >= 2.12'; then - case `$pkg_config --libs --static gnutls` in + case $($pkg_config --libs --static gnutls) in *gcrypt*) gnutls_gcrypt=yes gnutls_nettle=no @@ -2281,7 +2282,7 @@ has_libgcrypt_config() { if test -n "$cross_prefix" then - host=`libgcrypt-config --host` + host=$(libgcrypt-config --host) if test "$host-" != $cross_prefix then return 1 @@ -2293,8 +2294,8 @@ has_libgcrypt_config() { if test "$gcrypt" != "no"; then if has_libgcrypt_config; then - gcrypt_cflags=`libgcrypt-config --cflags` - gcrypt_libs=`libgcrypt-config --libs` + gcrypt_cflags=$(libgcrypt-config --cflags) + gcrypt_libs=$(libgcrypt-config --libs) # Debian has remove -lgpg-error from libgcrypt-config # as it "spreads unnecessary dependencies" which in # turn breaks static builds... @@ -2334,15 +2335,16 @@ fi if test "$nettle" != "no"; then if $pkg_config --exists "nettle"; then - nettle_cflags=`$pkg_config --cflags nettle` - nettle_libs=`$pkg_config --libs nettle` - nettle_version=`$pkg_config --modversion nettle` + nettle_cflags=$($pkg_config --cflags nettle) + nettle_libs=$($pkg_config --libs nettle) + nettle_version=$($pkg_config --modversion nettle) libs_softmmu="$nettle_libs $libs_softmmu" libs_tools="$nettle_libs $libs_tools" QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" nettle="yes" cat > $TMPC << EOF +#include <stddef.h> #include <nettle/pbkdf2.h> int main(void) { pbkdf2_hmac_sha256(8, NULL, 1000, 8, NULL, 8, NULL); @@ -2373,8 +2375,8 @@ tasn1=yes tasn1_cflags="" tasn1_libs="" if $pkg_config --exists "libtasn1"; then - tasn1_cflags=`$pkg_config --cflags libtasn1` - tasn1_libs=`$pkg_config --libs libtasn1` + tasn1_cflags=$($pkg_config --cflags libtasn1) + tasn1_libs=$($pkg_config --libs libtasn1) else tasn1=no fi @@ -2404,9 +2406,9 @@ if test "$vte" != "no"; then vteminversion="0.24.0" fi if $pkg_config --exists "$vtepackage >= $vteminversion"; then - vte_cflags=`$pkg_config --cflags $vtepackage` - vte_libs=`$pkg_config --libs $vtepackage` - vteversion=`$pkg_config --modversion $vtepackage` + vte_cflags=$($pkg_config --cflags $vtepackage) + vte_libs=$($pkg_config --libs $vtepackage) + vteversion=$($pkg_config --modversion $vtepackage) libs_softmmu="$vte_libs $libs_softmmu" vte="yes" elif test "$vte" = "yes"; then @@ -2447,16 +2449,16 @@ else error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0" fi -if test "`basename $sdl_config`" != $sdlconfigname && ! has ${sdl_config}; then +if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then sdl_config=$sdlconfigname fi if $pkg_config $sdlname --exists; then sdlconfig="$pkg_config $sdlname" - sdlversion=`$sdlconfig --modversion 2>/dev/null` + sdlversion=$($sdlconfig --modversion 2>/dev/null) elif has ${sdl_config}; then sdlconfig="$sdl_config" - sdlversion=`$sdlconfig --version` + sdlversion=$($sdlconfig --version) else if test "$sdl" = "yes" ; then feature_not_found "sdl" "Install SDL devel" @@ -2474,14 +2476,14 @@ if test "$sdl" != "no" ; then #undef main /* We don't want SDL to override our main() */ int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } EOF - sdl_cflags=`$sdlconfig --cflags 2> /dev/null` + sdl_cflags=$($sdlconfig --cflags 2>/dev/null) if test "$static" = "yes" ; then - sdl_libs=`$sdlconfig --static-libs 2>/dev/null` + sdl_libs=$($sdlconfig --static-libs 2>/dev/null) else - sdl_libs=`$sdlconfig --libs 2> /dev/null` + sdl_libs=$($sdlconfig --libs 2>/dev/null) fi if compile_prog "$sdl_cflags" "$sdl_libs" ; then - if test `echo $sdlversion | sed 's/[^0-9]//g'` -lt 121 ; then + if test $(echo $sdlversion | sed 's/[^0-9]//g') -lt 121 ; then sdl_too_old=yes else sdl=yes @@ -2490,8 +2492,8 @@ EOF # static link with sdl ? (note: sdl.pc's --static --libs is broken) if test "$sdl" = "yes" -a "$static" = "yes" ; then if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then - sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" - sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" + sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)" + sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)" fi if compile_prog "$sdl_cflags" "$sdl_libs" ; then : @@ -2608,8 +2610,8 @@ int main(void) { } EOF if $pkg_config libpng --exists; then - vnc_png_cflags=`$pkg_config libpng --cflags` - vnc_png_libs=`$pkg_config libpng --libs` + vnc_png_cflags=$($pkg_config libpng --cflags) + vnc_png_libs=$($pkg_config libpng --libs) else vnc_png_cflags="" vnc_png_libs="-lpng" @@ -2803,7 +2805,7 @@ EOF fi } -audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` +audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g') for drv in $audio_drv_list; do case $drv in alsa) @@ -2915,8 +2917,8 @@ if test "$curl" != "no" ; then #include <curl/curl.h> int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } EOF - curl_cflags=`$curlconfig --cflags 2>/dev/null` - curl_libs=`$curlconfig --libs 2>/dev/null` + curl_cflags=$($curlconfig --cflags 2>/dev/null) + curl_libs=$($curlconfig --libs 2>/dev/null) if compile_prog "$curl_cflags" "$curl_libs" ; then curl=yes else @@ -2934,8 +2936,8 @@ if test "$bluez" != "no" ; then #include <bluetooth/bluetooth.h> int main(void) { return bt_error(0); } EOF - bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` - bluez_libs=`$pkg_config --libs bluez 2> /dev/null` + bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null) + bluez_libs=$($pkg_config --libs bluez 2>/dev/null) if compile_prog "$bluez_cflags" "$bluez_libs" ; then bluez=yes libs_softmmu="$bluez_libs $libs_softmmu" @@ -2958,8 +2960,8 @@ fi for i in $glib_modules; do if $pkg_config --atleast-version=$glib_req_ver $i; then - glib_cflags=`$pkg_config --cflags $i` - glib_libs=`$pkg_config --libs $i` + glib_cflags=$($pkg_config --cflags $i) + glib_libs=$($pkg_config --libs $i) CFLAGS="$glib_cflags $CFLAGS" LIBS="$glib_libs $LIBS" libs_qga="$glib_libs $libs_qga" @@ -3048,8 +3050,8 @@ if test "$pixman" = "none"; then pixman_libs= elif test "$pixman" = "system"; then # pixman version has been checked above - pixman_cflags=`$pkg_config --cflags pixman-1` - pixman_libs=`$pkg_config --libs pixman-1` + pixman_cflags=$($pkg_config --cflags pixman-1) + pixman_libs=$($pkg_config --libs pixman-1) else if test ! -d ${source_path}/pixman/pixman; then error_exit "pixman >= 0.21.8 not present. Your options:" \ @@ -3165,8 +3167,8 @@ fi min_libssh2_version=1.2.8 if test "$libssh2" != "no" ; then if $pkg_config --atleast-version=$min_libssh2_version libssh2; then - libssh2_cflags=`$pkg_config libssh2 --cflags` - libssh2_libs=`$pkg_config libssh2 --libs` + libssh2_cflags=$($pkg_config libssh2 --cflags) + libssh2_libs=$($pkg_config libssh2 --libs) libssh2=yes else if test "$libssh2" = "yes" ; then @@ -3417,8 +3419,8 @@ fi if test "$glusterfs" != "no" ; then if $pkg_config --atleast-version=3 glusterfs-api; then glusterfs="yes" - glusterfs_cflags=`$pkg_config --cflags glusterfs-api` - glusterfs_libs=`$pkg_config --libs glusterfs-api` + glusterfs_cflags=$($pkg_config --cflags glusterfs-api) + glusterfs_libs=$($pkg_config --libs glusterfs-api) if $pkg_config --atleast-version=4 glusterfs-api; then glusterfs_xlator_opt="yes" fi @@ -4225,12 +4227,12 @@ int main(void) { return 0; } EOF if compile_prog "" "" ; then if $pkg_config lttng-ust --exists; then - lttng_ust_libs=`$pkg_config --libs lttng-ust` + lttng_ust_libs=$($pkg_config --libs lttng-ust) else lttng_ust_libs="-llttng-ust" fi if $pkg_config liburcu-bp --exists; then - urcu_bp_libs=`$pkg_config --libs liburcu-bp` + urcu_bp_libs=$($pkg_config --libs liburcu-bp) else urcu_bp_libs="-lurcu-bp" fi @@ -4526,6 +4528,25 @@ if compile_prog "" "" ; then have_fsxattr=yes fi +################################################# +# Sparc implicitly links with --relax, which is +# incompatible with -r, so --no-relax should be +# given. It does no harm to give it on other +# platforms too. + +# Note: the prototype is needed since QEMU_CFLAGS +# contains -Wmissing-prototypes +cat > $TMPC << EOF +extern int foo(void); +int foo(void) { return 0; } +EOF +if ! compile_object ""; then + error_exit "Failed to compile object file for LD_REL_FLAGS test" +fi +if do_cc -nostdlib -Wl,-r -Wl,--no-relax -o $TMPMO $TMPO; then + LD_REL_FLAGS="-Wl,--no-relax" +fi + ########################################## # End of CC checks # After here, no more $cc or $ld runs @@ -4670,10 +4691,10 @@ if test "$guest_agent_msi" = "yes"; then fi if test "$QEMU_GA_VERSION" = ""; then - QEMU_GA_VERSION=`cat $source_path/VERSION` + QEMU_GA_VERSION=$(cat $source_path/VERSION) fi - QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=`$pkg_config --variable=prefix glib-2.0`/bin" + QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin" case "$cpu" in x86_64) @@ -4747,16 +4768,16 @@ QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS" libs_softmmu="$pixman_libs $libs_softmmu" echo "Install prefix $prefix" -echo "BIOS directory `eval echo $qemu_datadir`" -echo "binary directory `eval echo $bindir`" -echo "library directory `eval echo $libdir`" -echo "module directory `eval echo $qemu_moddir`" -echo "libexec directory `eval echo $libexecdir`" -echo "include directory `eval echo $includedir`" -echo "config directory `eval echo $sysconfdir`" +echo "BIOS directory $(eval echo $qemu_datadir)" +echo "binary directory $(eval echo $bindir)" +echo "library directory $(eval echo $libdir)" +echo "module directory $(eval echo $qemu_moddir)" +echo "libexec directory $(eval echo $libexecdir)" +echo "include directory $(eval echo $includedir)" +echo "config directory $(eval echo $sysconfdir)" if test "$mingw32" = "no" ; then -echo "local state directory `eval echo $local_statedir`" -echo "Manual directory `eval echo $mandir`" +echo "local state directory $(eval echo $local_statedir)" +echo "Manual directory $(eval echo $mandir)" echo "ELF interp prefix $interp_prefix" else echo "local state directory queried at runtime" @@ -4791,16 +4812,16 @@ if test "$darwin" = "yes" ; then echo "Cocoa support $cocoa" fi echo "pixman $pixman" -echo "SDL support $sdl `echo_version $sdl $sdlversion`" -echo "GTK support $gtk `echo_version $gtk $gtk_version`" +echo "SDL support $sdl $(echo_version $sdl $sdlversion)" +echo "GTK support $gtk $(echo_version $gtk $gtk_version)" echo "GTK GL support $gtk_gl" -echo "VTE support $vte `echo_version $vte $vteversion`" +echo "VTE support $vte $(echo_version $vte $vteversion)" echo "GNUTLS support $gnutls" echo "GNUTLS hash $gnutls_hash" echo "GNUTLS rnd $gnutls_rnd" echo "libgcrypt $gcrypt" echo "libgcrypt kdf $gcrypt_kdf" -echo "nettle $nettle `echo_version $nettle $nettle_version`" +echo "nettle $nettle $(echo_version $nettle $nettle_version)" echo "nettle kdf $nettle_kdf" echo "libtasn1 $tasn1" echo "curses support $curses" @@ -4851,7 +4872,7 @@ echo "Trace backends $trace_backends" if have_backend "simple"; then echo "Trace output file $trace_file-<pid>" fi -echo "spice support $spice `echo_version $spice $spice_protocol_version/$spice_server_version`" +echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)" echo "rbd support $rbd" echo "xfsctl support $xfs" echo "smartcard support $smartcard" @@ -4930,7 +4951,7 @@ if test "$bigendian" = "yes" ; then fi if test "$mingw32" = "yes" ; then echo "CONFIG_WIN32=y" >> $config_host_mak - rc_version=`cat $source_path/VERSION` + rc_version=$(cat $source_path/VERSION) version_major=${rc_version%%.*} rc_version=${rc_version#*.} version_minor=${rc_version%%.*} @@ -5006,7 +5027,7 @@ if test "$cap_ng" = "yes" ; then fi echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak for drv in $audio_drv_list; do - def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'` + def=CONFIG_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]') echo "$def=y" >> $config_host_mak done if test "$audio_pt_int" = "yes" ; then @@ -5038,7 +5059,7 @@ fi if test "$xfs" = "yes" ; then echo "CONFIG_XFS=y" >> $config_host_mak fi -qemu_version=`head $source_path/VERSION` +qemu_version=$(head $source_path/VERSION) echo "VERSION=$qemu_version" >>$config_host_mak echo "PKGVERSION=$pkgversion" >>$config_host_mak echo "SRC_PATH=$source_path" >> $config_host_mak @@ -5049,7 +5070,7 @@ fi if test "$modules" = "yes"; then # $shacmd can generate a hash started with digit, which the compiler doesn't # like as an symbol. So prefix it with an underscore - echo "CONFIG_STAMP=_`(echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ `" >> $config_host_mak + echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak echo "CONFIG_MODULES=y" >> $config_host_mak fi if test "$sdl" = "yes" ; then @@ -5529,6 +5550,7 @@ else fi echo "LDFLAGS=$LDFLAGS" >> $config_host_mak echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak +echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak echo "LIBS+=$LIBS" >> $config_host_mak echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak echo "EXESUF=$EXESUF" >> $config_host_mak @@ -5577,7 +5599,7 @@ fi for target in $target_list; do target_dir="$target" config_target_mak=$target_dir/config-target.mak -target_name=`echo $target | cut -d '-' -f 1` +target_name=$(echo $target | cut -d '-' -f 1) target_bigendian="no" case "$target_name" in @@ -5617,7 +5639,7 @@ mkdir -p $target_dir echo "# Automatically generated by configure - do not modify" > $config_target_mak bflt="no" -interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"` +interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g") gdb_xml_files="" TARGET_ARCH="$target_name" @@ -5743,7 +5765,7 @@ upper() { echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' } -target_arch_name="`upper $TARGET_ARCH`" +target_arch_name="$(upper $TARGET_ARCH)" echo "TARGET_$target_arch_name=y" >> $config_target_mak echo "TARGET_NAME=$target_name" >> $config_target_mak echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak @@ -5959,11 +5981,11 @@ for bios_file in \ $source_path/pc-bios/u-boot.* \ $source_path/pc-bios/palcode-* do - FILES="$FILES pc-bios/`basename $bios_file`" + FILES="$FILES pc-bios/$(basename $bios_file)" done -for test_file in `find $source_path/tests/acpi-test-data -type f` +for test_file in $(find $source_path/tests/acpi-test-data -type f) do - FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`" + FILES="$FILES tests/acpi-test-data$(echo $test_file | sed -e 's/.*acpi-test-data//')" done mkdir -p $DIRS for f in $FILES ; do diff --git a/crypto/block-luks.c b/crypto/block-luks.c index 17c4300f11..63649f1091 100644 --- a/crypto/block-luks.c +++ b/crypto/block-luks.c @@ -1081,8 +1081,7 @@ qcrypto_block_luks_create(QCryptoBlock *block, luks->header.key_slots[i].key_offset = (QCRYPTO_BLOCK_LUKS_KEY_SLOT_OFFSET / QCRYPTO_BLOCK_LUKS_SECTOR_SIZE) + - (ROUND_UP(((splitkeylen + (QCRYPTO_BLOCK_LUKS_SECTOR_SIZE - 1)) / - QCRYPTO_BLOCK_LUKS_SECTOR_SIZE), + (ROUND_UP(DIV_ROUND_UP(splitkeylen, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE), (QCRYPTO_BLOCK_LUKS_KEY_SLOT_OFFSET / QCRYPTO_BLOCK_LUKS_SECTOR_SIZE)) * i); } @@ -1182,8 +1181,7 @@ qcrypto_block_luks_create(QCryptoBlock *block, luks->header.payload_offset = (QCRYPTO_BLOCK_LUKS_KEY_SLOT_OFFSET / QCRYPTO_BLOCK_LUKS_SECTOR_SIZE) + - (ROUND_UP(((splitkeylen + (QCRYPTO_BLOCK_LUKS_SECTOR_SIZE - 1)) / - QCRYPTO_BLOCK_LUKS_SECTOR_SIZE), + (ROUND_UP(DIV_ROUND_UP(splitkeylen, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE), (QCRYPTO_BLOCK_LUKS_KEY_SLOT_OFFSET / QCRYPTO_BLOCK_LUKS_SECTOR_SIZE)) * QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS); diff --git a/docs/multi-thread-compression.txt b/docs/multi-thread-compression.txt index 3d477c3bd2..d0caaf7b3b 100644 --- a/docs/multi-thread-compression.txt +++ b/docs/multi-thread-compression.txt @@ -110,7 +110,7 @@ Usage ===== 1. Verify both the source and destination QEMU are able to support the multiple thread compression migration: - {qemu} info_migrate_capabilities + {qemu} info migrate_capabilities {qemu} ... compress: off ... 2. Activate compression on the source: diff --git a/docs/qapi-code-gen.txt b/docs/qapi-code-gen.txt index d7d6987821..eff207502f 100644 --- a/docs/qapi-code-gen.txt +++ b/docs/qapi-code-gen.txt @@ -322,7 +322,7 @@ enum. The value for each branch can be of any type. A flat union definition avoids nesting on the wire, and specifies a set of common members that occur in all variants of the union. The -'base' key must specifiy either a type name (the type must be a +'base' key must specify either a type name (the type must be a struct, not a union), or a dictionary representing an anonymous type. All branches of the union must be complex types, and the top-level members of the union dictionary on the wire will be combination of diff --git a/docs/throttle.txt b/docs/throttle.txt index 06ed9b3943..26d4d5107f 100644 --- a/docs/throttle.txt +++ b/docs/throttle.txt @@ -39,7 +39,7 @@ the parameters for both cases: | throttling.bps-write | bps_wr | |-----------------------+-----------------------| -It is possible to set limits for both IOPS and bps and the same time, +It is possible to set limits for both IOPS and bps at the same time, and for each case we can decide whether to have separate read and write limits or not, but note that if iops-total is set then neither iops-read nor iops-write can be set. The same applies to bps-total and @@ -235,7 +235,7 @@ consider the following values: - Water leaks from the bucket at a rate of 100 IOPS. - Water can be added to the bucket at a rate of 2000 IOPS. - The size of the bucket is 2000 x 60 = 120000 - - If 'iops-total-max-length' is unset then the bucket size is 100. + - If 'iops-total-max' is unset then the bucket size is 100 x 60. The bucket is initially empty, therefore water can be added until it's full at a rate of 2000 IOPS (the burst rate). Once the bucket is full diff --git a/fsdev/9p-iov-marshal.c b/fsdev/9p-iov-marshal.c index fb40bdf0d5..fce1ee9e55 100644 --- a/fsdev/9p-iov-marshal.c +++ b/fsdev/9p-iov-marshal.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include <glib/gprintf.h> #include <utime.h> #include <sys/uio.h> diff --git a/fsdev/9p-marshal.c b/fsdev/9p-marshal.c index 183d3667c6..f56ef0e60c 100644 --- a/fsdev/9p-marshal.c +++ b/fsdev/9p-marshal.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include <glib/gprintf.h> #include <dirent.h> #include <utime.h> diff --git a/fsdev/virtfs-proxy-helper.texi b/fsdev/virtfs-proxy-helper.texi index 6eb2d5096a..f4cbb60623 100644 --- a/fsdev/virtfs-proxy-helper.texi +++ b/fsdev/virtfs-proxy-helper.texi @@ -15,7 +15,7 @@ provide access to files beyond 9p export path. 2) Running QEMU with root privilege could be a security issue. -To overcome above issues, following approach is used: A new filesytem +To overcome above issues, following approach is used: A new filesystem type 'proxy' is introduced. Proxy FS uses chroot + socket combination for securing the vulnerability known with following symbolic links. Intention of adding a new filesystem type is to allow qemu to run @@ -1631,7 +1631,7 @@ static int gdbserver_open(int port) close(fd); return -1; } - ret = listen(fd, 0); + ret = listen(fd, 1); if (ret < 0) { perror("listen"); close(fd); diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h index 46d787627a..d2030fdf56 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -4,7 +4,6 @@ #include <dirent.h> #include <utime.h> #include <sys/resource.h> -#include <glib.h> #include "fsdev/file-op-9p.h" #include "fsdev/9p-iov-marshal.h" #include "qemu/thread.h" diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 9dd6947bee..6c02646773 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -144,7 +144,7 @@ static void GUS_callback (void *opaque, int free) s->left = samples; reset: - gus_irqgen (&s->emu, muldiv64 (net, 1000000, s->freq)); + gus_irqgen (&s->emu, (uint64_t)net * 1000000 / s->freq); } int GUS_irqrequest (GUSEmuState *emu, int hwirq, int n) diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index f9afc8edad..d2599604d1 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -35,7 +35,7 @@ #define PCSPK_BUF_LEN 1792 #define PCSPK_SAMPLE_RATE 32000 #define PCSPK_MAX_FREQ (PCSPK_SAMPLE_RATE >> 1) -#define PCSPK_MIN_COUNT ((PIT_FREQ + PCSPK_MAX_FREQ - 1) / PCSPK_MAX_FREQ) +#define PCSPK_MIN_COUNT DIV_ROUND_UP(PIT_FREQ, PCSPK_MAX_FREQ) #define PC_SPEAKER(obj) OBJECT_CHECK(PCSpkState, (obj), TYPE_PC_SPEAKER) diff --git a/hw/block/tc58128.c b/hw/block/tc58128.c index 7909d5041e..1d9f7ee000 100644 --- a/hw/block/tc58128.c +++ b/hw/block/tc58128.c @@ -45,7 +45,7 @@ static void init_dev(tc58128_dev * dev, const char *filename) } } else { /* Build first block with number of blocks */ - blocks = (ret + 528 * 32 - 1) / (528 * 32); + blocks = DIV_ROUND_UP(ret, 528 * 32); dev->flash_contents[0] = blocks & 0xff; dev->flash_contents[1] = (blocks >> 8) & 0xff; dev->flash_contents[2] = (blocks >> 16) & 0xff; diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 853162b670..0a05a5295c 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -58,9 +58,6 @@ const char *qdev_fw_name(DeviceState *dev) return object_get_typename(OBJECT(dev)); } -static void qdev_property_add_legacy(DeviceState *dev, Property *prop, - Error **errp); - static void bus_remove_child(BusState *bus, DeviceState *child) { BusChild *kid; @@ -733,13 +730,20 @@ static void qdev_get_legacy_property(Object *obj, Visitor *v, } /** - * @qdev_add_legacy_property - adds a legacy property + * qdev_property_add_legacy: + * @dev: Device to add the property to. + * @prop: The qdev property definition. + * @errp: location to store error information. + * + * Add a legacy QOM property to @dev for qdev property @prop. + * On error, store error in @errp. * - * Do not use this is new code! Properties added through this interface will - * be given names and types in the "legacy" namespace. + * Legacy properties are string versions of QOM properties. The format of + * the string depends on the property type. Legacy properties are only + * needed for "info qtree". * - * Legacy properties are string versions of other OOM properties. The format - * of the string depends on the property type. + * Do not use this is new code! QOM Properties added through this interface + * will be given names in the "legacy" namespace. */ static void qdev_property_add_legacy(DeviceState *dev, Property *prop, Error **errp) @@ -762,10 +766,14 @@ static void qdev_property_add_legacy(DeviceState *dev, Property *prop, } /** - * @qdev_property_add_static - add a @Property to a device. + * qdev_property_add_static: + * @dev: Device to add the property to. + * @prop: The qdev property definition. + * @errp: location to store error information. * - * Static properties access data in a struct. The actual type of the - * property and the field depends on the property type. + * Add a static QOM property to @dev for qdev property @prop. + * On error, store error in @errp. Static properties access data in a struct. + * The type of the QOM property is derived from prop->info. */ void qdev_property_add_static(DeviceState *dev, Property *prop, Error **errp) diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index 9866dfda5f..570b0977c3 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -472,9 +472,9 @@ static int xenfb_map_fb(struct XenFB *xenfb) xenfb->pixels = NULL; } - xenfb->fbpages = (xenfb->fb_len + (XC_PAGE_SIZE - 1)) / XC_PAGE_SIZE; + xenfb->fbpages = DIV_ROUND_UP(xenfb->fb_len, XC_PAGE_SIZE); n_fbdirs = xenfb->fbpages * mode / 8; - n_fbdirs = (n_fbdirs + (XC_PAGE_SIZE - 1)) / XC_PAGE_SIZE; + n_fbdirs = DIV_ROUND_UP(n_fbdirs, XC_PAGE_SIZE); pgmfns = g_malloc0(sizeof(xen_pfn_t) * n_fbdirs); fbmfns = g_malloc0(sizeof(xen_pfn_t) * xenfb->fbpages); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 06d6204749..8ca203211a 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -23,7 +23,6 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "acpi-build.h" -#include <glib.h> #include "qemu-common.h" #include "qemu/bitmap.h" #include "qemu/error-report.h" diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 92125a8cc8..b8e8933a51 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1147,14 +1147,6 @@ void pc_cpus_init(PCMachineState *pcms) smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]); } -/* pci-info ROM file. Little endian format */ -typedef struct PcRomPciInfo { - uint64_t w32_min; - uint64_t w32_max; - uint64_t w64_min; - uint64_t w64_max; -} PcRomPciInfo; - static void pc_machine_done(Notifier *notifier, void *data) { diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 24e7042680..a6a6604722 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -23,7 +23,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "hw/hw.h" #include "hw/loader.h" diff --git a/hw/intc/aspeed_vic.c b/hw/intc/aspeed_vic.c index 725d5b62c5..2370e7485f 100644 --- a/hw/intc/aspeed_vic.c +++ b/hw/intc/aspeed_vic.c @@ -28,7 +28,6 @@ */ #include "qemu/osdep.h" -#include <inttypes.h> #include "hw/intc/aspeed_vic.h" #include "qemu/bitops.h" #include "qemu/log.h" diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c index fe12112a2f..157879e177 100644 --- a/hw/ipmi/ipmi_bmc_extern.c +++ b/hw/ipmi/ipmi_bmc_extern.c @@ -190,7 +190,7 @@ static void ipmi_bmc_extern_handle_command(IPMIBmc *b, if (ibe->outlen) { /* We already have a command queued. Shouldn't ever happen. */ fprintf(stderr, "IPMI KCS: Got command when not finished with the" - " previous commmand\n"); + " previous command\n"); abort(); } diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 2a2d52e69a..213741bc21 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -97,8 +97,8 @@ static void ich9_cc_update(ICH9LPCState *lpc) /* * D30: DMI2PCI bridge - * It is arbitrarily decided how INTx lines of PCI devicesbehind the bridge - * are connected to pirq lines. Our choice is PIRQ[E-H]. + * It is arbitrarily decided how INTx lines of PCI devices behind + * the bridge are connected to pirq lines. Our choice is PIRQ[E-H]. * INT[A-D] are connected to PIRQ[E-H] */ for (pci_intx = 0; pci_intx < PCI_NUM_PINS; pci_intx++) { diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 36e3dbe347..1202371271 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -311,11 +311,9 @@ set_interrupt_cause(E1000State *s, int index, uint32_t val) */ mit_delay = (mit_delay < 500) ? 500 : mit_delay; - if (mit_delay) { - s->mit_timer_on = 1; - timer_mod(s->mit_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - mit_delay * 256); - } + s->mit_timer_on = 1; + timer_mod(s->mit_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + + mit_delay * 256); s->mit_ide = 0; } } diff --git a/hw/net/rocker/rocker_of_dpa.c b/hw/net/rocker/rocker_of_dpa.c index 0a134ebca8..9b1e0d2441 100644 --- a/hw/net/rocker/rocker_of_dpa.c +++ b/hw/net/rocker/rocker_of_dpa.c @@ -103,9 +103,8 @@ typedef struct of_dpa_flow_key { /* Width of key which includes field 'f' in u64s, rounded up */ #define FLOW_KEY_WIDTH(f) \ - ((offsetof(OfDpaFlowKey, f) + \ - sizeof(((OfDpaFlowKey *)0)->f) + \ - sizeof(uint64_t) - 1) / sizeof(uint64_t)) + DIV_ROUND_UP(offsetof(OfDpaFlowKey, f) + sizeof(((OfDpaFlowKey *)0)->f), \ + sizeof(uint64_t)) typedef struct of_dpa_flow_action { uint32_t goto_tbl; diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index cdbdfb5320..74a0079ca6 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -729,15 +729,20 @@ static int get_fw_cfg_order(FWCfgState *s, const char *name) { int i; - if (s->fw_cfg_order_override > 0) - return s->fw_cfg_order_override; + if (s->fw_cfg_order_override > 0) { + return s->fw_cfg_order_override; + } for (i = 0; i < ARRAY_SIZE(fw_cfg_order); i++) { - if (fw_cfg_order[i].name == NULL) - continue; - if (strcmp(name, fw_cfg_order[i].name) == 0) - return fw_cfg_order[i].order; + if (fw_cfg_order[i].name == NULL) { + continue; + } + + if (strcmp(name, fw_cfg_order[i].name) == 0) { + return fw_cfg_order[i].order; + } } + /* Stick unknown stuff at the end. */ error_report("warning: Unknown firmware file in legacy mode: %s\n", name); return FW_CFG_ORDER_OVERRIDE_LAST; diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index cdf9f258ae..1bcf740f0e 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -880,7 +880,7 @@ static int timebase_post_load(void *opaque, int version_id) host_ns = qemu_clock_get_ns(QEMU_CLOCK_HOST); ns_diff = MAX(0, host_ns - tb_remote->time_of_the_day_ns); migration_duration_ns = MIN(NANOSECONDS_PER_SECOND, ns_diff); - migration_duration_tb = muldiv64(migration_duration_ns, freq, + migration_duration_tb = muldiv64(freq, migration_duration_ns, NANOSECONDS_PER_SECOND); guest_tb = tb_remote->guest_timebase + MIN(0, migration_duration_tb); diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index a1c1ed9496..2b68e5e87d 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1476,7 +1476,7 @@ static void virtio_ccw_device_plugged(DeviceState *d, Error **errp) int n = virtio_get_num_queues(vdev); if (virtio_get_num_queues(vdev) > VIRTIO_CCW_QUEUE_MAX) { - error_setg(errp, "The nubmer of virtqueues %d " + error_setg(errp, "The number of virtqueues %d " "exceeds ccw limit %d", n, VIRTIO_CCW_QUEUE_MAX); return; diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 2ac0fd3e48..a11b8b4b21 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -22,7 +22,6 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" -#include "config-target.h" #include "qemu/cutils.h" #include "qemu/bcd.h" #include "hw/hw.h" diff --git a/hw/timer/omap_gptimer.c b/hw/timer/omap_gptimer.c index 3a43863042..5e3e8a6d70 100644 --- a/hw/timer/omap_gptimer.c +++ b/hw/timer/omap_gptimer.c @@ -133,8 +133,8 @@ static inline void omap_gp_timer_update(struct omap_gp_timer_s *timer) timer_mod(timer->timer, timer->time + expires); if (timer->ce && timer->match_val >= timer->val) { - matches = muldiv64(timer->match_val - timer->val, - timer->ticks_per_sec, timer->rate); + matches = muldiv64(timer->ticks_per_sec, + timer->match_val - timer->val, timer->rate); timer_mod(timer->match, timer->time + matches); } else timer_del(timer->match); diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 16d9ff7b4b..fa5703832c 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -1474,7 +1474,7 @@ static uint32_t ohci_get_frame_remaining(OHCIState *ohci) if (tks >= usb_frame_time) return (ohci->frt << 31); - tks = muldiv64(1, tks, usb_bit_time); + tks = tks / usb_bit_time; fr = (uint16_t)(ohci->fi - tks); return (ohci->frt << 31) | fr; diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 8d8054037f..8ec8484349 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -542,9 +542,9 @@ static void usbredir_handle_iso_data(USBRedirDevice *dev, USBPacket *p, start_iso.pkts_per_urb = 32; } - start_iso.no_urbs = (dev->endpoint[EP2I(ep)].bufpq_target_size + - start_iso.pkts_per_urb - 1) / - start_iso.pkts_per_urb; + start_iso.no_urbs = DIV_ROUND_UP( + dev->endpoint[EP2I(ep)].bufpq_target_size, + start_iso.pkts_per_urb); /* Output endpoints pre-fill only 1/2 of the packets, keeping the rest as overflow buffer. Also see the usbredir protocol documentation */ if (!(ep & USB_DIR_IN)) { diff --git a/hw/xtensa/pic_cpu.c b/hw/xtensa/pic_cpu.c index ccf65fd8ad..2bed64f15b 100644 --- a/hw/xtensa/pic_cpu.c +++ b/hw/xtensa/pic_cpu.c @@ -122,8 +122,8 @@ void xtensa_rearm_ccompare_timer(CPUXtensaState *env) } env->wake_ccount = wake_ccount; timer_mod(env->ccompare_timer, env->halt_clock + - muldiv64(wake_ccount - env->sregs[CCOUNT], - 1000000, env->config->clock_freq_khz)); + (uint64_t)(wake_ccount - env->sregs[CCOUNT]) * + 1000000 / env->config->clock_freq_khz); } static void xtensa_ccompare_cb(void *opaque) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 3911576431..9f38edf419 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -34,14 +34,9 @@ /* some important defines: * - * WORDS_ALIGNED : if defined, the host cpu can only make word aligned - * memory accesses. - * * HOST_WORDS_BIGENDIAN : if defined, the host cpu is big endian and * otherwise little endian. * - * (TARGET_WORDS_ALIGNED : same for target cpu (not supported yet)) - * * TARGET_WORDS_BIGENDIAN : same for target cpu */ diff --git a/include/exec/hwaddr.h b/include/exec/hwaddr.h index bb41588b9d..a71c93cc81 100644 --- a/include/exec/hwaddr.h +++ b/include/exec/hwaddr.h @@ -3,7 +3,6 @@ #ifndef HWADDR_H #define HWADDR_H -#include <inttypes.h> #define HWADDR_BITS 64 /* hwaddr is the type of a physical address (its size can diff --git a/include/exec/user/thunk.h b/include/exec/user/thunk.h index ad1d60266e..f19ef4b230 100644 --- a/include/exec/user/thunk.h +++ b/include/exec/user/thunk.h @@ -60,10 +60,10 @@ typedef struct { /* Translation table for bitmasks... */ typedef struct bitmask_transtbl { - unsigned int x86_mask; - unsigned int x86_bits; - unsigned int alpha_mask; - unsigned int alpha_bits; + unsigned int target_mask; + unsigned int target_bits; + unsigned int host_mask; + unsigned int host_bits; } bitmask_transtbl; void thunk_register_struct(int id, const char *name, const argtype *types); @@ -71,7 +71,6 @@ void thunk_register_struct_direct(int id, const char *name, const StructEntry *se1); const argtype *thunk_convert(void *dst, const void *src, const argtype *type_ptr, int to_host); -#ifndef NO_THUNK_TYPE_SIZE extern StructEntry *struct_entries; @@ -178,11 +177,9 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host) } } -#endif /* NO_THUNK_TYPE_SIZE */ - -unsigned int target_to_host_bitmask(unsigned int x86_mask, +unsigned int target_to_host_bitmask(unsigned int target_mask, const bitmask_transtbl * trans_tbl); -unsigned int host_to_target_bitmask(unsigned int alpha_mask, +unsigned int host_to_target_bitmask(unsigned int host_mask, const bitmask_transtbl * trans_tbl); void thunk_init(unsigned int max_structs); diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 3952f85eeb..10c09ca29f 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -1,7 +1,6 @@ #ifndef HW_ACPI_GEN_UTILS_H #define HW_ACPI_GEN_UTILS_H -#include <glib.h> #include "hw/acpi/acpi-defs.h" #include "hw/acpi/bios-linker-loader.h" diff --git a/include/hw/acpi/bios-linker-loader.h b/include/hw/acpi/bios-linker-loader.h index a05227eb30..fa1e5d1a4e 100644 --- a/include/hw/acpi/bios-linker-loader.h +++ b/include/hw/acpi/bios-linker-loader.h @@ -1,7 +1,6 @@ #ifndef BIOS_LINKER_LOADER_H #define BIOS_LINKER_LOADER_H -#include <glib.h> typedef struct BIOSLinker { GArray *cmd_blob; diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h index d04dcdcfb3..88233c3077 100644 --- a/include/hw/i386/ich9.h +++ b/include/hw/i386/ich9.h @@ -35,7 +35,7 @@ typedef struct ICH9LPCState { /* (pci device, intx) -> pirq * In real chipset case, the unused slots are never used - * as ICH9 supports only D25-D32 irq routing. + * as ICH9 supports only D25-D31 irq routing. * On the other hand in qemu case, any slot/function can be populated * via command line option. * So fallback interrupt routing for any devices in any slots is necessary. @@ -181,7 +181,7 @@ Object *ich9_lpc_find(void); #define ICH9_SATA1_DEV 31 #define ICH9_SATA1_FUNC 2 -/* D30:F1 power management I/O registers +/* D31:F0 power management I/O registers offset from the address ICH9_LPC_PMBASE */ /* ICH9 LPC PM I/O registers are 128 ports and 128-aligned */ diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 0586cacceb..034b75acc5 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -197,8 +197,14 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev, Property *prop, const char *value); /** - * @qdev_property_add_static - add a @Property to a device referencing a - * field in a struct. + * qdev_property_add_static: + * @dev: Device to add the property to. + * @prop: The qdev property definition. + * @errp: location to store error information. + * + * Add a static QOM property to @dev for qdev property @prop. + * On error, store error in @errp. Static properties access data in a struct. + * The type of the QOM property is derived from prop->info. */ void qdev_property_add_static(DeviceState *dev, Property *prop, Error **errp); diff --git a/include/qemu-common.h b/include/qemu-common.h index 835cbc68b8..1f2cb94318 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -14,10 +14,6 @@ #include "qemu/fprintf-fn.h" -#if defined(__arm__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__) || defined(__ia64__) -#define WORDS_ALIGNED -#endif - #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) #include "qemu/option.h" diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h index 0e33fa5d9d..ec5146f84e 100644 --- a/include/qemu/bitmap.h +++ b/include/qemu/bitmap.h @@ -12,7 +12,6 @@ #ifndef BITMAP_H #define BITMAP_H -#include <glib.h> #include "qemu/bitops.h" diff --git a/include/qemu/fifo32.h b/include/qemu/fifo32.h index 2e5a0ccddf..4e9fd1b5ef 100644 --- a/include/qemu/fifo32.h +++ b/include/qemu/fifo32.h @@ -15,7 +15,6 @@ #ifndef FIFO32_H #define FIFO32_H -#include "qemu/osdep.h" #include "qemu/fifo8.h" typedef struct { diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index 1cdae0d0ed..3de7d4ec55 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -486,7 +486,7 @@ static inline uint64_t revbit64(uint64_t x) static inline bool is_power_of_2(uint64_t value) { if (!value) { - return 0; + return false; } return !(value & (value - 1)); diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h index 56d3a682a9..83ae2808be 100644 --- a/include/qemu/rcu.h +++ b/include/qemu/rcu.h @@ -23,7 +23,6 @@ * IBM's contributions to this file may be relicensed under LGPLv2 or later. */ -#include <glib.h> #include "qemu/thread.h" #include "qemu/queue.h" diff --git a/include/qom/object.h b/include/qom/object.h index 21bb5ff149..99de539e7c 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -14,7 +14,6 @@ #ifndef QEMU_OBJECT_H #define QEMU_OBJECT_H -#include <glib.h> #include "qapi-types.h" #include "qemu/queue.h" diff --git a/include/sysemu/tpm_backend_int.h b/include/sysemu/tpm_backend_int.h index 40f693a0cc..cc0dcb3fd2 100644 --- a/include/sysemu/tpm_backend_int.h +++ b/include/sysemu/tpm_backend_int.h @@ -22,7 +22,6 @@ #ifndef TPM_TPM_BACKEND_H #define TPM_TPM_BACKEND_H -#include <glib.h> typedef struct TPMBackendThread { GThreadPool *pool; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index df70255e5f..96ec801240 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -829,7 +829,7 @@ static inline abi_long copy_from_user_fdset(fd_set *fds, int i, nw, j, k; abi_ulong b, *target_fds; - nw = (n + TARGET_ABI_BITS - 1) / TARGET_ABI_BITS; + nw = DIV_ROUND_UP(n, TARGET_ABI_BITS); if (!(target_fds = lock_user(VERIFY_READ, target_fds_addr, sizeof(abi_ulong) * nw, @@ -876,7 +876,7 @@ static inline abi_long copy_to_user_fdset(abi_ulong target_fds_addr, abi_long v; abi_ulong *target_fds; - nw = (n + TARGET_ABI_BITS - 1) / TARGET_ABI_BITS; + nw = DIV_ROUND_UP(n, TARGET_ABI_BITS); if (!(target_fds = lock_user(VERIFY_WRITE, target_fds_addr, sizeof(abi_ulong) * nw, diff --git a/memory_mapping.c b/memory_mapping.c index 2354b2b7f3..e3e0d95172 100644 --- a/memory_mapping.c +++ b/memory_mapping.c @@ -13,7 +13,6 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include <glib.h> #include "qemu-common.h" #include "cpu.h" diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index cf7dcd25d4..47250b675d 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -17,7 +17,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "migration/migration.h" @@ -320,7 +320,7 @@ static void monitor_flush_locked(Monitor *mon) return; } if (rc > 0) { - /* partinal write */ + /* partial write */ QString *tmp = qstring_from_str(buf + rc); QDECREF(mon->outbuf); mon->outbuf = tmp; diff --git a/page_cache.c b/page_cache.c index 37a66e497b..a2809db2f5 100644 --- a/page_cache.c +++ b/page_cache.c @@ -13,7 +13,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "qemu/host-utils.h" diff --git a/po/Makefile b/po/Makefile index b271f79ba2..7bab09dce2 100644 --- a/po/Makefile +++ b/po/Makefile @@ -32,7 +32,7 @@ update: $(SRCS) build: $(OBJS) clean: - $(RM) $(OBJS) + rm -f $(OBJS) install: $(OBJS) for obj in $(OBJS); do \ diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c index 4332a6818d..68b24c98b0 100644 --- a/qapi/qmp-registry.c +++ b/qapi/qmp-registry.c @@ -13,7 +13,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qapi/qmp/dispatch.h" static QTAILQ_HEAD(QmpCommandList, QmpCommand) qmp_commands = diff --git a/qemu-bridge-helper.c b/qemu-bridge-helper.c index 830fb9e269..5396fbfbb6 100644 --- a/qemu-bridge-helper.c +++ b/qemu-bridge-helper.c @@ -15,7 +15,6 @@ #include "qemu/osdep.h" -#include <glib.h> #include <sys/ioctl.h> #include <sys/socket.h> diff --git a/qemu-options.hx b/qemu-options.hx index 9f33361876..272630f639 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -35,7 +35,7 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " kernel_irqchip=on|off controls accelerated irqchip support\n" " kernel_irqchip=on|off|split controls accelerated irqchip support (default=off)\n" " vmport=on|off|auto controls emulation of vmport (default: auto)\n" - " kvm_shadow_mem=size of KVM shadow MMU\n" + " kvm_shadow_mem=size of KVM shadow MMU in bytes\n" " dump-guest-core=on|off include guest memory in a core dump (default=on)\n" " mem-merge=on|off controls memory merge support (default: on)\n" " iommu=on|off controls emulated Intel IOMMU (VT-d) support (default=off)\n" @@ -569,7 +569,7 @@ These options have the same definition as they have in @option{-hdachs}. @var{discard} is one of "ignore" (or "off") or "unmap" (or "on") and controls whether @dfn{discard} (also known as @dfn{trim} or @dfn{unmap}) requests are ignored or passed to the filesystem. Some machine types may not support discard requests. @item format=@var{format} Specify which disk @var{format} will be used rather than detecting -the format. Can be used to specifiy format=raw to avoid interpreting +the format. Can be used to specify format=raw to avoid interpreting an untrusted format header. @item serial=@var{serial} This option specifies the serial number to assign to the device. @@ -894,7 +894,7 @@ mouse. Also overrides the PS/2 mouse emulation when activated. @item disk:[format=@var{format}]:@var{file} Mass storage device based on file. The optional @var{format} argument -will be used rather than detecting the format. Can be used to specifiy +will be used rather than detecting the format. Can be used to specify @code{format=raw} to avoid interpreting an untrusted format header. @item host:@var{bus}.@var{addr} diff --git a/qemu-timer.c b/qemu-timer.c index 4441fe66ff..eb22e9218b 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -292,7 +292,7 @@ int qemu_timeout_ns_to_ms(int64_t ns) /* Always round up, because it's better to wait too long than to wait too * little and effectively busy-wait */ - ms = (ns + SCALE_MS - 1) / SCALE_MS; + ms = DIV_ROUND_UP(ns, SCALE_MS); /* To avoid overflow problems, limit this to 2^31, i.e. approx 25 days */ if (ms > (int64_t) INT32_MAX) { diff --git a/qga/channel-posix.c b/qga/channel-posix.c index 63458c6632..bb65d8ba17 100644 --- a/qga/channel-posix.c +++ b/qga/channel-posix.c @@ -1,5 +1,4 @@ #include "qemu/osdep.h" -#include <glib.h> #include <termios.h> #include "qapi/error.h" #include "qemu/sockets.h" diff --git a/qga/channel-win32.c b/qga/channel-win32.c index 68168d14a5..21f9deedf6 100644 --- a/qga/channel-win32.c +++ b/qga/channel-win32.c @@ -1,5 +1,4 @@ #include "qemu/osdep.h" -#include <glib.h> #include <windows.h> #include <io.h> #include "qga/guest-agent-core.h" diff --git a/qga/channel.h b/qga/channel.h index 3704ea9c86..ae8cf0f7e0 100644 --- a/qga/channel.h +++ b/qga/channel.h @@ -12,7 +12,6 @@ #ifndef QGA_CHANNEL_H #define QGA_CHANNEL_H -#include <glib.h> typedef struct GAChannel GAChannel; diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 2ae37255d4..eaef7be42e 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include <sys/ioctl.h> #include <sys/wait.h> #include <dirent.h> @@ -1242,8 +1241,8 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints, goto error; } - /* we try to cull filesytems we know won't work in advance, but other - * filesytems may not implement fsfreeze for less obvious reasons. + /* we try to cull filesystems we know won't work in advance, but other + * filesystems may not implement fsfreeze for less obvious reasons. * these will report EOPNOTSUPP. we simply ignore these when tallying * the number of frozen filesystems. * @@ -1392,10 +1391,10 @@ qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp) continue; } - /* We try to cull filesytems we know won't work in advance, but other - * filesytems may not implement fstrim for less obvious reasons. These - * will report EOPNOTSUPP; while in some other cases ENOTTY will be - * reported (e.g. CD-ROMs). + /* We try to cull filesystems we know won't work in advance, but other + * filesystems may not implement fstrim for less obvious reasons. + * These will report EOPNOTSUPP; while in some other cases ENOTTY + * will be reported (e.g. CD-ROMs). * Any other error means an unexpected error. */ r.start = 0; diff --git a/qga/commands-win32.c b/qga/commands-win32.c index d76327f5a3..c1a8588206 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include <wtypes.h> #include <powrprof.h> #include <winsock2.h> diff --git a/qga/commands.c b/qga/commands.c index 31444643e2..50fd26a817 100644 --- a/qga/commands.c +++ b/qga/commands.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qga/guest-agent-core.h" #include "qga-qmp-commands.h" #include "qapi/qmp/qerror.h" diff --git a/qga/guest-agent-command-state.c b/qga/guest-agent-command-state.c index 20b9b22224..4de229cd78 100644 --- a/qga/guest-agent-command-state.c +++ b/qga/guest-agent-command-state.c @@ -10,7 +10,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include <glib.h> #include "qga/guest-agent-core.h" struct GACommandState { diff --git a/qga/main.c b/qga/main.c index c552782101..4c3b2c772b 100644 --- a/qga/main.c +++ b/qga/main.c @@ -11,7 +11,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include <glib.h> #include <getopt.h> #include <glib/gstdio.h> #ifndef _WIN32 diff --git a/qga/service-win32.c b/qga/service-win32.c index 72437587b0..fd434e3f49 100644 --- a/qga/service-win32.c +++ b/qga/service-win32.c @@ -11,7 +11,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include <glib.h> #include <windows.h> #include "qga/service-win32.h" diff --git a/replay/replay-char.c b/replay/replay-char.c index 23b6922977..edf46ab9df 100755 --- a/replay/replay-char.c +++ b/replay/replay-char.c @@ -9,10 +9,6 @@ * */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - #include "qemu/osdep.h" #include "qemu/error-report.h" #include "sysemu/replay.h" @@ -95,7 +95,7 @@ module-common.o: CFLAGS += $(DSO_OBJ_CFLAGS) $(if $(findstring /,$@),$(call quiet-command,cp $@ $(subst /,-,$@), " CP $(subst /,-,$@)")) -LD_REL := $(CC) -nostdlib -Wl,-r +LD_REL := $(CC) -nostdlib -Wl,-r $(LD_REL_FLAGS) %.mo: $(call quiet-command,$(LD_REL) -o $@ $^," LD -r $(TARGET_DIR)$@") 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" diff --git a/slirp/dnssearch.c b/slirp/dnssearch.c index aed2f13af5..8fb563321b 100644 --- a/slirp/dnssearch.c +++ b/slirp/dnssearch.c @@ -23,7 +23,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "slirp.h" static const uint8_t RFC3397_OPT_DOMAIN_SEARCH = 119; @@ -262,7 +261,7 @@ int translate_dnssearch(Slirp *s, const char **names) } /* reserve extra 2 header bytes for each 255 bytes of output */ - memreq += ((memreq + MAX_OPT_LEN - 1) / MAX_OPT_LEN) * OPT_HEADER_LEN; + memreq += DIV_ROUND_UP(memreq, MAX_OPT_LEN) * OPT_HEADER_LEN; result = g_malloc(memreq * sizeof(*result)); outptr = result; @@ -289,7 +288,7 @@ int translate_dnssearch(Slirp *s, const char **names) domain_mkxrefs(domains, domains + num_domains - 1, 0); memreq = domain_compactify(domains, num_domains); - blocks = (memreq + MAX_OPT_LEN - 1) / MAX_OPT_LEN; + blocks = DIV_ROUND_UP(memreq, MAX_OPT_LEN); bsrc_end = memreq; bsrc_start = (blocks - 1) * MAX_OPT_LEN; bdst_start = bsrc_start + blocks * OPT_HEADER_LEN; diff --git a/slirp/slirp.h b/slirp/slirp.h index 5df755e697..e3641f9eba 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -69,7 +69,6 @@ typedef char *caddr_t; #include <sys/stropts.h> #endif -#include <glib.h> #include "debug.h" diff --git a/target-moxie/mmu.h b/target-moxie/mmu.h index abc79297cd..284a44d18e 100644 --- a/target-moxie/mmu.h +++ b/target-moxie/mmu.h @@ -6,11 +6,6 @@ typedef struct { uint32_t phy; uint32_t pfn; - unsigned g:1; - unsigned v:1; - unsigned k:1; - unsigned w:1; - unsigned e:1; int cause_op; } MoxieMMUResult; diff --git a/tests/ac97-test.c b/tests/ac97-test.c index 75cab8f98f..e0d177bd9c 100644 --- a/tests/ac97-test.c +++ b/tests/ac97-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/ahci-test.c b/tests/ahci-test.c index 6869f7f46d..57dc44cf3b 100644 --- a/tests/ahci-test.c +++ b/tests/ahci-test.c @@ -24,7 +24,6 @@ #include "qemu/osdep.h" #include <getopt.h> -#include <glib.h> #include "libqtest.h" #include "libqos/libqos-pc.h" diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index f0493f8c69..16d11aa854 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include <glib/gstdio.h> #include "qemu-common.h" #include "libqtest.h" diff --git a/tests/boot-order-test.c b/tests/boot-order-test.c index a6d8bd5cbf..fc1e7941f7 100644 --- a/tests/boot-order-test.c +++ b/tests/boot-order-test.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqos/fw_cfg.h" #include "libqtest.h" diff --git a/tests/check-qdict.c b/tests/check-qdict.c index a43056c5de..42da1e65a5 100644 --- a/tests/check-qdict.c +++ b/tests/check-qdict.c @@ -10,7 +10,6 @@ * See the COPYING.LIB file in the top-level directory. */ #include "qemu/osdep.h" -#include <glib.h> #include "qapi/qmp/qint.h" #include "qapi/qmp/qdict.h" diff --git a/tests/check-qfloat.c b/tests/check-qfloat.c index 3102608f55..1da2cdae08 100644 --- a/tests/check-qfloat.c +++ b/tests/check-qfloat.c @@ -11,7 +11,6 @@ * */ #include "qemu/osdep.h" -#include <glib.h> #include "qapi/qmp/qfloat.h" #include "qemu-common.h" diff --git a/tests/check-qint.c b/tests/check-qint.c index c86f7dfa38..b6e4555115 100644 --- a/tests/check-qint.c +++ b/tests/check-qint.c @@ -10,7 +10,6 @@ * See the COPYING.LIB file in the top-level directory. */ #include "qemu/osdep.h" -#include <glib.h> #include "qapi/qmp/qint.h" #include "qemu-common.h" diff --git a/tests/check-qjson.c b/tests/check-qjson.c index 99de6f5252..0e158f6eac 100644 --- a/tests/check-qjson.c +++ b/tests/check-qjson.c @@ -11,7 +11,6 @@ * */ #include "qemu/osdep.h" -#include <glib.h> #include "qapi/qmp/qstring.h" #include "qapi/qmp/qint.h" diff --git a/tests/check-qlist.c b/tests/check-qlist.c index f231d5fa97..e16da5e5c6 100644 --- a/tests/check-qlist.c +++ b/tests/check-qlist.c @@ -10,7 +10,6 @@ * See the COPYING.LIB file in the top-level directory. */ #include "qemu/osdep.h" -#include <glib.h> #include "qapi/qmp/qint.h" #include "qapi/qmp/qlist.h" diff --git a/tests/check-qnull.c b/tests/check-qnull.c index fd9c68f7e1..05d562d494 100644 --- a/tests/check-qnull.c +++ b/tests/check-qnull.c @@ -7,7 +7,6 @@ * See the COPYING.LIB file in the top-level directory. */ #include "qemu/osdep.h" -#include <glib.h> #include "qapi/qmp/qobject.h" #include "qemu-common.h" diff --git a/tests/check-qom-interface.c b/tests/check-qom-interface.c index 09354deb70..719ddcf2e0 100644 --- a/tests/check-qom-interface.c +++ b/tests/check-qom-interface.c @@ -10,7 +10,6 @@ * See the COPYING.LIB file in the top-level directory. */ #include "qemu/osdep.h" -#include <glib.h> #include "qom/object.h" #include "qemu/module.h" diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c index ffffd872f2..42defe7128 100644 --- a/tests/check-qom-proplist.c +++ b/tests/check-qom-proplist.c @@ -19,7 +19,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qapi/error.h" #include "qom/object.h" diff --git a/tests/check-qstring.c b/tests/check-qstring.c index 9877b42c89..239e9d9da3 100644 --- a/tests/check-qstring.c +++ b/tests/check-qstring.c @@ -10,7 +10,6 @@ * See the COPYING.LIB file in the top-level directory. */ #include "qemu/osdep.h" -#include <glib.h> #include "qapi/qmp/qstring.h" #include "qemu-common.h" diff --git a/tests/device-introspect-test.c b/tests/device-introspect-test.c index 4477926014..37debc11f9 100644 --- a/tests/device-introspect-test.c +++ b/tests/device-introspect-test.c @@ -18,7 +18,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "qapi/qmp/qstring.h" #include "libqtest.h" diff --git a/tests/display-vga-test.c b/tests/display-vga-test.c index 5706d338a1..06b244ed9a 100644 --- a/tests/display-vga-test.c +++ b/tests/display-vga-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" static void pci_cirrus(void) diff --git a/tests/drive_del-test.c b/tests/drive_del-test.c index fe03236f3a..74e43c248b 100644 --- a/tests/drive_del-test.c +++ b/tests/drive_del-test.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" static void drive_add(void) diff --git a/tests/ds1338-test.c b/tests/ds1338-test.c index 2792415841..26968bc82a 100644 --- a/tests/ds1338-test.c +++ b/tests/ds1338-test.c @@ -21,8 +21,6 @@ #include "libqtest.h" #include "libqos/i2c.h" -#include <glib.h> - #define IMX25_I2C_0_BASE 0x43F80000 #define DS1338_ADDR 0x68 diff --git a/tests/e1000-test.c b/tests/e1000-test.c index a42b3810c1..59cab68a60 100644 --- a/tests/e1000-test.c +++ b/tests/e1000-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/eepro100-test.c b/tests/eepro100-test.c index e17eed0b7a..ed23258b0f 100644 --- a/tests/eepro100-test.c +++ b/tests/eepro100-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" static void test_device(gconstpointer data) diff --git a/tests/endianness-test.c b/tests/endianness-test.c index cc5bccd88e..2197972e55 100644 --- a/tests/endianness-test.c +++ b/tests/endianness-test.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "qemu/bswap.h" diff --git a/tests/es1370-test.c b/tests/es1370-test.c index 824dc31c64..199fe193ce 100644 --- a/tests/es1370-test.c +++ b/tests/es1370-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/fdc-test.c b/tests/fdc-test.c index 53df1d0d88..738c6b4a5e 100644 --- a/tests/fdc-test.c +++ b/tests/fdc-test.c @@ -24,7 +24,6 @@ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "qemu-common.h" diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c index b4392c2d38..688342bed5 100644 --- a/tests/fw_cfg-test.c +++ b/tests/fw_cfg-test.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "hw/nvram/fw_cfg_keys.h" diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c index c8e669ac26..12ee3929da 100644 --- a/tests/hd-geo-test.c +++ b/tests/hd-geo-test.c @@ -16,7 +16,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "libqtest.h" diff --git a/tests/i440fx-test.c b/tests/i440fx-test.c index 05029e90b2..bff999cf12 100644 --- a/tests/i440fx-test.c +++ b/tests/i440fx-test.c @@ -13,7 +13,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include <sys/mman.h> #include "libqtest.h" diff --git a/tests/i82801b11-test.c b/tests/i82801b11-test.c index c3b5ebbca1..a6e31594c9 100644 --- a/tests/i82801b11-test.c +++ b/tests/i82801b11-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/ide-test.c b/tests/ide-test.c index 67e5c1f5cc..fed1b2ec2e 100644 --- a/tests/ide-test.c +++ b/tests/ide-test.c @@ -24,7 +24,6 @@ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/libqos.h" diff --git a/tests/intel-hda-test.c b/tests/intel-hda-test.c index 1be6add9b5..b0ca7e042a 100644 --- a/tests/intel-hda-test.c +++ b/tests/intel-hda-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #define HDA_ID "hda0" diff --git a/tests/ioh3420-test.c b/tests/ioh3420-test.c index 93eb2f7506..b54c4b9f11 100644 --- a/tests/ioh3420-test.c +++ b/tests/ioh3420-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/ipmi-bt-test.c b/tests/ipmi-bt-test.c index 812907fb7b..be9005eb85 100644 --- a/tests/ipmi-bt-test.c +++ b/tests/ipmi-bt-test.c @@ -29,7 +29,6 @@ #include <netinet/ip.h> #include <netinet/tcp.h> -#include <glib.h> #include "libqtest.h" #include "qemu-common.h" diff --git a/tests/ipmi-kcs-test.c b/tests/ipmi-kcs-test.c index 42c4b974c5..3750389651 100644 --- a/tests/ipmi-kcs-test.c +++ b/tests/ipmi-kcs-test.c @@ -24,7 +24,6 @@ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" diff --git a/tests/ipoctal232-test.c b/tests/ipoctal232-test.c index 846aaf5711..684914164d 100644 --- a/tests/ipoctal232-test.c +++ b/tests/ipoctal232-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c index c027ff1e09..010860a5b7 100644 --- a/tests/ivshmem-test.c +++ b/tests/ivshmem-test.c @@ -9,7 +9,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include <glib/gstdio.h> #include <sys/mman.h> #include "contrib/ivshmem-server/ivshmem-server.h" diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c index ac6c155c83..f3be5500e1 100644 --- a/tests/libqos/ahci.c +++ b/tests/libqos/ahci.c @@ -23,7 +23,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/ahci.h" diff --git a/tests/libqos/fw_cfg.c b/tests/libqos/fw_cfg.c index 76894d5759..4d9dc3fd0b 100644 --- a/tests/libqos/fw_cfg.c +++ b/tests/libqos/fw_cfg.c @@ -13,7 +13,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqos/fw_cfg.h" #include "libqtest.h" #include "qemu/bswap.h" diff --git a/tests/libqos/i2c-imx.c b/tests/libqos/i2c-imx.c index 51c3468f97..1c4b4314ba 100644 --- a/tests/libqos/i2c-imx.c +++ b/tests/libqos/i2c-imx.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include "libqos/i2c.h" -#include <glib.h> #include "libqtest.h" diff --git a/tests/libqos/i2c-omap.c b/tests/libqos/i2c-omap.c index 2028f2f146..f603fdf43c 100644 --- a/tests/libqos/i2c-omap.c +++ b/tests/libqos/i2c-omap.c @@ -9,7 +9,6 @@ #include "qemu/osdep.h" #include "libqos/i2c.h" -#include <glib.h> #include "qemu/bswap.h" #include "libqtest.h" diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c index 79b0b29b4d..c7ba441d0b 100644 --- a/tests/libqos/libqos.c +++ b/tests/libqos/libqos.c @@ -1,5 +1,4 @@ #include "qemu/osdep.h" -#include <glib.h> #include <sys/wait.h> #include "libqtest.h" diff --git a/tests/libqos/malloc-generic.c b/tests/libqos/malloc-generic.c index 6000df2b82..33ce90b925 100644 --- a/tests/libqos/malloc-generic.c +++ b/tests/libqos/malloc-generic.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqos/malloc-generic.h" #include "libqos/malloc.h" diff --git a/tests/libqos/malloc-pc.c b/tests/libqos/malloc-pc.c index eee706bd63..dd2b900c5f 100644 --- a/tests/libqos/malloc-pc.c +++ b/tests/libqos/malloc-pc.c @@ -17,7 +17,6 @@ #include "hw/nvram/fw_cfg_keys.h" #include "qemu-common.h" -#include <glib.h> #define PAGE_SIZE (4096) diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c index 793fe69c2f..b8eff5f495 100644 --- a/tests/libqos/malloc.c +++ b/tests/libqos/malloc.c @@ -14,7 +14,6 @@ #include "libqos/malloc.h" #include "qemu-common.h" #include "qemu/host-utils.h" -#include <glib.h> typedef QTAILQ_HEAD(MemList, MemBlock) MemList; diff --git a/tests/libqos/pci-pc.c b/tests/libqos/pci-pc.c index 77f15e5a0e..1ae2d3780f 100644 --- a/tests/libqos/pci-pc.c +++ b/tests/libqos/pci-pc.c @@ -19,7 +19,6 @@ #include "qemu-common.h" #include "qemu/host-utils.h" -#include <glib.h> #define ACPI_PCIHP_ADDR 0xae00 #define PCI_EJ_BASE 0x0008 diff --git a/tests/libqos/pci.c b/tests/libqos/pci.c index 0e104e14ed..ed78d91cea 100644 --- a/tests/libqos/pci.c +++ b/tests/libqos/pci.c @@ -14,7 +14,6 @@ #include "libqos/pci.h" #include "hw/pci/pci_regs.h" -#include <glib.h> void qpci_device_foreach(QPCIBus *bus, int vendor_id, int device_id, void (*func)(QPCIDevice *dev, int devfn, void *data), diff --git a/tests/libqos/usb.c b/tests/libqos/usb.c index 87efb90782..f794d92da5 100644 --- a/tests/libqos/usb.c +++ b/tests/libqos/usb.c @@ -12,7 +12,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "hw/usb/uhci-regs.h" #include "libqos/usb.h" diff --git a/tests/libqos/virtio-mmio.c b/tests/libqos/virtio-mmio.c index a4382f3660..e15b480ab8 100644 --- a/tests/libqos/virtio-mmio.c +++ b/tests/libqos/virtio-mmio.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/virtio.h" #include "libqos/virtio-mmio.h" diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c index fde2ff0bcb..9d45e2028e 100644 --- a/tests/libqos/virtio-pci.c +++ b/tests/libqos/virtio-pci.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c index 613decea5a..d792635340 100644 --- a/tests/libqos/virtio.c +++ b/tests/libqos/virtio.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/virtio.h" diff --git a/tests/libqtest.c b/tests/libqtest.c index b12a9e4ca9..5c82348265 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -17,7 +17,6 @@ #include "qemu/osdep.h" #include "libqtest.h" -#include <glib.h> #include <sys/socket.h> #include <sys/wait.h> #include <sys/un.h> diff --git a/tests/m48t59-test.c b/tests/m48t59-test.c index a751fd350e..0f921ef38a 100644 --- a/tests/m48t59-test.c +++ b/tests/m48t59-test.c @@ -13,7 +13,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" diff --git a/tests/ne2000-test.c b/tests/ne2000-test.c index 3727875f2e..b7cf3dd2f5 100644 --- a/tests/ne2000-test.c +++ b/tests/ne2000-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/nvme-test.c b/tests/nvme-test.c index ec06893eee..c8bece4434 100644 --- a/tests/nvme-test.c +++ b/tests/nvme-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/pc-cpu-test.c b/tests/pc-cpu-test.c index 6b34ca588b..4428cea5f1 100644 --- a/tests/pc-cpu-test.c +++ b/tests/pc-cpu-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "libqtest.h" diff --git a/tests/pcnet-test.c b/tests/pcnet-test.c index 2ddf4965c6..efb1ef44e9 100644 --- a/tests/pcnet-test.c +++ b/tests/pcnet-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/pvpanic-test.c b/tests/pvpanic-test.c index d435833f79..3bfa678667 100644 --- a/tests/pvpanic-test.c +++ b/tests/pvpanic-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" static void test_panic(void) diff --git a/tests/pxe-test.c b/tests/pxe-test.c index 875e4c4a26..b2cc355a95 100644 --- a/tests/pxe-test.c +++ b/tests/pxe-test.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include <glib/gstdio.h> #include "qemu-common.h" #include "libqtest.h" diff --git a/tests/q35-test.c b/tests/q35-test.c index a105f10782..71538fc17c 100644 --- a/tests/q35-test.c +++ b/tests/q35-test.c @@ -10,7 +10,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/pci.h" #include "libqos/pci-pc.h" diff --git a/tests/qom-test.c b/tests/qom-test.c index bd5cdde261..23493a2b0a 100644 --- a/tests/qom-test.c +++ b/tests/qom-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "qemu/cutils.h" diff --git a/tests/rcutorture.c b/tests/rcutorture.c index 244f0f28b2..4002ecf123 100644 --- a/tests/rcutorture.c +++ b/tests/rcutorture.c @@ -61,7 +61,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu/atomic.h" #include "qemu/rcu.h" #include "qemu/thread.h" diff --git a/tests/rtc-test.c b/tests/rtc-test.c index fa7029aa8a..a086efd120 100644 --- a/tests/rtc-test.c +++ b/tests/rtc-test.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "hw/timer/mc146818rtc_regs.h" diff --git a/tests/rtl8139-test.c b/tests/rtl8139-test.c index 54e5aa7d0e..13de7eeafd 100644 --- a/tests/rtl8139-test.c +++ b/tests/rtl8139-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/pci-pc.h" #include "qemu/timer.h" diff --git a/tests/spapr-phb-test.c b/tests/spapr-phb-test.c index f53911d9f7..21004a76ec 100644 --- a/tests/spapr-phb-test.c +++ b/tests/spapr-phb-test.c @@ -8,7 +8,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" diff --git a/tests/tco-test.c b/tests/tco-test.c index ac11175e90..0d13aa8d63 100644 --- a/tests/tco-test.c +++ b/tests/tco-test.c @@ -7,7 +7,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/pci.h" diff --git a/tests/test-aio.c b/tests/test-aio.c index 687dfa062e..982339c801 100644 --- a/tests/test-aio.c +++ b/tests/test-aio.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "block/aio.h" #include "qapi/error.h" #include "qemu/timer.h" diff --git a/tests/test-base64.c b/tests/test-base64.c index 922e839dd6..ec122ceba5 100644 --- a/tests/test-base64.c +++ b/tests/test-base64.c @@ -19,7 +19,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qapi/error.h" #include "qemu/base64.h" diff --git a/tests/test-bitops.c b/tests/test-bitops.c index 5050950607..eb19a36a36 100644 --- a/tests/test-bitops.c +++ b/tests/test-bitops.c @@ -7,7 +7,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu/bitops.h" typedef struct { diff --git a/tests/test-blockjob-txn.c b/tests/test-blockjob-txn.c index 828389bb45..d3030f1566 100644 --- a/tests/test-blockjob-txn.c +++ b/tests/test-blockjob-txn.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qapi/error.h" #include "qemu/main-loop.h" #include "block/blockjob.h" diff --git a/tests/test-coroutine.c b/tests/test-coroutine.c index ea7f87f487..215b92e636 100644 --- a/tests/test-coroutine.c +++ b/tests/test-coroutine.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu/coroutine.h" #include "qemu/coroutine_int.h" diff --git a/tests/test-crypto-cipher.c b/tests/test-crypto-cipher.c index 66d1c63fd5..1b5130d5f6 100644 --- a/tests/test-crypto-cipher.c +++ b/tests/test-crypto-cipher.c @@ -19,7 +19,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "crypto/init.h" #include "crypto/cipher.h" diff --git a/tests/test-crypto-hash.c b/tests/test-crypto-hash.c index 735d6d7e0b..6e0e89f7d6 100644 --- a/tests/test-crypto-hash.c +++ b/tests/test-crypto-hash.c @@ -19,7 +19,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "crypto/init.h" #include "crypto/hash.h" diff --git a/tests/test-crypto-secret.c b/tests/test-crypto-secret.c index aa26c20499..0b1fe8dd37 100644 --- a/tests/test-crypto-secret.c +++ b/tests/test-crypto-secret.c @@ -19,7 +19,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "crypto/init.h" #include "crypto/secret.h" diff --git a/tests/test-cutils.c b/tests/test-cutils.c index fb8f5b5321..64e3e95ce2 100644 --- a/tests/test-cutils.c +++ b/tests/test-cutils.c @@ -26,7 +26,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu/cutils.h" diff --git a/tests/test-filter-mirror.c b/tests/test-filter-mirror.c index f60bf2adbe..ffaaffabd0 100644 --- a/tests/test-filter-mirror.c +++ b/tests/test-filter-mirror.c @@ -9,7 +9,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "qemu/iov.h" #include "qemu/sockets.h" diff --git a/tests/test-filter-redirector.c b/tests/test-filter-redirector.c index b93012ceae..280e4b68ab 100644 --- a/tests/test-filter-redirector.c +++ b/tests/test-filter-redirector.c @@ -51,7 +51,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "qemu/iov.h" #include "qemu/sockets.h" diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c index abe1427917..c0e9895fb9 100644 --- a/tests/test-hbitmap.c +++ b/tests/test-hbitmap.c @@ -10,7 +10,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu/hbitmap.h" #define LOG_BITS_PER_LONG (BITS_PER_LONG == 32 ? 5 : 6) @@ -80,7 +79,7 @@ static void hbitmap_test_init(TestHBitmapData *data, size_t n; data->hb = hbitmap_alloc(size, granularity); - n = (size + BITS_PER_LONG - 1) / BITS_PER_LONG; + n = DIV_ROUND_UP(size, BITS_PER_LONG); if (n == 0) { n = 1; } @@ -94,7 +93,7 @@ static void hbitmap_test_init(TestHBitmapData *data, static inline size_t hbitmap_test_array_size(size_t bits) { - size_t n = (bits + BITS_PER_LONG - 1) / BITS_PER_LONG; + size_t n = DIV_ROUND_UP(bits, BITS_PER_LONG); return n ? n : 1; } @@ -186,7 +185,7 @@ static void hbitmap_test_reset_all(TestHBitmapData *data) hbitmap_reset_all(data->hb); - n = (data->size + BITS_PER_LONG - 1) / BITS_PER_LONG; + n = DIV_ROUND_UP(data->size, BITS_PER_LONG); if (n == 0) { n = 1; } diff --git a/tests/test-int128.c b/tests/test-int128.c index cacf6beac8..4390123bd3 100644 --- a/tests/test-int128.c +++ b/tests/test-int128.c @@ -7,7 +7,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu/int128.h" /* clang doesn't support __noclone__ but it does have a mechanism for diff --git a/tests/test-io-task.c b/tests/test-io-task.c index 5a9775086c..a36cb824eb 100644 --- a/tests/test-io-task.c +++ b/tests/test-io-task.c @@ -19,7 +19,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "io/task.h" #include "qapi/error.h" diff --git a/tests/test-iov.c b/tests/test-iov.c index 3f25268dd4..46ae25efd6 100644 --- a/tests/test-iov.c +++ b/tests/test-iov.c @@ -1,5 +1,4 @@ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "qemu/iov.h" #include "qemu/sockets.h" diff --git a/tests/test-logging.c b/tests/test-logging.c index ac8deedc9a..5ef5bb887d 100644 --- a/tests/test-logging.c +++ b/tests/test-logging.c @@ -25,7 +25,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "include/qemu/log.h" diff --git a/tests/test-mul64.c b/tests/test-mul64.c index 1282ec5a22..9be775d084 100644 --- a/tests/test-mul64.c +++ b/tests/test-mul64.c @@ -7,7 +7,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu/host-utils.h" diff --git a/tests/test-netfilter.c b/tests/test-netfilter.c index 7d105c3232..8b5a9b21b5 100644 --- a/tests/test-netfilter.c +++ b/tests/test-netfilter.c @@ -9,7 +9,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* add a netfilter to a netdev and then remove it */ diff --git a/tests/test-opts-visitor.c b/tests/test-opts-visitor.c index 008e677388..d75b114c15 100644 --- a/tests/test-opts-visitor.c +++ b/tests/test-opts-visitor.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu/config-file.h" /* qemu_add_opts() */ #include "qemu/option.h" /* qemu_opts_parse() */ diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c index f0cc31e113..48e5b7315f 100644 --- a/tests/test-qdev-global-props.c +++ b/tests/test-qdev-global-props.c @@ -23,7 +23,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "hw/qdev.h" #include "qom/object.h" diff --git a/tests/test-qemu-opts.c b/tests/test-qemu-opts.c index 32abed5ea1..a505a3e059 100644 --- a/tests/test-qemu-opts.c +++ b/tests/test-qemu-opts.c @@ -12,7 +12,6 @@ #include "qapi/qmp/qstring.h" #include "qemu/config-file.h" -#include <glib.h> static QemuOptsList opts_list_01 = { .name = "opts_list_01", diff --git a/tests/test-qga.c b/tests/test-qga.c index 72a89dec23..9c9039fac5 100644 --- a/tests/test-qga.c +++ b/tests/test-qga.c @@ -1,6 +1,5 @@ #include "qemu/osdep.h" #include <locale.h> -#include <glib.h> #include <glib/gstdio.h> #include <sys/socket.h> #include <sys/un.h> diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c index 5c3edd753a..e8f619d331 100644 --- a/tests/test-qmp-commands.c +++ b/tests/test-qmp-commands.c @@ -1,5 +1,4 @@ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "qapi/qmp/types.h" #include "test-qmp-commands.h" diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c index a296fdbac2..633dc87402 100644 --- a/tests/test-qmp-event.c +++ b/tests/test-qmp-event.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "test-qapi-types.h" diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c index 4602529ea0..d5f57c583a 100644 --- a/tests/test-qmp-input-strict.c +++ b/tests/test-qmp-input-strict.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "qapi/error.h" diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qmp-input-visitor.c index cee07ce8dd..3b6b39e297 100644 --- a/tests/test-qmp-input-visitor.c +++ b/tests/test-qmp-input-visitor.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "qapi/error.h" diff --git a/tests/test-qmp-output-visitor.c b/tests/test-qmp-output-visitor.c index 1f80e696ea..f8a7a271a9 100644 --- a/tests/test-qmp-output-visitor.c +++ b/tests/test-qmp-output-visitor.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "qapi/error.h" diff --git a/tests/test-rcu-list.c b/tests/test-rcu-list.c index 79d3750144..1514d7ec97 100644 --- a/tests/test-rcu-list.c +++ b/tests/test-rcu-list.c @@ -21,7 +21,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu/atomic.h" #include "qemu/rcu.h" #include "qemu/thread.h" diff --git a/tests/test-rfifolock.c b/tests/test-rfifolock.c index 9a3cb243ba..471a81114d 100644 --- a/tests/test-rfifolock.c +++ b/tests/test-rfifolock.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "qemu/rfifolock.h" diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c index 5a56920222..7fe7a9c270 100644 --- a/tests/test-string-input-visitor.c +++ b/tests/test-string-input-visitor.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "qapi/error.h" diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c index 1ecd75b853..edff5235fe 100644 --- a/tests/test-string-output-visitor.c +++ b/tests/test-string-output-visitor.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "qapi/error.h" diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c index 88dc7316b3..b0e1f3290f 100644 --- a/tests/test-thread-pool.c +++ b/tests/test-thread-pool.c @@ -1,5 +1,4 @@ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "block/aio.h" #include "block/thread-pool.h" diff --git a/tests/test-throttle.c b/tests/test-throttle.c index d584870950..afe094bcc4 100644 --- a/tests/test-throttle.c +++ b/tests/test-throttle.c @@ -13,7 +13,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include <math.h> #include "block/aio.h" #include "qapi/error.h" diff --git a/tests/test-timed-average.c b/tests/test-timed-average.c index 1cc4ab3027..e2bcf5fe13 100644 --- a/tests/test-timed-average.c +++ b/tests/test-timed-average.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu/timed-average.h" diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c index 7b14b5a7af..777469f114 100644 --- a/tests/test-visitor-serialization.c +++ b/tests/test-visitor-serialization.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include <float.h> #include "qemu-common.h" diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index d19b16a60e..41fd841aed 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -23,7 +23,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "migration/migration.h" diff --git a/tests/test-write-threshold.c b/tests/test-write-threshold.c index fdbc8020fd..97ca12f710 100644 --- a/tests/test-write-threshold.c +++ b/tests/test-write-threshold.c @@ -7,7 +7,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "block/block_int.h" #include "block/write-threshold.h" diff --git a/tests/test-x86-cpuid.c b/tests/test-x86-cpuid.c index 8eb0bc6ad5..ff225006e4 100644 --- a/tests/test-x86-cpuid.c +++ b/tests/test-x86-cpuid.c @@ -23,7 +23,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "hw/i386/topology.h" diff --git a/tests/tmp105-test.c b/tests/tmp105-test.c index 235cae0137..a7940a4639 100644 --- a/tests/tmp105-test.c +++ b/tests/tmp105-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/i2c.h" diff --git a/tests/tpci200-test.c b/tests/tpci200-test.c index cb2b00ca8b..0321ec27ec 100644 --- a/tests/tpci200-test.c +++ b/tests/tpci200-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/usb-hcd-ehci-test.c b/tests/usb-hcd-ehci-test.c index a0f13ef40a..eb247ad453 100644 --- a/tests/usb-hcd-ehci-test.c +++ b/tests/usb-hcd-ehci-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/pci-pc.h" #include "hw/usb/uhci-regs.h" diff --git a/tests/usb-hcd-ohci-test.c b/tests/usb-hcd-ohci-test.c index efd6669c7c..4758813d78 100644 --- a/tests/usb-hcd-ohci-test.c +++ b/tests/usb-hcd-ohci-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/usb.h" diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c index 71ff2ea189..5cd59ad91f 100644 --- a/tests/usb-hcd-uhci-test.c +++ b/tests/usb-hcd-uhci-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/usb.h" #include "hw/usb/uhci-regs.h" diff --git a/tests/usb-hcd-xhci-test.c b/tests/usb-hcd-xhci-test.c index 7e2e212df3..22513e9eb5 100644 --- a/tests/usb-hcd-xhci-test.c +++ b/tests/usb-hcd-xhci-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/usb.h" diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 69615968ce..2724fe9755 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -9,7 +9,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "qemu/option.h" diff --git a/tests/virtio-9p-test.c b/tests/virtio-9p-test.c index 59d0f1fa9b..1e39335a79 100644 --- a/tests/virtio-9p-test.c +++ b/tests/virtio-9p-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "qemu-common.h" diff --git a/tests/virtio-balloon-test.c b/tests/virtio-balloon-test.c index b010ce98e8..0d0046bf25 100644 --- a/tests/virtio-balloon-test.c +++ b/tests/virtio-balloon-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c index 3a66630d79..8272ba8c42 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -9,7 +9,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/virtio.h" #include "libqos/virtio-pci.h" diff --git a/tests/virtio-console-test.c b/tests/virtio-console-test.c index 0b9c2a55ef..6d6414dc8e 100644 --- a/tests/virtio-console-test.c +++ b/tests/virtio-console-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c index 04cfcd594e..e5c144818e 100644 --- a/tests/virtio-net-test.c +++ b/tests/virtio-net-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "qemu-common.h" #include "qemu/sockets.h" diff --git a/tests/virtio-rng-test.c b/tests/virtio-rng-test.c index 771dbd73af..e1b26401f9 100644 --- a/tests/virtio-rng-test.c +++ b/tests/virtio-rng-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "libqos/pci.h" diff --git a/tests/virtio-scsi-test.c b/tests/virtio-scsi-test.c index d78747a466..5f1a8aefeb 100644 --- a/tests/virtio-scsi-test.c +++ b/tests/virtio-scsi-test.c @@ -9,7 +9,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "block/scsi.h" #include "libqos/virtio.h" diff --git a/tests/virtio-serial-test.c b/tests/virtio-serial-test.c index 480d4abb2d..b14d943ada 100644 --- a/tests/virtio-serial-test.c +++ b/tests/virtio-serial-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/vmxnet3-test.c b/tests/vmxnet3-test.c index 6ef0e2f043..159c0ad728 100644 --- a/tests/vmxnet3-test.c +++ b/tests/vmxnet3-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" /* Tests only initialization so far. TODO: Replace with functional tests */ diff --git a/tests/wdt_ib700-test.c b/tests/wdt_ib700-test.c index efe3370453..9c1d78b1bc 100644 --- a/tests/wdt_ib700-test.c +++ b/tests/wdt_ib700-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "libqtest.h" #include "qemu/timer.h" @@ -273,37 +273,36 @@ const argtype *thunk_convert(void *dst, const void *src, /* from em86 */ /* Utility function: Table-driven functions to translate bitmasks - * between X86 and Alpha formats... + * between host and target formats */ -unsigned int target_to_host_bitmask(unsigned int x86_mask, +unsigned int target_to_host_bitmask(unsigned int target_mask, const bitmask_transtbl * trans_tbl) { const bitmask_transtbl *btp; - unsigned int alpha_mask = 0; + unsigned int host_mask = 0; - for(btp = trans_tbl; btp->x86_mask && btp->alpha_mask; btp++) { - if((x86_mask & btp->x86_mask) == btp->x86_bits) { - alpha_mask |= btp->alpha_bits; - } + for (btp = trans_tbl; btp->target_mask && btp->host_mask; btp++) { + if ((target_mask & btp->target_mask) == btp->target_bits) { + host_mask |= btp->host_bits; + } } - return(alpha_mask); + return host_mask; } -unsigned int host_to_target_bitmask(unsigned int alpha_mask, +unsigned int host_to_target_bitmask(unsigned int host_mask, const bitmask_transtbl * trans_tbl) { const bitmask_transtbl *btp; - unsigned int x86_mask = 0; + unsigned int target_mask = 0; - for(btp = trans_tbl; btp->x86_mask && btp->alpha_mask; btp++) { - if((alpha_mask & btp->alpha_mask) == btp->alpha_bits) { - x86_mask |= btp->x86_bits; - } + for (btp = trans_tbl; btp->target_mask && btp->host_mask; btp++) { + if ((host_mask & btp->host_mask) == btp->host_bits) { + target_mask |= btp->target_bits; + } } - return(x86_mask); + return target_mask; } -#ifndef NO_THUNK_TYPE_SIZE int thunk_type_size_array(const argtype *type_ptr, int is_host) { return thunk_type_size(type_ptr, is_host); @@ -313,7 +312,6 @@ int thunk_type_align_array(const argtype *type_ptr, int is_host) { return thunk_type_align(type_ptr, is_host); } -#endif /* ndef NO_THUNK_TYPE_SIZE */ void thunk_init(unsigned int max_structs) { diff --git a/ui/sdl_zoom.c b/ui/sdl_zoom.c index 72622c2647..b96196bac5 100644 --- a/ui/sdl_zoom.c +++ b/ui/sdl_zoom.c @@ -13,7 +13,6 @@ #include "qemu/osdep.h" #include "sdl_zoom.h" -#include <glib.h> static void sdl_zoom_rgb16(SDL_Surface *src, SDL_Surface *dst, int smooth, SDL_Rect *dst_rect); diff --git a/ui/spice-display.c b/ui/spice-display.c index 0553c5e5b0..34095fbc8c 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -197,7 +197,7 @@ static void qemu_spice_create_one_update(SimpleSpiceDisplay *ssd, static void qemu_spice_create_update(SimpleSpiceDisplay *ssd) { static const int blksize = 32; - int blocks = (surface_width(ssd->ds) + blksize - 1) / blksize; + int blocks = DIV_ROUND_UP(surface_width(ssd->ds), blksize); int dirty_top[blocks]; int y, yoff1, yoff2, x, xoff, blk, bw; int bpp = surface_bytes_per_pixel(ssd->ds); diff --git a/ui/vnc-palette.c b/ui/vnc-palette.c index 3b89d1af25..dc7c0ba997 100644 --- a/ui/vnc-palette.c +++ b/ui/vnc-palette.c @@ -28,7 +28,6 @@ #include "qemu/osdep.h" #include "vnc-palette.h" -#include <glib.h> static VncPaletteEntry *palette_find(const VncPalette *palette, uint32_t color, unsigned int hash) diff --git a/util/coroutine-gthread.c b/util/coroutine-gthread.c index fb697eb0b7..62bfb4015d 100644 --- a/util/coroutine-gthread.c +++ b/util/coroutine-gthread.c @@ -19,7 +19,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu-common.h" #include "qemu/coroutine_int.h" diff --git a/util/hbitmap.c b/util/hbitmap.c index b22b87d0a6..7121b11c01 100644 --- a/util/hbitmap.c +++ b/util/hbitmap.c @@ -10,7 +10,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu/hbitmap.h" #include "qemu/host-utils.h" #include "trace.h" diff --git a/util/memfd.c b/util/memfd.c index 7c406914c5..b374238a59 100644 --- a/util/memfd.c +++ b/util/memfd.c @@ -27,7 +27,6 @@ #include "qemu/osdep.h" -#include <glib.h> #include <glib/gprintf.h> #include <sys/mman.h> diff --git a/util/oslib-win32.c b/util/oslib-win32.c index c926db4a5c..6debc2b8a6 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -31,7 +31,6 @@ */ #include "qemu/osdep.h" #include <windows.h> -#include <glib.h> #include "qapi/error.h" #include "sysemu/sysemu.h" #include "qemu/main-loop.h" diff --git a/util/uri.c b/util/uri.c index d109d6c01d..70a9cbcbd2 100644 --- a/util/uri.c +++ b/util/uri.c @@ -52,7 +52,6 @@ */ #include "qemu/osdep.h" -#include <glib.h> #include "qemu/uri.h" @@ -51,7 +51,6 @@ int main(int argc, char **argv) #define main qemu_main #endif /* CONFIG_COCOA */ -#include <glib.h> #include "qemu/error-report.h" #include "qemu/sockets.h" @@ -567,7 +567,7 @@ static void xen_sync_dirty_bitmap(XenIOState *state, { hwaddr npages = size >> TARGET_PAGE_BITS; const int width = sizeof(unsigned long) * 8; - unsigned long bitmap[(npages + width - 1) / width]; + unsigned long bitmap[DIV_ROUND_UP(npages, width)]; int rc, i, j; const XenPhysmap *physmap = NULL; |