X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/d7e50217d7adf6e52786a38bcaa4cd698cb9a79e..cc9f6e38162d3c1bf6ca97536c2477f476c8e01b:/bsd/netat/ddp_aarp.c diff --git a/bsd/netat/ddp_aarp.c b/bsd/netat/ddp_aarp.c index cbb18fc4d..d3692d60c 100644 --- a/bsd/netat/ddp_aarp.c +++ b/bsd/netat/ddp_aarp.c @@ -3,22 +3,19 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. + * The contents of this file constitute Original Code as defined in and + * are subject to the Apple Public Source License Version 1.1 (the + * "License"). You may not use this file except in compliance with the + * License. Please obtain a copy of the License at + * http://www.apple.com/publicsource and read it before using this file. * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * This Original Code and all software distributed under the License are + * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. * * @APPLE_LICENSE_HEADER_END@ */ @@ -81,7 +78,6 @@ aarp_amt_array *aarp_table[IF_TOTAL_MAX]; int aarp_init1(), aarp_init2(); int aarp_send_data(); -int aarp_sched_probe(); StaticProc int aarp_req_cmd_in(); StaticProc int aarp_resp_cmd_in(); @@ -93,7 +89,7 @@ StaticProc aarp_amt_t *aarp_lru_entry(); StaticProc int aarp_glean_info(); StaticProc int aarp_delete_amt_info(); StaticProc void aarp_build_pkt(); -StaticProc int aarp_sched_req(); +StaticProc void aarp_sched_req(void *); StaticProc int aarp_get_rand_node(); StaticProc int aarp_get_next_node(); StaticProc int aarp_get_rand_net(); @@ -438,6 +434,8 @@ int aarp_send_data(m, elapp, dest_at_addr, loop) register at_ddp_t *ddp_hdrp; int error; int s; + struct timeval timenow; + getmicrouptime(&timenow); if (gbuf_len(m) <= 0) ddp_hdrp = (at_ddp_t *)gbuf_rptr(gbuf_cont(m)); @@ -518,7 +516,8 @@ int aarp_send_data(m, elapp, dest_at_addr, loop) amt_ptr->dest_at_addr = *dest_at_addr; amt_ptr->dest_at_addr.atalk_unused = 0; - amt_ptr->last_time = time.tv_sec; + getmicrouptime(&timenow); + amt_ptr->last_time = timenow.tv_sec; amt_ptr->m = m; amt_ptr->elapp = elapp; amt_ptr->no_of_retries = 0; @@ -767,13 +766,13 @@ register aarp_amt_t *amt_ptr; * ****************************************************************************/ -int aarp_sched_probe() +void aarp_sched_probe(void *arg) { - boolean_t funnel_state; - funnel_state = thread_funnel_set(network_flock, TRUE); + atalk_lock(); - if (probe_cb.no_of_retries != AARP_MAX_PROBE_RETRIES) { + if (probe_cb.elapp->aa_ifp != 0 && + probe_cb.no_of_retries != AARP_MAX_PROBE_RETRIES) { if (aarp_send_probe() == -1) AARPwakeup(&probe_cb); } else { @@ -781,8 +780,7 @@ int aarp_sched_probe() AARPwakeup(&probe_cb); } - (void) thread_funnel_set(network_flock, FALSE); - return(0); + atalk_unlock(); } @@ -810,13 +808,13 @@ StaticProc void aarp_build_pkt(pkt, elapp) * ****************************************************************************/ -StaticProc int aarp_sched_req(amt_ptr) - register aarp_amt_t *amt_ptr; +StaticProc void aarp_sched_req(arg) + void *arg; { int s, i; - boolean_t funnel_state; + aarp_amt_t *amt_ptr = (aarp_amt_t *)arg; - funnel_state = thread_funnel_set(network_flock, TRUE); + atalk_lock(); /* * make sure pointer still valid in case interface removed @@ -824,7 +822,8 @@ StaticProc int aarp_sched_req(amt_ptr) * into one of the amt arrays. */ for (i = 0; i < IF_TOTAL_MAX; i++) { - if (aarp_table[i] == NULL || amt_ptr < aarp_table[i] || amt_ptr >= (aarp_table[i] + 1)) + if (aarp_table[i] == NULL || (void *)amt_ptr < (void *)aarp_table[i] || + (void *)amt_ptr >= (void *)(aarp_table[i] + 1)) continue; /* no match - try next entry */ /* @@ -833,14 +832,14 @@ StaticProc int aarp_sched_req(amt_ptr) ATDISABLE(s, arpinp_lock); if (amt_ptr->tmo == 0) { ATENABLE(s, arpinp_lock); - (void) thread_funnel_set(network_flock, FALSE); - return(0); + atalk_unlock(); + return; } if (amt_ptr->no_of_retries < AARP_MAX_REQ_RETRIES) { ATENABLE(s, arpinp_lock); if (aarp_send_req(amt_ptr) == 0) { - (void) thread_funnel_set(network_flock, FALSE); - return(0); + atalk_unlock(); + return; } ATDISABLE(s, arpinp_lock); } @@ -848,9 +847,9 @@ StaticProc int aarp_sched_req(amt_ptr) aarp_delete_amt_info(amt_ptr); break; } - (void) thread_funnel_set(network_flock, FALSE); + atalk_unlock(); - return(0); + return; }