diff options
author | John Levon <john.levon@nutanix.com> | 2021-03-23 15:30:25 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-23 15:30:25 +0000 |
commit | 9ed4c9e8c86ec04cbae067db18e1d31dd5f2ca79 (patch) | |
tree | 3179a0a18319c3e863bd01c334de8a8fc7c68ab2 /test/mocks.h | |
parent | 8ba55dfb9bb54b773513e78d87d9ebe078384573 (diff) | |
download | libvfio-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 'test/mocks.h')
-rw-r--r-- | test/mocks.h | 48 |
1 files changed, 6 insertions, 42 deletions
diff --git a/test/mocks.h b/test/mocks.h index 1bc6983..b005af6 100644 --- a/test/mocks.h +++ b/test/mocks.h @@ -29,6 +29,8 @@ */ #include <stdbool.h> +#include <sys/socket.h> + #include "private.h" void unpatch_all(void); @@ -37,51 +39,13 @@ void patch(void *fn); bool is_patched(void *fn); -bool -__real_cmd_allowed_when_stopped_and_copying(u_int16_t cmd); - -int -handle_dirty_pages(vfu_ctx_t *vfu_ctx, uint32_t size, - struct iovec **iovecs, size_t *nr_iovecs, - struct vfio_iommu_type1_dirty_bitmap *dirty_bitmap); - -int -__real_handle_dirty_pages(vfu_ctx_t *vfu_ctx, uint32_t size, - struct iovec **iovecs, size_t *nr_iovecs, - struct vfio_iommu_type1_dirty_bitmap *dirty_bitmap); - -int -__real_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, close, int fd); -int -__real_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); - -bool -__real_device_is_stopped(struct migration *migr); - -int -__real_exec_command(vfu_ctx_t *vfu_ctx, struct vfio_user_header *hdr, - size_t size, int *fds, size_t *nr_fds, size_t **fds_out, - int *nr_fds_out, struct iovec *_iovecs, struct iovec **iovecs, - size_t *nr_iovecs, bool *free_iovec_data); -int -__real_close(int fd); - -void -__real_free(void *ptr); - -int -__real_process_request(vfu_ctx_t *vfu_ctx); +MOCKED(void, free, void *); -bool -__real_device_is_stopped_and_copying(struct migration *migration); +MOCKED(int, bind, int sockfd, const struct sockaddr *addr, socklen_t addrlen); -bool -__real_should_exec_command(vfu_ctx_t *vfu_ctx, uint16_t cmd); +MOCKED(int, listen, int sockfd, int backlog); int mock_unmap_dma(vfu_ctx_t *vfu_ctx, uint64_t iova, uint64_t len); |