sock: Change the netns_core member name.
Change the member name will make the code more readable. This patch will be used in next patch. Signed-off-by: Martin Zhang <zhangjunweimartin@didichuxing.com> Signed-off-by: Tonghao Zhang <zhangtonghao@didichuxing.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
962b582785
commit
08fc7f8140
|
@ -11,7 +11,7 @@ struct netns_core {
|
||||||
|
|
||||||
int sysctl_somaxconn;
|
int sysctl_somaxconn;
|
||||||
|
|
||||||
struct prot_inuse __percpu *inuse;
|
struct prot_inuse __percpu *prot_inuse;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3045,7 +3045,7 @@ static DECLARE_BITMAP(proto_inuse_idx, PROTO_INUSE_NR);
|
||||||
|
|
||||||
void sock_prot_inuse_add(struct net *net, struct proto *prot, int val)
|
void sock_prot_inuse_add(struct net *net, struct proto *prot, int val)
|
||||||
{
|
{
|
||||||
__this_cpu_add(net->core.inuse->val[prot->inuse_idx], val);
|
__this_cpu_add(net->core.prot_inuse->val[prot->inuse_idx], val);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(sock_prot_inuse_add);
|
EXPORT_SYMBOL_GPL(sock_prot_inuse_add);
|
||||||
|
|
||||||
|
@ -3055,7 +3055,7 @@ int sock_prot_inuse_get(struct net *net, struct proto *prot)
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
for_each_possible_cpu(cpu)
|
for_each_possible_cpu(cpu)
|
||||||
res += per_cpu_ptr(net->core.inuse, cpu)->val[idx];
|
res += per_cpu_ptr(net->core.prot_inuse, cpu)->val[idx];
|
||||||
|
|
||||||
return res >= 0 ? res : 0;
|
return res >= 0 ? res : 0;
|
||||||
}
|
}
|
||||||
|
@ -3063,13 +3063,13 @@ EXPORT_SYMBOL_GPL(sock_prot_inuse_get);
|
||||||
|
|
||||||
static int __net_init sock_inuse_init_net(struct net *net)
|
static int __net_init sock_inuse_init_net(struct net *net)
|
||||||
{
|
{
|
||||||
net->core.inuse = alloc_percpu(struct prot_inuse);
|
net->core.prot_inuse = alloc_percpu(struct prot_inuse);
|
||||||
return net->core.inuse ? 0 : -ENOMEM;
|
return net->core.prot_inuse ? 0 : -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __net_exit sock_inuse_exit_net(struct net *net)
|
static void __net_exit sock_inuse_exit_net(struct net *net)
|
||||||
{
|
{
|
||||||
free_percpu(net->core.inuse);
|
free_percpu(net->core.prot_inuse);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct pernet_operations net_inuse_ops = {
|
static struct pernet_operations net_inuse_ops = {
|
||||||
|
|
Loading…
Reference in New Issue