diff mbox

[v4] qemu-char: add logfile facility to all chardev backends

Message ID 56991727.5040901@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paolo Bonzini Jan. 15, 2016, 3:58 p.m. UTC
On 15/01/2016 10:15, Daniel P. Berrange wrote:
> On Thu, Jan 14, 2016 at 09:05:03PM -0700, Eric Blake wrote:
>> On 01/11/2016 05:44 AM, Daniel P. Berrange wrote:
>>> Typically a UNIX guest OS will log boot messages to a serial
>>> port in addition to any graphical console. An admin user
>>> may also wish to use the serial port for an interactive
>>> console. A virtualization management system may wish to
>>> collect system boot messages by logging the serial port,
>>> but also wish to allow admins interactive access.
>>> This patch introduces a 'ChardevCommon' struct which
>>> is setup as a base for all the ChardevBackend types.
>>> Ideally this would be registered directly as a base
>>> against ChardevBackend, rather than each type, but
>>> the QAPI generator doesn't allow that since the
>>> ChardevBackend is a non-discriminated union. The
>>> ChardevCommon struct provides the optional 'logfile'
>>> parameter, as well as 'logappend' which controls
>>> whether QEMU truncates or appends (default truncate).
>>> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>

This patch fails make check, due to a segmentation fault that can be 
reproduced with "x86_64-softmmu/qemu-system-x86_64 -serial null".

I'm squashing in the fix:

diff mbox


diff --git a/qemu-char.c b/qemu-char.c
index 02b0318..11caa56 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3827,7 +3827,12 @@  CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
             error_propagate(errp, local_err);
             goto qapi_out;
+    } else {
+        ChardevCommon *cc = g_new0(ChardevCommon, 1);
+        qemu_chr_parse_common(opts, cc);
+        backend->u.data = cc;
     ret = qmp_chardev_add(bid ? bid : id, backend, errp);
     if (!ret) {
         goto qapi_out;