diff options
author | swapnili <swapnil.ingle@nutanix.com> | 2020-12-10 12:50:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-10 12:50:54 +0100 |
commit | b40603643660299dd4ba0fd9521e282a0af98f81 (patch) | |
tree | f410cc58b448cbbb64d1f27dbd5ee06527c18b5f /include | |
parent | becb165b321b66fa3465d0d4a6d74316044188b4 (diff) | |
download | libvfio-user-b40603643660299dd4ba0fd9521e282a0af98f81.zip libvfio-user-b40603643660299dd4ba0fd9521e282a0af98f81.tar.gz libvfio-user-b40603643660299dd4ba0fd9521e282a0af98f81.tar.bz2 |
Drop vfu_ctx_drive() and use vfu_ctx_poll() (#178)
* Drop vfu_ctx_drive() and use vfu_run_ctx()
Renamed vfu_ctx_poll() to vfu_run_ctx().
Updated vfu_run_ctx() to also handle blocking ctx.
Instead of having separate functions for blocking and
non-blocking ctx, better to have one.
This way user can call same set of functions for both cases.
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libvfio-user.h | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/include/libvfio-user.h b/include/libvfio-user.h index c0636ae..773ba1f 100644 --- a/include/libvfio-user.h +++ b/include/libvfio-user.h @@ -436,31 +436,21 @@ void vfu_destroy_ctx(vfu_ctx_t *vfu_ctx); /** - * Once the vfu_ctx is configured vfu_ctx_drive() drives it. This function waits - * for commands coming from the client, and processes them in a loop. - * - * @vfu_ctx: the libvfio-user context to drive - * - * @returns 0 on success, -errno on failure. - */ -int -vfu_ctx_drive(vfu_ctx_t *vfu_ctx); - -/** - * Polls, without blocking, an vfu_ctx. This is an alternative to using - * a thread and making a blocking call to vfu_ctx_drive(). Instead, the - * application can periodically poll the context directly from one of - * its own threads. - * - * This is only allowed when LIBVFIO_USER_FLAG_ATTACH_NB is specified during - * creation. + * Polls the vfu_ctx and processes the command recieved from client. + * - Blocking vfu_ctx: + * Blocks until new request is received from client and continues processing + * the requests. Exits only in case of error or if the client disconnects. + * - Non-blocking vfu_ctx(LIBVFIO_USER_FLAG_ATTACH_NB): + * Processes one request from client if it's available, otherwise it + * immediatelly returns and the caller is responsible for periodically + * calling again. * * @vfu_ctx: The libvfio-user context to poll * * @returns 0 on success, -errno on failure. */ int -vfu_ctx_poll(vfu_ctx_t *vfu_ctx); +vfu_run_ctx(vfu_ctx_t *vfu_ctx); /** * Triggers an interrupt. @@ -617,7 +607,7 @@ vfu_realize_ctx(vfu_ctx_t *vfu_ctx); /* * Attempts to attach to the transport. Attach is mandatory before - * vfu_ctx_drive() or vfu_ctx_poll() and is non blocking if context is created + * vfu_run_ctx() and is non blocking if context is created * with LIBVFIO_USER_FLAG_ATTACH_NB flag. * Returns client's file descriptor on success and -1 on error. If errno is * set to EAGAIN or EWOULDBLOCK then the transport is not ready to attach to and |