Stealth Mode script
[tomato.git] / release / src / router / hotplug2 / hotplug2.h
blobaf6ac4f06ad5c87f94fb9c763f0b4a0b188c1d9c
1 /*****************************************************************************\
2 * _ _ _ _ ___ *
3 * | || | ___ | |_ _ __ | | _ _ __ _ |_ ) *
4 * | __ |/ _ \| _|| '_ \| || || |/ _` | / / *
5 * |_||_|\___/ \__|| .__/|_| \_,_|\__, |/___| *
6 * |_| |___/ *
7 \*****************************************************************************/
10 #ifndef HOTPLUG2_H
11 #define HOTPLUG2_H 1
14 * Various compatibility definitions.
16 #ifndef SO_RCVBUFFORCE
17 #if defined(__alpha__) || defined(__hppa__) || defined(__sparc__) || defined(__sparc_v9__)
18 #define SO_RCVBUFFORCE 0x100b
19 #else
20 #define SO_RCVBUFFORCE 33
21 #endif
22 #endif
24 #ifndef SO_SNDBUFFORCE
25 #if defined(__alpha__) || defined(__hppa__) || defined(__sparc__) || defined(__sparc_v9__)
26 #define SO_SNDBUFFORCE 0x100a
27 #else
28 #define SO_SNDBUFFORCE 32
29 #endif
30 #endif
32 #ifndef NETLINK_KOBJECT_UEVENT
33 #define NETLINK_KOBJECT_UEVENT 15
34 #endif
36 #ifndef O_NOATIME
37 #define O_NOATIME 01000000
38 #endif
40 #define ERROR(action, fmt, arg...) fprintf(stderr, "[%s]: " fmt"\n", action, ##arg);
41 #define INFO(action, fmt, arg...) fprintf(stdout, "[%s]: " fmt"\n", action, ##arg);
42 #ifdef DEBUG
43 #define DBG(action, fmt, arg...) fprintf(stdout, "[%s]: " fmt"\n", action, ##arg);
44 #else
45 #define DBG(action, fmt, arg...)
46 #endif
48 #define HOTPLUG2_MSG_BACKLOG 64
49 #define UEVENT_BUFFER_SIZE 2048
50 #define HOTPLUG2_THROTTLE_INTERVAL 50
51 #define HOTPLUG2_RULE_PATH "/etc/hotplug2.rules"
53 #define ACTION_ADD 0
54 #define ACTION_REMOVE 1
55 #define ACTION_UNKNOWN -1
57 #define UDEVTRIGGER_COMMAND "/sbin/udevtrigger", "/sbin/udevtrigger"
59 #define FORK_CHILD 0
60 #define FORK_ERROR -1
61 #define FORK_FINISHED -2
63 #define event_seqnum_t unsigned long long
65 #define sysfs_seqnum_path "/sys/kernel/uevent_seqnum"
67 struct env_var_t {
68 char *key;
69 char *value;
72 struct hotplug2_event_t {
73 int action;
74 event_seqnum_t seqnum;
75 struct env_var_t *env_vars;
76 int env_vars_c;
77 char *plain;
78 int plain_s;
79 struct hotplug2_event_t *next;
82 struct options_t {
83 char *name;
84 int *value;
87 char *get_hotplug2_value_by_key(struct hotplug2_event_t *, char *);
89 #endif /* ifndef HOTPLUG2_H */