1
0
Fork 0
mirror of https://passt.top/passt synced 2025-07-30 21:08:01 +02:00

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>
This commit is contained in:
David Gibson 2025-01-30 17:52:11 +11:00 committed by Stefano Brivio
commit 0349cf637f
9 changed files with 25 additions and 27 deletions

10
util.c
View file

@ -837,3 +837,13 @@ void raw_random(void *buf, size_t buflen)
if (random_read < buflen)
die("Unexpected EOF on random data source");
}
/**
* epoll_del() - Remove a file descriptor from our passt epoll
* @c: Execution context
* @fd: File descriptor to remove
*/
void epoll_del(const struct ctx *c, int fd)
{
epoll_ctl(c->epollfd, EPOLL_CTL_DEL, fd, NULL);
}