Commit 7a0877d4 authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by David S. Miller

netns: rename peernet2id() to peernet2id_alloc()

In a following commit, a new function will be introduced to only lookup for
a nsid (no allocation if the nsid doesn't exist). To avoid confusion, the
existing function is renamed.
Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cab3c8ec
...@@ -336,7 +336,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan, ...@@ -336,7 +336,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
if (!net_eq(dev_net(vxlan->dev), vxlan->net) && if (!net_eq(dev_net(vxlan->dev), vxlan->net) &&
nla_put_s32(skb, NDA_LINK_NETNSID, nla_put_s32(skb, NDA_LINK_NETNSID,
peernet2id(dev_net(vxlan->dev), vxlan->net))) peernet2id_alloc(dev_net(vxlan->dev), vxlan->net)))
goto nla_put_failure; goto nla_put_failure;
if (send_eth && nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->eth_addr)) if (send_eth && nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->eth_addr))
......
...@@ -271,7 +271,7 @@ static inline struct net *read_pnet(const possible_net_t *pnet) ...@@ -271,7 +271,7 @@ static inline struct net *read_pnet(const possible_net_t *pnet)
#define __net_initconst __initconst #define __net_initconst __initconst
#endif #endif
int peernet2id(struct net *net, struct net *peer); int peernet2id_alloc(struct net *net, struct net *peer);
struct net *get_net_ns_by_id(struct net *net, int id); struct net *get_net_ns_by_id(struct net *net, int id);
struct pernet_operations { struct pernet_operations {
......
...@@ -202,13 +202,13 @@ static int __peernet2id(struct net *net, struct net *peer, bool alloc) ...@@ -202,13 +202,13 @@ static int __peernet2id(struct net *net, struct net *peer, bool alloc)
/* This function returns the id of a peer netns. If no id is assigned, one will /* This function returns the id of a peer netns. If no id is assigned, one will
* be allocated and returned. * be allocated and returned.
*/ */
int peernet2id(struct net *net, struct net *peer) int peernet2id_alloc(struct net *net, struct net *peer)
{ {
bool alloc = atomic_read(&peer->count) == 0 ? false : true; bool alloc = atomic_read(&peer->count) == 0 ? false : true;
return __peernet2id(net, peer, alloc); return __peernet2id(net, peer, alloc);
} }
EXPORT_SYMBOL(peernet2id); EXPORT_SYMBOL(peernet2id_alloc);
struct net *get_net_ns_by_id(struct net *net, int id) struct net *get_net_ns_by_id(struct net *net, int id)
{ {
......
...@@ -1204,7 +1204,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, ...@@ -1204,7 +1204,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
struct net *link_net = dev->rtnl_link_ops->get_link_net(dev); struct net *link_net = dev->rtnl_link_ops->get_link_net(dev);
if (!net_eq(dev_net(dev), link_net)) { if (!net_eq(dev_net(dev), link_net)) {
int id = peernet2id(dev_net(dev), link_net); int id = peernet2id_alloc(dev_net(dev), link_net);
if (nla_put_s32(skb, IFLA_LINK_NETNSID, id)) if (nla_put_s32(skb, IFLA_LINK_NETNSID, id))
goto nla_put_failure; goto nla_put_failure;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment