qemu-stable
[Top][All Lists]
Advanced

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

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


From: Marc-André Lureau
Subject: Re: [Qemu-stable] [Qemu-devel] [PATCH] mux: fix ctrl-a b again
Date: Wed, 18 Apr 2018 14:22:59 +0200

Hi

On Wed, Apr 18, 2018 at 1:55 PM, Paolo Bonzini <address@hidden> wrote:
> On 18/04/2018 13:35, Marc-André Lureau wrote:
>>> CharBackend is not the frontend, it is *used* by the front-end.  It is
>>> the qemu_chr_* functions that are named wrong (they're named according
>>> to the user rather than the recipient).
>> If I follow you and the naming, you have this in mind:
>>
>> - Chardev: stdio, mux, ringbuf, pty, file, null etc..
>> - CharBackend: the "user" end
>> - frontend: the "user"
>
> The frontend is the device, the monitor, etc.

yes, I should have listed it for clarity

> The backend is how the
> frontend sees a Chardev, it never talks to it directly.


Ok, but why not call CharFrontend, since it's the frontend interface
to the chardev? (which we call the backend, by extension, and because
many functions are named *_be_* )

> Perhaps the confusing part is that the backend is also how the Chardev
> talks to the frontend?

It's less confusing, because that part is mostly internal to char.c
implementation.

But rather than:

static void chr_be_event(Chardev *s, int event)
{
    CharBackend *be = s->be;
...
    be->chr_event(be->opaque, event);
}

I would rather have:

static void chr_be_event(Chardev *s, int event)
{
    CharFrontend *fe = s->fe;
...
    fe->chr_event(be->opaque, event);
}

This would not only mean that we clearly associate CharBackend with
the frontend, but also the chardev code becomes clearer, sending an
event on the chardev (be), forwards it to the frontend side... (that
is so much clearer to me)

>
> Paolo
>
>> It is quite confusing to me that CharBackend is for the "user"
>> frontend, and the backend of Chardev.
>>
>> You have to switch your mind
>> depending on the context or the point of view.
>>
>>  I'd rather use that terminology:
>>
>> - ChardevBackend: stdio, mux, ringbuf, pty, file, null etc..
>> - CharFrontend: the "user" end
>> - frontend the "user"
>>
>> This way, there is only one direction from backend to frontend
>> (regardless of the point of view from chardev to frontend)
>



-- 
Marc-André Lureau



reply via email to

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