diff options
author | Jon Maloy <jmaloy@redhat.com> | 2021-03-17 03:06:12 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-03-17 19:51:04 +0100 |
commit | a45ffa68573e97fdced4b08aef19efda555f18bc (patch) | |
tree | 2bc397a361037e18fa4d387e2dd09aad277190d7 /net/tipc/name_table.c | |
parent | tipc: simplify signature of tipc_namtbl_publish() (diff) | |
download | linux-a45ffa68573e97fdced4b08aef19efda555f18bc.tar.xz linux-a45ffa68573e97fdced4b08aef19efda555f18bc.zip |
tipc: simplify call signatures for publication creation
We simplify the call signatures for tipc_nametbl_insert_publ() and
tipc_publ_create() so that fewer parameters are passed around.
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/name_table.c')
-rw-r--r-- | net/tipc/name_table.c | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 7b309fdd0090..146c478143a6 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c @@ -222,16 +222,12 @@ static int hash(int x) /** * tipc_publ_create - create a publication structure - * @type: name sequence type - * @lower: name sequence lower bound - * @upper: name sequence upper bound - * @scope: publication scope - * @node: network address of publishing socket - * @port: publishing port + * @ua: the service range the user is binding to + * @sk: the address of the socket that is bound * @key: publication key */ -static struct publication *tipc_publ_create(u32 type, u32 lower, u32 upper, - u32 scope, u32 node, u32 port, +static struct publication *tipc_publ_create(struct tipc_uaddr *ua, + struct tipc_socket_addr *sk, u32 key) { struct publication *p = kzalloc(sizeof(*p), GFP_ATOMIC); @@ -239,12 +235,9 @@ static struct publication *tipc_publ_create(u32 type, u32 lower, u32 upper, if (!p) return NULL; - p->sr.type = type; - p->sr.lower = lower; - p->sr.upper = upper; - p->scope = scope; - p->sk.node = node; - p->sk.ref = port; + p->sr = ua->sr; + p->sk = *sk; + p->scope = ua->scope; p->key = key; INIT_LIST_HEAD(&p->binding_sock); INIT_LIST_HEAD(&p->binding_node); @@ -472,22 +465,23 @@ static struct tipc_service *tipc_service_find(struct net *net, u32 type) return NULL; }; -struct publication *tipc_nametbl_insert_publ(struct net *net, u32 type, - u32 lower, u32 upper, - u32 scope, u32 node, - u32 port, u32 key) +struct publication *tipc_nametbl_insert_publ(struct net *net, + struct tipc_uaddr *ua, + struct tipc_socket_addr *sk, + u32 key) { struct name_table *nt = tipc_name_table(net); struct tipc_service *sc; struct publication *p; + u32 type = ua->sr.type; - p = tipc_publ_create(type, lower, upper, scope, node, port, key); + p = tipc_publ_create(ua, sk, key); if (!p) return NULL; - if (scope > TIPC_NODE_SCOPE || lower > upper) { - pr_debug("Failed to bind illegal {%u,%u,%u} with scope %u\n", - type, lower, upper, scope); + if (ua->sr.lower > ua->sr.upper) { + pr_debug("Failed to bind illegal {%u,%u,%u} from node %u\n", + type, ua->sr.lower, ua->sr.upper, sk->node); return NULL; } sc = tipc_service_find(net, type); @@ -756,9 +750,7 @@ struct publication *tipc_nametbl_publish(struct net *net, struct tipc_uaddr *ua, goto exit; } - p = tipc_nametbl_insert_publ(net, ua->sr.type, ua->sr.lower, - ua->sr.upper, ua->scope, - sk->node, sk->ref, key); + p = tipc_nametbl_insert_publ(net, ua, sk, key); if (p) { nt->local_publ_count++; skb = tipc_named_publish(net, p); |