spice: make compression configurable.

This patch adds options to the -spice command line switch to
configure image compression.

[ v2: speling fix in the documentation ]
spice: add config options for channel security.

This allows to enforce tls or plaintext usage for certain spice
channels.

[ v2: code style fixup ]
spice: add config options for the listening address

Make listening address configurable.  Also add options to
force using IPv4 or IPv6.
spice: add misc config options

This patch adds a few more options to tweak spice server behavior.
The documentation update chunk has the details ;)
trace: Use portable format strings

It is not portable to use "%ld" for int64_t because int64_t may have
type long on 64-bit platforms and long long on 32-bit platforms.  Use
the standard library PRId64 macros to keep format strings portable.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
trace: Don't strip lines containing '#' arbitrarily

Although comment lines must be skipped, the '#' character can occur in
valid format strings.  Be more careful when checking for comments.
Leave comments at the end of the line where they will not interfere with
other processing.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
trace: Use TP_PROTO() and TP_ARGS() for LTTng UST

The LTTng UserSpace Tracer formerly used TPPROTO() and TPARGS() instead
of TP_PROTO() and TP_ARGS() like the kernel uses.  This has been changed
so QEMU needs to follow.

I am not aware of a graceful way of making the transition but since no
one complained that the UST build is broken, it should be fine to just
switch over without compatibility for old UST headers.  The newer UST
headers are shipping in distro packages so it is realistic to make this
change now.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
trace: Trace bdrv_aio_{readv,writev}

Observing block layer aio readv/writev operations is useful for
debugging image formats or understanding guest disk I/O patterns.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
configure: include stddef.h for NULL

This fixes an observed failure to detect madvise() on Linux.

To avoid similar issues, all other tests that use NULL but don't already
have stddef.h (or another header that is defined to provide NULL,
such as stdio.h, unistd.h, or time.h) are also fixed.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
configure: Remove unneeded defines from checks

_GNU_SOURCE is already defined in QEMU_CFLAGS which
is passed to gcc in shell function compile_prog.

Removing the definition from several checks avoids compiler warnings
(which are now written to config.log).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
acpi: Fix an infinite loop in acpi_table_add

Commit d729bb9a7700e364b1c5f9893d61f07a9e002bce has a typo, causing an
infinite loop in acpi_table_add.

Signed-off-by: Vincent Minet <vincent@vincent-minet.net>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
.gitignore: Ignore *-timestamp

Timestamp files were recently added to reduce make churn on source files
that use tracing.  The timestamp files should never be committed and
should not be visible in git status.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
win32: Set unbuffered stdout

Win32 does not support line-buffering, but it allows
unbuffered output.

Unbuffered output is a good approximation. For typical output
statements which usually end with '\n', it's even identical.

Buffered output is unusable for program traces because of
its large delay.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
configure: Send error message from spice check to /dev/null

pkg-config is not always available (e.g. on win32 hosts),
but we don't want to see the 'command not found' error message.

Redirect stdout and stderr to /dev/null.

v2:

* Removed changes which should not have been here.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
trace: remove timestamp files when cleaning up

'make clean' did not remove trace.[ch]-timestamp files,
only trace.[ch]. But 'make' did not know how to make trace.[ch]
files if the timestamp files were present.

Fix by removing the timestamp files along with trace.[ch].

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Merge remote branch 'mst/for_anthony' into staging
block: avoid a write only variable

Compiling with GCC 4.6.0 20100925 produced a warning:
/src/qemu/block/qcow2-refcount.c: In function 'update_refcount':
/src/qemu/block/qcow2-refcount.c:552:13: error: variable 'dummy' set but not used [-Werror=unused-but-set-variable]

Fix by adding a dummy cast so that the result is not unused.

Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
cirrus: avoid write only variables

Compiling with GCC 4.6.0 20100925 produced a lot of warnings like:
In file included from /src/qemu/hw/cirrus_vga_rop.h:174:0,
                 from /src/qemu/hw/cirrus_vga.c:284:
/src/qemu/hw/cirrus_vga_rop2.h: In function 'cirrus_patternfill_0_8':
/src/qemu/hw/cirrus_vga_rop2.h:48:18: error: variable 'col' set but not used [-Werror=unused-but-set-variable]
/src/qemu/hw/cirrus_vga_rop2.h: In function 'cirrus_colorexpand_transp_0_8':
/src/qemu/hw/cirrus_vga_rop2.h:104:18: error: variable 'col' set but not used [-Werror=unused-but-set-variable]

Fix the warnings by introducing an inline function, which avoids
exposing write-only variables.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
eepro100: initialize a variable in all cases

Compiling with GCC 4.6.0 20100925 produced warnings:
/src/qemu/hw/eepro100.c: In function 'eepro100_read4':
/src/qemu/hw/eepro100.c:1351:14: error: 'val' may be used uninitialized in this function [-Werror=uninitialized]
/src/qemu/hw/eepro100.c: In function 'eepro100_read2':
/src/qemu/hw/eepro100.c:1328:14: error: 'val' may be used uninitialized in this function [-Werror=uninitialized]
/src/qemu/hw/eepro100.c: In function 'eepro100_read1':
/src/qemu/hw/eepro100.c:1285:13: error: 'val' may be used uninitialized in this function [-Werror=uninitialized]

Fix by initializing 'val' at start.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
lsi53c895a: avoid a write only variable

Compiling with GCC 4.6.0 20100925 produced a warning:
/src/qemu/hw/lsi53c895a.c: In function 'lsi_do_msgout':
/src/qemu/hw/lsi53c895a.c:848:9: error: variable 'len' set but not used [-Werror=unused-but-set-variable]

Fix by adding a dummy cast so that the variable is not unused for
non-debug case.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>