Lines Matching refs:rule_line
270 static void udev_rule_line_clear_tokens(UdevRuleLine *rule_line) { in udev_rule_line_clear_tokens() argument
271 assert(rule_line); in udev_rule_line_clear_tokens()
273 LIST_FOREACH(tokens, i, rule_line->tokens) in udev_rule_line_clear_tokens()
276 rule_line->tokens = NULL; in udev_rule_line_clear_tokens()
279 static UdevRuleLine* udev_rule_line_free(UdevRuleLine *rule_line) { in udev_rule_line_free() argument
280 if (!rule_line) in udev_rule_line_free()
283 udev_rule_line_clear_tokens(rule_line); in udev_rule_line_free()
285 if (rule_line->rule_file) { in udev_rule_line_free()
286 if (rule_line->rule_file->current_line == rule_line) in udev_rule_line_free()
287 rule_line->rule_file->current_line = rule_line->rule_lines_prev; in udev_rule_line_free()
289 LIST_REMOVE(rule_lines, rule_line->rule_file->rule_lines, rule_line); in udev_rule_line_free()
292 free(rule_line->line); in udev_rule_line_free()
293 return mfree(rule_line); in udev_rule_line_free()
401 static void rule_line_append_token(UdevRuleLine *rule_line, UdevRuleToken *token) { in rule_line_append_token() argument
402 assert(rule_line); in rule_line_append_token()
405 if (rule_line->current_token) in rule_line_append_token()
406 LIST_APPEND(tokens, rule_line->current_token, token); in rule_line_append_token()
408 LIST_APPEND(tokens, rule_line->tokens, token); in rule_line_append_token()
410 rule_line->current_token = token; in rule_line_append_token()
413 static int rule_line_add_token(UdevRuleLine *rule_line, UdevRuleTokenType type, UdevRuleOperatorTyp… in rule_line_add_token() argument
420 assert(rule_line); in rule_line_add_token()
501 rule_line_append_token(rule_line, token); in rule_line_add_token()
504 SET_FLAG(rule_line->type, LINE_HAS_NAME, true); in rule_line_add_token()
509 SET_FLAG(rule_line->type, LINE_HAS_DEVLINK, true); in rule_line_add_token()
512 SET_FLAG(rule_line->type, LINE_HAS_STATIC_NODE, true); in rule_line_add_token()
518 SET_FLAG(rule_line->type, LINE_UPDATE_SOMETHING, true); in rule_line_add_token()
546 UdevRuleLine *rule_line; in parse_token() local
555 rule_line = rules->current_file->current_line; in parse_token()
563 r = rule_line_add_token(rule_line, TK_M_ACTION, op, value, NULL); in parse_token()
570 r = rule_line_add_token(rule_line, TK_M_DEVPATH, op, value, NULL); in parse_token()
577 r = rule_line_add_token(rule_line, TK_M_KERNEL, op, value, NULL); in parse_token()
586 r = rule_line_add_token(rule_line, TK_A_DEVLINK, op, value, NULL); in parse_token()
588 r = rule_line_add_token(rule_line, TK_M_DEVLINK, op, value, NULL); in parse_token()
608 r = rule_line_add_token(rule_line, TK_A_NAME, op, value, NULL); in parse_token()
610 r = rule_line_add_token(rule_line, TK_M_NAME, op, value, NULL); in parse_token()
630 r = rule_line_add_token(rule_line, TK_A_ENV, op, value, attr); in parse_token()
632 r = rule_line_add_token(rule_line, TK_M_ENV, op, value, attr); in parse_token()
638 r = rule_line_add_token(rule_line, TK_M_CONST, op, value, attr); in parse_token()
650 r = rule_line_add_token(rule_line, TK_A_TAG, op, value, NULL); in parse_token()
652 r = rule_line_add_token(rule_line, TK_M_TAG, op, value, NULL); in parse_token()
662 r = rule_line_add_token(rule_line, TK_M_SUBSYSTEM, op, value, NULL); in parse_token()
669 r = rule_line_add_token(rule_line, TK_M_DRIVER, op, value, NULL); in parse_token()
683 r = rule_line_add_token(rule_line, TK_A_ATTR, op, value, attr); in parse_token()
685 r = rule_line_add_token(rule_line, TK_M_ATTR, op, value, attr); in parse_token()
699 r = rule_line_add_token(rule_line, TK_A_SYSCTL, op, value, attr); in parse_token()
701 r = rule_line_add_token(rule_line, TK_M_SYSCTL, op, value, attr); in parse_token()
708 r = rule_line_add_token(rule_line, TK_M_PARENTS_KERNEL, op, value, NULL); in parse_token()
715 r = rule_line_add_token(rule_line, TK_M_PARENTS_SUBSYSTEM, op, value, NULL); in parse_token()
722 r = rule_line_add_token(rule_line, TK_M_PARENTS_DRIVER, op, value, NULL); in parse_token()
735 r = rule_line_add_token(rule_line, TK_M_PARENTS_ATTR, op, value, attr); in parse_token()
742 r = rule_line_add_token(rule_line, TK_M_PARENTS_TAG, op, value, NULL); in parse_token()
755 r = rule_line_add_token(rule_line, TK_M_TEST, op, value, MODE_TO_PTR(mode)); in parse_token()
765 r = rule_line_add_token(rule_line, TK_M_PROGRAM, op, value, NULL); in parse_token()
776 r = rule_line_add_token(rule_line, TK_M_IMPORT_FILE, op, value, NULL); in parse_token()
783 … r = rule_line_add_token(rule_line, TK_M_IMPORT_BUILTIN, op, value, UDEV_BUILTIN_CMD_TO_PTR(cmd)); in parse_token()
785 … r = rule_line_add_token(rule_line, TK_M_IMPORT_PROGRAM, op, value, NULL); in parse_token()
793 … r = rule_line_add_token(rule_line, TK_M_IMPORT_BUILTIN, op, value, UDEV_BUILTIN_CMD_TO_PTR(cmd)); in parse_token()
795 r = rule_line_add_token(rule_line, TK_M_IMPORT_DB, op, value, NULL); in parse_token()
797 r = rule_line_add_token(rule_line, TK_M_IMPORT_CMDLINE, op, value, NULL); in parse_token()
799 r = rule_line_add_token(rule_line, TK_M_IMPORT_PARENT, op, value, NULL); in parse_token()
808 r = rule_line_add_token(rule_line, TK_M_RESULT, op, value, NULL); in parse_token()
820 … r = rule_line_add_token(rule_line, TK_A_OPTIONS_STRING_ESCAPE_NONE, op, NULL, NULL); in parse_token()
822 … r = rule_line_add_token(rule_line, TK_A_OPTIONS_STRING_ESCAPE_REPLACE, op, NULL, NULL); in parse_token()
824 r = rule_line_add_token(rule_line, TK_A_OPTIONS_DB_PERSIST, op, NULL, NULL); in parse_token()
826 … r = rule_line_add_token(rule_line, TK_A_OPTIONS_INOTIFY_WATCH, op, NULL, INT_TO_PTR(1)); in parse_token()
828 … r = rule_line_add_token(rule_line, TK_A_OPTIONS_INOTIFY_WATCH, op, NULL, INT_TO_PTR(0)); in parse_token()
830 r = rule_line_add_token(rule_line, TK_A_OPTIONS_STATIC_NODE, op, tmp, NULL); in parse_token()
837 … r = rule_line_add_token(rule_line, TK_A_OPTIONS_DEVLINK_PRIORITY, op, NULL, INT_TO_PTR(prio)); in parse_token()
848 … r = rule_line_add_token(rule_line, TK_A_OPTIONS_LOG_LEVEL, op, NULL, INT_TO_PTR(level)); in parse_token()
866 … r = rule_line_add_token(rule_line, TK_A_OWNER_ID, op, NULL, UID_TO_PTR(uid)); in parse_token()
873 … r = rule_line_add_token(rule_line, TK_A_OWNER_ID, op, NULL, UID_TO_PTR(uid)); in parse_token()
876 r = rule_line_add_token(rule_line, TK_A_OWNER, op, value, NULL); in parse_token()
894 … r = rule_line_add_token(rule_line, TK_A_GROUP_ID, op, NULL, GID_TO_PTR(gid)); in parse_token()
901 … r = rule_line_add_token(rule_line, TK_A_GROUP_ID, op, NULL, GID_TO_PTR(gid)); in parse_token()
904 r = rule_line_add_token(rule_line, TK_A_GROUP, op, value, NULL); in parse_token()
922 … r = rule_line_add_token(rule_line, TK_A_MODE_ID, op, NULL, MODE_TO_PTR(mode)); in parse_token()
925 r = rule_line_add_token(rule_line, TK_A_MODE, op, value, NULL); in parse_token()
938 r = rule_line_add_token(rule_line, TK_A_SECLABEL, op, value, attr); in parse_token()
944 r = rule_line_add_token(rule_line, TK_A_RUN_PROGRAM, op, value, NULL); in parse_token()
952 … r = rule_line_add_token(rule_line, TK_A_RUN_BUILTIN, op, value, UDEV_BUILTIN_CMD_TO_PTR(cmd)); in parse_token()
960 if (FLAGS_SET(rule_line->type, LINE_HAS_GOTO)) { in parse_token()
965 rule_line->goto_label = value; in parse_token()
966 SET_FLAG(rule_line->type, LINE_HAS_GOTO, true); in parse_token()
974 rule_line->label = value; in parse_token()
975 SET_FLAG(rule_line->type, LINE_HAS_LABEL, true); in parse_token()
1058 static void sort_tokens(UdevRuleLine *rule_line) { in sort_tokens() argument
1061 assert(rule_line); in sort_tokens()
1063 head_old = TAKE_PTR(rule_line->tokens); in sort_tokens()
1064 rule_line->current_token = NULL; in sort_tokens()
1074 rule_line_append_token(rule_line, min_token); in sort_tokens()
1079 _cleanup_(udev_rule_line_freep) UdevRuleLine *rule_line = NULL; in rule_add_line()
1100 rule_line = new(UdevRuleLine, 1); in rule_add_line()
1101 if (!rule_line) in rule_add_line()
1104 *rule_line = (UdevRuleLine) { in rule_add_line()
1111 LIST_APPEND(rule_lines, rule_file->current_line, rule_line); in rule_add_line()
1113 LIST_APPEND(rule_lines, rule_file->rule_lines, rule_line); in rule_add_line()
1115 rule_file->current_line = rule_line; in rule_add_line()
1117 for (p = rule_line->line; !isempty(p); ) { in rule_add_line()
1132 if (rule_line->type == 0) { in rule_add_line()
1137 sort_tokens(rule_line); in rule_add_line()
1138 TAKE_PTR(rule_line); in rule_add_line()
2543 static int udev_rule_line_apply_static_dev_perms(UdevRuleLine *rule_line) { in udev_rule_line_apply_static_dev_perms() argument
2550 assert(rule_line); in udev_rule_line_apply_static_dev_perms()
2552 if (!FLAGS_SET(rule_line->type, LINE_HAS_STATIC_NODE)) in udev_rule_line_apply_static_dev_perms()
2555 LIST_FOREACH(tokens, token, rule_line->tokens) in udev_rule_line_apply_static_dev_perms()