diff options
author | Daniel Berrangé <berrange@redhat.com> | 2022-04-28 12:38:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-28 12:38:46 +0100 |
commit | 418f58bfc8c23ebcf0deb3bb85967587fa51acf7 (patch) | |
tree | 37a7e29f0eba68c9b865961586eb6718fb1f3f92 /test/py | |
parent | 4ba8cde7c5417cfb11e1fc5d1d188f6a4f9a35d5 (diff) | |
download | libvfio-user-418f58bfc8c23ebcf0deb3bb85967587fa51acf7.zip libvfio-user-418f58bfc8c23ebcf0deb3bb85967587fa51acf7.tar.gz libvfio-user-418f58bfc8c23ebcf0deb3bb85967587fa51acf7.tar.bz2 |
lib: export dma_sg_size symbol in library (#664)
The dma_sg_size() method is listed in libvfio-user.h but the symbol
is marked private in the ELF library.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'test/py')
-rw-r--r-- | test/py/libvfio_user.py | 5 | ||||
-rw-r--r-- | test/py/test_map_unmap_sg.py | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/test/py/libvfio_user.py b/test/py/libvfio_user.py index c96b1bc..e8a7e68 100644 --- a/test/py/libvfio_user.py +++ b/test/py/libvfio_user.py @@ -613,6 +613,7 @@ lib.vfu_setup_device_dma.argtypes = (c.c_void_p, vfu_dma_register_cb_t, vfu_dma_unregister_cb_t) lib.vfu_setup_device_migration_callbacks.argtypes = (c.c_void_p, c.POINTER(vfu_migration_callbacks_t), c.c_uint64) +lib.dma_sg_size.restype = (c.c_size_t) lib.vfu_addr_to_sg.argtypes = (c.c_void_p, c.c_void_p, c.c_size_t, c.POINTER(dma_sg_t), c.c_int, c.c_int) lib.vfu_map_sg.argtypes = (c.c_void_p, c.POINTER(dma_sg_t), c.POINTER(iovec_t), @@ -1145,6 +1146,10 @@ def vfu_setup_device_migration_callbacks(ctx, cbs=None, offset=0x4000): return lib.vfu_setup_device_migration_callbacks(ctx, cbs, offset) +def dma_sg_size(): + return lib.dma_sg_size() + + def vfu_addr_to_sg(ctx, dma_addr, length, max_sg=1, prot=(mmap.PROT_READ | mmap.PROT_WRITE)): assert ctx is not None diff --git a/test/py/test_map_unmap_sg.py b/test/py/test_map_unmap_sg.py index fa98159..fd606f4 100644 --- a/test/py/test_map_unmap_sg.py +++ b/test/py/test_map_unmap_sg.py @@ -35,6 +35,11 @@ import tempfile ctx = None +def test_dma_sg_size(): + size = dma_sg_size() + assert size == len(dma_sg_t()) + + def test_map_sg_with_invalid_region(): global ctx |