aboutsummaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2020-11-16 04:47:56 -0500
committerThanos Makatos <thanos.makatos@nutanix.com>2020-11-16 07:49:05 -0500
commit787e82f0d3e0379d30a2bd4e8ea7b1814b435f33 (patch)
tree0a5a84bcbcc9249968507780b41be6415a19a995 /samples
parent7b31d499d19695112ae17a568ceb6d524c9af1b9 (diff)
downloadlibvfio-user-787e82f0d3e0379d30a2bd4e8ea7b1814b435f33.zip
libvfio-user-787e82f0d3e0379d30a2bd4e8ea7b1814b435f33.tar.gz
libvfio-user-787e82f0d3e0379d30a2bd4e8ea7b1814b435f33.tar.bz2
eliminate duplicate recv(2) code
Instead of having each command handler do its own recv(2) to receive the command, we do this once for all commands. This reduces the code a bit. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples')
-rw-r--r--samples/client.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/samples/client.c b/samples/client.c
index ba62ba1..e49230b 100644
--- a/samples/client.c
+++ b/samples/client.c
@@ -229,6 +229,12 @@ static int get_device_info(int sock, struct vfio_device_info *dev_info)
return ret;
}
+ if (dev_info->num_regions != 10) {
+ fprintf(stderr, "bad number of device regions %d\n",
+ dev_info->num_regions);
+ return -EINVAL;
+ }
+
printf("devinfo: flags %#x, num_regions %d, num_irqs %d\n",
dev_info->flags, dev_info->num_regions, dev_info->num_irqs);
return 0;