[package] opkg: implement "list-changed-conffiles" command, based on patch by Yann...
[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 #ifndef KERNEL_VERSION
13 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
14 #endif
15
16 typedef int (*switch_handler)(void *driver, char *buf, int nr);
17
18 typedef struct {
19 const char *name;
20 switch_handler read, write;
21 } switch_config;
22
23 typedef struct {
24 struct list_head list;
25 const char *name;
26 const char *version;
27 const char *interface;
28 int cpuport;
29 int ports;
30 int vlans;
31 const switch_config *driver_handlers, *port_handlers, *vlan_handlers;
32 void *data;
33 void *priv;
34 } switch_driver;
35
36 typedef struct {
37 u32 port, untag, pvid;
38 } switch_vlan_config;
39
40
41 extern int switch_device_registered (char* device);
42 extern int switch_register_driver(switch_driver *driver);
43 extern void switch_unregister_driver(char *name);
44 extern switch_vlan_config *switch_parse_vlan(switch_driver *driver, char *buf);
45 extern int switch_parse_media(char *buf);
46 extern int switch_print_media(char *buf, int media);
47
48 static inline char *strdup(const char *str)
49 {
50 char *new = kmalloc(strlen(str) + 1, GFP_KERNEL);
51 strcpy(new, str);
52 return new;
53 }
54
55
56 #endif
This page took 0.044099 seconds and 5 git commands to generate.