[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tools/libs/evtchn: Deduplicate xenevtchn_fd()


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 10 Jan 2022 12:36:54 +0000
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Mon, 10 Jan 2022 12:37:20 +0000
  • Ironport-data: A9a23:aQe7Ga4ge6HOYj0aeB42CAxRtP7AchMFZxGqfqrLsTDasY5as4F+v jRMW2GFb/uDNmD9eN50aoTnoEtSusXTmN9rS1A9pXoyHi5G8cbLO4+Ufxz6V8+wwmwvb67FA +E2MISowBUcFyeEzvuV3zyIQUBUjclkfJKlYAL/En03FV8MpBsJ00o5wbZg29Yw27BVPivW0 T/Mi5yHULOa82Yc3lI8s8pvfzs24ZweEBtB1rAPTagjUG32zhH5P7pGTU2FFFPqQ5E8IwKPb 72rIIdVXI/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8CbP2lS2Pc0MC9qZzu1c99Zy PJml6GpRx8QMJLGpuhFbwd1PCRABPgTkFPHCSDXXc27ykTHdz3nwul0DVFwNoodkgp1KTgQr 7pCcmlLN03dwbLtqF64YrAEasALBc/nJo4A/FpnyinUF60OSpHfWaTao9Rf2V/cg+gQRKiCP ZNAOVKDajzQe01gNAonCKthkem030DtSyJ58FS88P9fD2/7k1UqjemF3MDuUt6FX8JOhW6Du 3nLuW/+B3kyJNGZjDaI7H+oruvOhj/gHpIfEqWi8fxni0HVwXYcYCD6TnPi/6P/0BTnHYsCd QpEoULCsJTe6mSrafLfYgS2uEeKgRQiV4JsDcAV7T+0n/+8DxmiOkAISTtIadoDvcAwRCA32 lLho+4FFQC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DnoiV5An/SMHQKNufiOpQijFBa8gD FrpySETOCSEpQYqchOr5G16hdKRsrhdqXHoYYYSr98nGD7NtRaOWeDElR7m9+uIva+0KbbJa4Q WNBKBN74SP6g455G3SV5fn5fld5Z1qAhDXUT+bAniy/zLBOE5ClwE5l8PN7UabOMSrLdjWQsw8 Aonuyjiwhshss6Ne6zEo2gdeW4eF94C0HjJFcfYoJ6yn5K8lbTjOPtHxZpNiAL+eCYdlH2hnsc yH2UXzCbtWxFypxwCrogFfcR
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxxxx>
---
CC: Anthony PERARD <anthony.perard@xxxxxxxxxx>
CC: Juergen Gross <jgross@xxxxxxxx>
---
 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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.