public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Thomas Graf <tgraf@suug.ch>
Subject: [PATCH 04/16] [XFRM] netlink: Use nlmsg_broadcast() and nlmsg_unicast()
Date: Wed, 22 Aug 2007 16:55:42 +0200	[thread overview]
Message-ID: <20070822145630.343335774@lsx.localdomain> (raw)
In-Reply-To: 20070822145538.861270927@lsx.localdomain

[-- Attachment #1: xfrm_netlink_broadcast --]
[-- Type: text/plain, Size: 5279 bytes --]

This simplifies successful return codes from >0 to 0.

Signed-off-by: Thomas Graf <tgraf@suug.ch>

Index: net-2.6.24/net/xfrm/xfrm_user.c
===================================================================
--- net-2.6.24.orig/net/xfrm/xfrm_user.c	2007-08-21 16:13:57.000000000 +0200
+++ net-2.6.24/net/xfrm/xfrm_user.c	2007-08-21 16:15:03.000000000 +0200
@@ -800,8 +800,7 @@ static int xfrm_get_sa(struct sk_buff *s
 	if (IS_ERR(resp_skb)) {
 		err = PTR_ERR(resp_skb);
 	} else {
-		err = netlink_unicast(xfrm_nl, resp_skb,
-				      NETLINK_CB(skb).pid, MSG_DONTWAIT);
+		err = nlmsg_unicast(xfrm_nl, resp_skb, NETLINK_CB(skb).pid);
 	}
 	xfrm_state_put(x);
 out_noput:
@@ -882,8 +881,7 @@ static int xfrm_alloc_userspi(struct sk_
 		goto out;
 	}
 
-	err = netlink_unicast(xfrm_nl, resp_skb,
-			      NETLINK_CB(skb).pid, MSG_DONTWAIT);
+	err = nlmsg_unicast(xfrm_nl, resp_skb, NETLINK_CB(skb).pid);
 
 out:
 	xfrm_state_put(x);
@@ -1393,9 +1391,8 @@ static int xfrm_get_policy(struct sk_buf
 		if (IS_ERR(resp_skb)) {
 			err = PTR_ERR(resp_skb);
 		} else {
-			err = netlink_unicast(xfrm_nl, resp_skb,
-					      NETLINK_CB(skb).pid,
-					      MSG_DONTWAIT);
+			err = nlmsg_unicast(xfrm_nl, resp_skb,
+					    NETLINK_CB(skb).pid);
 		}
 	} else {
 		xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
@@ -1525,8 +1522,7 @@ static int xfrm_get_ae(struct sk_buff *s
 
 	if (build_aevent(r_skb, x, &c) < 0)
 		BUG();
-	err = netlink_unicast(xfrm_nl, r_skb,
-			      NETLINK_CB(skb).pid, MSG_DONTWAIT);
+	err = nlmsg_unicast(xfrm_nl, r_skb, NETLINK_CB(skb).pid);
 	spin_unlock_bh(&x->lock);
 	xfrm_state_put(x);
 	return err;
@@ -1903,9 +1899,7 @@ static int xfrm_send_migrate(struct xfrm
 	if (build_migrate(skb, m, num_migrate, sel, dir, type) < 0)
 		BUG();
 
-	NETLINK_CB(skb).dst_group = XFRMNLGRP_MIGRATE;
-	return netlink_broadcast(xfrm_nl, skb, 0, XFRMNLGRP_MIGRATE,
-				 GFP_ATOMIC);
+	return nlmsg_multicast(xfrm_nl, skb, 0, XFRMNLGRP_MIGRATE, GFP_ATOMIC);
 }
 #else
 static int xfrm_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
@@ -2061,8 +2055,7 @@ static int xfrm_exp_state_notify(struct 
 	if (build_expire(skb, x, c) < 0)
 		BUG();
 
-	NETLINK_CB(skb).dst_group = XFRMNLGRP_EXPIRE;
-	return netlink_broadcast(xfrm_nl, skb, 0, XFRMNLGRP_EXPIRE, GFP_ATOMIC);
+	return nlmsg_multicast(xfrm_nl, skb, 0, XFRMNLGRP_EXPIRE, GFP_ATOMIC);
 }
 
 static int xfrm_aevent_state_notify(struct xfrm_state *x, struct km_event *c)
@@ -2079,8 +2072,7 @@ static int xfrm_aevent_state_notify(stru
 	if (build_aevent(skb, x, c) < 0)
 		BUG();
 
-	NETLINK_CB(skb).dst_group = XFRMNLGRP_AEVENTS;
-	return netlink_broadcast(xfrm_nl, skb, 0, XFRMNLGRP_AEVENTS, GFP_ATOMIC);
+	return nlmsg_multicast(xfrm_nl, skb, 0, XFRMNLGRP_AEVENTS, GFP_ATOMIC);
 }
 
 static int xfrm_notify_sa_flush(struct km_event *c)
@@ -2105,8 +2097,7 @@ static int xfrm_notify_sa_flush(struct k
 
 	nlmsg_end(skb, nlh);
 
-	NETLINK_CB(skb).dst_group = XFRMNLGRP_SA;
-	return netlink_broadcast(xfrm_nl, skb, 0, XFRMNLGRP_SA, GFP_ATOMIC);
+	return nlmsg_multicast(xfrm_nl, skb, 0, XFRMNLGRP_SA, GFP_ATOMIC);
 }
 
 static inline int xfrm_sa_len(struct xfrm_state *x)
@@ -2175,8 +2166,7 @@ static int xfrm_notify_sa(struct xfrm_st
 
 	nlmsg_end(skb, nlh);
 
-	NETLINK_CB(skb).dst_group = XFRMNLGRP_SA;
-	return netlink_broadcast(xfrm_nl, skb, 0, XFRMNLGRP_SA, GFP_ATOMIC);
+	return nlmsg_multicast(xfrm_nl, skb, 0, XFRMNLGRP_SA, GFP_ATOMIC);
 
 nlmsg_failure:
 rtattr_failure:
@@ -2262,8 +2252,7 @@ static int xfrm_send_acquire(struct xfrm
 	if (build_acquire(skb, x, xt, xp, dir) < 0)
 		BUG();
 
-	NETLINK_CB(skb).dst_group = XFRMNLGRP_ACQUIRE;
-	return netlink_broadcast(xfrm_nl, skb, 0, XFRMNLGRP_ACQUIRE, GFP_ATOMIC);
+	return nlmsg_multicast(xfrm_nl, skb, 0, XFRMNLGRP_ACQUIRE, GFP_ATOMIC);
 }
 
 /* User gives us xfrm_user_policy_info followed by an array of 0
@@ -2371,8 +2360,7 @@ static int xfrm_exp_policy_notify(struct
 	if (build_polexpire(skb, xp, dir, c) < 0)
 		BUG();
 
-	NETLINK_CB(skb).dst_group = XFRMNLGRP_EXPIRE;
-	return netlink_broadcast(xfrm_nl, skb, 0, XFRMNLGRP_EXPIRE, GFP_ATOMIC);
+	return nlmsg_multicast(xfrm_nl, skb, 0, XFRMNLGRP_EXPIRE, GFP_ATOMIC);
 }
 
 static int xfrm_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *c)
@@ -2423,8 +2411,7 @@ static int xfrm_notify_policy(struct xfr
 
 	nlmsg_end(skb, nlh);
 
-	NETLINK_CB(skb).dst_group = XFRMNLGRP_POLICY;
-	return netlink_broadcast(xfrm_nl, skb, 0, XFRMNLGRP_POLICY, GFP_ATOMIC);
+	return nlmsg_multicast(xfrm_nl, skb, 0, XFRMNLGRP_POLICY, GFP_ATOMIC);
 
 nlmsg_failure:
 rtattr_failure:
@@ -2454,8 +2441,7 @@ static int xfrm_notify_policy_flush(stru
 
 	nlmsg_end(skb, nlh);
 
-	NETLINK_CB(skb).dst_group = XFRMNLGRP_POLICY;
-	return netlink_broadcast(xfrm_nl, skb, 0, XFRMNLGRP_POLICY, GFP_ATOMIC);
+	return nlmsg_multicast(xfrm_nl, skb, 0, XFRMNLGRP_POLICY, GFP_ATOMIC);
 
 nlmsg_failure:
 	kfree_skb(skb);
@@ -2520,8 +2506,7 @@ static int xfrm_send_report(u8 proto, st
 	if (build_report(skb, proto, sel, addr) < 0)
 		BUG();
 
-	NETLINK_CB(skb).dst_group = XFRMNLGRP_REPORT;
-	return netlink_broadcast(xfrm_nl, skb, 0, XFRMNLGRP_REPORT, GFP_ATOMIC);
+	return nlmsg_multicast(xfrm_nl, skb, 0, XFRMNLGRP_REPORT, GFP_ATOMIC);
 }
 
 static struct xfrm_mgr netlink_mgr = {

-- 


  parent reply	other threads:[~2007-08-22 15:29 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-22 14:55 [PATCH 00/16] xfrm netlink interface cleanups Thomas Graf
2007-08-22 14:55 ` [PATCH 01/16] [XFRM] netlink: Use nlmsg_put() instead of NLMSG_PUT() Thomas Graf
2007-08-22 19:47   ` David Miller
2007-08-22 14:55 ` [PATCH 02/16] [XFRM] netlink: Use nlmsg_end() and nlmsg_cancel() Thomas Graf
2007-08-22 19:47   ` David Miller
2007-08-22 14:55 ` [PATCH 03/16] [XFRM] netlink: Use nlmsg_data() instead of NLMSG_DATA() Thomas Graf
2007-08-22 19:49   ` David Miller
2007-08-22 14:55 ` Thomas Graf [this message]
2007-08-22 20:54   ` [PATCH 04/16] [XFRM] netlink: Use nlmsg_broadcast() and nlmsg_unicast() David Miller
2007-08-22 14:55 ` [PATCH 05/16] [XFRM] netlink: Use nla_put()/NLA_PUT() variantes Thomas Graf
2007-08-22 20:55   ` David Miller
2007-08-22 14:55 ` [PATCH 06/16] [XFRM] netlink: Move algorithm length calculation to its own function Thomas Graf
2007-08-22 20:56   ` David Miller
2007-08-22 14:55 ` [PATCH 07/16] [XFRM] netlink: Clear up some of the CONFIG_XFRM_SUB_POLICY ifdef mess Thomas Graf
2007-08-22 20:57   ` David Miller
2007-08-22 14:55 ` [PATCH 08/16] [XFRM] netlink: Use nlmsg_new() and type-safe size calculation helpers Thomas Graf
2007-08-22 20:57   ` David Miller
2007-08-22 14:55 ` [PATCH 09/16] [XFRM] netlink: Use nlmsg_parse() to parse attributes Thomas Graf
2007-08-22 20:58   ` David Miller
2007-08-22 14:55 ` [PATCH 10/16] [XFRM] netlink: Establish an attribute policy Thomas Graf
2007-08-22 20:59   ` David Miller
2007-08-22 14:55 ` [PATCH 11/16] [XFRM] netlink: Enhance indexing of the attribute array Thomas Graf
2007-08-22 20:59   ` David Miller
2007-08-22 14:55 ` [PATCH 12/16] [XFRM] netlink: Rename attribyte array from xfrma[] to attrs[] Thomas Graf
2007-08-22 21:01   ` David Miller
2007-08-22 14:55 ` [PATCH 13/16] [XFRM] netlink: Use nlattr instead of rtattr Thomas Graf
2007-08-22 21:01   ` David Miller
2007-08-22 14:55 ` [PATCH 14/16] [XFRM] netlink: Use nla_memcpy() in xfrm_update_ae_params() Thomas Graf
2007-08-22 21:02   ` David Miller
2007-08-22 14:55 ` [PATCH 15/16] [XFRM] netlink: Remove dependency on rtnetlink Thomas Graf
2007-08-22 21:02   ` David Miller
2007-08-22 14:55 ` [PATCH 16/16] [XFRM] netlink: Inline attach_encap_tmpl(), attach_sec_ctx(), and attach_one_addr() Thomas Graf
2007-08-22 21:03   ` David Miller
2007-08-24 10:05   ` [PATCH] [XFRM] : Fix pointer copy size for encap_tmpl and coaddr Masahide NAKAMURA
2007-08-24 10:35     ` Thomas Graf
2007-08-25  6:30     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070822145630.343335774@lsx.localdomain \
    --to=tgraf@suug.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox