aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@openwrt.org>2013-02-14 12:36:13 +0000
committerHauke Mehrtens <hauke@openwrt.org>2013-02-14 12:36:13 +0000
commite7ecb15a75509a391ba12fd6e143e48aeaddfef4 (patch)
treece9c9bcfeb6f820d2ae41bdd95f23149279e62ce
parenteb3cc6b537955fd92154b624b0684d15a5afe9dc (diff)
downloadupstream-e7ecb15a75509a391ba12fd6e143e48aeaddfef4.tar.gz
upstream-e7ecb15a75509a391ba12fd6e143e48aeaddfef4.tar.bz2
upstream-e7ecb15a75509a391ba12fd6e143e48aeaddfef4.zip
switch: export cpuport, ports and vlans via /proc
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35595 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/switch/src/switch-core.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/package/switch/src/switch-core.c b/package/switch/src/switch-core.c
index c77e4bba47..ab0754c94a 100644
--- a/package/switch/src/switch-core.c
+++ b/package/switch/src/switch-core.c
@@ -138,6 +138,24 @@ static int handle_driver_version(void *driver, char *buf, int nr)
return sprintf(buf, "%s\n", version);
}
+static int handle_driver_cpuport(void *driver, char *buf, int nr)
+{
+ int cpuport = ((switch_driver *) driver)->cpuport;
+ return sprintf(buf, "%i\n", cpuport);
+}
+
+static int handle_driver_ports(void *driver, char *buf, int nr)
+{
+ int ports = ((switch_driver *) driver)->ports;
+ return sprintf(buf, "%i\n", ports);
+}
+
+static int handle_driver_vlans(void *driver, char *buf, int nr)
+{
+ int vlans = ((switch_driver *) driver)->vlans;
+ return sprintf(buf, "%i\n", vlans);
+}
+
static void add_handler(switch_driver *driver, const switch_config *handler, struct proc_dir_entry *parent, int nr)
{
switch_priv *priv = (switch_priv *) driver->data;
@@ -221,6 +239,9 @@ static void do_unregister(switch_driver *driver)
switch_config global_driver_handlers[] = {
{"driver", handle_driver_name, NULL},
{"version", handle_driver_version, NULL},
+ {"cpuport", handle_driver_cpuport, NULL},
+ {"ports", handle_driver_ports, NULL},
+ {"vlans", handle_driver_vlans, NULL},
{NULL, NULL, NULL}
};