]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[NETLINK]: Directly return -EINTR from netlink_dump_start()
authorThomas Graf <tgraf@suug.ch>
Fri, 23 Mar 2007 06:30:55 +0000 (23:30 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:27:33 +0000 (22:27 -0700)
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>
net/core/rtnetlink.c
net/ipv4/inet_diag.c
net/netfilter/nf_conntrack_netlink.c
net/netlink/af_netlink.c
net/netlink/genetlink.c
net/xfrm/xfrm_user.c

index 14241ada41a10f852af01487013355ea20af48c4..fa5f938b37ee09088306be541759e5f59527a4ac 100644 (file)
@@ -859,7 +859,6 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
        int min_len;
        int family;
        int type;
-       int err;
 
        type = nlh->nlmsg_type;
        if (type > RTM_MAX)
@@ -888,10 +887,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
                if (dumpit == NULL)
                        return -EINVAL;
 
-               err = netlink_dump_start(rtnl, skb, nlh, dumpit, NULL);
-               if (err == 0)
-                       err = -EINTR;
-               return err;
+               return netlink_dump_start(rtnl, skb, nlh, dumpit, NULL);
        }
 
        memset(rta_buf, 0, (rtattr_max * sizeof(struct rtattr *)));
index 7dd97c5969b303abb7ddde3b40d0b3c31a50839d..0148f0e34ceba78e252acb8021385ab049a5715d 100644 (file)
@@ -818,8 +818,6 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
                return -ENOENT;
 
        if (nlh->nlmsg_flags & NLM_F_DUMP) {
-               int err;
-
                if (nlmsg_attrlen(nlh, hdrlen)) {
                        struct nlattr *attr;
 
@@ -831,11 +829,8 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
                                return -EINVAL;
                }
 
-               err = netlink_dump_start(idiagnl, skb, nlh,
-                                        inet_diag_dump, NULL);
-               if (err == 0)
-                       err = -EINTR;
-               return err;
+               return netlink_dump_start(idiagnl, skb, nlh,
+                                         inet_diag_dump, NULL);
        }
 
        return inet_diag_get_exact(skb, nlh);
index 443ba7753a333ac2eb06f410bc9c79bc8572c78a..e5267305bb4890664018578347c7941fe563fb12 100644 (file)
@@ -724,11 +724,8 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
                if (NFNL_MSG_TYPE(nlh->nlmsg_type) == IPCTNL_MSG_CT_GET_CTRZERO)
                        return -ENOTSUPP;
 #endif
-               err = netlink_dump_start(ctnl, skb, nlh, ctnetlink_dump_table,
-                                        ctnetlink_done);
-               if (err == 0)
-                       err = -EINTR;
-               return err;
+               return netlink_dump_start(ctnl, skb, nlh, ctnetlink_dump_table,
+                                         ctnetlink_done);
        }
 
        if (nfattr_bad_size(cda, CTA_MAX, cta_min))
@@ -1266,12 +1263,9 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
                return -EINVAL;
 
        if (nlh->nlmsg_flags & NLM_F_DUMP) {
-               err = netlink_dump_start(ctnl, skb, nlh,
-                                        ctnetlink_exp_dump_table,
-                                        ctnetlink_done);
-               if (err == 0)
-                       err = -EINTR;
-               return err;
+               return netlink_dump_start(ctnl, skb, nlh,
+                                         ctnetlink_exp_dump_table,
+                                         ctnetlink_done);
        }
 
        if (cda[CTA_EXPECT_MASTER-1])
index 1823b7c6315634ad9e2701652e81a0bf973d96c8..2cbf1682f63d5394fe04aef919b8905caf6bc045 100644 (file)
@@ -1426,7 +1426,12 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
 
        netlink_dump(sk);
        sock_put(sk);
-       return 0;
+
+       /* We successfully started a dump, by returning -EINTR we
+        * signal the queue mangement to interrupt processing of
+        * any netlink messages so userspace gets a chance to read
+        * the results. */
+       return -EINTR;
 }
 
 void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
index 1b897bc92e61c4be37210dd3f382d8d4685677e8..fac2e7a6dbe45ffa5f6783b883e00facc5c0dcb4 100644 (file)
@@ -323,11 +323,8 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
                if (ops->dumpit == NULL)
                        return -EOPNOTSUPP;
 
-               err = netlink_dump_start(genl_sock, skb, nlh,
-                                        ops->dumpit, ops->done);
-               if (err == 0)
-                       err = -EINTR;
-               return err;
+               return netlink_dump_start(genl_sock, skb, nlh,
+                                         ops->dumpit, ops->done);
        }
 
        if (ops->doit == NULL)
index 5e52d6275badda6075b2642f2774dc90b30801ee..2ff968373f1c6c52d21cf2931cf465b3bc0dd13b 100644 (file)
@@ -1856,7 +1856,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 {
        struct rtattr *xfrma[XFRMA_MAX];
        struct xfrm_link *link;
-       int type, min_len, err;
+       int type, min_len;
 
        type = nlh->nlmsg_type;
        if (type > XFRM_MSG_MAX)
@@ -1875,10 +1875,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
                if (link->dump == NULL)
                        return -EINVAL;
 
-               err = netlink_dump_start(xfrm_nl, skb, nlh, link->dump, NULL);
-               if (err == 0)
-                       err = -EINTR;
-               return err;
+               return netlink_dump_start(xfrm_nl, skb, nlh, link->dump, NULL);
        }
 
        memset(xfrma, 0, sizeof(xfrma));