diff options
author | James Chapman <jchapman@katalix.com> | 2010-04-02 02:18:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-03 17:56:02 -0400 |
commit | 63f96072f9ba430aa348bc987c3d5a4f48bae301 (patch) | |
tree | 7c210e4a03f09c12f302a8f4800e1258660c1068 | |
parent | fd558d186df2c13a22455373858bae634a4795af (diff) |
ppp: Add ppp_dev_name() exported function
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ppp_generic.c | 19 | ||||
-rw-r--r-- | 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 6d61602208c1..8a0dd8a843a9 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) | |||
2163 | } | 2163 | } |
2164 | 2164 | ||
2165 | /* | 2165 | /* |
2166 | * Return the PPP device interface name of a channel. | ||
2167 | */ | ||
2168 | char *ppp_dev_name(struct ppp_channel *chan) | ||
2169 | { | ||
2170 | struct channel *pch = chan->ppp; | ||
2171 | char *name = NULL; | ||
2172 | |||
2173 | if (pch) { | ||
2174 | read_lock_bh(&pch->upl); | ||
2175 | if (pch->ppp && pch->ppp->dev) | ||
2176 | name = pch->ppp->dev->name; | ||
2177 | read_unlock_bh(&pch->upl); | ||
2178 | } | ||
2179 | return name; | ||
2180 | } | ||
2181 | |||
2182 | |||
2183 | /* | ||
2166 | * Disconnect a channel from the generic layer. | 2184 | * Disconnect a channel from the generic layer. |
2167 | * This must be called in process context. | 2185 | * This must be called in process context. |
2168 | */ | 2186 | */ |
@@ -2890,6 +2908,7 @@ EXPORT_SYMBOL(ppp_register_channel); | |||
2890 | EXPORT_SYMBOL(ppp_unregister_channel); | 2908 | EXPORT_SYMBOL(ppp_unregister_channel); |
2891 | EXPORT_SYMBOL(ppp_channel_index); | 2909 | EXPORT_SYMBOL(ppp_channel_index); |
2892 | EXPORT_SYMBOL(ppp_unit_number); | 2910 | EXPORT_SYMBOL(ppp_unit_number); |
2911 | EXPORT_SYMBOL(ppp_dev_name); | ||
2893 | EXPORT_SYMBOL(ppp_input); | 2912 | EXPORT_SYMBOL(ppp_input); |
2894 | EXPORT_SYMBOL(ppp_input_error); | 2913 | EXPORT_SYMBOL(ppp_input_error); |
2895 | EXPORT_SYMBOL(ppp_output_wakeup); | 2914 | EXPORT_SYMBOL(ppp_output_wakeup); |
diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h index 0d3fa63e90ea..bff98ec1bfed 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 *); | |||
72 | /* Get the unit number associated with a channel, or -1 if none */ | 72 | /* Get the unit number associated with a channel, or -1 if none */ |
73 | extern int ppp_unit_number(struct ppp_channel *); | 73 | extern int ppp_unit_number(struct ppp_channel *); |
74 | 74 | ||
75 | /* Get the device name associated with a channel, or NULL if none */ | ||
76 | extern char *ppp_dev_name(struct ppp_channel *); | ||
77 | |||
75 | /* | 78 | /* |
76 | * SMP locking notes: | 79 | * SMP locking notes: |
77 | * The channel code must ensure that when it calls ppp_unregister_channel, | 80 | * The channel code must ensure that when it calls ppp_unregister_channel, |