aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-08-17 17:08:05 +0100
committerGitHub <noreply@github.com>2021-08-17 17:08:05 +0100
commit46ed1dbd8e692ee53a544022dd70151f21a4e725 (patch)
treef702a1538d0bc001d794c652a6edb189f97fcb48 /include
parentb4760d54d0f75eac27b1439e436eea84c7338bda (diff)
downloadlibvfio-user-46ed1dbd8e692ee53a544022dd70151f21a4e725.zip
libvfio-user-46ed1dbd8e692ee53a544022dd70151f21a4e725.tar.gz
libvfio-user-46ed1dbd8e692ee53a544022dd70151f21a4e725.tar.bz2
fix dma_{map,unmap}_sg() array handling (#586)
Multiple places in dma_map_sg() and dma_unmap_sg() were dereferencing sg[0] instead of the correct index. Take the opportunity to improve the doc comments at the same time. Reported-by: Changpeng Liu <changpeng.liu@intel.com> Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Diffstat (limited to 'include')
-rw-r--r--include/libvfio-user.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/include/libvfio-user.h b/include/libvfio-user.h
index f91f3c7..5e379df 100644
--- a/include/libvfio-user.h
+++ b/include/libvfio-user.h
@@ -624,9 +624,9 @@ int
vfu_irq_trigger(vfu_ctx_t *vfu_ctx, uint32_t subindex);
/**
- * Takes a guest physical address and returns a list of scatter/gather entries
- * than can be individually mapped in the program's virtual memory. A single
- * linear guest physical address span may need to be split into multiple
+ * Takes a guest physical address range and populates an array of scatter/gather
+ * entries than can be individually mapped in the program's virtual memory. A
+ * single linear guest physical address span may need to be split into multiple
* scatter/gather regions due to limitations of how memory can be mapped.
*
* vfu_setup_device_dma() must have been called prior to using this function.
@@ -650,9 +650,9 @@ vfu_addr_to_sg(vfu_ctx_t *vfu_ctx, vfu_dma_addr_t dma_addr, size_t len,
dma_sg_t *sg, int max_sg, int prot);
/**
- * Maps a list scatter/gather entries from the guest's physical address space
- * to the program's virtual memory. It is the caller's responsibility to remove
- * the mappings by calling vfu_unmap_sg().
+ * Maps scatter/gather entries from the guest's physical address space to the
+ * process's virtual memory. It is the caller's responsibility to remove the
+ * mappings by calling vfu_unmap_sg().
*
* This is only supported when a @dma_unregister callback is provided to
* vfu_setup_device_dma().
@@ -660,7 +660,7 @@ vfu_addr_to_sg(vfu_ctx_t *vfu_ctx, vfu_dma_addr_t dma_addr, size_t len,
* @vfu_ctx: the libvfio-user context
* @sg: array of scatter/gather entries returned by vfu_addr_to_sg. These
* entries must not be modified and the array must not be deallocated
- * until vfu_unmap_sg() has been called for each entry.
+ * until vfu_unmap_sg() has been called.
* @iov: array of iovec structures (defined in <sys/uio.h>) to receive each
* mapping
* @cnt: number of scatter/gather entries to map
@@ -673,8 +673,8 @@ vfu_map_sg(vfu_ctx_t *vfu_ctx, dma_sg_t *sg, struct iovec *iov, int cnt,
int flags);
/**
- * Unmaps a list scatter/gather entries (previously mapped by vfu_map_sg()) from
- * the program's virtual memory.
+ * Unmaps scatter/gather entries (previously mapped by vfu_map_sg()) from
+ * the process's virtual memory.
*
* @vfu_ctx: the libvfio-user context
* @sg: array of scatter/gather entries to unmap