diff mbox series

[v3,1/6] chardev: comment details for CLOSED event

Message ID 20180615014249.22730-2-peterx@redhat.com
State New
Headers show
Series monitor: enable OOB by default | expand

Commit Message

Peter Xu June 15, 2018, 1:42 a.m. UTC
It was unclear before on what does the CLOSED event mean.  Meanwhile we
add a TODO to fix up the CLOSED event in the future when the in/out
ports are different for a chardev.

CC: Paolo Bonzini <pbonzini@redhat.com>
CC: "Marc-André Lureau" <marcandre.lureau@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
 include/chardev/char.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Markus Armbruster June 15, 2018, 12:49 p.m. UTC | #1
Peter Xu <peterx@redhat.com> writes:

> It was unclear before on what does the CLOSED event mean.  Meanwhile we
> add a TODO to fix up the CLOSED event in the future when the in/out
> ports are different for a chardev.
>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> CC: "Marc-André Lureau" <marcandre.lureau@redhat.com>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  include/chardev/char.h | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/include/chardev/char.h b/include/chardev/char.h
> index 04de45795e..6f0576e214 100644
> --- a/include/chardev/char.h
> +++ b/include/chardev/char.h
> @@ -22,7 +22,16 @@ typedef enum {
>      CHR_EVENT_OPENED, /* new connection established */
>      CHR_EVENT_MUX_IN, /* mux-focus was set to this terminal */
>      CHR_EVENT_MUX_OUT, /* mux-focus will move on */
> -    CHR_EVENT_CLOSED /* connection closed */
> +    CHR_EVENT_CLOSED /* connection closed.  NOTE: currently this event
> +                      * is only bound to the read port of the chardev.
> +                      * Normally the read port and write port of a
> +                      * chardev should be the same, but it can be
> +                      * different, e.g., for fd chardevs, when the two
> +                      * fds are different.  So when we received the
> +                      * CLOSED event it's still possible that the out
> +                      * port is still open.  TODO: we should only send
> +                      * the CLOSED event when both ports are closed.
> +                      */
>  } QEMUChrEvent;
>  
>  #define CHR_READ_BUF_LEN 4096

Undefined terms "read port" and "write port".  But the header is full of
undefined terms, like "front end", "back end", "data channel", "chardev
peer", ...  It could use a file comment to tie things together.  Clearly
out of scope for this series.
Stefan Hajnoczi June 18, 2018, 3:55 p.m. UTC | #2
On Fri, Jun 15, 2018 at 09:42:44AM +0800, Peter Xu wrote:
> It was unclear before on what does the CLOSED event mean.  Meanwhile we
> add a TODO to fix up the CLOSED event in the future when the in/out
> ports are different for a chardev.
> 
> CC: Paolo Bonzini <pbonzini@redhat.com>
> CC: "Marc-André Lureau" <marcandre.lureau@redhat.com>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  include/chardev/char.h | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff mbox series

Patch

diff --git a/include/chardev/char.h b/include/chardev/char.h
index 04de45795e..6f0576e214 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -22,7 +22,16 @@  typedef enum {
     CHR_EVENT_OPENED, /* new connection established */
     CHR_EVENT_MUX_IN, /* mux-focus was set to this terminal */
     CHR_EVENT_MUX_OUT, /* mux-focus will move on */
-    CHR_EVENT_CLOSED /* connection closed */
+    CHR_EVENT_CLOSED /* connection closed.  NOTE: currently this event
+                      * is only bound to the read port of the chardev.
+                      * Normally the read port and write port of a
+                      * chardev should be the same, but it can be
+                      * different, e.g., for fd chardevs, when the two
+                      * fds are different.  So when we received the
+                      * CLOSED event it's still possible that the out
+                      * port is still open.  TODO: we should only send
+                      * the CLOSED event when both ports are closed.
+                      */
 } QEMUChrEvent;
 
 #define CHR_READ_BUF_LEN 4096