aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-07-14 12:33:20 +0100
committerGitHub <noreply@github.com>2021-07-14 12:33:20 +0100
commit2a0a92912d598de871ab47c034432c5fa6546dc4 (patch)
tree7c33b0f6350fe6e2cce0434dd2bfe9b9631b4dca /include
parent561b3092c73b1b45756630fac73b182a3de0fdff (diff)
downloadlibvfio-user-2a0a92912d598de871ab47c034432c5fa6546dc4.zip
libvfio-user-2a0a92912d598de871ab47c034432c5fa6546dc4.tar.gz
libvfio-user-2a0a92912d598de871ab47c034432c5fa6546dc4.tar.bz2
check for valid vfu_setup_region() flags (#579)
Complain about a region that isn't readable *or* writable, or any unknown flags. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'include')
-rw-r--r--include/libvfio-user.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/include/libvfio-user.h b/include/libvfio-user.h
index 4b08c22..f91f3c7 100644
--- a/include/libvfio-user.h
+++ b/include/libvfio-user.h
@@ -217,11 +217,14 @@ typedef ssize_t (vfu_region_access_cb_t)(vfu_ctx_t *vfu_ctx, char *buf,
size_t count, loff_t offset,
bool is_write);
-#define VFU_REGION_FLAG_READ (1 << 0)
-#define VFU_REGION_FLAG_WRITE (1 << 1)
-#define VFU_REGION_FLAG_RW (VFU_REGION_FLAG_READ | VFU_REGION_FLAG_WRITE)
-#define VFU_REGION_FLAG_MEM (1 << 2) // if unset, bar is IO
-#define VFU_REGION_FLAG_ALWAYS_CB (1 << 3)
+#define VFU_REGION_FLAG_READ (1 << 0)
+#define VFU_REGION_FLAG_WRITE (1 << 1)
+#define VFU_REGION_FLAG_RW (VFU_REGION_FLAG_READ | VFU_REGION_FLAG_WRITE)
+/* If unset, this is an IO region. */
+#define VFU_REGION_FLAG_MEM (1 << 2)
+#define VFU_REGION_FLAG_ALWAYS_CB (1 << 3)
+#define VFU_REGION_FLAG_MASK (VFU_REGION_FLAG_RW | VFU_REGION_FLAG_MEM | \
+ VFU_REGION_FLAG_ALWAYS_CB)
/**
* Set up a device region.