ramips: fix package name of kmod-input-gpio-buttons
[openwrt.git] / package / switch / src / switch-core.h
1 #ifndef __SWITCH_CORE_H
2 #define __SWITCH_CORE_H
3
4 #include <linux/version.h>
5 #include <linux/list.h>
6 #define SWITCH_MAX_BUFSZ 4096
7
8 #define SWITCH_MEDIA_AUTO 1
9 #define SWITCH_MEDIA_100 2
10 #define SWITCH_MEDIA_FD 4
11
12 typedef int (*switch_handler)(void *driver, char *buf, int nr);
13
14 typedef struct {
15 const char *name;
16 switch_handler read, write;
17 } switch_config;
18
19 typedef struct {
20 struct list_head list;
21 const char *name;
22 const char *version;
23 const char *interface;
24 int cpuport;
25 int ports;
26 int vlans;
27 const switch_config *driver_handlers, *port_handlers, *vlan_handlers;
28 void *data;
29 void *priv;
30 } switch_driver;
31
32 typedef struct {
33 u32 port, untag, pvid;
34 } switch_vlan_config;
35
36
37 extern int switch_device_registered (char* device);
38 extern int switch_register_driver(switch_driver *driver);
39 extern void switch_unregister_driver(char *name);
40 extern switch_vlan_config *switch_parse_vlan(switch_driver *driver, char *buf);
41 extern int switch_parse_media(char *buf);
42 extern int switch_print_media(char *buf, int media);
43
44 static inline char *strdup(const char *str)
45 {
46 char *new = kmalloc(strlen(str) + 1, GFP_KERNEL);
47 strcpy(new, str);
48 return new;
49 }
50
51
52 #endif
This page took 0.043122 seconds and 5 git commands to generate.