# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1291369007 0
# Node ID 3e8cb37144eb01a1ebb843882f4c3f43d0b4bd26
# Parent 03b9f81f1f367a2143e2ef48fd7f2a57b0c47643
libxc: osdep: convert xc_evtchn_{pending,unmask}()
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
diff -r 03b9f81f1f36 -r 3e8cb37144eb tools/libxc/xc_evtchn.c
--- a/tools/libxc/xc_evtchn.c Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_evtchn.c Fri Dec 03 09:36:47 2010 +0000
@@ -112,6 +112,17 @@ int xc_evtchn_unbind(xc_evtchn *xce, evt
return xce->ops->u.evtchn.unbind(xce, xce->ops_handle, port);
}
+evtchn_port_or_error_t
+xc_evtchn_pending(xc_evtchn *xce)
+{
+ return xce->ops->u.evtchn.pending(xce, xce->ops_handle);
+}
+
+int xc_evtchn_unmask(xc_evtchn *xce, evtchn_port_t port)
+{
+ return xce->ops->u.evtchn.unmask(xce, xce->ops_handle, port);
+}
+
/*
* Local variables:
* mode: C
diff -r 03b9f81f1f36 -r 3e8cb37144eb tools/libxc/xc_linux.c
--- a/tools/libxc/xc_linux.c Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_linux.c Fri Dec 03 09:36:47 2010 +0000
@@ -420,20 +420,24 @@ static int linux_evtchn_unbind(xc_evtchn
return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind);
}
-evtchn_port_or_error_t
-xc_evtchn_pending(xc_evtchn *xce)
+static evtchn_port_or_error_t linux_evtchn_pending(xc_evtchn *xce,
xc_osdep_handle h)
{
+ int fd = (int)h;
evtchn_port_t port;
- if ( read_exact(xce->fd, (char *)&port, sizeof(port)) == -1 )
+ if ( read(fd, &port, sizeof(port)) != sizeof(port) )
return -1;
return port;
}
-int xc_evtchn_unmask(xc_evtchn *xce, evtchn_port_t port)
+static int linux_evtchn_unmask(xc_evtchn *xce, xc_osdep_handle h,
evtchn_port_t port)
{
- return write_exact(xce->fd, (char *)&port, sizeof(port));
+ int fd = (int)h;
+
+ if ( write(fd, &port, sizeof(port)) != sizeof(port) )
+ return -1;
+ return 0;
}
static struct xc_osdep_ops linux_evtchn_ops = {
@@ -447,6 +451,8 @@ static struct xc_osdep_ops linux_evtchn_
.bind_interdomain = &linux_evtchn_bind_interdomain,
.bind_virq = &linux_evtchn_bind_virq,
.unbind = &linux_evtchn_unbind,
+ .pending = &linux_evtchn_pending,
+ .unmask = &linux_evtchn_unmask,
},
};
diff -r 03b9f81f1f36 -r 3e8cb37144eb tools/libxc/xc_minios.c
--- a/tools/libxc/xc_minios.c Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_minios.c Fri Dec 03 09:36:47 2010 +0000
@@ -371,22 +371,23 @@ static evtchn_port_or_error_t minios_evt
return port;
}
-evtchn_port_or_error_t xc_evtchn_pending(xc_evtchn *xce)
+static evtchn_port_or_error_t minios_evtchn_pending(xc_evtchn *xce,
xc_osdep_handle h)
{
+ int fd = (int)h;
int i;
unsigned long flags;
evtchn_port_t ret = -1;
local_irq_save(flags);
- files[xce->fd].read = 0;
+ files[fd].read = 0;
for (i = 0; i < MAX_EVTCHN_PORTS; i++) {
- evtchn_port_t port = files[xce->fd].evtchn.ports[i].port;
- if (port != -1 && files[xce->fd].evtchn.ports[i].pending) {
+ evtchn_port_t port = files[fd].evtchn.ports[i].port;
+ if (port != -1 && files[fd].evtchn.ports[i].pending) {
if (ret == -1) {
ret = port;
- files[xce->fd].evtchn.ports[i].pending = 0;
+ files[fd].evtchn.ports[i].pending = 0;
} else {
- files[xce->fd].read = 1;
+ files[fd].read = 1;
break;
}
}
@@ -395,7 +396,7 @@ evtchn_port_or_error_t xc_evtchn_pending
return ret;
}
-int xc_evtchn_unmask(xc_evtchn *xce, evtchn_port_t port)
+static int minios_evtchn_unmask(xc_evtchn *xce, xc_osdep_handle h,
evtchn_port_t port)
{
unmask_evtchn(port);
return 0;
@@ -412,7 +413,9 @@ static struct xc_osdep_ops minios_evtchn
.bind_interdomain = &minios_evtchn_bind_interdomain,
.bind_virq = &minios_evtchn_bind_virq,
.unbind = &minios_evtchn_unbind,
- },
+ .pending = &minios_evtchn_pending,
+ .unmask = &minios_evtchn_unmask,
+ },
};
/* Optionally flush file to disk and discard page cache */
diff -r 03b9f81f1f36 -r 3e8cb37144eb tools/libxc/xc_netbsd.c
--- a/tools/libxc/xc_netbsd.c Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_netbsd.c Fri Dec 03 09:36:47 2010 +0000
@@ -285,20 +285,22 @@ netbsd_evtchn_bind_virq(xc_evtchn *xce,
return bind.port;
}
-evtchn_port_or_error_t
-xc_evtchn_pending(xc_evtchn *xce)
+static evtchn_port_or_error_t
+netbsd_evtchn_pending(xc_evtchn *xce, xc_osdep_handle h)
{
+ int fd = (int)h;
evtchn_port_t port;
- if ( read_exact(xce->fd, (char *)&port, sizeof(port)) == -1 )
+ if ( read_exact(fd, (char *)&port, sizeof(port)) == -1 )
return -1;
return port;
}
-int xc_evtchn_unmask(xc_evtchn *xce, evtchn_port_t port)
+static int netbsd_evtchn_unmask(xc_evtchn *xce, xc_osdep_handle h,
evtchn_port_t port)
{
- return write_exact(xce->fd, (char *)&port, sizeof(port));
+ int fd = (int)h;
+ return write_exact(fd, (char *)&port, sizeof(port));
}
static struct xc_osdep_ops netbsd_evtchn_ops = {
@@ -312,6 +314,8 @@ static struct xc_osdep_ops netbsd_evtchn
.bind_interdomain = &netbsd_evtchn_bind_interdomain,
.bind_virq = &netbsd_evtchn_bind_virq,
.unbind = &netbsd_evtchn_unbind,
+ .pending = &netbsd_evtchn_pending,
+ .unmask = &netbsd_evtchn_unmask,
},
};
diff -r 03b9f81f1f36 -r 3e8cb37144eb tools/libxc/xc_solaris.c
--- a/tools/libxc/xc_solaris.c Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xc_solaris.c Fri Dec 03 09:36:47 2010 +0000
@@ -262,20 +262,22 @@ static int solaris_evtchn_unbind(xc_evtc
return ioctl(fd, IOCTL_EVTCHN_UNBIND, &unbind);
}
-evtchn_port_or_error_t
-xc_evtchn_pending(xc_evtchn *xce)
+static evtchn_port_or_error_t
+solaris_evtchn_pending(xc_evtchn *xce, xc_osdep_handle h)
{
+ int fd = (int)h;
evtchn_port_t port;
- if ( read_exact(xce->fd, (char *)&port, sizeof(port)) == -1 )
+ if ( read_exact(fd, (char *)&port, sizeof(port)) == -1 )
return -1;
return port;
}
-int xc_evtchn_unmask(xc_evtchn *xce, evtchn_port_t port)
+static int solaris_evtchn_unmask(xc_evtchn *xce, xc_osdep_handle
h,evtchn_port_t port)
{
- return write_exact(xce->fd, (char *)&port, sizeof(port));
+ int fd = (int)h;
+ return write_exact(fd, (char *)&port, sizeof(port));
}
static struct xc_osdep_ops solaris_evtchn_ops = {
@@ -289,6 +291,8 @@ static struct xc_osdep_ops solaris_evtch
.bind_interdomain = &solaris_evtchn_bind_interdomain,
.bind_virq = &solaris_evtchn_bind_virq,
.unbind = &solaris_evtchn_unbind,
+ .pending = &solaris_evtchn_pending,
+ .unmask = &solaris_evtchn_unmask,
},
};
diff -r 03b9f81f1f36 -r 3e8cb37144eb tools/libxc/xenctrlosdep.h
--- a/tools/libxc/xenctrlosdep.h Fri Dec 03 09:36:47 2010 +0000
+++ b/tools/libxc/xenctrlosdep.h Fri Dec 03 09:36:47 2010 +0000
@@ -85,6 +85,9 @@ struct xc_osdep_ops
evtchn_port_or_error_t (*bind_virq)(xc_evtchn *xce,
xc_osdep_handle h, unsigned int virq);
int (*unbind)(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t
port);
+
+ evtchn_port_or_error_t (*pending)(xc_evtchn *xce, xc_osdep_handle
h);
+ int (*unmask)(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t
port);
} evtchn;
} u;
};
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|