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 /test/mocks.c | |
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 'test/mocks.c')
-rw-r--r-- | test/mocks.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/mocks.c b/test/mocks.c index ac0a986..204ae75 100644 --- a/test/mocks.c +++ b/test/mocks.c @@ -37,6 +37,7 @@ #include "mocks.h" #include "dma.h" #include "migration.h" +#include "../lib/private.h" struct function { @@ -147,6 +148,18 @@ __wrap_free(void *ptr) check_expected(ptr); } +int +__wrap_process_request(vfu_ctx_t *vfu_ctx) +{ + + if (!is_patched(process_request)) { + return __real_process_request(vfu_ctx); + } + check_expected(vfu_ctx); + + return mock(); +} + /* FIXME should be something faster than unsorted array, look at tsearch(3). */ static struct function funcs[] = { {.addr = &__wrap_dma_controller_add_region}, @@ -157,7 +170,8 @@ static struct function funcs[] = { {.addr = &__wrap_exec_command}, {.addr = &__wrap_close}, {.addr = &__wrap_vfu_send_iovec}, - {.addr = &__wrap_free} + {.addr = &__wrap_free}, + {.addr = &__wrap_process_request} }; static struct function* |