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 <andrew.cooper3@citrix.com>
---
CC: Anthony PERARD <anthony.perard@citrix.com>
CC: Juergen Gross <jgross@suse.com>
---
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 c402d9393b65..de925fc9630c 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 7427ab240860..c4d075350b5e 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 f27b6def39ef..e61b77ca618a 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 e5dfdc5ef52e..8f84048b11f0 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 1cebc21ffce0..0b223c4beb26 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 df9579df1778..7fef88a73e79 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.11.0