aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2007-03-23 02:30:55 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:27:33 -0400
commitc702e8047fe74648f7852a9c1de781b0d5a98402 (patch)
tree24bd031d79f3d1159bc08704a51c84de01d712b0 /net
parentead592ba246dfcc643b3f0f0c8c03f7bc898a59f (diff)
[NETLINK]: Directly return -EINTR from netlink_dump_start()
Now that all users of netlink_dump_start() use netlink_run_queue() to process the receive queue, it is possible to return -EINTR from netlink_dump_start() directly, therefore simplying the callers. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/rtnetlink.c6
-rw-r--r--net/ipv4/inet_diag.c9
-rw-r--r--net/netfilter/nf_conntrack_netlink.c16
-rw-r--r--net/netlink/af_netlink.c7
-rw-r--r--net/netlink/genetlink.c7
-rw-r--r--net/xfrm/xfrm_user.c7
6 files changed, 18 insertions, 34 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 14241ada41a1..fa5f938b37ee 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -859,7 +859,6 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
859 int min_len; 859 int min_len;
860 int family; 860 int family;
861 int type; 861 int type;
862 int err;
863 862
864 type = nlh->nlmsg_type; 863 type = nlh->nlmsg_type;
865 if (type > RTM_MAX) 864 if (type > RTM_MAX)
@@ -888,10 +887,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
888 if (dumpit == NULL) 887 if (dumpit == NULL)
889 return -EINVAL; 888 return -EINVAL;
890 889
891 err = netlink_dump_start(rtnl, skb, nlh, dumpit, NULL); 890 return netlink_dump_start(rtnl, skb, nlh, dumpit, NULL);
892 if (err == 0)
893 err = -EINTR;
894 return err;
895 } 891 }
896 892
897 memset(rta_buf, 0, (rtattr_max * sizeof(struct rtattr *))); 893 memset(rta_buf, 0, (rtattr_max * sizeof(struct rtattr *)));
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 7dd97c5969b3..0148f0e34ceb 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -818,8 +818,6 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
818 return -ENOENT; 818 return -ENOENT;
819 819
820 if (nlh->nlmsg_flags & NLM_F_DUMP) { 820 if (nlh->nlmsg_flags & NLM_F_DUMP) {
821 int err;
822
823 if (nlmsg_attrlen(nlh, hdrlen)) { 821 if (nlmsg_attrlen(nlh, hdrlen)) {
824 struct nlattr *attr; 822 struct nlattr *attr;
825 823
@@ -831,11 +829,8 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
831 return -EINVAL; 829 return -EINVAL;
832 } 830 }
833 831
834 err = netlink_dump_start(idiagnl, skb, nlh, 832 return netlink_dump_start(idiagnl, skb, nlh,
835 inet_diag_dump, NULL); 833 inet_diag_dump, NULL);
836 if (err == 0)
837 err = -EINTR;
838 return err;
839 } 834 }
840 835
841 return inet_diag_get_exact(skb, nlh); 836 return inet_diag_get_exact(skb, nlh);
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 443ba7753a33..e5267305bb48 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -724,11 +724,8 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
724 if (NFNL_MSG_TYPE(nlh->nlmsg_type) == IPCTNL_MSG_CT_GET_CTRZERO) 724 if (NFNL_MSG_TYPE(nlh->nlmsg_type) == IPCTNL_MSG_CT_GET_CTRZERO)
725 return -ENOTSUPP; 725 return -ENOTSUPP;
726#endif 726#endif
727 err = netlink_dump_start(ctnl, skb, nlh, ctnetlink_dump_table, 727 return netlink_dump_start(ctnl, skb, nlh, ctnetlink_dump_table,
728 ctnetlink_done); 728 ctnetlink_done);
729 if (err == 0)
730 err = -EINTR;
731 return err;
732 } 729 }
733 730
734 if (nfattr_bad_size(cda, CTA_MAX, cta_min)) 731 if (nfattr_bad_size(cda, CTA_MAX, cta_min))
@@ -1266,12 +1263,9 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
1266 return -EINVAL; 1263 return -EINVAL;
1267 1264
1268 if (nlh->nlmsg_flags & NLM_F_DUMP) { 1265 if (nlh->nlmsg_flags & NLM_F_DUMP) {
1269 err = netlink_dump_start(ctnl, skb, nlh, 1266 return netlink_dump_start(ctnl, skb, nlh,
1270 ctnetlink_exp_dump_table, 1267 ctnetlink_exp_dump_table,
1271 ctnetlink_done); 1268 ctnetlink_done);
1272 if (err == 0)
1273 err = -EINTR;
1274 return err;
1275 } 1269 }
1276 1270
1277 if (cda[CTA_EXPECT_MASTER-1]) 1271 if (cda[CTA_EXPECT_MASTER-1])
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 1823b7c63156..2cbf1682f63d 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1426,7 +1426,12 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
1426 1426
1427 netlink_dump(sk); 1427 netlink_dump(sk);
1428 sock_put(sk); 1428 sock_put(sk);
1429 return 0; 1429
1430 /* We successfully started a dump, by returning -EINTR we
1431 * signal the queue mangement to interrupt processing of
1432 * any netlink messages so userspace gets a chance to read
1433 * the results. */
1434 return -EINTR;
1430} 1435}
1431 1436
1432void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err) 1437void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 1b897bc92e61..fac2e7a6dbe4 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -323,11 +323,8 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
323 if (ops->dumpit == NULL) 323 if (ops->dumpit == NULL)
324 return -EOPNOTSUPP; 324 return -EOPNOTSUPP;
325 325
326 err = netlink_dump_start(genl_sock, skb, nlh, 326 return netlink_dump_start(genl_sock, skb, nlh,
327 ops->dumpit, ops->done); 327 ops->dumpit, ops->done);
328 if (err == 0)
329 err = -EINTR;
330 return err;
331 } 328 }
332 329
333 if (ops->doit == NULL) 330 if (ops->doit == NULL)
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 5e52d6275bad..2ff968373f1c 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1856,7 +1856,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1856{ 1856{
1857 struct rtattr *xfrma[XFRMA_MAX]; 1857 struct rtattr *xfrma[XFRMA_MAX];
1858 struct xfrm_link *link; 1858 struct xfrm_link *link;
1859 int type, min_len, err; 1859 int type, min_len;
1860 1860
1861 type = nlh->nlmsg_type; 1861 type = nlh->nlmsg_type;
1862 if (type > XFRM_MSG_MAX) 1862 if (type > XFRM_MSG_MAX)
@@ -1875,10 +1875,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1875 if (link->dump == NULL) 1875 if (link->dump == NULL)
1876 return -EINVAL; 1876 return -EINVAL;
1877 1877
1878 err = netlink_dump_start(xfrm_nl, skb, nlh, link->dump, NULL); 1878 return netlink_dump_start(xfrm_nl, skb, nlh, link->dump, NULL);
1879 if (err == 0)
1880 err = -EINTR;
1881 return err;
1882 } 1879 }
1883 1880
1884 memset(xfrma, 0, sizeof(xfrma)); 1881 memset(xfrma, 0, sizeof(xfrma));