Changes in uspace/srv/net/ethip/atrans.c [feeac0d:69a93df7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/ethip/atrans.c
rfeeac0d r69a93df7 49 49 static FIBRIL_CONDVAR_INITIALIZE(atrans_cv); 50 50 51 static ethip_atrans_t *atrans_find( addr32_tip_addr)51 static ethip_atrans_t *atrans_find(iplink_srv_addr_t *ip_addr) 52 52 { 53 list_foreach(atrans_list, atrans_list, ethip_atrans_t, atrans) { 54 if (atrans->ip_addr == ip_addr) 53 list_foreach(atrans_list, link) { 54 ethip_atrans_t *atrans = list_get_instance(link, 55 ethip_atrans_t, atrans_list); 56 57 if (atrans->ip_addr.ipv4 == ip_addr->ipv4) 55 58 return atrans; 56 59 } … … 59 62 } 60 63 61 int atrans_add( addr32_t ip_addr, addr48_tmac_addr)64 int atrans_add(iplink_srv_addr_t *ip_addr, mac48_addr_t *mac_addr) 62 65 { 63 66 ethip_atrans_t *atrans; … … 68 71 return ENOMEM; 69 72 70 atrans->ip_addr = ip_addr;71 a ddr48(mac_addr, atrans->mac_addr);73 atrans->ip_addr = *ip_addr; 74 atrans->mac_addr = *mac_addr; 72 75 73 76 fibril_mutex_lock(&atrans_list_lock); … … 85 88 } 86 89 87 int atrans_remove( addr32_tip_addr)90 int atrans_remove(iplink_srv_addr_t *ip_addr) 88 91 { 89 92 ethip_atrans_t *atrans; … … 103 106 } 104 107 105 int atrans_lookup( addr32_t ip_addr, addr48_tmac_addr)108 int atrans_lookup(iplink_srv_addr_t *ip_addr, mac48_addr_t *mac_addr) 106 109 { 110 ethip_atrans_t *atrans; 111 107 112 fibril_mutex_lock(&atrans_list_lock); 108 ethip_atrans_t *atrans = atrans_find(ip_addr);113 atrans = atrans_find(ip_addr); 109 114 if (atrans == NULL) { 110 115 fibril_mutex_unlock(&atrans_list_lock); 111 116 return ENOENT; 112 117 } 113 118 114 119 fibril_mutex_unlock(&atrans_list_lock); 115 addr48(atrans->mac_addr, mac_addr);120 *mac_addr = atrans->mac_addr; 116 121 return EOK; 117 122 } … … 119 124 int atrans_wait_timeout(suseconds_t timeout) 120 125 { 126 int rc; 127 121 128 fibril_mutex_lock(&atrans_list_lock); 122 intrc = fibril_condvar_wait_timeout(&atrans_cv, &atrans_list_lock,129 rc = fibril_condvar_wait_timeout(&atrans_cv, &atrans_list_lock, 123 130 timeout); 124 131 fibril_mutex_unlock(&atrans_list_lock); 125 132 126 133 return rc; 127 134 }
Note:
See TracChangeset
for help on using the changeset viewer.