History | View | Annotate | Download (97.1 kB)
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...
Merge remote-tracking branch 'mjt/trivial-patches' into staging
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 fd_chr to use a GIOChannel
This uses the newly introduced IOWatchPoll source.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 0cb5d14510ee835a0ebc23676d10a2cce9280da5.1362505276.git.amit.shah@redhat.com...
qemu-char: convert pty to GIOChannel
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 339eebf3c59a450b0354056e9ac4b41f67230831.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.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>
qemu-char: remove dead/confusing logic with nb_stdio_clients
This code is very old dating back to 2007. What is puzzling is thatSTDIO_MAX_CLIENTS was always #define to 1 meaning that all of the code to dealwith more than one client was unreachable.
Just remove the whole mess of it....
char: add IOWatchPoll support
This is a special GSource that supports CharDriverState stylepoll callbacks.
For reviewability and bisectability, this code is #if 0'd out in thispatch to avoid unused warnings since all of the functions are static.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
move socket_set_nodelay to osdep.c
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
console: allow VCs to be overridden by UI
We want to expose VCs using a VteTerminal widget. We need access to provide ourown CharDriverState in order to do this.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Message-id: 1361367806-4599-3-git-send-email-aliguori@us.ibm.com
qapi: Flatten away ChardevPort
Simplifies the schema and the code.
QMP command
{ "execute" : "chardev-add", "arguments" : { "id" : "ser0", "backend" : { "type" : "port", "data" : { "type": "serial",...
error: Strip trailing '\n' from error string arguments (again)
Commit 6daf194d and be62a2eb got rid of a bunch, but they keep comingback. Tracked down with this Coccinelle semantic patch:
r expression err, eno, cls, fmt; position p; @@ (...
r
qmp: Drop wasteful zero-initialization in qmp_memchar_read()
Signed-off-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: Fix chardev "memory" not to drop IAC characters
Undocumented misfeature, get rid of it while we can.
qemu-char: Drop undocumented chardev "memory" compatibility syntax
This is a new device, so there's no compatibility to maintain, and itsuse case isn't common enough to justify shorthand syntax.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
qemu-char: General chardev "memory" code cleanup
Inline trivial cirmem_chr_is_empty() into its only caller.
Rename qemu_chr_cirmem_count() to cirmem_count().
Fast ring buffer index wraparound. Without this, there's no point inrestricting size to a power two....
qemu-char: Saner naming of memchar stuff & doc fixes
New device, has never been released, so we can still improve thingswithout worrying about compatibility.
Naming is a mess. The code calls the device driver CirMemCharDriver,the public API calls it "memory", "memchardev", or "memchar", and the...
qemu-char: Support suffixed ringbuf size arguments like "size=64K"
qmp: Plug memory leaks in memchar-write, memchar-read
qmp: Drop superfluous special case "empty" in qmp_memchar_read()
qmp: Use generic errors in memchar-read, memchar-write
New errors should be generic unless there's a real use case for richerrors.
qmp: Clean up type usage in qmp_memchar_write(), qmp_memchar_read()
Const-correctness, consistently use standard C types instead of mixingthem with GLib types.