aboutsummaryrefslogtreecommitdiff
path: root/test/mocks.h
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-03-31 16:49:52 +0100
committerGitHub <noreply@github.com>2021-03-31 16:49:52 +0100
commit14b237fc80473bf4419a2bccda4cf7e7d382c174 (patch)
tree959e0cc1c4d2557f624df6fa5c189a8cdc92993f /test/mocks.h
parent0ae00cbb9edcc3879b1276cd61479d668a7f1ec9 (diff)
downloadlibvfio-user-14b237fc80473bf4419a2bccda4cf7e7d382c174.zip
libvfio-user-14b237fc80473bf4419a2bccda4cf7e7d382c174.tar.gz
libvfio-user-14b237fc80473bf4419a2bccda4cf7e7d382c174.tar.bz2
rework DMA callbacks (#396)
This fixes a number of issues with how DMA is handled, based on some changes by Thanos Makatos: - rename callbacks to register/unregister, as there is not necessarily any mapping - provide the (large) page-aligned mapped start and size, the page size used, as well as the protection flags: some API users need these - for convenience, provide the virtual address separately that corresponds to the mapped region - we should only require a DMA controller to use vfu_addr_to_sg(), not an unregister callback - the callbacks should return errno not -errno - region removal was incorrectly updating the region array - various other cleanups and clarifications Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'test/mocks.h')
-rw-r--r--test/mocks.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/test/mocks.h b/test/mocks.h
index 4ffe047..496cc54 100644
--- a/test/mocks.h
+++ b/test/mocks.h
@@ -28,16 +28,14 @@
*
*/
-#include <stdbool.h>
-#include <sys/socket.h>
-
#include "private.h"
-void patch(const char *func);
-
void unpatch_all(void);
-int
-mock_unmap_dma(vfu_ctx_t *vfu_ctx, uint64_t iova, uint64_t len);
+void patch(const char *name);
+
+void mock_dma_register(vfu_ctx_t *vfu_ctx, vfu_dma_info_t *info);
+
+int mock_dma_unregister(vfu_ctx_t *vfu_ctx, vfu_dma_info_t *info);
/* ex: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: */