diff mbox series

[2/4] chardev/char-fe: Clarify qemu_chr_fe_add_watch 'condition' arg is a mask

Message ID 20230705133139.54419-3-philmd@linaro.org
State New
Headers show
Series chardev/char-fe: Document FEWatchFunc and use G_SOURCE_CONTINUE/REMOVE | expand

Commit Message

Philippe Mathieu-Daudé July 5, 2023, 1:31 p.m. UTC
qemu_chr_fe_add_watch() can poll for multiple conditions.
It's @cond argument is a combination of all the condition bits.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/chardev/char-fe.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Marc-André Lureau July 10, 2023, 11:19 a.m. UTC | #1
On Wed, Jul 5, 2023 at 5:33 PM Philippe Mathieu-Daudé <philmd@linaro.org>
wrote:

> qemu_chr_fe_add_watch() can poll for multiple conditions.
> It's @cond argument is a combination of all the condition bits.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  include/chardev/char-fe.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h
> index 8c420fa36e..309960046a 100644
> --- a/include/chardev/char-fe.h
> +++ b/include/chardev/char-fe.h
> @@ -179,8 +179,8 @@ typedef gboolean (*FEWatchFunc)(void *do_not_use,
> GIOCondition condition, void *
>
>  /**
>   * qemu_chr_fe_add_watch:
> - * @cond: the condition to poll for
>
- * @func: the function to call when the condition happens
> + * @cond: bitwise combination of conditions to poll for
> + * @func: the function to call when the conditions are satisfied
>

Not really worth imo, do you want to also fix all the io/ docs for
@condition? and probably elsewhere...

The rewording of @func isn't much clearer either... "any of the conditions"?


>   * @user_data: the opaque pointer to pass to @func
>   *
>   * If the backend is connected, create and add a #GSource that fires
> --
> 2.38.1
>
>
>
Philippe Mathieu-Daudé July 10, 2023, 1:42 p.m. UTC | #2
On 10/7/23 13:19, Marc-André Lureau wrote:
> 
> 
> On Wed, Jul 5, 2023 at 5:33 PM Philippe Mathieu-Daudé <philmd@linaro.org 
> <mailto:philmd@linaro.org>> wrote:
> 
>     qemu_chr_fe_add_watch() can poll for multiple conditions.
>     It's @cond argument is a combination of all the condition bits.
> 
>     Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org
>     <mailto:philmd@linaro.org>>
>     ---
>       include/chardev/char-fe.h | 4 ++--
>       1 file changed, 2 insertions(+), 2 deletions(-)
> 
>     diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h
>     index 8c420fa36e..309960046a 100644
>     --- a/include/chardev/char-fe.h
>     +++ b/include/chardev/char-fe.h
>     @@ -179,8 +179,8 @@ typedef gboolean (*FEWatchFunc)(void
>     *do_not_use, GIOCondition condition, void *
> 
>       /**
>        * qemu_chr_fe_add_watch:
>     - * @cond: the condition to poll for
> 
>     - * @func: the function to call when the condition happens
>     + * @cond: bitwise combination of conditions to poll for
>     + * @func: the function to call when the conditions are satisfied
> 
> 
> Not really worth imo, do you want to also fix all the io/ docs for 
> @condition? and probably elsewhere...
> 
> The rewording of @func isn't much clearer either... "any of the conditions"?

Hmm OK I'll just drop this patch for now, thanks.
diff mbox series

Patch

diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h
index 8c420fa36e..309960046a 100644
--- a/include/chardev/char-fe.h
+++ b/include/chardev/char-fe.h
@@ -179,8 +179,8 @@  typedef gboolean (*FEWatchFunc)(void *do_not_use, GIOCondition condition, void *
 
 /**
  * qemu_chr_fe_add_watch:
- * @cond: the condition to poll for
- * @func: the function to call when the condition happens
+ * @cond: bitwise combination of conditions to poll for
+ * @func: the function to call when the conditions are satisfied
  * @user_data: the opaque pointer to pass to @func
  *
  * If the backend is connected, create and add a #GSource that fires