On 20/11/13(Wed) 10:16, Stuart Henderson wrote: > On 2013/11/20 10:10, Martin Pieuchot wrote: > > This one is not under _KERNEL but it's used at only one place and > > if a port use it, it should probably define it by itself. > > This is used in at least kde-workspace and embedded copies of slirp > (the ones I know about so far are emulators/qemu and emulators/BasiliskII). > > It's easy enough to patch existing users in ports now, but removing it > makes things more difficult for people porting something else later > which happens to use it - so I wonder what's the reasoning behind this? > (if it's a namespace issue, I don't think that's valid given that it's > widely available - xnu, solaris, free/net/open/dfbsd and derivatives).
Simply cleaning, to unify our code base. > btw if people want a quick way to search for things in common source code, > http://codesearch.debian.net/ is useful. Nice tool, thanks for the hint. So here's an updated version that keeps the define for userland, would it be ok? Index: netinet/if_ether.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/if_ether.c,v retrieving revision 1.111 diff -u -p -r1.111 if_ether.c --- netinet/if_ether.c 11 Nov 2013 09:15:34 -0000 1.111 +++ netinet/if_ether.c 20 Nov 2013 10:27:12 -0000 @@ -868,8 +868,8 @@ arp_ifinit(struct arpcom *ac, struct ifa /* Warn the user if another station has this IP address. */ arprequest(&ac->ac_if, - &(IA_SIN(ifa)->sin_addr.s_addr), - &(IA_SIN(ifa)->sin_addr.s_addr), + &satosin(ifa->ifa_addr)->sin_addr.s_addr, + &satosin(ifa->ifa_addr)->sin_addr.s_addr, ac->ac_enaddr); ifa->ifa_rtrequest = arp_rtrequest; ifa->ifa_flags |= RTF_CLONING; Index: netinet/in_var.h =================================================================== RCS file: /home/ncvs/src/sys/netinet/in_var.h,v retrieving revision 1.26 diff -u -p -r1.26 in_var.h --- netinet/in_var.h 23 Oct 2013 15:12:42 -0000 1.26 +++ netinet/in_var.h 20 Nov 2013 10:27:12 -0000 @@ -73,12 +73,6 @@ struct in_aliasreq { #define ifra_broadaddr ifra_dstaddr struct sockaddr_in ifra_mask; }; -/* - * Given a pointer to an in_ifaddr (ifaddr), - * return a pointer to the addr as a sockaddr_in. - */ -#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr)) - #ifdef _KERNEL TAILQ_HEAD(in_ifaddrhead, in_ifaddr); @@ -179,6 +173,14 @@ struct in_multi *in_addmulti(struct in_a void in_delmulti(struct in_multi *); void in_ifscrub(struct ifnet *, struct in_ifaddr *); int in_control(struct socket *, u_long, caddr_t, struct ifnet *); -#endif +#else /* _KERNEL */ + +/* + * Given a pointer to an in_ifaddr (ifaddr), + * return a pointer to the addr as a sockaddr_in. + */ +#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr)) + +#endif /* _KERNEL */ #endif /* _NETINET_IN_VAR_H_ */