diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2021-02-10 09:08:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-10 09:08:10 +0000 |
commit | 365ca96a97740332d3633090d850222d10bc9d70 (patch) | |
tree | bd9885cd57351c05ac12d63ef51a4e4e5b3eef7d /test/mocks.c | |
parent | c5d11659c95c995acb77a71fe03c38b240ca43d9 (diff) | |
download | libvfio-user-365ca96a97740332d3633090d850222d10bc9d70.zip libvfio-user-365ca96a97740332d3633090d850222d10bc9d70.tar.gz libvfio-user-365ca96a97740332d3633090d850222d10bc9d70.tar.bz2 |
expose migration region (#305)
This patch exposes the fact that live migration is implemented as a
special device region. Hiding this from the user doesn't offer much
benefit since it only takes just a little bit of extra code for the user
to handle it as a region. We do keep the migration callback
functionality since this feature substantially simplifies supporting
live migration from the device implementation's perspective.
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Co-authored-by: John Levon <john.levon@nutanix.com>
Diffstat (limited to 'test/mocks.c')
-rw-r--r-- | test/mocks.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/mocks.c b/test/mocks.c index c38ec7b..303a6c2 100644 --- a/test/mocks.c +++ b/test/mocks.c @@ -33,6 +33,8 @@ #include <setjmp.h> #include <cmocka.h> #include <stdio.h> +#include <sys/types.h> +#include <sys/socket.h> #include "mocks.h" #include "dma.h" @@ -124,6 +126,10 @@ __wrap_exec_command(vfu_ctx_t *vfu_ctx, struct vfio_user_header *hdr, int __wrap_close(int fd) { + if (!is_patched(close)) { + return __real_close(fd); + } + check_expected(fd); return mock(); } @@ -168,6 +174,19 @@ __wrap_process_request(vfu_ctx_t *vfu_ctx) return mock(); } +int __wrap_bind(int sockfd __attribute__((unused)), + const struct sockaddr *addr __attribute__((unused)), + socklen_t addrlen __attribute__((unused))) +{ + return 0; +} + +int __wrap_listen(int sockfd __attribute__((unused)), + int backlog __attribute__((unused))) +{ + return 0; +} + /* FIXME should be something faster than unsorted array, look at tsearch(3). */ static struct function funcs[] = { {.addr = &__wrap_dma_controller_add_region}, @@ -179,7 +198,9 @@ static struct function funcs[] = { {.addr = &__wrap_close}, {.addr = &__wrap_tran_sock_send_iovec}, {.addr = &__wrap_free}, - {.addr = &__wrap_process_request} + {.addr = &__wrap_process_request}, + {.addr = &__wrap_bind}, + {.addr = &__wrap_listen} }; static struct function* |