tools/libs/evtchn: Deduplicate xenevtchn_fd()
PATCH 1/1 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 <[email protected]>
---
CC: Anthony PERARD <[email protected]>
CC: Juergen Gross <[email protected]>
--- 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(-)
tools/libs/evtchn/core.c +5 -0
@@ -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);
tools/libs/evtchn/freebsd.c +0 -5
@@ -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;
tools/libs/evtchn/linux.c +0 -5
@@ -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;
tools/libs/evtchn/minios.c +0 -5
@@ -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;
tools/libs/evtchn/netbsd.c +0 -5
@@ -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;
tools/libs/evtchn/solaris.c +0 -5
@@ -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;
Signature · 1 line
2.11.0
Quoted 7 lines · Andrew Cooper
struct
xenevtchn_handleis common inprivate.h, meaning thatxenevtchn_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 <[email protected]>
Oh, indeed.
Reviewed-by Juergen Gross <[email protected]>
Juergen