aboutsummaryrefslogtreecommitdiff
path: root/test/mocks.c
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2021-03-04 16:23:45 +0000
committerGitHub <noreply@github.com>2021-03-04 16:23:45 +0000
commita8242d117118d5191dad69a96e28a21d66fe8b50 (patch)
tree0e68a9f63e7bdb7933a732f90edaed2ca9e9b16c /test/mocks.c
parentb0cebe8340579c0a31b95af1e07bb7d214ac79c8 (diff)
downloadlibvfio-user-a8242d117118d5191dad69a96e28a21d66fe8b50.zip
libvfio-user-a8242d117118d5191dad69a96e28a21d66fe8b50.tar.gz
libvfio-user-a8242d117118d5191dad69a96e28a21d66fe8b50.tar.bz2
don't munmap(2) unmapped DMA region (#384)
Plus always notify user when DMA region is removed. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
Diffstat (limited to 'test/mocks.c')
-rw-r--r--test/mocks.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/mocks.c b/test/mocks.c
index 0d63ed1..df10147 100644
--- a/test/mocks.c
+++ b/test/mocks.c
@@ -271,6 +271,16 @@ __wrap_handle_dirty_pages(vfu_ctx_t *vfu_ctx, uint32_t size,
return mock();
}
+/* Always mocked. */
+int
+mock_unmap_dma(vfu_ctx_t *vfu_ctx, uint64_t iova, uint64_t len)
+{
+ check_expected(vfu_ctx);
+ check_expected(iova);
+ check_expected(len);
+ return mock();
+}
+
/* FIXME should be something faster than unsorted array, look at tsearch(3). */
static struct function funcs[] = {
{.addr = &__wrap_dma_controller_add_region},