qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] mux: fix ctrl-a b again


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] mux: fix ctrl-a b again
Date: Wed, 18 Apr 2018 13:06:06 +0100

On 18 April 2018 at 11:36, Marc-André Lureau <address@hidden> wrote:
> In  commit cd9526ab7c04f2c32c63340b04401f6ed25682b9
> Author: Philippe Mathieu-Daudé <address@hidden>
> Date:   Thu Mar 8 23:39:32 2018 +0100
>
>     hw/isa/superio: Factor out the serial code from pc87312.c
>
> You changed from:
>
> -            if (chr == NULL) {
> -                snprintf(name, sizeof(name), "ser%d", i);
> -                chr = qemu_chr_new(name, "null");
> -            }
>
> to:
>
> +            if (chr == NULL || chr->be) {
> +                name = g_strdup_printf("discarding-serial%d", i);
> +                chr = qemu_chr_new(name, "null");
> +            } else {
> +                name = g_strdup_printf("serial%d", i);
> +            }
>
> Why do you check if chr->be ?

After commit 12051d82f004024 none of this should be necessary --
the code should handle chr being NULL without needing to
create a fake null chardev to throw away output.

> In case of a mux chardev, it may already
> have an active frontend (yeah be is CharBackend which is the frontend,
> I still can't grasp that either, please Paolo change your mind! ;).

I agree with Marc-André that the terminology for our chardev
code is hopelessly confusing. The things that are logically
backends (file, stdio, etc) are called "chardevs", and the
thing that is called the CharBackend is, well, I don't know
what it is. include/chardev/char.h has a helpful comment:
     /* character device */
     typedef struct CharBackend CharBackend;

The doc comments for functions like qemu_chr_new() that return
a Chardev* say they "create a new character backend".

And then there's ChardevBackend, which is something else again.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]