debuggers.hg
changeset 994:45296ed1d50d
bitkeeper revision 1.611 (3fbb410b63xMuUN6Q1y1PYhhAi94Lw)
event_channel.c:
Cleanups for event channels.
event_channel.c:
Cleanups for event channels.
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Wed Nov 19 10:08:11 2003 +0000 (2003-11-19) |
parents | 5a9d5824dcb7 |
children | 603ae09a1314 |
files | xen/common/event_channel.c |
line diff
1.1 --- a/xen/common/event_channel.c Tue Nov 18 17:49:24 2003 +0000 1.2 +++ b/xen/common/event_channel.c Wed Nov 19 10:08:11 2003 +0000 1.3 @@ -22,6 +22,7 @@ 1.4 #include <xeno/sched.h> 1.5 #include <xeno/event.h> 1.6 1.7 +#define MAX_EVENT_CHANNELS 1024 1.8 1.9 static long event_channel_open(u16 target_dom) 1.10 { 1.11 @@ -75,7 +76,7 @@ static long event_channel_open(u16 targe 1.12 if ( unlikely(lid == -1) ) 1.13 { 1.14 /* Reached maximum channel count? */ 1.15 - if ( unlikely(lmax == 1024) ) 1.16 + if ( unlikely(lmax == MAX_EVENT_CHANNELS) ) 1.17 { 1.18 rc = -ENOSPC; 1.19 goto out; 1.20 @@ -224,39 +225,27 @@ static long event_channel_close(u16 lid) 1.21 static long event_channel_send(u16 lid) 1.22 { 1.23 struct task_struct *lp = current, *rp; 1.24 - event_channel_t *lchn, *rchn; 1.25 - u16 rid; 1.26 + u16 rid, rdom; 1.27 shared_info_t *rsi; 1.28 unsigned long cpu_mask; 1.29 1.30 spin_lock(&lp->event_channel_lock); 1.31 1.32 - lchn = lp->event_channel; 1.33 - 1.34 if ( unlikely(lid >= lp->max_event_channel) || 1.35 - unlikely((lchn[lid].flags & (ECF_INUSE|ECF_CONNECTED)) != 1.36 - (ECF_INUSE|ECF_CONNECTED)) ) 1.37 + unlikely(!(lp->event_channel[lid].flags & ECF_CONNECTED)) ) 1.38 { 1.39 spin_unlock(&lp->event_channel_lock); 1.40 return -EINVAL; 1.41 } 1.42 1.43 - rid = lchn[lid].flags & ECF_TARGET_ID; 1.44 - rp = find_domain_by_id(lchn[lid].target_dom); 1.45 - ASSERT(rp != NULL); 1.46 + rdom = lp->event_channel[lid].target_dom; 1.47 + rid = lp->event_channel[lid].flags & ECF_TARGET_ID; 1.48 1.49 spin_unlock(&lp->event_channel_lock); 1.50 1.51 - spin_lock(&rp->event_channel_lock); 1.52 - 1.53 - rchn = rp->event_channel; 1.54 - 1.55 - if ( unlikely(rid >= rp->max_event_channel) ) 1.56 - { 1.57 - spin_unlock(&rp->event_channel_lock); 1.58 - put_task_struct(rp); 1.59 + if ( unlikely(rid >= MAX_EVENT_CHANNELS) || 1.60 + unlikely ((rp = find_domain_by_id(rdom)) == NULL) ) 1.61 return -EINVAL; 1.62 - } 1.63 1.64 rsi = rp->shared_info; 1.65 if ( !test_and_set_bit(rid, &rsi->event_channel_pend[0]) && 1.66 @@ -266,7 +255,6 @@ static long event_channel_send(u16 lid) 1.67 guest_event_notify(cpu_mask); 1.68 } 1.69 1.70 - spin_unlock(&rp->event_channel_lock); 1.71 put_task_struct(rp); 1.72 return 0; 1.73 } 1.74 @@ -284,7 +272,7 @@ static long event_channel_status(u16 lid 1.75 1.76 if ( lid < lp->max_event_channel ) 1.77 { 1.78 - if ( (lchn[lid].flags & (ECF_INUSE|ECF_CONNECTED)) == ECF_INUSE ) 1.79 + if ( lchn[lid].flags & ECF_CONNECTED ) 1.80 rc = EVTCHNSTAT_connected; 1.81 else if ( lchn[lid].flags & ECF_INUSE ) 1.82 rc = EVTCHNSTAT_disconnected;