public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: James Chapman <jchapman@katalix•com>
To: netdev@vger•kernel.org
Subject: [PATCH v2 03/12] ppp: Add ppp_dev_name() exported function
Date: Mon, 29 Mar 2010 10:56:55 +0100	[thread overview]
Message-ID: <20100329095655.30460.54573.stgit@bert.katalix.com> (raw)
In-Reply-To: <20100329095639.30460.30496.stgit@bert.katalix.com>

ppp_dev_name() gives PPP users visibility of a ppp channel's device
name. This can be used by L2TP drivers to dump the assigned PPP
interface name.

Signed-off-by: James Chapman <jchapman@katalix•com>
Reviewed-by: Randy Dunlap <randy.dunlap@oracle•com>
---
 drivers/net/ppp_generic.c   |   19 +++++++++++++++++++
 include/linux/ppp_channel.h |    3 +++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 6d61602..8a0dd8a 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -2163,6 +2163,24 @@ int ppp_unit_number(struct ppp_channel *chan)
 }
 
 /*
+ * Return the PPP device interface name of a channel.
+ */
+char *ppp_dev_name(struct ppp_channel *chan)
+{
+	struct channel *pch = chan->ppp;
+	char *name = NULL;
+
+	if (pch) {
+		read_lock_bh(&pch->upl);
+		if (pch->ppp && pch->ppp->dev)
+			name = pch->ppp->dev->name;
+		read_unlock_bh(&pch->upl);
+	}
+	return name;
+}
+
+
+/*
  * Disconnect a channel from the generic layer.
  * This must be called in process context.
  */
@@ -2890,6 +2908,7 @@ EXPORT_SYMBOL(ppp_register_channel);
 EXPORT_SYMBOL(ppp_unregister_channel);
 EXPORT_SYMBOL(ppp_channel_index);
 EXPORT_SYMBOL(ppp_unit_number);
+EXPORT_SYMBOL(ppp_dev_name);
 EXPORT_SYMBOL(ppp_input);
 EXPORT_SYMBOL(ppp_input_error);
 EXPORT_SYMBOL(ppp_output_wakeup);
diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h
index 0d3fa63..bff98ec 100644
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -72,6 +72,9 @@ extern int ppp_channel_index(struct ppp_channel *);
 /* Get the unit number associated with a channel, or -1 if none */
 extern int ppp_unit_number(struct ppp_channel *);
 
+/* Get the device name associated with a channel, or NULL if none */
+extern char *ppp_dev_name(struct ppp_channel *);
+
 /*
  * SMP locking notes:
  * The channel code must ensure that when it calls ppp_unregister_channel,


  parent reply	other threads:[~2010-03-29  9:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-29  9:56 [PATCH v2 00/12] l2tp: Introduce L2TPv3 support James Chapman
2010-03-29  9:56 ` [PATCH v2 01/12] l2tp: Relocate pppol2tp driver to new net/l2tp directory James Chapman
2010-03-29  9:56 ` [PATCH v2 02/12] l2tp: Split pppol2tp patch into separate l2tp and ppp parts James Chapman
2010-03-29 10:18   ` Eric Dumazet
2010-03-29  9:56 ` James Chapman [this message]
2010-03-29  9:57 ` [PATCH v2 04/12] l2tp: Add ppp device name to L2TP ppp session data James Chapman
2010-03-29  9:57 ` [PATCH v2 05/12] l2tp: Add L2TPv3 protocol support James Chapman
2010-03-29  9:57 ` [PATCH v2 06/12] l2tp: Update PPP-over-L2TP driver to work over L2TPv3 James Chapman
2010-03-29  9:57 ` [PATCH v2 07/12] l2tp: Add L2TPv3 IP encapsulation (no UDP) support James Chapman
2010-03-29  9:57 ` [PATCH v2 08/12] netlink: Export genl_lock() API for use by modules James Chapman
2010-03-29  9:57 ` [PATCH v2 09/12] l2tp: Add netlink control API for L2TP James Chapman
2010-03-29  9:57 ` [PATCH v2 10/12] l2tp: Add L2TP ethernet pseudowire support James Chapman
2010-03-29 11:05   ` Eric Dumazet
2010-03-29 12:10     ` James Chapman
2010-03-29  9:57 ` [PATCH v2 11/12] l2tp: Add support for static unmanaged L2TPv3 tunnels James Chapman
2010-03-29 10:40   ` Eric Dumazet
2010-03-29 10:52     ` James Chapman
2010-03-29  9:57 ` [PATCH v2 12/12] l2tp: Update documentation James Chapman

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=20100329095655.30460.54573.stgit@bert.katalix.com \
    --to=jchapman@katalix$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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