aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/bind_addr.c
diff options
context:
space:
mode:
authorRobert P. J. Day <rpjday@crashcourse.ca>2008-04-12 21:54:24 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-12 21:54:24 -0400
commit9dbc15f055f05393ace4f1733f160ec3d188cf9b (patch)
treec3aca36fdb57d7b64aa5d5fdea0b7cf048c88dc7 /net/sctp/bind_addr.c
parent30e935600776b45db38238355f0de2b8f72b3847 (diff)
[SCTP]: "list_for_each()" -> "list_for_each_entry()" where appropriate.
Replacing (almost) all invocations of list_for_each() with list_for_each_entry() tightens up the code and allows for the deletion of numerous list iterator variables that are no longer necessary. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/bind_addr.c')
-rw-r--r--net/sctp/bind_addr.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index ceefda025e2d..80e6df06967a 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -67,15 +67,13 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
67 int flags) 67 int flags)
68{ 68{
69 struct sctp_sockaddr_entry *addr; 69 struct sctp_sockaddr_entry *addr;
70 struct list_head *pos;
71 int error = 0; 70 int error = 0;
72 71
73 /* All addresses share the same port. */ 72 /* All addresses share the same port. */
74 dest->port = src->port; 73 dest->port = src->port;
75 74
76 /* Extract the addresses which are relevant for this scope. */ 75 /* Extract the addresses which are relevant for this scope. */
77 list_for_each(pos, &src->address_list) { 76 list_for_each_entry(addr, &src->address_list, list) {
78 addr = list_entry(pos, struct sctp_sockaddr_entry, list);
79 error = sctp_copy_one_addr(dest, &addr->a, scope, 77 error = sctp_copy_one_addr(dest, &addr->a, scope,
80 gfp, flags); 78 gfp, flags);
81 if (error < 0) 79 if (error < 0)
@@ -87,9 +85,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
87 * the assumption that we must be sitting behind a NAT. 85 * the assumption that we must be sitting behind a NAT.
88 */ 86 */
89 if (list_empty(&dest->address_list) && (SCTP_SCOPE_GLOBAL == scope)) { 87 if (list_empty(&dest->address_list) && (SCTP_SCOPE_GLOBAL == scope)) {
90 list_for_each(pos, &src->address_list) { 88 list_for_each_entry(addr, &src->address_list, list) {
91 addr = list_entry(pos, struct sctp_sockaddr_entry,
92 list);
93 error = sctp_copy_one_addr(dest, &addr->a, 89 error = sctp_copy_one_addr(dest, &addr->a,
94 SCTP_SCOPE_LINK, gfp, 90 SCTP_SCOPE_LINK, gfp,
95 flags); 91 flags);
@@ -115,14 +111,12 @@ int sctp_bind_addr_dup(struct sctp_bind_addr *dest,
115 gfp_t gfp) 111 gfp_t gfp)
116{ 112{
117 struct sctp_sockaddr_entry *addr; 113 struct sctp_sockaddr_entry *addr;
118 struct list_head *pos;
119 int error = 0; 114 int error = 0;
120 115
121 /* All addresses share the same port. */ 116 /* All addresses share the same port. */
122 dest->port = src->port; 117 dest->port = src->port;
123 118
124 list_for_each(pos, &src->address_list) { 119 list_for_each_entry(addr, &src->address_list, list) {
125 addr = list_entry(pos, struct sctp_sockaddr_entry, list);
126 error = sctp_add_bind_addr(dest, &addr->a, 1, gfp); 120 error = sctp_add_bind_addr(dest, &addr->a, 1, gfp);
127 if (error < 0) 121 if (error < 0)
128 break; 122 break;
@@ -273,8 +267,7 @@ union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,
273 267
274 addrparms = retval; 268 addrparms = retval;
275 269
276 list_for_each(pos, &bp->address_list) { 270 list_for_each_entry(addr, &bp->address_list, list) {
277 addr = list_entry(pos, struct sctp_sockaddr_entry, list);
278 af = sctp_get_af_specific(addr->a.v4.sin_family); 271 af = sctp_get_af_specific(addr->a.v4.sin_family);
279 len = af->to_addr_param(&addr->a, &rawaddr); 272 len = af->to_addr_param(&addr->a, &rawaddr);
280 memcpy(addrparms.v, &rawaddr, len); 273 memcpy(addrparms.v, &rawaddr, len);