Changeset 35595


Ignore:
Timestamp:
2013-02-14T13:36:13+01:00 (5 years ago)
Author:
hauke
Message:

switch: export cpuport, ports and vlans via /proc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/switch/src/switch-core.c

    r34992 r35595  
    139139} 
    140140 
     141static int handle_driver_cpuport(void *driver, char *buf, int nr) 
     142{ 
     143        int cpuport = ((switch_driver *) driver)->cpuport; 
     144        return sprintf(buf, "%i\n", cpuport); 
     145} 
     146 
     147static int handle_driver_ports(void *driver, char *buf, int nr) 
     148{ 
     149        int ports = ((switch_driver *) driver)->ports; 
     150        return sprintf(buf, "%i\n", ports); 
     151} 
     152 
     153static int handle_driver_vlans(void *driver, char *buf, int nr) 
     154{ 
     155        int vlans = ((switch_driver *) driver)->vlans; 
     156        return sprintf(buf, "%i\n", vlans); 
     157} 
     158 
    141159static void add_handler(switch_driver *driver, const switch_config *handler, struct proc_dir_entry *parent, int nr) 
    142160{ 
     
    222240        {"driver", handle_driver_name, NULL}, 
    223241        {"version", handle_driver_version, NULL}, 
     242        {"cpuport", handle_driver_cpuport, NULL}, 
     243        {"ports", handle_driver_ports, NULL}, 
     244        {"vlans", handle_driver_vlans, NULL}, 
    224245        {NULL, NULL, NULL} 
    225246}; 
Note: See TracChangeset for help on using the changeset viewer.