From 0349cf637f64a5128846c79d9537849e1ed3e1cc Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 30 Jan 2025 17:52:11 +1100 Subject: 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 Signed-off-by: Stefano Brivio --- util.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'util.c') diff --git a/util.c b/util.c index 11973c4..c7b09f0 100644 --- a/util.c +++ b/util.c @@ -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); +} -- cgit v1.2.3