From 2e8aa1663c76a189998bf51b869b9e468c992c89 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Mon, 10 Jan 2022 12:29:05 +0000 Subject: [PATCH] tools/libs/evtchn: Deduplicate xenevtchn_fd() struct xenevtchn_handle is common in private.h, meaning that xenevtchn_fd() has exactly one correct implementation. Implement it in core.c, rather than identically for each OS. This matches all other libraries (call, gnttab, gntshr) which implement an fd getter. Signed-off-by: Andrew Cooper Reviewed-by: Juergen Gross --- tools/libs/evtchn/core.c | 5 +++++ tools/libs/evtchn/freebsd.c | 5 ----- tools/libs/evtchn/linux.c | 5 ----- tools/libs/evtchn/minios.c | 5 ----- tools/libs/evtchn/netbsd.c | 5 ----- tools/libs/evtchn/solaris.c | 5 ----- 6 files changed, 5 insertions(+), 25 deletions(-) diff --git a/tools/libs/evtchn/core.c b/tools/libs/evtchn/core.c index c402d9393b..de925fc963 100644 --- a/tools/libs/evtchn/core.c +++ b/tools/libs/evtchn/core.c @@ -120,6 +120,11 @@ int xenevtchn_close(xenevtchn_handle *xce) return rc; } +int xenevtchn_fd(xenevtchn_handle *xce) +{ + return xce->fd; +} + int xenevtchn_restrict(xenevtchn_handle *xce, domid_t domid) { return osdep_evtchn_restrict(xce, domid); diff --git a/tools/libs/evtchn/freebsd.c b/tools/libs/evtchn/freebsd.c index 7427ab2408..c4d075350b 100644 --- a/tools/libs/evtchn/freebsd.c +++ b/tools/libs/evtchn/freebsd.c @@ -63,11 +63,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid) return -1; } -int xenevtchn_fd(xenevtchn_handle *xce) -{ - return xce->fd; -} - int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port) { int fd = xce->fd; diff --git a/tools/libs/evtchn/linux.c b/tools/libs/evtchn/linux.c index f27b6def39..e61b77ca61 100644 --- a/tools/libs/evtchn/linux.c +++ b/tools/libs/evtchn/linux.c @@ -66,11 +66,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid) return ioctl(xce->fd, IOCTL_EVTCHN_RESTRICT_DOMID, &restrict_domid); } -int xenevtchn_fd(xenevtchn_handle *xce) -{ - return xce->fd; -} - int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port) { int fd = xce->fd; diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c index e5dfdc5ef5..8f84048b11 100644 --- a/tools/libs/evtchn/minios.c +++ b/tools/libs/evtchn/minios.c @@ -112,11 +112,6 @@ void minios_evtchn_close_fd(int fd) files[fd].type = FTYPE_NONE; } -int xenevtchn_fd(xenevtchn_handle *xce) -{ - return xce->fd; -} - int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port) { int ret; diff --git a/tools/libs/evtchn/netbsd.c b/tools/libs/evtchn/netbsd.c index 1cebc21ffc..0b223c4beb 100644 --- a/tools/libs/evtchn/netbsd.c +++ b/tools/libs/evtchn/netbsd.c @@ -58,11 +58,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid) return -1; } -int xenevtchn_fd(xenevtchn_handle *xce) -{ - return xce->fd; -} - int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port) { int fd = xce->fd; diff --git a/tools/libs/evtchn/solaris.c b/tools/libs/evtchn/solaris.c index df9579df17..7fef88a73e 100644 --- a/tools/libs/evtchn/solaris.c +++ b/tools/libs/evtchn/solaris.c @@ -57,11 +57,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid) return -1; } -int xenevtchn_fd(xenevtchn_handle *xce) -{ - return xce->fd; -} - int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port) { int fd = xce->fd; -- 2.30.2