mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-12 09:24:17 +00:00
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>
This commit is contained in:
parent
50a3499ab8
commit
a45ffa6857
3 changed files with 34 additions and 40 deletions
|
@ -293,30 +293,31 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i,
|
||||||
u32 node, u32 dtype)
|
u32 node, u32 dtype)
|
||||||
{
|
{
|
||||||
struct publication *p = NULL;
|
struct publication *p = NULL;
|
||||||
u32 lower = ntohl(i->lower);
|
struct tipc_socket_addr sk;
|
||||||
u32 upper = ntohl(i->upper);
|
struct tipc_uaddr ua;
|
||||||
u32 type = ntohl(i->type);
|
|
||||||
u32 port = ntohl(i->port);
|
|
||||||
u32 key = ntohl(i->key);
|
u32 key = ntohl(i->key);
|
||||||
|
|
||||||
|
tipc_uaddr(&ua, TIPC_SERVICE_RANGE, TIPC_CLUSTER_SCOPE,
|
||||||
|
ntohl(i->type), ntohl(i->lower), ntohl(i->upper));
|
||||||
|
sk.ref = ntohl(i->port);
|
||||||
|
sk.node = node;
|
||||||
|
|
||||||
if (dtype == PUBLICATION) {
|
if (dtype == PUBLICATION) {
|
||||||
p = tipc_nametbl_insert_publ(net, type, lower, upper,
|
p = tipc_nametbl_insert_publ(net, &ua, &sk, key);
|
||||||
TIPC_CLUSTER_SCOPE, node,
|
|
||||||
port, key);
|
|
||||||
if (p) {
|
if (p) {
|
||||||
tipc_node_subscribe(net, &p->binding_node, node);
|
tipc_node_subscribe(net, &p->binding_node, node);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (dtype == WITHDRAWAL) {
|
} else if (dtype == WITHDRAWAL) {
|
||||||
p = tipc_nametbl_remove_publ(net, type, lower,
|
p = tipc_nametbl_remove_publ(net, ua.sr.type, ua.sr.lower,
|
||||||
upper, node, key);
|
ua.sr.upper, node, key);
|
||||||
if (p) {
|
if (p) {
|
||||||
tipc_node_unsubscribe(net, &p->binding_node, node);
|
tipc_node_unsubscribe(net, &p->binding_node, node);
|
||||||
kfree_rcu(p, rcu);
|
kfree_rcu(p, rcu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
pr_warn_ratelimited("Failed to remove binding %u,%u from %x\n",
|
pr_warn_ratelimited("Failed to remove binding %u,%u from %u\n",
|
||||||
type, lower, node);
|
ua.sr.type, ua.sr.lower, node);
|
||||||
} else {
|
} else {
|
||||||
pr_warn("Unrecognized name table message received\n");
|
pr_warn("Unrecognized name table message received\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,16 +222,12 @@ static int hash(int x)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tipc_publ_create - create a publication structure
|
* tipc_publ_create - create a publication structure
|
||||||
* @type: name sequence type
|
* @ua: the service range the user is binding to
|
||||||
* @lower: name sequence lower bound
|
* @sk: the address of the socket that is bound
|
||||||
* @upper: name sequence upper bound
|
|
||||||
* @scope: publication scope
|
|
||||||
* @node: network address of publishing socket
|
|
||||||
* @port: publishing port
|
|
||||||
* @key: publication key
|
* @key: publication key
|
||||||
*/
|
*/
|
||||||
static struct publication *tipc_publ_create(u32 type, u32 lower, u32 upper,
|
static struct publication *tipc_publ_create(struct tipc_uaddr *ua,
|
||||||
u32 scope, u32 node, u32 port,
|
struct tipc_socket_addr *sk,
|
||||||
u32 key)
|
u32 key)
|
||||||
{
|
{
|
||||||
struct publication *p = kzalloc(sizeof(*p), GFP_ATOMIC);
|
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)
|
if (!p)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
p->sr.type = type;
|
p->sr = ua->sr;
|
||||||
p->sr.lower = lower;
|
p->sk = *sk;
|
||||||
p->sr.upper = upper;
|
p->scope = ua->scope;
|
||||||
p->scope = scope;
|
|
||||||
p->sk.node = node;
|
|
||||||
p->sk.ref = port;
|
|
||||||
p->key = key;
|
p->key = key;
|
||||||
INIT_LIST_HEAD(&p->binding_sock);
|
INIT_LIST_HEAD(&p->binding_sock);
|
||||||
INIT_LIST_HEAD(&p->binding_node);
|
INIT_LIST_HEAD(&p->binding_node);
|
||||||
|
@ -472,22 +465,23 @@ static struct tipc_service *tipc_service_find(struct net *net, u32 type)
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct publication *tipc_nametbl_insert_publ(struct net *net, u32 type,
|
struct publication *tipc_nametbl_insert_publ(struct net *net,
|
||||||
u32 lower, u32 upper,
|
struct tipc_uaddr *ua,
|
||||||
u32 scope, u32 node,
|
struct tipc_socket_addr *sk,
|
||||||
u32 port, u32 key)
|
u32 key)
|
||||||
{
|
{
|
||||||
struct name_table *nt = tipc_name_table(net);
|
struct name_table *nt = tipc_name_table(net);
|
||||||
struct tipc_service *sc;
|
struct tipc_service *sc;
|
||||||
struct publication *p;
|
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)
|
if (!p)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (scope > TIPC_NODE_SCOPE || lower > upper) {
|
if (ua->sr.lower > ua->sr.upper) {
|
||||||
pr_debug("Failed to bind illegal {%u,%u,%u} with scope %u\n",
|
pr_debug("Failed to bind illegal {%u,%u,%u} from node %u\n",
|
||||||
type, lower, upper, scope);
|
type, ua->sr.lower, ua->sr.upper, sk->node);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
sc = tipc_service_find(net, type);
|
sc = tipc_service_find(net, type);
|
||||||
|
@ -756,9 +750,7 @@ struct publication *tipc_nametbl_publish(struct net *net, struct tipc_uaddr *ua,
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = tipc_nametbl_insert_publ(net, ua->sr.type, ua->sr.lower,
|
p = tipc_nametbl_insert_publ(net, ua, sk, key);
|
||||||
ua->sr.upper, ua->scope,
|
|
||||||
sk->node, sk->ref, key);
|
|
||||||
if (p) {
|
if (p) {
|
||||||
nt->local_publ_count++;
|
nt->local_publ_count++;
|
||||||
skb = tipc_named_publish(net, p);
|
skb = tipc_named_publish(net, p);
|
||||||
|
|
|
@ -75,7 +75,7 @@ struct tipc_uaddr;
|
||||||
struct publication {
|
struct publication {
|
||||||
struct tipc_service_range sr;
|
struct tipc_service_range sr;
|
||||||
struct tipc_socket_addr sk;
|
struct tipc_socket_addr sk;
|
||||||
u32 scope;
|
u16 scope;
|
||||||
u32 key;
|
u32 key;
|
||||||
u32 id;
|
u32 id;
|
||||||
struct list_head binding_node;
|
struct list_head binding_node;
|
||||||
|
@ -125,9 +125,10 @@ struct publication *tipc_nametbl_publish(struct net *net, struct tipc_uaddr *ua,
|
||||||
struct tipc_socket_addr *sk, u32 key);
|
struct tipc_socket_addr *sk, u32 key);
|
||||||
int tipc_nametbl_withdraw(struct net *net, u32 type, u32 lower, u32 upper,
|
int tipc_nametbl_withdraw(struct net *net, u32 type, u32 lower, u32 upper,
|
||||||
u32 key);
|
u32 key);
|
||||||
struct publication *tipc_nametbl_insert_publ(struct net *net, u32 type,
|
struct publication *tipc_nametbl_insert_publ(struct net *net,
|
||||||
u32 lower, u32 upper, u32 scope,
|
struct tipc_uaddr *ua,
|
||||||
u32 node, u32 ref, u32 key);
|
struct tipc_socket_addr *sk,
|
||||||
|
u32 key);
|
||||||
struct publication *tipc_nametbl_remove_publ(struct net *net, u32 type,
|
struct publication *tipc_nametbl_remove_publ(struct net *net, u32 type,
|
||||||
u32 lower, u32 upper,
|
u32 lower, u32 upper,
|
||||||
u32 node, u32 key);
|
u32 node, u32 key);
|
||||||
|
|
Loading…
Add table
Reference in a new issue