Commit ff0d3e78 authored by Parthasarathy Bhuvaragan's avatar Parthasarathy Bhuvaragan Committed by David S. Miller

tipc: add a function to get the bearer name

Introduce a new function to get the bearer name from
its id. This is used in subsequent commit.
Reviewed-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarParthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bf1035b2
...@@ -171,6 +171,27 @@ struct tipc_bearer *tipc_bearer_find(struct net *net, const char *name) ...@@ -171,6 +171,27 @@ struct tipc_bearer *tipc_bearer_find(struct net *net, const char *name)
return NULL; return NULL;
} }
/* tipc_bearer_get_name - get the bearer name from its id.
* @net: network namespace
* @name: a pointer to the buffer where the name will be stored.
* @bearer_id: the id to get the name from.
*/
int tipc_bearer_get_name(struct net *net, char *name, u32 bearer_id)
{
struct tipc_net *tn = tipc_net(net);
struct tipc_bearer *b;
if (bearer_id >= MAX_BEARERS)
return -EINVAL;
b = rtnl_dereference(tn->bearer_list[bearer_id]);
if (!b)
return -EINVAL;
strcpy(name, b->name);
return 0;
}
void tipc_bearer_add_dest(struct net *net, u32 bearer_id, u32 dest) void tipc_bearer_add_dest(struct net *net, u32 bearer_id, u32 dest)
{ {
struct tipc_net *tn = net_generic(net, tipc_net_id); struct tipc_net *tn = net_generic(net, tipc_net_id);
......
...@@ -197,6 +197,7 @@ int tipc_l2_send_msg(struct net *net, struct sk_buff *buf, ...@@ -197,6 +197,7 @@ int tipc_l2_send_msg(struct net *net, struct sk_buff *buf,
void tipc_bearer_add_dest(struct net *net, u32 bearer_id, u32 dest); void tipc_bearer_add_dest(struct net *net, u32 bearer_id, u32 dest);
void tipc_bearer_remove_dest(struct net *net, u32 bearer_id, u32 dest); void tipc_bearer_remove_dest(struct net *net, u32 bearer_id, u32 dest);
struct tipc_bearer *tipc_bearer_find(struct net *net, const char *name); struct tipc_bearer *tipc_bearer_find(struct net *net, const char *name);
int tipc_bearer_get_name(struct net *net, char *name, u32 bearer_id);
struct tipc_media *tipc_media_find(const char *name); struct tipc_media *tipc_media_find(const char *name);
void tipc_bearer_reset_all(struct net *net); void tipc_bearer_reset_all(struct net *net);
int tipc_bearer_setup(void); int tipc_bearer_setup(void);
......
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