summaryrefslogtreecommitdiff
path: root/src/udev/udev-rules.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev/udev-rules.c')
-rw-r--r--src/udev/udev-rules.c38
1 files changed, 10 insertions, 28 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 9864016d14..aacde38da9 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -137,7 +137,6 @@ enum token_type {
TK_M_PARENTS_MAX,
TK_M_TEST, /* val, mode_t */
- TK_M_EVENT_TIMEOUT, /* int */
TK_M_PROGRAM, /* val */
TK_M_IMPORT_FILE, /* val */
TK_M_IMPORT_PROG, /* val */
@@ -201,7 +200,6 @@ struct token {
uid_t uid;
gid_t gid;
int devlink_prio;
- int event_timeout;
int watch;
enum udev_builtin_cmd builtin_cmd;
};
@@ -275,7 +273,6 @@ static const char *token_str(enum token_type type)
[TK_M_PARENTS_MAX] = "M PARENTS_MAX",
[TK_M_TEST] = "M TEST",
- [TK_M_EVENT_TIMEOUT] = "M EVENT_TIMEOUT",
[TK_M_PROGRAM] = "M PROGRAM",
[TK_M_IMPORT_FILE] = "M IMPORT_FILE",
[TK_M_IMPORT_PROG] = "M IMPORT_PROG",
@@ -409,9 +406,6 @@ static void dump_token(struct udev_rules *rules, struct token *token)
case TK_A_SECLABEL:
log_debug("%s %s '%s' '%s'", token_str(type), operation_str(op), attr, value);
break;
- case TK_M_EVENT_TIMEOUT:
- log_debug("%s %u", token_str(type), token->key.event_timeout);
- break;
case TK_A_GOTO:
log_debug("%s '%s' %u", token_str(type), value, token->key.rule_goto);
break;
@@ -627,8 +621,9 @@ static int import_file_into_properties(struct udev_device *dev, const char *file
return 0;
}
-static int import_program_into_properties(struct udev_event *event, const char *program, const sigset_t *sigmask)
-{
+static int import_program_into_properties(struct udev_event *event,
+ usec_t timeout_usec,
+ const char *program, const sigset_t *sigmask) {
struct udev_device *dev = event->dev;
char **envp;
char result[UTIL_LINE_SIZE];
@@ -636,7 +631,7 @@ static int import_program_into_properties(struct udev_event *event, const char *
int err;
envp = udev_device_get_properties_envp(dev);
- err = udev_event_spawn(event, program, envp, sigmask, result, sizeof(result));
+ err = udev_event_spawn(event, timeout_usec, program, envp, sigmask, result, sizeof(result));
if (err < 0)
return err;
@@ -942,9 +937,6 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
case TK_A_MODE_ID:
token->key.mode = *(mode_t *)data;
break;
- case TK_M_EVENT_TIMEOUT:
- token->key.event_timeout = *(int *)data;
- break;
case TK_RULE:
case TK_M_PARENTS_MIN:
case TK_M_PARENTS_MAX:
@@ -1462,14 +1454,6 @@ static int add_rule(struct udev_rules *rules, char *line,
rule_add_key(&rule_tmp, TK_A_DEVLINK_PRIO, op, NULL, &prio);
}
- pos = strstr(value, "event_timeout=");
- if (pos != NULL) {
- int tout = atoi(&pos[strlen("event_timeout=")]);
-
- rule_add_key(&rule_tmp, TK_M_EVENT_TIMEOUT, op, NULL, &tout);
- }
-
- pos = strstr(value, "string_escape=");
if (pos != NULL) {
pos = &pos[strlen("string_escape=")];
if (startswith(pos, "none"))
@@ -1829,8 +1813,10 @@ enum escape_type {
ESCAPE_REPLACE,
};
-int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask)
-{
+int udev_rules_apply_to_event(struct udev_rules *rules,
+ struct udev_event *event,
+ usec_t timeout_usec,
+ const sigset_t *sigmask) {
struct token *cur;
struct token *rule;
enum escape_type esc = ESCAPE_UNSET;
@@ -2024,10 +2010,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
goto nomatch;
break;
}
- case TK_M_EVENT_TIMEOUT:
- log_debug("OPTIONS event_timeout=%u", cur->key.event_timeout);
- event->timeout_usec = cur->key.event_timeout * 1000 * 1000;
- break;
case TK_M_PROGRAM: {
char program[UTIL_PATH_SIZE];
char **envp;
@@ -2042,7 +2024,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
- if (udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)) < 0) {
+ if (udev_event_spawn(event, timeout_usec, program, envp, sigmask, result, sizeof(result)) < 0) {
if (cur->key.op != OP_NOMATCH)
goto nomatch;
} else {
@@ -2078,7 +2060,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
- if (import_program_into_properties(event, import, sigmask) != 0)
+ if (import_program_into_properties(event, timeout_usec, import, sigmask) != 0)
if (cur->key.op != OP_NOMATCH)
goto nomatch;
break;