diff mbox series

[RFC,net-next,3/9] net: export netdev_name_node_lookup

Message ID 20210928125500.167943-4-atenart@kernel.org (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series Userspace spinning on net-sysfs access | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 8 maintainers not CCed: weiwan@google.com ap420073@gmail.com arnd@arndb.de bjorn@kernel.org memxor@gmail.com daniel@iogearbox.net edumazet@google.com alobakin@pm.me
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 4846 this patch: 4846
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 25 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 4940 this patch: 4940
netdev/header_inline success Link

Commit Message

Antoine Tenart Sept. 28, 2021, 12:54 p.m. UTC
Export netdev_name_node_lookup for use outside of net/core/dev.c. Prior
to this __dev_get_by_name was used for both name collision detection and
to retrieve a net device reference. We now want to allow a difference in
behaviour between the two, hence exporting netdev_name_node_lookup. (It
will be used in the next commits).

Signed-off-by: Antoine Tenart <atenart@kernel.org>
---
 include/linux/netdevice.h | 2 ++
 net/core/dev.c            | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d79163208dfd..f8dae47b9aa8 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2955,6 +2955,8 @@  struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags,
 struct net_device *dev_get_by_name(struct net *net, const char *name);
 struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
 struct net_device *__dev_get_by_name(struct net *net, const char *name);
+struct netdev_name_node *netdev_name_node_lookup(struct net *net,
+						 const char *name);
 int dev_alloc_name(struct net_device *dev, const char *name);
 int dev_open(struct net_device *dev, struct netlink_ext_ack *extack);
 void dev_close(struct net_device *dev);
diff --git a/net/core/dev.c b/net/core/dev.c
index 2f28b70e5244..bfe17a264d6c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -279,8 +279,8 @@  static void netdev_name_node_del(struct netdev_name_node *name_node)
 	hlist_del_rcu(&name_node->hlist);
 }
 
-static struct netdev_name_node *netdev_name_node_lookup(struct net *net,
-							const char *name)
+struct netdev_name_node *netdev_name_node_lookup(struct net *net,
+						 const char *name)
 {
 	struct hlist_head *head = dev_name_hash(net, name);
 	struct netdev_name_node *name_node;
@@ -290,6 +290,7 @@  static struct netdev_name_node *netdev_name_node_lookup(struct net *net,
 			return name_node;
 	return NULL;
 }
+EXPORT_SYMBOL(netdev_name_node_lookup);
 
 static struct netdev_name_node *netdev_name_node_lookup_rcu(struct net *net,
 							    const char *name)