aboutgitcodebugslistschat
path: root/vu_common.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2025-01-30 17:52:11 +1100
committerStefano Brivio <sbrivio@redhat.com>2025-02-03 07:32:51 +0100
commit0349cf637f64a5128846c79d9537849e1ed3e1cc (patch)
treeb66e907e90ccea5a8527397b67a5670a40fb28d5 /vu_common.c
parent10c4a9e1b383becd7366bda986f886675f7c4cb2 (diff)
downloadpasst-0349cf637f64a5128846c79d9537849e1ed3e1cc.tar
passt-0349cf637f64a5128846c79d9537849e1ed3e1cc.tar.gz
passt-0349cf637f64a5128846c79d9537849e1ed3e1cc.tar.bz2
passt-0349cf637f64a5128846c79d9537849e1ed3e1cc.tar.lz
passt-0349cf637f64a5128846c79d9537849e1ed3e1cc.tar.xz
passt-0349cf637f64a5128846c79d9537849e1ed3e1cc.tar.zst
passt-0349cf637f64a5128846c79d9537849e1ed3e1cc.zip
util: Rename and make global vu_remove_watch()
vu_remove_watch() is used in vhost_user.c to remove an fd from the global epoll set. There's nothing really vhost user specific about it though, so rename, move to util.c and use it in a bunch of places outside vhost_user.c where it makes things marginally more readable. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'vu_common.c')
-rw-r--r--vu_common.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/vu_common.c b/vu_common.c
index f43d8ac..2c12dca 100644
--- a/vu_common.c
+++ b/vu_common.c
@@ -325,8 +325,7 @@ void vu_migrate(struct vu_dev *vdev, uint32_t events)
/* value to be returned by VHOST_USER_CHECK_DEVICE_STATE */
vdev->device_state_result = ret == -1 ? -1 : 0;
/* Closing the file descriptor signals the end of transfer */
- epoll_ctl(vdev->context->epollfd, EPOLL_CTL_DEL,
- vdev->device_state_fd, NULL);
+ epoll_del(vdev->context, vdev->device_state_fd);
close(vdev->device_state_fd);
vdev->device_state_fd = -1;
} else if (events & EPOLLIN) {
@@ -346,8 +345,7 @@ void vu_migrate(struct vu_dev *vdev, uint32_t events)
debug("Closing migration channel");
/* The end of file signals the end of the transfer. */
- epoll_ctl(vdev->context->epollfd, EPOLL_CTL_DEL,
- vdev->device_state_fd, NULL);
+ epoll_del(vdev->context, vdev->device_state_fd);
close(vdev->device_state_fd);
vdev->device_state_fd = -1;
}