summaryrefslogtreecommitdiff
path: root/src/udev/udev-rules.h
Commit message (Collapse)AuthorAgeFilesLines
* udev-rules: move udev_check_rule_line() invocationDmitry V. Levin2023-03-271-1/+1
| | | | | | | | | Move udev_check_rule_line() invocation from udev_rule_file_get_issues() to udev_rules_parse_file(), invoke udev_check_rule_line() only when udev_rules_parse_file() is called by udevadm verify. Subsequent commits are going to perform more checks invoked from udev_rules_parse_file().
* udev-rule: rework logging about udev rulesYu Watanabe2023-03-131-2/+3
| | | | | | | | | | | | | | | This makes the loggers take the most relevant object, i.e. when applying udev rules to a device, the loggers take sd_device and UdevRuleToken object, and when parsing udev rules, they take UdevRuleLine or UdevRuleFile object. To achieve that, this drops 'iterators' in UdevRules or friends named `current_file` or so. Instead of that, each object now has its parent object, e.g. UdevRuleToken.rule_line that references the UdevRuleLine object the token belonging to. And each function previously took UdevRules object now takes the most relevant object, e.g. UdevRuleToken. Solves the discussion in https://github.com/systemd/systemd/pull/26698#discussion_r1129261193.
* udevadm: introduce new 'verify' commandDmitry V. Levin2023-03-081-0/+1
| | | | | | | | | | | | | | | | | | | We seem to have no tool to verify udev rule files. There is a simple udev rules syntax checker in the tree, test/rule-syntax-check.py, but it is too simple to detect less trivial issues not detected by udev, e.g. redundant comparisons (#26593) or labels without references. Such a tool would be beneficial not only for maintaining udev rules distributed along with udev, but also and even more so for maintaining third party udev rules that are more likely to have issues with syntax and semantic correctness. Implement a udev rules syntax and semantics checker in the form of 'udevadm verify [OPTIONS] FILE...' command that is based on udev_rules_parse_file() interface and would apply further checks on top of it in subsequent commits. Resolves: #26606
* udev: reload rules and builtins only when mtime of a config changedYu Watanabe2022-07-231-0/+2
| | | | | | | This makes udevd reload rules only when the timestamp is updated, even on SIGHUP or `udevadm control --reload`. So, we can call `udevadm control --reload` without huge performance penalty when no rules, .link files, and so on are changed.
* udev: save stats of all udev rules fileYu Watanabe2022-07-231-1/+1
| | | | | The mtime of directory is not updated when an existing rule file is changed. Hence, paths_check_timestamp() is not reliable.
* tree-wide: use -EINVAL for enum invalid valuesZbigniew Jędrzejewski-Szmek2021-02-101-1/+1
| | | | | | | | | As suggested in https://github.com/systemd/systemd/pull/11484#issuecomment-775288617. This does not touch anything exposed in src/systemd. Changing the defines there would be a compatibility break. Note that tests are broken after this commit. They will be fixed in the next one.
* license: GPL-2.0+ -> GPL-2.0-or-laterYu Watanabe2020-11-091-1/+1
|
* udev: split rules object creation and loadingZbigniew Jędrzejewski-Szmek2020-06-231-1/+3
| | | | | The only functional change is to downgrade the log line to avoid double logging.
* udev: make signal that we use to kill workers on timeout configurableMichal Sekletár2020-06-051-0/+1
|
* udev: move rule structure definitions into the .c fileZbigniew Jędrzejewski-Szmek2019-06-281-145/+0
| | | | They are (and should) only be used there, no need to expose them.
* udev: move rules logging functions into the .c fileZbigniew Jędrzejewski-Szmek2019-06-281-54/+0
| | | | They are (and can) only be used there, no need to expose them.
* udev: check formatting of attribute or value earlierYu Watanabe2019-06-031-0/+9
|
* udev: modernize udev-rules.cYu Watanabe2019-06-021-0/+217
This does the following: - rename enum udev_builtin_cmd -> UdevBuiltinCmd - rename struct udev_builtin -> UdevBuiltin - move type definitions to udev-rules.h - move prototypes of functions defined in udev-rules.c to udev-rules.h - drop to use strbuf - propagate critical errors in applying rules, - drop limitation for number of tokens per line.