diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2021-01-13 13:39:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-13 13:39:36 +0000 |
commit | ae4c7c829b5791629e3b711aff05a528ce2a1a00 (patch) | |
tree | 45407aef3cc33a852261c6770396f523cc8386a5 | |
parent | 9ce88433cc185866519fb0ec3ef84d99db739b9f (diff) | |
download | libvfio-user-ae4c7c829b5791629e3b711aff05a528ce2a1a00.zip libvfio-user-ae4c7c829b5791629e3b711aff05a528ce2a1a00.tar.gz libvfio-user-ae4c7c829b5791629e3b711aff05a528ce2a1a00.tar.bz2 |
make vfu_region_to_offset public (#228)
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
-rw-r--r-- | include/libvfio-user.h | 10 | ||||
-rw-r--r-- | lib/libvfio-user.c | 6 |
2 files changed, 16 insertions, 0 deletions
diff --git a/include/libvfio-user.h b/include/libvfio-user.h index d74087e..2bf0cd1 100644 --- a/include/libvfio-user.h +++ b/include/libvfio-user.h @@ -644,6 +644,16 @@ size_t vfu_pci_find_next_capability(vfu_ctx_t *vfu_ctx, bool extended, size_t pos, int cap_id); +/** + * Returns the memory offset where the specific region starts in device memory. + * + * @region: the region to translate + * + * @returns the absolute offset + */ +uint64_t +vfu_region_to_offset(uint32_t region); + #ifdef __cplusplus } #endif diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c index 2b95b43..5c78a36 100644 --- a/lib/libvfio-user.c +++ b/lib/libvfio-user.c @@ -1482,4 +1482,10 @@ vfu_dma_write(vfu_ctx_t *vfu_ctx, dma_sg_t *sg, void *data) return ret; } +uint64_t +vfu_region_to_offset(uint32_t region) +{ + return region_to_offset(region); +} + /* ex: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: */ |