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