summaryrefslogtreecommitdiffstats
path: root/spice-qemu-char.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'bonzini/header-dirs' into stagingAnthony Liguori2012-12-191-1/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bonzini/header-dirs: (45 commits) janitor: move remaining public headers to include/ hw: move executable format header files to hw/ fpu: move public header file to include/fpu softmmu: move remaining include files to include/ subdirectories softmmu: move include files to include/sysemu/ misc: move include files to include/qemu/ qom: move include files to include/qom/ migration: move include files to include/migration/ monitor: move include files to include/monitor/ exec: move include files to include/exec/ block: move include files to include/block/ qapi: move include files to include/qobject/ janitor: add guards to headers qapi: make struct Visitor opaque qapi: remove qapi/qapi-types-core.h qapi: move inclusions of qemu-common.h from headers to .c files ui: move files to ui/ and include/ui/ qemu-ga: move qemu-ga files to qga/ net: reorganize headers net: move net.c to net/ ... Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
| * softmmu: move remaining include files to include/ subdirectoriesPaolo Bonzini2012-12-191-1/+1
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * misc: move include files to include/qemu/Paolo Bonzini2012-12-191-1/+1
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * janitor: do not rely on indirect inclusions of or from qemu-char.hPaolo Bonzini2012-12-191-0/+1
| | | | | | | | | | | | | | | | | | Various header files rely on qemu-char.h including qemu-config.h or main-loop.h, but they really do not need qemu-char.h at all (particularly interesting is the case of the block layer!). Clean this up, and also add missing inclusions of qemu-char.h itself. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* | spice-qemu-char: register spicevmc ports during qemu_spice_init()Marc-André Lureau2012-12-171-0/+12
| | | | | | | | | | | | | | Do the delayed registration of spicevmc ports after Spice server is initialized. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | spice-qemu-char: keep a list of spice chardevMarc-André Lureau2012-12-171-0/+7
| | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | spice-qemu-char: add spiceport chardevMarc-André Lureau2012-12-171-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new spice chardev to allow arbitrary communication between the host and the Spice client via the spice server. Examples: This allows the Spice client to have a special port for the qemu monitor: ... -chardev spiceport,name=org.qemu.monitor,id=monitorport -mon chardev=monitorport v2: - remove support for chardev to chardev linking - conditionnaly compile with SPICE_SERVER_VERSION Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | spice-qemu-char: factor out CharDriverState creationMarc-André Lureau2012-12-171-14/+23
| | | | | | | | | | | | Make the CharDriverState creation code reusable by spicevmc port. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | spice-qemu-char: write to chardev whatever amount it can readMarc-André Lureau2012-12-171-4/+2
|/ | | | | | | | | The current code waits until the chardev can read MIN(len, VMC_MAX) But some chardev may never reach than amount, in fact some of them will only ever accept write of 1. Fix the min computation and remove the VMC_MAX constant. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* spice-qemu-char.c: Show what name is unsupportedEduardo Elias Ferreira2012-04-201-1/+1
| | | | | Signed-off-by: Eduardo Elias Ferreira <edusf@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* Revert "qemu-char: Print strerror message on failure" and depsMarkus Armbruster2012-02-241-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The commit's purpose is laudable: The only way for chardev drivers to communicate an error was to return a NULL pointer, which resulted in an error message that said _that_ something went wrong, but not _why_. It attempts to achieve it by changing the interface to return 0/-errno and update qemu_chr_open_opts() to use strerror() to display a more helpful error message. Unfortunately, it has serious flaws: 1. Backends "socket" and "udp" return bogus error codes, because qemu_chr_open_socket() and qemu_chr_open_udp() assume that unix_listen_opts(), unix_connect_opts(), inet_listen_opts(), inet_connect_opts() and inet_dgram_opts() fail with errno set appropriately. That assumption is wrong, and the commit turns unspecific error messages into misleading error messages. For instance: $ qemu-system-x86_64 -nodefaults -vnc :0 -chardev socket,id=bar,host=xxx inet_connect: host and/or port not specified chardev: opening backend "socket" failed: No such file or directory ENOENT is what happens to be in my errno when the backend returns -errno. Let's put ERANGE there just for giggles: $ qemu-system-x86_64 -nodefaults -vnc :0 -chardev socket,id=bar,host=xxx -drive if=none,iops=99999999999999999999 inet_connect: host and/or port not specified chardev: opening backend "socket" failed: Numerical result out of range Worse: when errno happens to be zero, return -errno erroneously signals success, and qemu_chr_new_from_opts() dies dereferencing uninitialized chr. I observe this with "-serial unix:". 2. All qemu_chr_open_opts() knows about the error is an errno error code. That's simply not enough for a decent message. For instance, when inet_dgram() can't resolve the parameter host, which errno code should it use? What if it can't resolve parameter localaddr? Clue: many backends already report errors in their open methods. Let's revert the flawed commit along with its dependencies, and fix up the silent error paths instead. This reverts commit 6e1db57b2ac9025c2443c665a0d9e78748637b26. Conflicts: console.c hw/baum.c qemu-char.c This reverts commit aad04cd024f0c59f0b96f032cde2e24eb3abba6d. The parts of commit db418a0a "Add stdio char device on windows" that depend on the reverted change fixed up. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* spice-qemu-char: Generate chardev open/close eventsHans de Goede2011-11-281-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | Define a state callback and make that generate chardev open/close events when called by the spice-server. Notes: 1) For all but the newest spice-server versions (which have a fix for this) the code ignores these events for a spicevmc with a subtype of vdagent, this subtype specific knowledge is undesirable, but unavoidable for now, see: http://lists.freedesktop.org/archives/spice-devel/2011-July/004837.html 2) This code deliberately sends the events immediately rather then from a bh. This is done this way because: a) There is no need to do it from a bh; and b) Doing it from a bh actually causes issues because the spice-server may send data immediately after the open and when the open runs from a bh, then qemu_chr_be_can_write will return 0 for the first write which the spice-server does not expect, when this happens the spice-server will never retry the write causing communication to stall. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* spice-qemu-char.c: Use correct printf format char for ssize_tPeter Maydell2011-09-071-1/+1
| | | | | | | | Use the correct printf format string character (%z) for ssize_t. This fixes a compile failure on 32 bit Linux with spice enabled. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* char: rename qemu_chr_can_read() -> qemu_chr_be_can_read()Anthony Liguori2011-08-221-1/+1
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* char: rename qemu_chr_read() -> qemu_chr_be_write()Anthony Liguori2011-08-221-1/+1
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-4/+4
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: Print strerror message on failureKevin Wolf2011-07-231-4/+5
| | | | | | | | | | | | The only way for chardev drivers to communicate an error was to return a NULL pointer, which resulted in an error message that said _that_ something went wrong, but not _why_. This patch changes the interface to return 0/-errno and updates qemu_chr_open_opts to use strerror to display a more helpful error message. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* spice-qemu-char: Fix flow control in client -> guest directionHans de Goede2011-06-061-6/+5
| | | | | | | | | | | | | | | | | | | | | | | In the old spice-vmc device we used to have: last_out = virtio_serial_write(&svc->port, p, MIN(len, VMC_MAX_HOST_WRITE)); if (last_out > 0) ... Now in the chardev backend we have: last_out = MIN(len, VMC_MAX_HOST_WRITE); qemu_chr_read(scd->chr, p, last_out); if (last_out > 0) { ... Which causes us to no longer detect if the virtio port is not ready to receive data from us. chardev actually has a mechanism to detect this, but it requires a separate call to qemu_chr_can_read, before calling qemu_chr_read (which return void). This patch uses qemu_chr_can_read to fix the flow control from client to guest. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* spice-chardev: listen to frontend guest open / closeHans de Goede2011-04-281-0/+14
| | | | | | | | | | Note the vmc_register_interface() in spice_chr_write is left in place in case someone uses spice-chardev with a frontend which does not have guest open / close notification. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Alon Levy <alevy@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* spice: add chardev (v5)Alon Levy2011-01-241-0/+190
Adding a chardev backend for spice, where spice determines what to do with it based on the name attribute given during chardev creation. For usage by spice vdagent in conjunction with a properly named virtio-serial device, and future smartcard channel usage. Example usage: qemu -device virtio-serial -chardev spicevmc,name=vdagent,id=vdagent \ -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 v4->v5: * add tracing events * fix missing comma * fix help string to show debug is optional v3->v4: * updated commit message v1->v3 changes: (v2 had a wrong commit message) * removed spice-qemu-char.h, folded into ui/qemu-spice.h * removed dead IOCTL code * removed comment * removed ifdef CONFIG_SPICE from qemu-config.c and qemu-options.hx help. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
OpenPOWER on IntegriCloud