History | View | Annotate | Download (98.8 kB)
misc: Use macro ARRAY_SIZE where possible
This improves readability and simplifies the code.
Cc: Anthony Liguori <aliguori@amazon.com>Cc: Gerd Hoffmann <kraxel@redhat.com>Cc: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Stefan Weil <sw@weilnetz.de>...
char: add qemu_chr_fe_event()
Teach the chardev frontend to send event. This is used by the Spice portchardev currently.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Merge remote-tracking branch 'amit/char-remove-watch-on-unplug' into staging
Merge remote-tracking branch 'mjt/trivial-patches' into staging
qemu-char: Fix potential out of bounds access to local arrays
Latest gcc-4.8 supports a new option -fsanitize=address which activatesan AddressSanitizer. This AddressSanitizer stops the QEMU system emulationvery early because two character arrays of size 8 are potentially written...
chardev: handle qmp_chardev_add(KIND_MUX) failure
Cc: Markus Armbruster <armbru@redhat.com>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
chardev: fix pty_chr_timer
pty_chr_timer first calls pty_chr_update_read_handler(), then clearstimer_tag (because it is a one-shot timer). This is the wrong orderthough. pty_chr_update_read_handler might re-arm time timer, and thenew timer_tag gets overwitten in that case....
char: remove watch callback on chardev detach from frontend
If a frontend device releases the chardev (via unplug), the chr handlersare set to NULL via qdev's exit callbacks invokingqemu_chr_add_handlers(). If the chardev had a pending operation, acallback will be invoked, which will try to access data in the...
char: move backends' io watch tag to CharDriverState
All the backends implement an io watcher tag for callbacks. Move it toCharDriverState from each backend's struct to make accessing the tag frombackend-neutral functions easier.
This will be used later to cancel a callback on chardev detach from a...
char: use common function to disable callbacks on chardev close
This deduplicates code used a lot of times.
CC: <qemu-stable@nongnu.org>Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>
Merge remote-tracking branch 'stefanha/block' into staging
aio / timers: Switch entire codebase to the new timer API
This is an autogenerated patch using scripts/switch-timer-api.
Switch the entire code base to using the new timer API.
Note this patch may introduce some line length issues.
Signed-off-by: Alex Bligh <alex@alex.org.uk>...
Convert stderr message calling error_get_pretty() to error_report()
Convert stderr messages calling error_get_pretty()to error_report().
Timestamp is prepended by -msg timstamp option with it.
Per Markus's comment below, A conversion from fprintf() to...
qemu-char: fix infinite recursion connecting to monitor pty
Since commit bd5c51e (qemu-char: don't issue CHR_EVENT_OPEN in a BH), aninfinite recursion occurs when putting the monitor on a pty (-monitorpty) and connecting a terminal to the slave port.
This is because of the qemu_chr_be_event(s, CHR_EVENT_OPENED) added to...
chardev: fix CHR_EVENT_OPENED events for mux chardevs
As of bd5c51ee6c4f1c79cae5ad2516d711a27b4ea8ec, chardevs no longer usebottom-halves to issue CHR_EVENT_OPENED events. To maintain pastsemantics, we instead defer the CHR_EVENT_OPENED events toward the end...
qapi: Rename ChardevBackend member "memory" to "ringbuf"
Commit 1da48c6 called the new member "memory" after commit 3949e59standardized "ringbuf". Rename for consistency.
However, member name "memory" is visible in QMP since 1.5. It'sundocumented just like the driver name. Keep it working anyway....
Revert "chardev: Make the name of memory device consistent"
This reverts commit 6a85e60cb994bd95d1537aafbff65816f3de4637.
Commit 51767e7 "qemu-char: Add new char backend CirMemCharDriver" introduced a memory ring buffer character device driver named"memory". Commit 3949e59 "qemu-char: Saner naming of memchar stuff &...
qemu-char: Register ring buffer driver with correct name "ringbuf"
The driver is new in 1.4, with the documented name "ringbuf".However, it's actual name is the completely undocumented "memory".Screwed up in commit 3949e59. Fix code to match documentation....
char: io_channel_send: don't lose written bytes
The g_io_channel_write_chars() documentation states,
bytes_written: The number of bytes written. This can be nonzero even if the return value is not G_IO_STATUS_NORMAL. [...]
io_channel_send() could lose such bytes before....
qemu-char: Fix ringbuf option size
Any attempt to use it trips an "opt->desc->type == QEMU_OPT_NUMBER" assertion. Broken in commit 1da48c65.
Cc: qemu-stable@nongnu.orgSigned-off-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
trap signals for "-serial mon:stdio"
With mon:stdio you can exit the VM by switching to the monitor andsending the "quit" command. It is then useful to pass Ctrl-C to theVM instead of exiting.
This in turn lets us stop tying the default signal handling behavior...
qemu-char: Fix ID reuse after chardev-remove for qapi-based init
Commit 2c5f488 introduced qapi-based character device initializationas a new code path in qemu_chr_new_from_opts(). Unfortunately, itfailed to store parameter opts in the new chardev. Therefore,...
qemu-char: add -chardev mux support
Allow to explicitly create mux chardevs on the command line,like you can using QMP.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
qemu-char: report udp backend errors
qemu-char: check optional fields using has_*
qemu-char: use more specific error_setg_* variants
qemu-char: print notification to stderr
qemu-char: don't leak opts on error
qemu-char: use ChardevBackendKind in CharDriver
qemu-char: minor mux chardev fixes
mux failure path has a memory leak. creating a mux chardev can'tfail though, so just assert() that instead of fixing an error pathwhich never ever runs anyway ...
Also fix bid being leaked while being at it.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>...
qemu-char: use bool in qemu_chr_open_socket and simplify code a bit
Local variables is_* should be bool by usage.While at it, simplify the logic/code a bit.
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
create qemu_openpty_raw() helper function and move it to a separate file
In two places qemu uses openpty() which is very system-dependent,and in both places the pty is switched to raw mode as well.Make a wrapper function which does both steps, and move all the...
qemu-char: remove a few needless #includes
This removes <syslog.h> since we don't usesyslogging, and removes second, solaris-specific,include of <net/if.h> (which is included ina common part of the file)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
qemu-char: don't issue CHR_EVENT_OPEN in a BH
When CHR_EVENT_OPENED was initially added, it was CHR_EVENT_RESET,and it was issued as a bottom-half:
86e94dea5b740dad65446c857f6959eae43e0ba6
Which we basically used to print out a greeting/prompt for the...
chardev: fix "info chardev" output
Fill unset CharDriverState->filename with the backend name, so'info chardev' will return at least the chardev type. Don'ttouch it in case the chardev init function filled it already,like the socket+pty chardevs do for example....
Revert "chardev: Get filename for new qapi backend"
Does not handle chardevs created via chardev-add monitor command.
This reverts commit 2b220025993e76d4116781ca91a4fabc5ad9c722.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
chardev: Make the name of memory device consistent
Now we have memory char device, but the backend name of itis a little confusion. We actually register it by 'memory', butthe description in qemu-option, the name of open functionsand the new api backend called it 'ringbuf'. It should keep...
chardev: Get filename for new qapi backend
This patch sets the filename when the new qapi backendinit from opts.
The previous patch and discussions as link below:
http://patchwork.ozlabs.org/patch/243896/
If anyone who have better idea to fix this please let...
glib: Fix some misuses of gsize/size_t types
This unbreaks cross compile builds:
configure --target-list="i386-softmmu" --cpu=i386
When building on a 64bit machine.
Reported-by: David Holsgrove <david.holsgrove@xilinx.com>Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>...
chardev: Make consistent with udp device for new qapi backend
When register and open a chardev udp, the backend name should be udpnot dgram, and we do not have backend dgram in the chardev list. Thispatch makes the new qapi udp backend consistent with the original...
portability: pty.h is glibc-specific
This should fix building the GTK+ front-end on BSDs.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Message-id: 1368533121-30796-1-git-send-email-pbonzini@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: Set foo_tag = 0 when returning FALSE from callbacks
While reviewing some patches I found this problem where tcp_chr_acceptdoes not clear listen_tag when returning FALSE, leading to a doubleg_source_remove of the underlying source. Not really a problem unless the id...
qemu-char: do not operate on sources from finalize callbacks
Due to a glib bug, the finalize callback is called with the GMainContextlock held. Thus, any operation on the context from the callback willcause recursive locking and a deadlock. This happens, for example,...
qemu-char: use consistent idiom for removing sources
Always check that the source is active, and zero the tag afterwards.
The occurrence in pty_chr_state will trigger with the next patch, theothers are just theoretical.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
qemu-char: simplify pty polling
There is no need to use a timer and pty_chr_read to detect a connectedpty. It is simpler to just call g_poll periodically and check for POLLHUP.It is done once per second, and only if the pty is disconnected, so itis cheap enough....
qemu-char: correct return value from chr_read functions
Even if a CharDriverState's source is blocked by the front-end,it must not be dropped. The IOWatchPoll that wraps it will takecare of adding and removing it to the main loop. Only removethe source when the channel is closed; and in that case, make sure...
Merge remote-tracking branch 'bonzini/hw-dirs' into staging
sysemu: avoid proliferation of include/ subdirectories
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-char: another io_add_watch_poll fix
After attaching the source, we have to remove the reference we holdto it, because we do not hold anymore a pointer to the source.
If we do not do this, removing the source will not finalize it andwill not drop the "real" I/O watch source....
qemu-char: really fix behavior on can_read = 0
I misread the glib manual, g_source_remove does not let you re-attachthe source later. This behavior (called "blocking" the source in glib)is present in glib's source code, but private and not available outside...
qemu-char: eliminate busy waiting on can_read returning zero
The character backend refactoring introduced an undesirable busy wait.The busy wait happens if can_read returns zero and there is data availableon the character device's file descriptor. Then, the I/O watch will...
chardev: drop the Memory chardev driver
It's not used anymore since the last commit.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Acked-by: Gerd Hoffmann <kraxel@redhat.com>
qemu-char: Add qemu_chr_fe_claim / _release helper functions
Add qemu_chr_fe_claim / _release helper functions for properly dealing withavail_connections.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>Message-id: 1364412581-3672-2-git-send-email-hdegoede@redhat.com...
qemu-char: Call fe_claim / fe_release when not using qdev chr properties
chardev-frontends need to explictly check, increase and decrement theavail_connections "property" of the chardev when they are not using aqdev-chardev-property for the chardev.
This fixes things like:...
Merge remote-tracking branch 'luiz/queue/qmp' into staging
oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()
The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets.Rename to qemu_set_nonblock() just like qemu_set_cloexec().
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
chardev: clear O_NONBLOCK on SCM_RIGHTS file descriptors
When we receive a file descriptor over a UNIX domain socket theO_NONBLOCK flag is preserved. Clear the O_NONBLOCK flag and rely onQEMU file descriptor users like migration, SPICE, VNC, block layer, and...
qemu-char: rewrite io_channel_send_all and drop the '_all' suffix
The current code is oddly written and have equally odd semantics.Despite the '_all' suffix, upon EAGAIN the result will be a partialwrite but instead of returning the partial write, we return EAGAIN....
qemu-char: Rename qemu_chr_generic_open to qemu_chr_be_generic_open
To better reflect that it is for handling a backend being opened.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>Message-id: 1364292483-16564-3-git-send-email-hdegoede@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: Add fe_open tracking
Add tracking of the fe_open state to struct CharDriverState.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>Message-id: 1364292483-16564-4-git-send-email-hdegoede@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: Automatically do fe_open / fe_close on qemu_chr_add_handlers
Most frontends can't really determine if the guest actually has the frontendside open. So lets automatically generate fe_open / fe_close as soon as afrontend becomes ready (as signalled by calling qemu_chr_add_handlers) /...
qemu-char: Cleanup: consolidate fe_open/fe_close into fe_set_open
Signed-off-by: Hans de Goede <hdegoede@redhat.com>Message-id: 1364292483-16564-6-git-send-email-hdegoede@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: Consolidate guest_close/guest_open into a set_fe_open callback
Signed-off-by: Hans de Goede <hdegoede@redhat.com>Message-id: 1364292483-16564-7-git-send-email-hdegoede@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: Move incrementing of avail_connections to qdev-properties-system
The decrement of avail_connections is done in qdev-properties-system movethe increment there too for proper balancing of the calls.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>...
qemu-char: add_handlers: Don't re-send the be_open event on unregister
Resending the be_open event only is useful when a frontend is registering, notwhen it is unregistering.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>Message-id: 1364292483-16564-9-git-send-email-hdegoede@redhat.com...
qemu-char: Rename opened to be_open
Rename the opened variable to be_open to reflect that it contains theopened state of the backend.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>Message-id: 1364292483-16564-2-git-send-email-hdegoede@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
char: introduce a blocking version of qemu_chr_fe_write
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
char: Fix return type of qemu_chr_fe_add_watch()
qemu_chr_fe_add_watch() can return negative errors, therefore it mustnot have an unsigned return type. For consistency with otherqemu_chr_fe_* functions, this uses a standard C int instead of glibtypes....
qemu-char.c: fix waiting for telnet connection message
Current colon position in "waiting for telnet connection" message templateproduces messages like:QEMU waiting for connection on: telnet::127.0.0.16666,server
After moving a colon to the right, we will get a correct messages like:...
chardev: add msmouse support to qapi
This patch adds 'msmouse' support to qapi and also switches overthe msmouse chardev initialization to the new qapi code path.
chardev: add braille support to qapi
This patch adds 'braille' support to qapi and also switches overthe braille chardev initialization to the new qapi code path.
chardev: switch file init to qapi
This patch switches over the 'file' chardev initializationto the new qapi code path.
chardev: add stdio support to qapi
This patch adds 'stdio' support to qapi and also switches over thestdio chardev initialization to the new qapi code path.
chardev: switch serial/tty init to qapi
This patch switches over the serial chardev initializationto the new qapi code path.
chardev: switch parallel init to qapi
This patch switches over the parallel chardev initializationto the new qapi code path.
chardev: switch pty init to qapi
This patch switches over the pty chardev initializationto the new qapi code path.
Bonus: Taking QemuOpts out of the loop allows some nicecleanups along the way.
chardev: add console support to qapi
This patch adds 'console' support to qapi and also switches over theconsole chardev initialization to the new qapi code path.
chardev: add pipe support to qapi
This patch adds 'pipe' support to qapi and also switches over thepipe chardev initialization to the new qapi code path.
chardev: add spice support to qapi
This patch adds 'spicevmc' and 'spiceport' support to qapi and alsoswitches over the spice chardev initialization to the new qapi codepath.
chardev: add vc support to qapi
This patch adds 'vc' support to qapi and also switches over thevc chardev initialization to the new qapi code path.
chardev: add memory (ringbuf) support to qapi
This patch adds 'memory' support to qapi and also switches overthe memory chardev initialization to the new qapi code path.
chardev: add udp support to qapi
This patch adds 'udp' support to qapi.
chardev: add support for qapi-based chardev initialization
This patch add support for a new way to initialize chardev devices.Instead of calling a initialization function with a QemuOpts we willnow create a (qapi) ChardevBackend, optionally call a function to...
chardev: add mux chardev support to qapi
This adds mux chardev support to the qapi and also makes the qapi-basedchardev creation path handle the "mux=on" option correctly.
chardev: switch null init to qapi
This patch switches over the 'null' chardev initializationto the new qapi code path.
Add a TPM Passthrough backend driver implementation
This patch is based of off version 9 of Stefan Berger's patch series "QEMU Trusted Platform Module (TPM) integration" and adds a new backend driver for it.
This patch adds a passthrough backend driver for passing commands sent to the...
qemu-char: fix win32 build
96c6384776d631839a9c8fe02bf135f9ba22586c did not adjustWin32 #ifdeffery properly, breaking build in later commits. Fix.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>Tested-by: Igor Mitsyanko <i.mitsyanko@gmail.com>Message-id: 0ba5565b1ed44380c57d4a5fab86e9549f581ebf.1362822910.git.blauwirbel@gmail.com...
qemu-char: move baum registration to baum.c
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 1b24baa1ec3a174d5cad31e079d829904b53077b.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: move msmouse registeration to msmouse.c
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: b47d1153b0d7669743c9a6bb98ce30f4cf7f876b.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: move text console init to console.c
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 17cefde0a8d7807294bab95e93c3328a20d3f2ed.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: add watch support
This allows a front-end to request for a callback when the backendis writable again.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 96f93c0f741064604bbb6389ce962191120af8b7.1362505276.git.amit.shah@redhat.com...
qemu-char: add pty watch
This lets ptys support adding front end watchs.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 23380f37b22d407ba0b9e080f6ea0d66b279f2d2.1362505276.git.amit.shah@redhat.com...
char: add gio watch fn for tcp backends
Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: b50e668c4f4146a654c5d4412440eb9e589f2c02.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: use a glib timeout instead of qemu-timer
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 05a883ce5a98275b976bf0124610599859c2b7da.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: remove use of QEMUTimer in favor of glib idle function
qemu-char is now independent of the QEMU main loop.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 3cda0bbcfb94912df8a767983a52bb71a4a3231d.1362505276.git.amit.shah@redhat.com...
qemu-char: make char drivers dynamically registerable
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 0ff4f5f2b8b7afdb85a0c241403ad73f472f0b81.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: move spice registration to spice-qemu-char.c
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 49a8d12eeb117e5530b2fab02af7681b54f9245c.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: tcp: make use GIOChannel
I didn't bother switching to g_io_channel_read/write because we need to usesendmsg on Unix. No problem though since we're using an unbuffered channel.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>...
qemu-char: convert UDP to GIOChannel
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 775a2bd666a3d1fa008656bf97191b7573c6ffb5.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>