[Qemu-devel] [PATCH] main-loop: document IOCanReadHandler

Stefan Hajnoczi posted 1 patch 7 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180602085259.17853-1-stefanha@redhat.com
Test checkpatch passed
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test s390x passed
include/qemu/main-loop.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
[Qemu-devel] [PATCH] main-loop: document IOCanReadHandler
Posted by Stefan Hajnoczi 7 years, 8 months ago
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 include/qemu/main-loop.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
index 6b4b60bf6d..721aa2416a 100644
--- a/include/qemu/main-loop.h
+++ b/include/qemu/main-loop.h
@@ -168,6 +168,20 @@ void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque);
 /* async I/O support */
 
 typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
+
+/**
+ * IOCanReadHandler: Return the number of bytes that #IOReadHandler can accept
+ *
+ * This function reports how many bytes #IOReadHandler is prepared to accept.
+ * #IOReadHandler may be invoked with up to this number of bytes.  If this
+ * function returns 0 then #IOReadHandler is not invoked.
+ *
+ * This function is typically called from an event loop.  If the number of
+ * bytes changes outside the event loop (e.g. because a vcpu thread drained the
+ * buffer), then it is necessary to kick the event loop so that this function
+ * is called again.  aio_notify() or qemu_notify_event() can be used to kick
+ * the event loop.
+ */
 typedef int IOCanReadHandler(void *opaque);
 
 /**
-- 
2.17.0


Re: [Qemu-devel] [PATCH] main-loop: document IOCanReadHandler
Posted by Philippe Mathieu-Daudé 7 years, 8 months ago
On 06/02/2018 05:52 AM, Stefan Hajnoczi wrote:
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  include/qemu/main-loop.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
> index 6b4b60bf6d..721aa2416a 100644
> --- a/include/qemu/main-loop.h
> +++ b/include/qemu/main-loop.h
> @@ -168,6 +168,20 @@ void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque);
>  /* async I/O support */
>  
>  typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
> +
> +/**
> + * IOCanReadHandler: Return the number of bytes that #IOReadHandler can accept
> + *
> + * This function reports how many bytes #IOReadHandler is prepared to accept.
> + * #IOReadHandler may be invoked with up to this number of bytes.  If this
> + * function returns 0 then #IOReadHandler is not invoked.
> + *
> + * This function is typically called from an event loop.  If the number of
> + * bytes changes outside the event loop (e.g. because a vcpu thread drained the
> + * buffer), then it is necessary to kick the event loop so that this function
> + * is called again.  aio_notify() or qemu_notify_event() can be used to kick
> + * the event loop.
> + */
>  typedef int IOCanReadHandler(void *opaque);
>  
>  /**
> 

Thanks!

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Re: [Qemu-devel] [PATCH] main-loop: document IOCanReadHandler
Posted by Paolo Bonzini 7 years, 8 months ago
On 02/06/2018 10:52, Stefan Hajnoczi wrote:
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  include/qemu/main-loop.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
> index 6b4b60bf6d..721aa2416a 100644
> --- a/include/qemu/main-loop.h
> +++ b/include/qemu/main-loop.h
> @@ -168,6 +168,20 @@ void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque);
>  /* async I/O support */
>  
>  typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
> +
> +/**
> + * IOCanReadHandler: Return the number of bytes that #IOReadHandler can accept
> + *
> + * This function reports how many bytes #IOReadHandler is prepared to accept.
> + * #IOReadHandler may be invoked with up to this number of bytes.  If this
> + * function returns 0 then #IOReadHandler is not invoked.
> + *
> + * This function is typically called from an event loop.  If the number of
> + * bytes changes outside the event loop (e.g. because a vcpu thread drained the
> + * buffer), then it is necessary to kick the event loop so that this function
> + * is called again.  aio_notify() or qemu_notify_event() can be used to kick
> + * the event loop.
> + */
>  typedef int IOCanReadHandler(void *opaque);
>  
>  /**
> 

Queued, thanks.

Paolo