1 /*****************************************************************************\
3 * | || | ___ | |_ _ __ | | _ _ __ _ |_ ) *
4 * | __ |/ _ \| _|| '_ \| || || |/ _` | / / *
5 * |_||_|\___/ \__|| .__/|_| \_,_|\__, |/___| *
7 \*****************************************************************************/
12 #define COND_MATCH_CMP 0 /* == */
13 #define COND_MATCH_RE 1 /* ~~ */
14 #define COND_NMATCH_CMP 2 /* != */
15 #define COND_NMATCH_RE 3 /* !~ */
16 #define COND_MATCH_IS 4 /* is */
18 #define ACT_RUN_SHELL 0 /* system app <...>, run app <...> */
19 #define ACT_RUN_NOSHELL 1 /* exec app <...> */
20 #define ACT_STOP_PROCESSING 2 /* break */
21 #define ACT_STOP_IF_FAILED 3 /* break_if_failed */
22 #define ACT_MAKE_DEVICE 4 /* makedev <...> */
23 #define ACT_CHMOD 5 /* chmod <...> */
24 #define ACT_CHGRP 6 /* chgrp <...> */
25 #define ACT_CHOWN 7 /* chown <...> */
26 #define ACT_SYMLINK 8 /* symlink <...> */
27 #define ACT_NEXT_EVENT 9 /* next */
28 #define ACT_NEXT_IF_FAILED 10 /* next_if_failed */
29 #define ACT_SETENV 11 /* setenv <...> */
30 #define ACT_REMOVE 12 /* remove <...> */
31 #define ACT_DEBUG 13 /* debug */
32 #define ACT_FLAG_NOTHROTTLE 14 /* sets 'nothrottle' flag */
35 #define EVAL_NOT_MATCH 0
36 #define EVAL_NOT_AVAILABLE -1
39 #define QUOTES_SINGLE 1
40 #define QUOTES_DOUBLE 2
42 #define STATUS_KEY 0 /* just about anything */
43 #define STATUS_CONDTYPE 1 /* viz COND_* */
44 #define STATUS_VALUE 2 /* just about anything */
45 #define STATUS_INITIATOR 3 /* ',' for next cond, '{' for block*/
46 #define STATUS_ACTION 4 /* viz ACT_* and '}' for end of block */
49 #define FLAG_ALL 0xffffffff
50 #define FLAG_NOTHROTTLE 1 /* We want this rule to ignore max_children limit */
70 struct condition_t
*conditions
;
73 struct action_t
*actions
;
84 int rule_condition_eval(struct hotplug2_event_t
*, struct condition_t
*);
85 int rule_execute(struct hotplug2_event_t
*, struct rule_t
*);
86 void rule_flags(struct rule_t
*);
87 void rules_free(struct rules_t
*);
88 struct rules_t
*rules_from_config(char *, struct rules_t
*);
90 #endif /* ifndef RULES_H*/