From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: "David S. Miller" <davem@davemloft.net>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] net: core: export dev_alloc_name_ns
Date: Tue, 21 Nov 2017 01:34:37 +0100 [thread overview]
Message-ID: <20171121003439.10974-1-linux@rasmusvillemoes.dk> (raw)
dev_alloc_name_ns and dev_get_valid_name now do exactly the same
thing. Let's expose this functionality as dev_alloc_name_ns
(obviously, a core function like this won't return an invalid
name...).
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
include/linux/netdevice.h | 1 +
net/core/dev.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 6b274bfe489f..e249d3d0ff85 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2447,6 +2447,7 @@ 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);
int dev_alloc_name(struct net_device *dev, const char *name);
+int dev_alloc_name_ns(struct net *net, struct net_device *dev, const char *name);
int dev_open(struct net_device *dev);
void dev_close(struct net_device *dev);
void dev_close_many(struct list_head *head, bool unlink);
diff --git a/net/core/dev.c b/net/core/dev.c
index 8ee29f4f5fa9..9575e7329823 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1109,9 +1109,9 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf)
return p ? -ENFILE : -EEXIST;
}
-static int dev_alloc_name_ns(struct net *net,
- struct net_device *dev,
- const char *name)
+int dev_alloc_name_ns(struct net *net,
+ struct net_device *dev,
+ const char *name)
{
char buf[IFNAMSIZ];
int ret;
@@ -1122,6 +1122,7 @@ static int dev_alloc_name_ns(struct net *net,
strlcpy(dev->name, buf, IFNAMSIZ);
return ret;
}
+EXPORT_SYMBOL(dev_alloc_name_ns);
/**
* dev_alloc_name - allocate a name for a device
--
2.11.0
next reply other threads:[~2017-11-21 0:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-21 0:34 Rasmus Villemoes [this message]
2017-11-21 0:34 ` [PATCH 2/3] net: use dev_alloc_name_ns instead of dev_get_valid_name Rasmus Villemoes
2017-11-21 0:34 ` [PATCH 3/3] net: core: remove dev_get_valid_name Rasmus Villemoes
2017-11-24 20:11 ` [PATCH 1/3] net: core: export dev_alloc_name_ns David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171121003439.10974-1-linux@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®