aboutsummaryrefslogtreecommitdiff
path: root/lib/dma.h
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-03-23 15:30:25 +0000
committerGitHub <noreply@github.com>2021-03-23 15:30:25 +0000
commit9ed4c9e8c86ec04cbae067db18e1d31dd5f2ca79 (patch)
tree3179a0a18319c3e863bd01c334de8a8fc7c68ab2 /lib/dma.h
parent8ba55dfb9bb54b773513e78d87d9ebe078384573 (diff)
downloadlibvfio-user-9ed4c9e8c86ec04cbae067db18e1d31dd5f2ca79.zip
libvfio-user-9ed4c9e8c86ec04cbae067db18e1d31dd5f2ca79.tar.gz
libvfio-user-9ed4c9e8c86ec04cbae067db18e1d31dd5f2ca79.tar.bz2
add -Wmissing-declarations (#399)
This is used by SPDK, and it's generally useful. This also uncovered some issues in the test mocking. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Diffstat (limited to 'lib/dma.h')
-rw-r--r--lib/dma.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/dma.h b/lib/dma.h
index 7ff2828..3f94945 100644
--- a/lib/dma.h
+++ b/lib/dma.h
@@ -116,15 +116,15 @@ dma_controller_destroy(dma_controller_t *dma);
* where this region would have been mapped to if the call could succeed
* (e.g. due to conflict with existing region).
*/
-int
-dma_controller_add_region(dma_controller_t *dma,
- dma_addr_t dma_addr, size_t size,
- int fd, off_t offset, uint32_t prot);
+MOCKED(int, dma_controller_add_region, dma_controller_t *dma,
+ dma_addr_t dma_addr, size_t size, int fd, off_t offset, uint32_t prot);
-int
-dma_controller_remove_region(dma_controller_t *dma,
- dma_addr_t dma_addr, size_t size,
- vfu_unmap_dma_cb_t *unmap_dma, void *data);
+MOCKED(void, _dma_controller_do_remove_region, dma_controller_t *dma,
+ dma_memory_region_t *region);
+
+MOCKED(int, dma_controller_remove_region, dma_controller_t *dma,
+ dma_addr_t dma_addr, size_t size, vfu_unmap_dma_cb_t *unmap_dma,
+ void *data);
// Helper for dma_addr_to_sg() slow path.
int
@@ -250,9 +250,8 @@ dma_addr_to_sg(const dma_controller_t *dma,
return cnt;
}
-void *
-dma_map_region(dma_memory_region_t *region, int prot,
- size_t offset, size_t len);
+MOCKED(void *, dma_map_region, dma_memory_region_t *region, int prot,
+ size_t offset, size_t len);
int
dma_unmap_region(dma_memory_region_t *region, void *virt_addr, size_t len);