diff options
author | Jon Maloy <jmaloy@redhat.com> | 2021-03-16 22:06:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-03-17 11:51:04 -0700 |
commit | 998d3907f419ed5c27728161d34f5ed14be53fc0 (patch) | |
tree | bd426a798bca3df3c922261e084006c03de2c656 /net/tipc/socket.c | |
parent | 5c9e418b0616cfdc2dd2de99e8d6d8deb1f213eb (diff) |
tipc: re-organize members of struct publication
In a future commit we will introduce more members to struct publication.
In order to keep this structure comprehensible we now group some of
its current fields into the sub-structures where they really belong,
- A struct tipc_service_range for the functional address the publication
is representing.
- A struct tipc_socket_addr for the socket bound to that service range.
We also rename the stack variable 'publ' to just 'p' in a few places.
This is just as easy to understand in the given context, and keeps the
number of wrapped code lines to a minimum.
There are no functional changes in this commit.
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Hoang Le <hoang.h.le@dektech.com.au>
Acked-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
Acked-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index cebcc104dc70..fe522d49f747 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -3,7 +3,7 @@ * * Copyright (c) 2001-2007, 2012-2019, Ericsson AB * Copyright (c) 2004-2008, 2010-2013, Wind River Systems - * Copyright (c) 2020, Red Hat Inc + * Copyright (c) 2020-2021, Red Hat Inc * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -2923,30 +2923,30 @@ static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope, struct tipc_service_range const *seq) { struct net *net = sock_net(&tsk->sk); - struct publication *publ; + struct publication *p; struct publication *safe; int rc = -EINVAL; if (scope != TIPC_NODE_SCOPE) scope = TIPC_CLUSTER_SCOPE; - list_for_each_entry_safe(publ, safe, &tsk->publications, binding_sock) { + list_for_each_entry_safe(p, safe, &tsk->publications, binding_sock) { if (seq) { - if (publ->scope != scope) + if (p->scope != scope) continue; - if (publ->type != seq->type) + if (p->sr.type != seq->type) continue; - if (publ->lower != seq->lower) + if (p->sr.lower != seq->lower) continue; - if (publ->upper != seq->upper) + if (p->sr.upper != seq->upper) break; - tipc_nametbl_withdraw(net, publ->type, publ->lower, - publ->upper, publ->key); + tipc_nametbl_withdraw(net, p->sr.type, p->sr.lower, + p->sr.upper, p->key); rc = 0; break; } - tipc_nametbl_withdraw(net, publ->type, publ->lower, - publ->upper, publ->key); + tipc_nametbl_withdraw(net, p->sr.type, p->sr.lower, + p->sr.upper, p->key); rc = 0; } if (list_empty(&tsk->publications)) @@ -3711,11 +3711,11 @@ static int __tipc_nl_add_sk_publ(struct sk_buff *skb, if (nla_put_u32(skb, TIPC_NLA_PUBL_KEY, publ->key)) goto attr_msg_cancel; - if (nla_put_u32(skb, TIPC_NLA_PUBL_TYPE, publ->type)) + if (nla_put_u32(skb, TIPC_NLA_PUBL_TYPE, publ->sr.type)) goto attr_msg_cancel; - if (nla_put_u32(skb, TIPC_NLA_PUBL_LOWER, publ->lower)) + if (nla_put_u32(skb, TIPC_NLA_PUBL_LOWER, publ->sr.lower)) goto attr_msg_cancel; - if (nla_put_u32(skb, TIPC_NLA_PUBL_UPPER, publ->upper)) + if (nla_put_u32(skb, TIPC_NLA_PUBL_UPPER, publ->sr.upper)) goto attr_msg_cancel; nla_nest_end(skb, attrs); @@ -3863,9 +3863,9 @@ bool tipc_sk_filtering(struct sock *sk) p = list_first_entry_or_null(&tsk->publications, struct publication, binding_sock); if (p) { - type = p->type; - lower = p->lower; - upper = p->upper; + type = p->sr.type; + lower = p->sr.lower; + upper = p->sr.upper; } } @@ -3964,9 +3964,9 @@ int tipc_sk_dump(struct sock *sk, u16 dqueues, char *buf) if (tsk->published) { p = list_first_entry_or_null(&tsk->publications, struct publication, binding_sock); - i += scnprintf(buf + i, sz - i, " %u", (p) ? p->type : 0); - i += scnprintf(buf + i, sz - i, " %u", (p) ? p->lower : 0); - i += scnprintf(buf + i, sz - i, " %u", (p) ? p->upper : 0); + i += scnprintf(buf + i, sz - i, " %u", (p) ? p->sr.type : 0); + i += scnprintf(buf + i, sz - i, " %u", (p) ? p->sr.lower : 0); + i += scnprintf(buf + i, sz - i, " %u", (p) ? p->sr.upper : 0); } i += scnprintf(buf + i, sz - i, " | %u", tsk->snd_win); i += scnprintf(buf + i, sz - i, " %u", tsk->rcv_win); |