Commit Graph

33395 Commits

Author SHA1 Message Date
Chunyan Liu
8559e45e51 QemuOpts: add conversion between QEMUOptionParameter to QemuOpts
Add two temp conversion functions between QEMUOptionParameter to QemuOpts,
so that next patch can use it. It will simplify later patch for easier
review. And will be finally removed after all backend drivers switch to
QemuOpts.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Leandro Dorileo <l@dorileo.org>
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:20 +08:00
Chunyan Liu
504189a96f QemuOpts: add qemu_opts_print_help to replace print_option_help
print_option_help takes QEMUOptionParameter as parameter, add
qemu_opts_print_help to take QemuOptsList as parameter for later
replace work.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Leandro Dorileo <l@dorileo.org>
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:20 +08:00
Chunyan Liu
782730b0bc QemuOpts: add qemu_opt_get_*_del functions for replace work
Add qemu_opt_get_del, qemu_opt_get_bool_del, qemu_opt_get_number_del and
qemu_opt_get_size_del to replace the same handling of QEMUOptionParameter
(get and delete).

Several drivers are coded to parse a known subset of options, then
remove them from the list before handing all remaining options to a
second driver for further option processing.  get_*_del makes it easier
to retrieve a known option (or its default) and remove it from the list
all in one action.

Share common helper function:

For qemu_opt_get_bool/size/number, they and their get_*_del counterpart
could share most of the code except whether or not deleting the opt from
option list, so generate common helper functions.

For qemu_opt_get and qemu_opt_get_del, keep code duplication, since
1. qemu_opt_get_del returns malloc'd memory while qemu_opt_get returns
in-place memory
2. qemu_opt_get_del returns (char *), qemu_opt_get returns (const char *),
and could not change to (char *), since in one case, it will return
desc->def_value_str, which is (const char *).

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:20 +08:00
Chunyan Liu
fc345512c5 QemuOpts: move qemu_opt_del ahead for later calling
In later patch, qemu_opt_get_del functions will be added, they will
first get the option value, then call qemu_opt_del to remove the option
from opt list. To prepare for that purpose, move qemu_opt_del ahead first.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Leandro Dorileo <l@dorileo.org>
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:20 +08:00
Chunyan Liu
dc8622f2bf QemuOpts: change opt->name|str from (const char *) to (char *)
qemu_opt_del() already assumes that all QemuOpt instances contain
malloc'd name and value; but it had to cast away const because
opts_start_struct() was doing its own thing and using static storage
instead.  By using the correct type and malloced strings everywhere, the
usage of this struct becomes clearer.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Leandro Dorileo <l@dorileo.org>
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:20 +08:00
Chunyan Liu
e36af94f86 qapi: output def_value_str when query command line options
Change qapi interfaces to output the newly added def_value_str when querying
command line options.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Leandro Dorileo <l@dorileo.org>
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:20 +08:00
Chunyan Liu
09722032e1 QemuOpts: add def_value_str to QemuOptDesc
Add def_value_str (default value) to QemuOptDesc, to replace function of the
default value in QEMUOptionParameter.

Improve qemu_opts_get_* functions: if find opt, return opt->str; otherwise,
if desc->def_value_str is set, return desc->def_value_str; otherwise, return
input defval.

Improve qemu_opts_print: if option is set, print opt->str; otherwise, if
desc->def_value_str is set, print it.

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:20 +08:00
Chunyan Liu
e67905426b QemuOpts: repurpose qemu_opts_print to replace print_option_parameters
Currently this function is not used anywhere. In later patches, it will
replace print_option_parameters. To avoid print info changes, change
qemu_opts_print from fprintf stderr to printf, and remove last printf.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:19 +08:00
Chunyan Liu
5e89db7641 QemuOpts: move find_desc_by_name ahead for later calling
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:19 +08:00
Peter Lieven
a2c0fe2fd2 block/nfs: fix potential segfault on early callback
it will happen in the future that the callback of a libnfs call
directly invokes the callback. In this case we end up in a segfault
because the NFSRPC is gone when we the BH is scheduled.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:19 +08:00
Markus Armbruster
ae60e8e378 blockdev: Remove unused DriveInfo reference count
It's always one since commit fa510eb dropped the last drive_get_ref().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:19 +08:00
Markus Armbruster
60e19e06a4 blockdev: Rename drive_init(), drive_uninit() to drive_new(), drive_del()
"Init" and "uninit" suggest the functions don't allocate / free
storage.  But they do.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:19 +08:00
Kevin Wolf
bcf8315857 blockdev: Move 'serial' option to drive_init()
It is not available with blockdev-add.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:19 +08:00
Markus Armbruster
f7047c2daf block: Drop superfluous conditionals around g_free()
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:19 +08:00
Stefan Weil
b25c9dff35 configure: Enable dead code (lzo, snappy, quorum)
Those options were not enabled by default, even when the build
environment would have supported them, so the corresponding
code was not compiled in normal test builds like on build bots.

[Building quorum by default "broke" qemu-iotests ./check 081.  It turns
out the 081.out master output was just bitrotted.  Fix this by updating
the error message.
--Stefan]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-16 17:23:19 +08:00
Peter Maydell
06a59afac4 usb-host: add range checks for usb-host parameters
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTmuFxAAoJEEy22O7T6HE4bL4QAKhDYyRgvyeRXbby2pahn0ZH
 H+Fjy3Fz0q0p1oV7n1RmOt2+ktcjJQ9jCq2kd6DYY2GMNXp9oP1cKsFSQGktqb3U
 hKHBKt16qCOqxg1i6uRK+XAzH/C60xqKXRf27n9FsoJVoN30vn+WlQ86T1p5oYav
 XaGo3JyaXkXvjT8LZrXYSF+5IZSLW6CHULissweUFDek4CUACF/QwMPzKp8BU7j/
 fDeLpHT17pkQsVVud7TB67J7TM9b/y0E5FDJmUR2YlT/e2IhqL3vw3+QCyUARObk
 +0DkZv7uN9D/s6HBspLuXW69aTYaxje4GhBDX6TgNpprgWdgyCxquw7mktphW6Cv
 oF1kYKjn12gLxpnEO+hlP9I35e/P3dfsysBv4oKi6OmkNVjDPKSBnEBmMyu1HzJN
 I7RK/d6Dq3rS2yojeY7bEUCZQ7xOQWDUnN5mCgl3WoFm8KWazwS9sB4PHBI67KAc
 vJb3SSXI6sVeug11JxBBxJq/Ckm6E/GhGdSOy/RXdCXIwOgEB5Bts/hVgp6HKBG7
 wOZkiEQpJY7BlLxtL4twS1ub/L9MbWV1N4QG+/Ge415BNsEy6GayUyGLs8d9S9/u
 XMuLfvh/K6MTymrqmVX5kLjPWqM7bEhkQTRvhtSYRm6H0AMDncHCz+K07tFFEUkI
 B0JWCNLM9e2eCLQDh3lR
 =77e6
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20140613-1' into staging

usb-host: add range checks for usb-host parameters

# gpg: Signature made Fri 13 Jun 2014 12:33:05 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-usb-20140613-1:
  usb-host: add range checks for usb-host parameters

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-13 18:18:55 +01:00
Peter Maydell
80008a6a29 inet_listen_opts: add error checking
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTmuCnAAoJEEy22O7T6HE4FUwP/18ASPkBFPIipJYuZ/qu3tO8
 4gKf1Rdpg5UxD9yPXGVy/BRlr0ggQr3/0AJoEgs7vqRi8QSI9FO6ZnkjcAo8BHhW
 goTUY20u3evoyw6V83ZSTOSEUnSO7auagRP5VmfXI37NKVQ3xVz+0Ot6NOZNfpCy
 x+yGaUfl5jDbYjoFBlcEr8OwsyOEzEq+JjzMZ8JAbzM54IoSPtkiZMHkqImY+YYZ
 RkLKoJDKc8lWorjmJTbfql8KdBV4Jo+dUCEOqKSQKZd49Xb2gecXtZMfN//0Odo0
 eDWgg5lQU1gFaV7dLoGQ4QIMdqThdtKAnIx7lIEowPOnSnlRCHRZv+TxHGAJzqIk
 0ndsNNKrmhnLmpXM019f5DJmCLcJ+00lJ3+QM/sMiKBYMW2/bRg6dTTlEdng3bEl
 TSi+dI8h2X29h9/yku7GCqsbxU2vpMMWS00NP8GfzwnMDiKhCH3MdV9o52kImEnL
 l6TgVWRedizfd0SC9dh3GqqxoYXlB2kf0qb9DkQbLVo7srOvGLOwKJBzl3Ggj8qi
 NsTMJPSYcLqUH5ysO86SUDwxfbIrUjyxiOXIFgD/Kkda55gRXo5EzRF7KMf3sT11
 IBcNBZ1/SQkoumglb3iSwox9DhdYxRDx9pbYAbAW3JvFFY4unZ+X27LaaG/bnGTA
 w0URswRN9LF09aq9ZtbN
 =EyoP
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-trivial-20140613-1' into staging

inet_listen_opts: add error checking

# gpg: Signature made Fri 13 Jun 2014 12:29:43 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-trivial-20140613-1:
  inet_listen_opts: add error checking

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-13 16:07:04 +01:00
Peter Maydell
592fb17691 spice: add mouse cursor support
qxl-render: add sanity check
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTmt8FAAoJEEy22O7T6HE4Ib0P/27T8x8pqrz1deIx+9Bsgrmb
 94/qXM137T/WUjqpFL9WJgyqTENtNcW7HXbW/W3SI7yazTso4kCT85Qav5rwKqjt
 n7NNtwtoxBMz9jYfl6HuDgIUaPGHBxS/DtLzFyHICIYoF/LSj5dXKUvRvEYdvr/M
 7qIYvJU71Ck540tYvZ+qUj6/cCHS4IDArBndpMuiWY8c/CQXwAsSKVOnBtdzm3V6
 GPEPBT3+OaEFMqDBBlGMV6aDsCm7cpYCiqMGrYf6x64SZ4/JC2HhopS3VPTJR1Zg
 ugCb4x6GmkIHa/dE+45T1EZ6BFjgh2YuRnrIE7xold1i2FcajnBlDLMtcrh6rSOz
 f1PBL/KJW5RlhdRabFB8w6kuWAP9VPYDqT4ELGb5J373QN0ChtdYD5ZbvzukEMpq
 vRBaesuKFK1uyCkQ8xWZ938WTWZf21dliIeva+li+PE94a4SrdxAVsTEeGhfA5B4
 tAE6Gg26EEgBEAf8FZdaJCf+17LxuVGm83bqCumhn2WT1SOmv+RZivbbxlsAmWDl
 3IF2pHacGxbpGcUxDRdvIzoSsKwLeazbUvLXEoaKsEDGFqLeorXwhpmvelsE+xbN
 011JEwTGdMWxYbxPWKTmAymS5PX5JT6BQudZ7XUlU/n8VQWMHZTpgSwHJfonXEaf
 1wkY5iTie95D+n/Jd2yi
 =N8b6
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20140613-1' into staging

spice: add mouse cursor support
qxl-render: add sanity check

# gpg: Signature made Fri 13 Jun 2014 12:22:45 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/spice/tags/pull-spice-20140613-1:
  qxl-render: add sanity check
  spice: add mouse cursor support

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-13 15:15:31 +01:00
Peter Maydell
7d5bef0873 char: fix avail_connections init in qemu_chr_open_eventfd()
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTmt2iAAoJEEy22O7T6HE4SAsQANwqoKl0Eg2P75LDvm5qQjev
 ItJb2IeY0loTGOLcIYfseBR7W+GFPcoKwjR4BQTzL5poBX3MqdIzBx+7NhG/iMJ/
 lGEsDQ/ia1zmOyvL+Z7CZCYS0rsJT1k/lHeETv5UuE8HjKuGhgvUTq/ypbtKv65A
 rIGvXt8PadDtzrLSkTNuqLtv+Cq2fWnDHefCqJlWVAgFKEiE65y6gvf1XdPOdkK6
 Q2L7+r1obMQlT3aEtNT1heduDjtQEc8RNo+fvXTaM7w4kGlWKDX0oHC3IgzFCwHK
 EH12YnLj1mmERP/62x+tAwMh01TcwQsyoS0F9RGthkx/rF0QI3D1hzpAkfkPfuF2
 YllFH60VGaW0qes8HxclnNPBZNJuPyFm/AINm9d4aWL/i6k9lGh80OGmyLK5gPHp
 zJsiQiNIHuY5LHqbifU37UpCyvBkLze2JDkbLKejyFLA4NhwiocbllioWTiYIbOj
 M+jjoJgX3eDs5gHCK0F0ScuTixvMAOCz+juGiUuCAcTMUW3ApQFWqadwaEm+ncMQ
 qsL2as8Q//WlAuqmlr/nYldM6VJhKhBkSSjNYfo/rhuPNy9Z+ie/adFk8j3+SuTs
 fiquMB7oaffqAMiJsNSfefO/3xLWAnMUhxCj2sXH3ZpS+Iv39Sxwv0kwV7aSFS28
 tMDuW7eyl+ci7q2B6kkI
 =AybP
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-chardev-20140613-1' into staging

char: fix avail_connections init in qemu_chr_open_eventfd()

# gpg: Signature made Fri 13 Jun 2014 12:16:50 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-chardev-20140613-1:
  char: fix avail_connections init in qemu_chr_open_eventfd()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-13 14:57:56 +01:00
Peter Maydell
d61de7255b audio: Drop superfluous conditionals around g_free()
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTmt0QAAoJEEy22O7T6HE4iI0QAJ0uJitRGMLnmdhz9qn2txz4
 hK39NdNnKH9Mcna1CD6xfunVA87pKUZt1GoweDQ4y/spKC/W/wlcfxqhL+E3LNTJ
 OODQ1pCBGvR3rMpZWfXmcBzAWErvqHzfGI3nsAcixfT4I4fxs//EzJR8tw9IVXvG
 rA7mnW2S492iqbeGvrhBbbono5KIGz4OhB0gM+Eb3lrzJYsD4LOC0BreitORkNaW
 BqWTj0y0YcDQh62rX8UtooSy6Bht8x8wiexzrjZI0Ch0FA8XRfqwz9p7GNdMlQLC
 D/up3cO8fIhE/ksvWgtywV0pxhO8srXTl5RW2Ygi3tlZCAHCdgnte+TwnYi4ntJU
 7l4piCQ57KCa5hZNg7lyHPmU/WL4QuuGFQcP/narHlYJu2AYdnLbz/M5RiqP2R4Q
 fsALZNR9dlgl0tfGof9WdkMNCI+o14x2Y5P/7H+eLx1wZD1QerTwbGVofayUY54N
 1SJIli17bnzi0g98mlTJp+4ydW/IT9QcRdlm14trizCdaibvU9u6ZkRLSKA7HPDL
 a8J2jq/RNUwppQqrOMh2opRmtfIb2mH9lX29XsaZ6PYxdcimwRHQ4idH4WjY577m
 9D8v44ANlBsWzNdmrwGK+Kb1Ny4wuTXpYLgmNJ+7O/N4PhT0A5zKVpbRKdkZE1+c
 uQ7SsAHxV3Q8l+oPFBkh
 =HaqS
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-audio-20140613-1' into staging

audio: Drop superfluous conditionals around g_free()

# gpg: Signature made Fri 13 Jun 2014 12:14:24 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-audio-20140613-1:
  audio: Drop superfluous conditionals around g_free()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-13 12:58:24 +01:00
Gerd Hoffmann
f3cda6e060 usb-host: add range checks for usb-host parameters
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-13 12:34:57 +02:00
Gerd Hoffmann
8bc8912796 inet_listen_opts: add error checking
Don't use atoi() function which doesn't detect errors, switch to
strtol and error out on failures.  Also add a range check while
being at it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
2014-06-13 12:34:57 +02:00
Gerd Hoffmann
788fbf042f qxl-render: add sanity check
Verify dirty rectangle is completely within the primary surface,
just ignore it in case it isn't.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-13 12:34:57 +02:00
Gerd Hoffmann
5643fc012c spice: add mouse cursor support
So you'll have a mouse pointer when running non-qxl gfx cards with
mouse pointer support (virtio-gpu, IIRC vmware too).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-13 12:34:57 +02:00
David Marchand
e9d21c436f char: fix avail_connections init in qemu_chr_open_eventfd()
When trying to use a ivshmem server with qemu, ivshmem init code tries to
create a CharDriverState object for each eventfd retrieved from the server.
To create this object, a call to qemu_chr_open_eventfd() is done.
Right after this, before adding a frontend, qemu_chr_fe_claim_no_fail() is
called.
qemu_chr_open_eventfd() does not set avail_connections to 1, so no frontend can
be associated because qemu_chr_fe_claim_no_fail() makes qemu stop right away.

This problem comes from 456d606923
"qemu-char: Call fe_claim / fe_release when not using qdev chr properties".

Fix this, by setting avail_connections to 1 in qemu_chr_open_eventfd().

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-13 12:34:55 +02:00
Markus Armbruster
fb7da626c0 audio: Drop superfluous conditionals around g_free()
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-13 12:34:54 +02:00
Peter Maydell
2a2c4830c0 gtk: misc fixes & cleanups.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTmEtcAAoJEEy22O7T6HE4OigP/3/H6WBaVbhvo59lmuGkaVtf
 7xdxAi+8d/d6gd/X0UGyip98+vjdzYd1BDuAc5GfDzMAJCccu03TQwJT6PqbRitb
 XJt6r69Brd1Epx81xxzkQK/OPmTqlpjlMWL3KcLZHFyyhAijFhVpTbttxEgXfU3G
 Sg5W/TShsNN+dt0W3SXRQ7VLmoiZbvD5dsL4RkYQyWiHZllG1FTywsSbJQaAACRa
 LSRH1QasYq0ah+e7sRYTNcMDAy9Z7oQHbyjuk2C7F6nfwE1662lw6JCE4dFGa4Mp
 YklkGzRnAgD+D7Beu70fNt1SwFe+NxbTN4doV9qpEhcyMnpvftIEjRhN15oc+leM
 fgJQvjGByL/mSZ3vumYx00NIv+GciCGQaG936YC83LSEjRr6VBxCqait0qL9jwhS
 pg3AtZiAyHgoD7dOY1lyxu3eSFNevU88w7WbaWajydBbj5bqlJIDsFE2krebo6rv
 J2pbleiEsZgt2eyF9rZguDUawDvjwHFv8x0YFB/p1Pk+R+bCEQvaqRFGJPiisv7N
 84EugPSvVSxm1/C1mc5ZQBXLcWctDIWhCfHVWgw9hy9X36/RUvCvMzuit1ESY1JA
 0+9wuNfSnG1CThOqFTGzd1Md8A0doSHUcUIcIaF9XmDsl08IoGA1G9V8lGsE5biO
 Z6cMRsqnzUtXuHD5Paun
 =mLkk
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20140611-1' into staging

gtk: misc fixes & cleanups.

# gpg: Signature made Wed 11 Jun 2014 13:28:12 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-gtk-20140611-1:
  gtk: update window size after showing/hiding tabs
  gtk: factor out gtk3 grab into the new gd_grab_devices function
  gtk: cleanup backend dependencies
  gtk: factor out keycode mapping

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-12 09:51:41 +01:00
Peter Maydell
05fedeef83 Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
* remotes/qmp-unstable/queue/qmp:
  json-parser: drop superfluous assignment for token variable
  readline: Clear screen on form feed.
  monitor: Add delvm and loadvm argument completion
  monitor: Add host_net_remove arguments completion
  readline: Make completion strings always unique
  monitor: Add host_net_add device argument completion
  net: Export valid host network devices list
  monitor: Add migrate_set_capability completion
  monitor: Add watchdog_action argument completion
  monitor: Add ringbuf_write and ringbuf_read argument completion
  dump: simplify get_len_buf_out()
  dump: hoist lzo_init() from get_len_buf_out() to dump_init()
  dump: select header bitness based on ELF class, not ELF architecture
  dump: eliminate DumpState.page_size ("guest's page size")
  dump: eliminate DumpState.page_shift ("guest's page shift")
  dump: simplify write_start_flat_header()
  dump: fill in the flat header signature more pleasingly to the eye

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-11 21:34:08 +01:00
Peter Maydell
706808585a bsd-user queue:
* build fixes
  * improvements to strace
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABCAAGBQJTmGZsAAoJEDwlJe0UNgzeW8cQAJlCKVtlfTJD+EFdHP7vbs/z
 1qYoWWGAg3fT81lfJ7Dg1JjwFEzHAGmKLIAZLrmLt6MhxrWQEGYPMSW6TUZJhY2v
 JTPJdxoItUn1D0+yw0NX8Y8Cmx7v2rDz7mAxsyvzjmBYv7Nor6j7iff8rAj+5VlU
 38c4VepWsuD/0hYcu9x+jgF2dMXp5YLWEdzBffbhIHefd3eLYE6SPIM1U7hlBeUN
 iyO9D+/teN61i0fF+Cmgt+pYH9OZjsr+Ood35EhOb4PjYh/nhlY7VJ0dVKtOZnS8
 2yJUi3D2Xg/9teb4d0I3dtc4KcSzNRTOBChBimXtUGI+baKpQjey3kVb+aqt/tGQ
 3eIKB3A7F/GJKhadJu0YtDKok8fq3n6o28NXyQIhLu/EZdBYoEUNLNPC6O1aMcqm
 5d6PLYMz1SHHHFLCxR8KImj98aqjLBlf7JL/5NbaYsTf/lLKOwNjGpIYNZyB8I+1
 Wi7zVhdLNXJSwRBRLL+OBD/21nZCAzkDVjx5/27XIWNzTV4LyM/Srq3T6ZLkhWa6
 lFJDsnBQYmspAyNhIZj3Y0c9/WLkxC+17eby75TAK87EFv3TLCUIHsOvvsVSWnBV
 HoD3STxCqYadk4ZXmaWv/9Bo2OEvn/Oh77+SJlWdyXQogelZcVuGP5vjs1SxMzMy
 uILFn94Dc+3tmnezU0zM
 =yKuf
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-bsd-user-20140611' into staging

bsd-user queue:
 * build fixes
 * improvements to strace

# gpg: Signature made Wed 11 Jun 2014 15:23:40 BST using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"

* remotes/pmaydell/tags/pull-bsd-user-20140611:
  bsd-user: Fix syscall format, add strace support for more syscalls
  bsd-user: Implement strace support for thr_* syscalls
  bsd-user: Implement strace support for extattr_* syscalls
  bsd-user: Implement strace support for __acl_* syscalls
  bsd-user: Implement strace support for print_ioctl syscall
  bsd-user: Implement strace support for print_sysctl syscall
  bsd-user: GPL v2 attribution update and style
  bsd-user: add HOST_VARIANT_DIR for various *BSD dependent code
  exec: replace ffsl with ctzl
  vhost: replace ffsl with ctzl
  xen: replace ffsl with ctzl
  util/qemu-openpty: fix build with musl libc by include termios.h as fallback
  bsd-user/mmap.c: Don't try to override g_malloc/g_free
  util/hbitmap.c: Use ctpopl rather than reimplementing a local equivalent
  bsd-user: refresh freebsd system call numbers

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-11 18:05:21 +01:00
Peter Maydell
c5cb1afc46 Merge remote-tracking branch 'remotes/bonzini/configure' into staging
* remotes/bonzini/configure:
  rules.mak: Rewrite unnest-vars
  configure: unset interfering variables
  configure: duplicate/incorrect order of -lrt
  libcacard: improve documentation
  libcacard: actually use symbols file
  libcacard: replace qemu thread primitives with glib ones
  vscclient: use glib thread primitives not qemu
  glib-compat.h: add new thread API emulation on top of pre-2.31 API

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-11 15:36:48 +01:00
Gonglei
a491af471b json-parser: drop superfluous assignment for token variable
Signed-off-by: ChenLiang <chenliang88@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:29 -04:00
Hani Benhabiles
075ccb6cd3 readline: Clear screen on form feed.
Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:29 -04:00
Hani Benhabiles
b21631f3b5 monitor: Add delvm and loadvm argument completion
Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:29 -04:00
Hani Benhabiles
ddd6b45ce2 monitor: Add host_net_remove arguments completion
Relies on readline unique completion strings patch to make the added vlan/hub
completion values unique, instead of using something like a hash table.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:29 -04:00
Hani Benhabiles
e70871d8b5 readline: Make completion strings always unique
There is no need to clutter the user's choices with repeating the same value
multiple times.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:29 -04:00
Hani Benhabiles
e3bb532cc7 monitor: Add host_net_add device argument completion
Also fix the parameters documentation.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:29 -04:00
Hani Benhabiles
84007e8181 net: Export valid host network devices list
Signed-off-by: Hani Benhabiles <hani@linux.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:29 -04:00
Hani Benhabiles
c68a0409b3 monitor: Add migrate_set_capability completion
Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:29 -04:00
Hani Benhabiles
d0ece345cb monitor: Add watchdog_action argument completion
Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:28 -04:00
Hani Benhabiles
8e5977797d monitor: Add ringbuf_write and ringbuf_read argument completion
Export chr_is_ringbuf() function. Also remove left-over function prototypes
while at it.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:28 -04:00
Laszlo Ersek
b87ef3518b dump: simplify get_len_buf_out()
We can (and should) rely on the fact that s->flag_compress is exactly one
of DUMP_DH_COMPRESSED_ZLIB, DUMP_DH_COMPRESSED_LZO, and
DUMP_DH_COMPRESSED_SNAPPY.

This is ensured by the QMP schema and dump_init() in combination.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:28 -04:00
Laszlo Ersek
c998acb03d dump: hoist lzo_init() from get_len_buf_out() to dump_init()
qmp_dump_guest_memory()
  dump_init()
    lzo_init() <---------+
  create_kdump_vmcore()  |
    write_dump_pages()   |
      get_len_buf_out()  |
        lzo_init() ------+

This patch doesn't change the fact that lzo_init() is called for every
LZO-compressed dump, but it makes get_len_buf_out() more focused (single
responsibility).

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:28 -04:00
Laszlo Ersek
24aeeace7a dump: select header bitness based on ELF class, not ELF architecture
The specific ELF architecture (d_machine) carries Too Much Information
(TM) for deciding between create_header32() and create_header64(), use
"d_class" instead (ELFCLASS32 vs. ELFCLASS64).

This change adapts write_dump_header() to write_elf_loads(), dump_begin()
etc. that also rely on the ELF class of the target for bitness selection.

Considering the current targets that support dumping, cpu_get_dump_info()
works as follows:
- target-s390x/arch_dump.c: (EM_S390, ELFCLASS64) only
- target-ppc/arch_dump.c (EM_PPC64, ELFCLASS64) only
- target-i386/arch_dump.c: sets (EM_X86_64, ELFCLASS64) vs. (EM_386,
  ELFCLASS32) keying off the same Long Mode Active flag.

Hence no observable change.

Approximately-suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:28 -04:00
Laszlo Ersek
2f859f80c2 dump: eliminate DumpState.page_size ("guest's page size")
Use TARGET_PAGE_SIZE and ~TARGET_PAGE_MASK instead.

"DumpState.page_size" has type "size_t", whereas TARGET_PAGE_SIZE has type
"int". TARGET_PAGE_MASK is of type "int" and has negative value. The patch
affects the implicit type conversions as follows:

- create_header32() and create_header64(): assigned to "block_size", which
  has type "uint32_t". No change.

- get_next_page(): "block->target_start", "block->target_end" and "addr"
  have type "hwaddr" (uint64_t).

  Before the patch,
  - if "size_t" was "uint64_t", then no additional conversion was done as
    part of the usual arithmetic conversions,
  - If "size_t" was "uint32_t", then it was widened to uint64_t as part of
    the usual arithmetic conversions,
  for the remainder and addition operators.

  After the patch,
  - "~TARGET_PAGE_MASK" expands to  ~~((1 << TARGET_PAGE_BITS) - 1). It
    has type "int" and positive value (only least significant bits set).
    That's converted (widened) to "uint64_t" for the bit-ands. No visible
    change.
  - The same holds for the (addr + TARGET_PAGE_SIZE) addition.

- write_dump_pages():
  - TARGET_PAGE_SIZE passed as argument to a bunch of functions that all
    have prototypes. No change.

  - When incrementing "offset_data" (of type "off_t"): given that we never
    build for ILP32_OFF32 (see "-D_FILE_OFFSET_BITS=64" in configure),
    "off_t" is always "int64_t", and we only need to consider:
    - ILP32_OFFBIG: "size_t" is "uint32_t".
      - before: int64_t += uint32_t. Page size converted to int64_t for
        the addition.
      - after:  int64_t += int32_t. No change.
    - LP64_OFF64: "size_t" is "uint64_t".
      - before: int64_t += uint64_t. Offset converted to uint64_t for the
        addition, then the uint64_t result is converted to int64_t for
        storage.
      - after:  int64_t += int32_t. Same as the ILP32_OFFBIG/after case.
        No visible change.

  - (size_out < s->page_size) comparisons, and (size_out = s->page_size)
    assignment:
    - before: "size_out" is of type "size_t", no implicit conversion for
              either operator.
    - after: TARGET_PAGE_SIZE (of type "int" and positive value) is
             converted to "size_t" (for the relop because the latter is
             one of "uint32_t" and "uint64_t"). No visible change.

- dump_init():
  - DIV_ROUND_UP(DIV_ROUND_UP(s->max_mapnr, CHAR_BIT), s->page_size): The
    innermost "DumpState.max_mapnr" field has type uint64_t, which
    propagates through all implicit conversions at hand:

    #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))

    regardless of the page size macro argument's type. In the outer macro
    replacement, the page size is converted from uint32_t and int32_t
    alike to uint64_t.

  - (tmp * s->page_size) multiplication: "tmp" has size "uint64_t"; the
    RHS is converted to that type from uint32_t and int32_t just the same
    if it's not uint64_t to begin with.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:28 -04:00
Laszlo Ersek
22227f121b dump: eliminate DumpState.page_shift ("guest's page shift")
Just use TARGET_PAGE_BITS.

"DumpState.page_shift" used to have type "uint32_t", while the replacement
TARGET_PAGE_BITS has type "int". Since "DumpState.page_shift" was only
used as bit shift counts in the paddr_to_pfn() and pfn_to_paddr() macros,
this is safe.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:28 -04:00
Laszlo Ersek
92ba1401e0 dump: simplify write_start_flat_header()
Currently, the function
- defines and populates an auto variable of type MakedumpfileHeader
- allocates and zeroes a buffer of size MAX_SIZE_MDF_HEADER (4096)
- copies the former into the latter (covering an initial portion of the
  latter)

Fill in the MakedumpfileHeader structure in its final place (the alignment
is OK because the structure lives at the address returned by g_malloc0()).

Approximately-suggested-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:28 -04:00
Laszlo Ersek
ae3f88f60f dump: fill in the flat header signature more pleasingly to the eye
The "mh.signature" array field has size 16, and is zeroed by the preceding
memset(). MAKEDUMPFILE_SIGNATURE expands to a string literal with string
length 12 (size 13). There's no need to measure the length of
MAKEDUMPFILE_SIGNATURE at runtime, nor for the extra zero-filling of
"mh.signature" with strncpy().

Use memcpy() with MIN(sizeof, sizeof) for robustness (which is an integer
constant expression, evaluable at compile time.)

Approximately-suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-11 10:10:28 -04:00
Gerd Hoffmann
fa7a1e5219 gtk: update window size after showing/hiding tabs
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-11 14:26:49 +02:00
Gerd Hoffmann
f50def915e gtk: factor out gtk3 grab into the new gd_grab_devices function
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-11 14:26:49 +02:00
Gerd Hoffmann
0a337ed067 gtk: cleanup backend dependencies
Make configure detect gtk x11 backend and link libX11 then.  Make
gtk backend specific code properly #ifdef'ed on the GTK_WINDOWING_*
backends at runtime).  Our gtk ui code should build and run fine on
any platform now.

This also fixes the linker failute due to the new XkbGetKeyboard call
added by commit 3158a3482b.

Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
2014-06-11 14:26:49 +02:00