aboutsummaryrefslogtreecommitdiff
path: root/samples/client.c
diff options
context:
space:
mode:
authorSwapnil Ingle <swapnil.ingle@nutanix.com>2020-09-28 07:29:00 -0400
committerSwapnil Ingle <swapnil.ingle@nutanix.com>2020-09-29 11:38:41 -0400
commitf8a57a5e1a598776019f251eadff12317a48f725 (patch)
treeb25199291646eda23dd7389fbaaaf908413e1703 /samples/client.c
parent2ea402b215f89a29a8e5163749456588856cf9c9 (diff)
downloadlibvfio-user-f8a57a5e1a598776019f251eadff12317a48f725.zip
libvfio-user-f8a57a5e1a598776019f251eadff12317a48f725.tar.gz
libvfio-user-f8a57a5e1a598776019f251eadff12317a48f725.tar.bz2
Keep client dev_info for further use
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Diffstat (limited to 'samples/client.c')
-rw-r--r--samples/client.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/samples/client.c b/samples/client.c
index 1a336373..23ffcbc 100644
--- a/samples/client.c
+++ b/samples/client.c
@@ -104,19 +104,18 @@ out:
return ret;
}
-static int
-get_device_info(int sock)
+static int get_device_info(int sock, struct vfio_device_info *dev_info)
{
- struct vfio_device_info dev_info = {
- .argsz = sizeof(dev_info)
- };
+ struct vfio_user_header hdr;
+ int dev_info_sz = sizeof(*dev_info);
uint16_t msg_id;
int ret;
- int size = sizeof dev_info;
+ dev_info->argsz = dev_info_sz;
msg_id = 1;
ret = send_recv_vfio_user_msg(sock, msg_id, VFIO_USER_DEVICE_GET_INFO,
- &dev_info, size, NULL, 0, NULL, &dev_info, size);
+ dev_info, dev_info_sz, NULL, 0, NULL,
+ &dev_info, dev_info_sz);
if (ret < 0) {
fprintf(stderr, "failed to get device info: %s\n", strerror(-ret));
return ret;
@@ -234,8 +233,8 @@ access_bar0(int sock)
int main(int argc, char *argv[])
{
int ret, sock;
-
struct vfio_user_dma_region *dma_regions;
+ struct vfio_device_info client_dev_info = {0};
int *dma_region_fds;
uint16_t msg_id = 1;
int i;
@@ -265,7 +264,7 @@ int main(int argc, char *argv[])
}
/* XXX VFIO_USER_DEVICE_GET_INFO */
- ret = get_device_info(sock);
+ ret = get_device_info(sock, &client_dev_info);
if (ret < 0) {
return ret;
}