diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-01-19 17:20:57 +0000 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-01-19 17:20:57 +0000 |
commit | 115209d91bcd3734ddaaf58a4a1cdbb4c44cd4fa (patch) | |
tree | 2b6454a5f05e6cede6689265f3d28782412a8c3e /xen/common | |
parent | f272b206703b3e8c5f12683475976dd77e5ecbf7 (diff) | |
download | xen-115209d91bcd3734ddaaf58a4a1cdbb4c44cd4fa.tar.gz xen-115209d91bcd3734ddaaf58a4a1cdbb4c44cd4fa.tar.bz2 xen-115209d91bcd3734ddaaf58a4a1cdbb4c44cd4fa.zip |
[XEN] New event-channel reset operation.
Plumbed through libxenctrl to python.
From: Andrei Petrov <andrei.petrov@xensource.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/common')
-rw-r--r-- | xen/common/event_channel.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index 70665a7e78..0116a9aa91 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -735,6 +735,29 @@ static long evtchn_unmask(evtchn_unmask_t *unmask) } +static long evtchn_reset(evtchn_reset_t *r) +{ + domid_t dom = r->dom; + struct domain *d; + int i; + + if ( dom == DOMID_SELF ) + dom = current->domain->domain_id; + else if ( !IS_PRIV(current->domain) ) + return -EPERM; + + if ( (d = find_domain_by_id(dom)) == NULL ) + return -ESRCH; + + for ( i = 0; port_is_valid(d, i); i++ ) + (void)__evtchn_close(d, i); + + put_domain(d); + + return 0; +} + + long do_event_channel_op(int cmd, XEN_GUEST_HANDLE(void) arg) { long rc; @@ -833,6 +856,14 @@ long do_event_channel_op(int cmd, XEN_GUEST_HANDLE(void) arg) break; } + case EVTCHNOP_reset: { + struct evtchn_reset reset; + if ( copy_from_guest(&reset, arg, 1) != 0 ) + return -EFAULT; + rc = evtchn_reset(&reset); + break; + } + default: rc = -ENOSYS; break; |