Remove unused argument from *rtrequest()

2013-08-27 Thread Martin Pieuchot
In order to define a proper API for our routine table, I'd like to turn
the struct rt_addrinfo into a private type (ie: only used in route.c
and rtsock.c).

This type is used by a lost of code in our network stack to add or delete
a route but also in the various *rtrequest() functions.  However in
these functions the argument is never used!  So the diff below kills it.

ok?

Index: net/if.c
===
RCS file: /home/ncvs/src/sys/net/if.c,v
retrieving revision 1.262
diff -u -p -r1.262 if.c
--- net/if.c20 Aug 2013 09:14:22 -  1.262
+++ net/if.c27 Aug 2013 13:50:50 -
@@ -985,7 +985,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, 
  * This should be moved to /sys/net/link.c eventually.
  */
 void
-link_rtrequest(int cmd, struct rtentry *rt, struct rt_addrinfo *info)
+link_rtrequest(int cmd, struct rtentry *rt)
 {
struct ifaddr *ifa;
struct sockaddr *dst;
@@ -999,7 +999,7 @@ link_rtrequest(int cmd, struct rtentry *
ifafree(rt-rt_ifa);
rt-rt_ifa = ifa;
if (ifa-ifa_rtrequest  ifa-ifa_rtrequest != link_rtrequest)
-   ifa-ifa_rtrequest(cmd, rt, info);
+   ifa-ifa_rtrequest(cmd, rt);
}
 }
 
Index: net/if.h
===
RCS file: /home/ncvs/src/sys/net/if.h,v
retrieving revision 1.144
diff -u -p -r1.144 if.h
--- net/if.h20 Jun 2013 12:03:40 -  1.144
+++ net/if.h27 Aug 2013 13:50:50 -
@@ -494,7 +494,7 @@ struct ifaddr {
struct  ifnet *ifa_ifp; /* back-pointer to interface */
TAILQ_ENTRY(ifaddr) ifa_list;   /* list of addresses for interface */
/* check or clean routes (+ or -)'d */
-   void(*ifa_rtrequest)(int, struct rtentry *, struct rt_addrinfo *);
+   void(*ifa_rtrequest)(int, struct rtentry *);
u_int   ifa_flags;  /* mostly rt_flags for cloning */
u_int   ifa_refcnt; /* count of references */
int ifa_metric; /* cost of going out this interface */
@@ -842,7 +842,7 @@ struct  ifaddr *ifa_ifwithroute(int, stru
struct sockaddr *, u_int);
 struct ifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *);
 void   ifafree(struct ifaddr *);
-void   link_rtrequest(int, struct rtentry *, struct rt_addrinfo *);
+void   link_rtrequest(int, struct rtentry *);
 
 void   if_clone_attach(struct if_clone *);
 void   if_clone_detach(struct if_clone *);
@@ -858,7 +858,7 @@ int loioctl(struct ifnet *, u_long, cadd
 void   loopattach(int);
 intlooutput(struct ifnet *,
struct mbuf *, struct sockaddr *, struct rtentry *);
-void   lortrequest(int, struct rtentry *, struct rt_addrinfo *);
+void   lortrequest(int, struct rtentry *);
 void   ifa_add(struct ifnet *, struct ifaddr *);
 void   ifa_del(struct ifnet *, struct ifaddr *);
 void   ifa_update_broadaddr(struct ifnet *, struct ifaddr *,
Index: net/if_loop.c
===
RCS file: /home/ncvs/src/sys/net/if_loop.c,v
retrieving revision 1.49
diff -u -p -r1.49 if_loop.c
--- net/if_loop.c   28 Mar 2013 16:55:27 -  1.49
+++ net/if_loop.c   27 Aug 2013 13:50:50 -
@@ -373,7 +373,7 @@ lo_altqstart(struct ifnet *ifp)
 
 /* ARGSUSED */
 void
-lortrequest(int cmd, struct rtentry *rt, struct rt_addrinfo *info)
+lortrequest(int cmd, struct rtentry *rt)
 {
if (rt)
rt-rt_rmx.rmx_mtu = LOMTU;
Index: net/route.c
===
RCS file: /home/ncvs/src/sys/net/route.c,v
retrieving revision 1.144
diff -u -p -r1.144 route.c
--- net/route.c 28 Mar 2013 23:10:05 -  1.144
+++ net/route.c 27 Aug 2013 13:50:50 -
@@ -781,7 +781,7 @@ rtrequest1(int req, struct rt_addrinfo *
 
rt-rt_flags = ~RTF_UP;
if ((ifa = rt-rt_ifa)  ifa-ifa_rtrequest)
-   ifa-ifa_rtrequest(RTM_DELETE, rt, info);
+   ifa-ifa_rtrequest(RTM_DELETE, rt);
rttrash++;
 
if (ret_nrt)
@@ -925,14 +925,13 @@ rtrequest1(int req, struct rt_addrinfo *
was (%p)\n, ifa, (*ret_nrt)-rt_ifa);
if ((*ret_nrt)-rt_ifa-ifa_rtrequest)
(*ret_nrt)-rt_ifa-ifa_rtrequest(
-   RTM_DELETE, *ret_nrt, NULL);
+   RTM_DELETE, *ret_nrt);
ifafree((*ret_nrt)-rt_ifa);
(*ret_nrt)-rt_ifa = ifa;
(*ret_nrt)-rt_ifp = ifa-ifa_ifp;
ifa-ifa_refcnt++;
if (ifa-ifa_rtrequest)
-   

Re: Remove unused argument from *rtrequest()

2013-08-27 Thread Kenneth R Westerback
On Tue, Aug 27, 2013 at 03:58:51PM +0200, Martin Pieuchot wrote:
 In order to define a proper API for our routine table, I'd like to turn
 the struct rt_addrinfo into a private type (ie: only used in route.c
 and rtsock.c).
 
 This type is used by a lost of code in our network stack to add or delete
 a route but also in the various *rtrequest() functions.  However in
 these functions the argument is never used!  So the diff below kills it.
 
 ok?

Less is more. ok krw@.

 Ken

 
 Index: net/if.c
 ===
 RCS file: /home/ncvs/src/sys/net/if.c,v
 retrieving revision 1.262
 diff -u -p -r1.262 if.c
 --- net/if.c  20 Aug 2013 09:14:22 -  1.262
 +++ net/if.c  27 Aug 2013 13:50:50 -
 @@ -985,7 +985,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, 
   * This should be moved to /sys/net/link.c eventually.
   */
  void
 -link_rtrequest(int cmd, struct rtentry *rt, struct rt_addrinfo *info)
 +link_rtrequest(int cmd, struct rtentry *rt)
  {
   struct ifaddr *ifa;
   struct sockaddr *dst;
 @@ -999,7 +999,7 @@ link_rtrequest(int cmd, struct rtentry *
   ifafree(rt-rt_ifa);
   rt-rt_ifa = ifa;
   if (ifa-ifa_rtrequest  ifa-ifa_rtrequest != link_rtrequest)
 - ifa-ifa_rtrequest(cmd, rt, info);
 + ifa-ifa_rtrequest(cmd, rt);
   }
  }
  
 Index: net/if.h
 ===
 RCS file: /home/ncvs/src/sys/net/if.h,v
 retrieving revision 1.144
 diff -u -p -r1.144 if.h
 --- net/if.h  20 Jun 2013 12:03:40 -  1.144
 +++ net/if.h  27 Aug 2013 13:50:50 -
 @@ -494,7 +494,7 @@ struct ifaddr {
   struct  ifnet *ifa_ifp; /* back-pointer to interface */
   TAILQ_ENTRY(ifaddr) ifa_list;   /* list of addresses for interface */
   /* check or clean routes (+ or -)'d */
 - void(*ifa_rtrequest)(int, struct rtentry *, struct rt_addrinfo *);
 + void(*ifa_rtrequest)(int, struct rtentry *);
   u_int   ifa_flags;  /* mostly rt_flags for cloning */
   u_int   ifa_refcnt; /* count of references */
   int ifa_metric; /* cost of going out this interface */
 @@ -842,7 +842,7 @@ structifaddr *ifa_ifwithroute(int, stru
   struct sockaddr *, u_int);
  struct   ifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *);
  void ifafree(struct ifaddr *);
 -void link_rtrequest(int, struct rtentry *, struct rt_addrinfo *);
 +void link_rtrequest(int, struct rtentry *);
  
  void if_clone_attach(struct if_clone *);
  void if_clone_detach(struct if_clone *);
 @@ -858,7 +858,7 @@ int   loioctl(struct ifnet *, u_long, cadd
  void loopattach(int);
  int  looutput(struct ifnet *,
   struct mbuf *, struct sockaddr *, struct rtentry *);
 -void lortrequest(int, struct rtentry *, struct rt_addrinfo *);
 +void lortrequest(int, struct rtentry *);
  void ifa_add(struct ifnet *, struct ifaddr *);
  void ifa_del(struct ifnet *, struct ifaddr *);
  void ifa_update_broadaddr(struct ifnet *, struct ifaddr *,
 Index: net/if_loop.c
 ===
 RCS file: /home/ncvs/src/sys/net/if_loop.c,v
 retrieving revision 1.49
 diff -u -p -r1.49 if_loop.c
 --- net/if_loop.c 28 Mar 2013 16:55:27 -  1.49
 +++ net/if_loop.c 27 Aug 2013 13:50:50 -
 @@ -373,7 +373,7 @@ lo_altqstart(struct ifnet *ifp)
  
  /* ARGSUSED */
  void
 -lortrequest(int cmd, struct rtentry *rt, struct rt_addrinfo *info)
 +lortrequest(int cmd, struct rtentry *rt)
  {
   if (rt)
   rt-rt_rmx.rmx_mtu = LOMTU;
 Index: net/route.c
 ===
 RCS file: /home/ncvs/src/sys/net/route.c,v
 retrieving revision 1.144
 diff -u -p -r1.144 route.c
 --- net/route.c   28 Mar 2013 23:10:05 -  1.144
 +++ net/route.c   27 Aug 2013 13:50:50 -
 @@ -781,7 +781,7 @@ rtrequest1(int req, struct rt_addrinfo *
  
   rt-rt_flags = ~RTF_UP;
   if ((ifa = rt-rt_ifa)  ifa-ifa_rtrequest)
 - ifa-ifa_rtrequest(RTM_DELETE, rt, info);
 + ifa-ifa_rtrequest(RTM_DELETE, rt);
   rttrash++;
  
   if (ret_nrt)
 @@ -925,14 +925,13 @@ rtrequest1(int req, struct rt_addrinfo *
   was (%p)\n, ifa, (*ret_nrt)-rt_ifa);
   if ((*ret_nrt)-rt_ifa-ifa_rtrequest)
   (*ret_nrt)-rt_ifa-ifa_rtrequest(
 - RTM_DELETE, *ret_nrt, NULL);
 + RTM_DELETE, *ret_nrt);
   ifafree((*ret_nrt)-rt_ifa);
   (*ret_nrt)-rt_ifa = ifa;
   (*ret_nrt)-rt_ifp = ifa-ifa_ifp;

Re: Remove unused argument from *rtrequest()

2013-08-27 Thread Mike Belopuhov
On 27 August 2013 15:58, Martin Pieuchot mpieuc...@nolizard.org wrote:
 In order to define a proper API for our routine table, I'd like to turn
 the struct rt_addrinfo into a private type (ie: only used in route.c
 and rtsock.c).

 This type is used by a lost of code in our network stack to add or delete
 a route but also in the various *rtrequest() functions.  However in
 these functions the argument is never used!  So the diff below kills it.

 ok?


ok