aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2005-11-09 20:25:52 -0500
committerThomas Graf <tgr@axs.localdomain>2005-11-09 20:26:40 -0500
commita8f74b228826eef1cbe04a05647d61e896f5fd63 (patch)
tree6abffeafca83f1aa342ed905367fab1f5a1ac554
parentbfa83a9e03cf8d501c6272999843470afecb32ed (diff)
[NETLINK]: Make netlink_callback->done() optional
Most netlink families make no use of the done() callback, making it optional gets rid of all unnecessary dummy implementations. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/rtnetlink.c8
-rw-r--r--net/ipv4/inet_diag.c9
-rw-r--r--net/ipv6/route.c2
-rw-r--r--net/netlink/af_netlink.c6
-rw-r--r--net/xfrm/xfrm_user.c8
5 files changed, 8 insertions, 25 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 9bed7569ce3f..193fd8637f9f 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -462,11 +462,6 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)
462 netlink_broadcast(rtnl, skb, 0, RTNLGRP_LINK, GFP_KERNEL); 462 netlink_broadcast(rtnl, skb, 0, RTNLGRP_LINK, GFP_KERNEL);
463} 463}
464 464
465static int rtnetlink_done(struct netlink_callback *cb)
466{
467 return 0;
468}
469
470/* Protected by RTNL sempahore. */ 465/* Protected by RTNL sempahore. */
471static struct rtattr **rta_buf; 466static struct rtattr **rta_buf;
472static int rtattr_max; 467static int rtattr_max;
@@ -533,8 +528,7 @@ rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp)
533 goto err_inval; 528 goto err_inval;
534 529
535 if ((*errp = netlink_dump_start(rtnl, skb, nlh, 530 if ((*errp = netlink_dump_start(rtnl, skb, nlh,
536 link->dumpit, 531 link->dumpit, NULL)) != 0) {
537 rtnetlink_done)) != 0) {
538 return -1; 532 return -1;
539 } 533 }
540 rlen = NLMSG_ALIGN(nlh->nlmsg_len); 534 rlen = NLMSG_ALIGN(nlh->nlmsg_len);
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 71f3c7350c6e..39061ed53cfd 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -724,12 +724,6 @@ done:
724 return skb->len; 724 return skb->len;
725} 725}
726 726
727static int inet_diag_dump_done(struct netlink_callback *cb)
728{
729 return 0;
730}
731
732
733static __inline__ int 727static __inline__ int
734inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 728inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
735{ 729{
@@ -760,8 +754,7 @@ inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
760 goto err_inval; 754 goto err_inval;
761 } 755 }
762 return netlink_dump_start(idiagnl, skb, nlh, 756 return netlink_dump_start(idiagnl, skb, nlh,
763 inet_diag_dump, 757 inet_diag_dump, NULL);
764 inet_diag_dump_done);
765 } else { 758 } else {
766 return inet_diag_get_exact(skb, nlh); 759 return inet_diag_get_exact(skb, nlh);
767 } 760 }
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 227e99ed510c..f7f42c3e96cb 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1710,7 +1710,7 @@ static void fib6_dump_end(struct netlink_callback *cb)
1710static int fib6_dump_done(struct netlink_callback *cb) 1710static int fib6_dump_done(struct netlink_callback *cb)
1711{ 1711{
1712 fib6_dump_end(cb); 1712 fib6_dump_end(cb);
1713 return cb->done(cb); 1713 return cb->done ? cb->done(cb) : 0;
1714} 1714}
1715 1715
1716int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) 1716int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 5ca283537bc6..f3fb7e575816 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -427,7 +427,8 @@ static int netlink_release(struct socket *sock)
427 427
428 spin_lock(&nlk->cb_lock); 428 spin_lock(&nlk->cb_lock);
429 if (nlk->cb) { 429 if (nlk->cb) {
430 nlk->cb->done(nlk->cb); 430 if (nlk->cb->done)
431 nlk->cb->done(nlk->cb);
431 netlink_destroy_callback(nlk->cb); 432 netlink_destroy_callback(nlk->cb);
432 nlk->cb = NULL; 433 nlk->cb = NULL;
433 } 434 }
@@ -1322,7 +1323,8 @@ static int netlink_dump(struct sock *sk)
1322 skb_queue_tail(&sk->sk_receive_queue, skb); 1323 skb_queue_tail(&sk->sk_receive_queue, skb);
1323 sk->sk_data_ready(sk, skb->len); 1324 sk->sk_data_ready(sk, skb->len);
1324 1325
1325 cb->done(cb); 1326 if (cb->done)
1327 cb->done(cb);
1326 nlk->cb = NULL; 1328 nlk->cb = NULL;
1327 spin_unlock(&nlk->cb_lock); 1329 spin_unlock(&nlk->cb_lock);
1328 1330
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index c35336a0f71b..6996b7e85665 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -948,11 +948,6 @@ static struct xfrm_link {
948 [XFRM_MSG_FLUSHPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_flush_policy }, 948 [XFRM_MSG_FLUSHPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_flush_policy },
949}; 949};
950 950
951static int xfrm_done(struct netlink_callback *cb)
952{
953 return 0;
954}
955
956static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp) 951static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp)
957{ 952{
958 struct rtattr *xfrma[XFRMA_MAX]; 953 struct rtattr *xfrma[XFRMA_MAX];
@@ -990,8 +985,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *err
990 goto err_einval; 985 goto err_einval;
991 986
992 if ((*errp = netlink_dump_start(xfrm_nl, skb, nlh, 987 if ((*errp = netlink_dump_start(xfrm_nl, skb, nlh,
993 link->dump, 988 link->dump, NULL)) != 0) {
994 xfrm_done)) != 0) {
995 return -1; 989 return -1;
996 } 990 }
997 rlen = NLMSG_ALIGN(nlh->nlmsg_len); 991 rlen = NLMSG_ALIGN(nlh->nlmsg_len);