libxc: osdep: convert xc_evtchn_{pending,unmask}()

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
This commit is contained in:
Ian Campbell committed 2010-12-03 09:36:47 +00:00
1 parent dbb5c70a0d
commit 3361a9deea
6 files changed
+54 -23

No files matched your search

+11
View File
@@ -112,6 +112,17 @@ int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
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
+11 -5
View File
@@ -420,20 +420,24 @@ static int linux_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t
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_ops = {
.bind_interdomain = &linux_evtchn_bind_interdomain,
.bind_virq = &linux_evtchn_bind_virq,
.unbind = &linux_evtchn_unbind,
.pending = &linux_evtchn_pending,
.unmask = &linux_evtchn_unmask,
},
};
+11 -8
View File
@@ -371,22 +371,23 @@ static evtchn_port_or_error_t minios_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_h
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(xc_evtchn *xce)
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_ops = {
.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 */
+9 -5
View File
@@ -285,20 +285,22 @@ netbsd_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq)
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_ops = {
.bind_interdomain = &netbsd_evtchn_bind_interdomain,
.bind_virq = &netbsd_evtchn_bind_virq,
.unbind = &netbsd_evtchn_unbind,
.pending = &netbsd_evtchn_pending,
.unmask = &netbsd_evtchn_unmask,
},
};
+9 -5
View File
@@ -262,20 +262,22 @@ static int solaris_evtchn_unbind(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_
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_evtchn_ops = {
.bind_interdomain = &solaris_evtchn_bind_interdomain,
.bind_virq = &solaris_evtchn_bind_virq,
.unbind = &solaris_evtchn_unbind,
.pending = &solaris_evtchn_pending,
.unmask = &solaris_evtchn_unmask,
},
};
+3
View File
@@ -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;
};
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.