Subject: multiple copies of arp_lock_try()
To: None <tech-net@netbsd.org>
From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
List: tech-net
Date: 06/24/2002 10:45:59
we have multiple copies of arp_lock_try() in netinet/if_arp.c and
netinet/if_ieee1394arp.c. does it make sense to merge them?
(i understand __inline will become meaningless)
itojun
Index: if_arp.c
===================================================================
RCS file: /cvsroot/syssrc/sys/netinet/if_arp.c,v
retrieving revision 1.81
diff -u -r1.81 if_arp.c
--- if_arp.c 2002/06/09 16:33:37 1.81
+++ if_arp.c 2002/06/24 01:47:32
@@ -248,12 +248,12 @@
* while the arp table is locked, we punt and try again later.
*/
-int arp_locked;
+static int arp_locked;
-static __inline int arp_lock_try __P((int));
-static __inline void arp_unlock __P((void));
+__inline int arp_lock_try __P((int));
+__inline void arp_unlock __P((void));
-static __inline int
+__inline int
arp_lock_try(int recurse)
{
int s;
@@ -272,7 +272,7 @@
return (1);
}
-static __inline void
+__inline void
arp_unlock()
{
int s;
Index: if_ieee1394arp.c
===================================================================
RCS file: /cvsroot/syssrc/sys/netinet/if_ieee1394arp.c,v
retrieving revision 1.8
diff -u -r1.8 if_ieee1394arp.c
--- if_ieee1394arp.c 2002/06/09 16:33:37 1.8
+++ if_ieee1394arp.c 2002/06/24 01:47:32
@@ -113,38 +113,8 @@
} arpstat;
#endif
-static __inline int arp_lock_try(int);
-static __inline void arp_unlock(void);
-
-static __inline int
-arp_lock_try(recurse)
- int recurse;
-{
- int s;
-
- /*
- * Use splvm() -- we're blocking things that would cause
- * mbuf allocation.
- */
- s = splvm();
- if (!recurse && arp_locked) {
- splx(s);
- return 0;
- }
- arp_locked++;
- splx(s);
- return 1;
-}
-
-static __inline void
-arp_unlock()
-{
- int s;
-
- s = splvm();
- arp_locked--;
- splx(s);
-}
+extern __inline int arp_lock_try __P((int));
+extern __inline void arp_unlock __P((void));
#define ARP_LOCK(x) (void)arp_lock_try(x)
#define ARP_UNLOCK() arp_unlock();