summaryrefslogtreecommitdiff
path: root/src/udev
Commit message (Collapse)AuthorAgeFilesLines
...
| * udev/mtd_probe: implement --helpZbigniew Jędrzejewski-Szmek2023-03-161-4/+34
| |
| * udev/fido_id: implement --helpZbigniew Jędrzejewski-Szmek2023-03-161-9/+38
| |
| * udev/ata_id: stop using errno, fix logicZbigniew Jędrzejewski-Szmek2023-03-161-118/+95
| | | | | | | | | | | | | | | | | | | | The code was setting errno, which we don't do, and which is hard to get right… Rework the code to use the usual negative-errno convention and add some debug logging. disk_scsi_inquiry_command() was working partially by accident: the v3 fallback would enter the v4 check path, and pass it because the v4 data would still be initialized to 0.
| * udev/ata_id: drop unused output parameterZbigniew Jędrzejewski-Szmek2023-03-161-22/+10
| |
| * udev/ata_id: convert to run()Zbigniew Jędrzejewski-Szmek2023-03-151-10/+9
| |
| * udev/ata_id: split out parse_argv()Zbigniew Jędrzejewski-Szmek2023-03-151-37/+44
| | | | | | | | Beef up syntax and error messages a bit.
| * udev/v4l_id: convert to run() and add error messagesZbigniew Jędrzejewski-Szmek2023-03-131-13/+29
| | | | | | | | | | Also split out parse_argv(), use "ARG" instead of "<arg>". Make the syntax help a bit more precise.
* | udev-rules: add another check for conflicting expressionsDmitry V. Levin2023-03-211-5/+37
| | | | | | | | | | | | | | Log an error when a rule line contains the following kind of conflicting match expressions: KEY=="foo", KEY=="bar"
* | udev-rules: fix check for conflicting and duplicate expressionsDmitry V. Levin2023-03-191-5/+23
| | | | | | | | | | | | | | Fix check for conflicting and duplicate expressions of types that support alternative patterns. Fixes: 3ec58d0cd8f6 ("udev-rules: check for conflicting and duplicate expressions")
* | Revert "udev: prepare memory for extra NUL termination for NULSTR"Dmitry V. Levin2023-03-191-3/+1
| | | | | | | | | | | | This reverts commit cd3c8a117ccf3505e49d34324473e2175ef0a9ce which was papering over the bug instead of a proper fix made by the previous commit.
* | Merge pull request #26783 from yuwata/loop-ref-follow-upDaan De Meyer2023-03-171-6/+8
|\ \ | | | | | | udev: slightly extend comment and add more tests
| * | udev: mention that the kernel silently truncates lo_file_name if too longYu Watanabe2023-03-141-6/+8
| | | | | | | | | | | | Resolves the confusion in https://github.com/systemd/systemd/pull/26693#discussion_r1131151335.
* | | udevadm-verify: add a short summaryYu Watanabe2023-03-161-2/+18
| | |
* | | udev-rules: check for conflicting and duplicate expressionsDmitry V. Levin2023-03-161-2/+78
|/ / | | | | | | | | | | | | | | Log an error when a rule line contains conflicting match expressions, e.g. NAME=="value", NAME!="value" Log a warning when a rule line contains duplicate expressions, e.g. NAME=="value", NAME=="value"
* | udevadm-verify: fix indentation of help messageYu Watanabe2023-03-131-1/+1
| |
* | udevadm: enable colorized loggingYu Watanabe2023-03-131-2/+1
| |
* | udev-rules: inline rule_line_append_token()Yu Watanabe2023-03-131-10/+3
| |
* | udev-rules: modernize free functionsYu Watanabe2023-03-131-10/+24
| |
* | udev-rules: do not set 'issues' tag when applying rules to event deviceYu Watanabe2023-03-131-7/+5
| | | | | | | | | | The tagging is used by `udevadm verify` and the command only parses udev rules but not apply them.
* | udev-rules: introduce log_event_truncated() helper functionYu Watanabe2023-03-131-62/+47
| |
* | udev-rule: rework logging about udev rulesYu Watanabe2023-03-134-445/+441
|/ | | | | | | | | | | | | | | 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.
* Merge pull request #26641 from medhefgo/boot-elf2efiYu Watanabe2023-03-111-2/+4
|\ | | | | boot: Drop gnu-efi / Add elf2efi.py
| * meson: Introduce userspace depJan Janssen2023-03-101-2/+4
| | | | | | | | This will help in a later commit to separate userspace from EFI builds.
* | udev_rules_parse_file: issue diagnostics about duplicate LABEL tokensDmitry V. Levin2023-03-101-0/+3
| | | | | | | | | | | | When a rules contains several LABEL tokens, the parser used to silently discard all of them besides the last one without any diagnostics at all. It's time to break the vow of silence and let the parser issue a warning.
* | udevadm verify: introduce --root optionDmitry V. Levin2023-03-101-5/+28
| | | | | | | | | | | | When udevadm verify is invoked without positional arguments and loads all rules files from the system like the udev daemon does, this option can be used to operate on files underneath the specified root path.
* | udevadm verify: load all rules from the system if no rules were givenDmitry V. Levin2023-03-101-4/+14
|/ | | | | | When udevadm verify is invoked without positional arguments, that is, when no udev rules files are specified, load all rules files from the system like the udev daemon does, and verify them.
* udev-builtin-blkid: pick up info of backing fileLennart Poettering2023-03-091-0/+108
| | | | | | | | | | | | | | | | | | | This adds support for retrieving info about the inode backing a loopback file to udev-builtin-blkid. It will pick up the inode number and device of the backing inode, as well as the lo_file_name[] array that the loopback device maintains. A later patch uses this information to create block device symlinks in /dev/ that allow refering block devices by their backing inodes. This is useful when separate tools set up a loopback device from those which ultimately shall mount them, and there shall be a stable reference be passed along. For example, we can add a new kernel option setuploop= or so which allows setting up a block device via a generator, and still have a way to safely reference later. And yes, this doesn't directly have anything to do with the probing libblkid does, but it's close enough, and we have the device open anyway here, so the additional ioctl() here should not hurt.
* udev: add new udev_builtin_add_propertyf() helperLennart Poettering2023-03-092-0/+21
|
* udev_rules_parse_file: issue diagnostics about line continuation at EOFDmitry V. Levin2023-03-081-0/+5
| | | | | | | When udev rules file ends with a line continuation, the parser used to silently ignore the line without any diagnostics at all. It's time to break the vow of silence and let the parser issue some error diagnostics.
* udevadm-verify: check for unused labelsDmitry V. Levin2023-03-081-2/+16
| | | | | | Check for unused labels in the specified udev rules files, report such labels and exit with a non-zero exit code if any unused labels are found.
* udevadm: introduce new 'verify' commandDmitry V. Levin2023-03-086-0/+140
| | | | | | | | | | | | | | | | | | | 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_rules_parse_file: mark logged issuesDmitry V. Levin2023-03-081-6/+52
| | | | | | | | | | | | | Traditionally, all issues found in udev rules by udev_rules_parse_file() are logged and ignored, so there was no mechanism to propagate the information about these issues back to the caller. Introduce such a mechanism by adding a new member to UdevRuleFile. This new member is a bitmask describing which log levels were used in messages logged with regards to the rule file. This mechanism is going to be used by udevadm verify in subsequent commits.
* udev: Don't mark as tablet if device has relative coordinatesJoshua Goins2023-03-071-1/+1
| | | | | | | | | | | Tablets don't typically have relative coordinates (they are separated on the kernel device layer). However, some Logitech mice report similar supported events, so use the existence of EV_REL to determiner whether or not the device is really a tablet. Fixes bug introduced by 0855ce67726f87a5a67b4fb536d58e0e4428a248. Fixes: #26600
* udev_rules_parse_file: do not skip ENOENTDmitry V. Levin2023-03-061-5/+1
| | | | | | | | | | | | | | | | | Starting with commit ed88bcfb7c15029f9fc95ee2380759a9eb782d46, udev_rules_parse_file() silently skips files it fails to open with ENOENT error, e.g. when they are broken symlinks. As this behavior is undocumented and it seems to be unintended, let's treat ENOENT like any other error. This change would also simplify the implementation of the udev rules syntax checker mentioned in #26606. udev_rules_load(), the only user of udev_rules_parse_file(), is not affected by this change because it essentially ignores the value returned by the latter, the only visible difference would be a log message issued for every udev rules file that couldn't be open because of ENOENT. Fixes: ed88bcfb7c15 ("Be more careful when checking for empty files")
* udevd: enable memory pressure/SIGRTMIN+18 logicLennart Poettering2023-03-011-1/+18
|
* Merge pull request #26203 from medhefgo/mesonYu Watanabe2023-02-221-37/+47
|\ | | | | meson: Use dicts for test/fuzzer definitions
| * meson: Use dicts for fuzzer definitionsJan Janssen2023-02-211-15/+20
| |
| * meson: Add simple_fuzzers listJan Janssen2023-02-211-2/+4
| |
| * meson: Use dicts for test definitionsJan Janssen2023-02-211-20/+23
| | | | | | | | | | | | | | Although this slightly more verbose it makes it much easier to reason about. The code that produces the tests heavily benefits from this. Test lists are also now sorted by test name.
* | tree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDSYu Watanabe2023-02-211-7/+5
|/
* udev-node: make stack_directory_read_one() accept NULL for devnodeYu Watanabe2023-02-201-2/+11
| | | | | No functional change, as currently the function is always called with non-NULL argument. Just a preparation for #26048 or #25839.
* udev-node: drop unnecessary initializationYu Watanabe2023-02-201-1/+1
| | | | | | | | | The priority of device node symlink can be negative. So the initialization is confusing. Fortunately, this changes no functionality, as we only compare the priorities of symlinks only when we parsed at least one device node and its priority.
* tree-wide: fix typo and comment style updateYu Watanabe2023-02-151-1/+1
|
* tree-wide: set FORK_RLIMIT_NOFILE_SAFE flagYu Watanabe2023-02-071-3/+1
| | | | No functional changes, just refactoring.
* udevd: configure a child process name for worker processesYu Watanabe2023-02-071-1/+1
| | | | | | | | | This effectively reverts commit ff86c92e3043f71fc801cf687600a480ee8f6778, and re-apply 49f3ee7e74c714f55aab395c080b1099fc17f7fd. The change was dropped due to the process name was not correctly logged, but the issue was fixed by dd15e4cb57129b915e01495e113696bfe0b70214. Let's set the child process name again.
* test: drop whitespace after shell redirection operatorsZbigniew Jędrzejewski-Szmek2023-02-061-1/+1
| | | | | | | | | | (The one case that is left unchanged is '< <(subcommand)'.) This way, the style with no gap was already dominant. This way, the reader immediately knows that ' < ' is a comparison operator and ' << ' is a shift. In a few cases, replace custom EOF replacement by just EOF. There is no point in using someting like "_EOL" unless "EOF" appears in the text.
* udev: make get_virtfn_info() provide physical PCI deviceYu Watanabe2023-02-011-1/+1
| | | | | | Fixes a bug introduced by 78463c6c4fdcb703bc0dc694c3ea77df3c5624e0. Fixes #25545.
* Merge pull request #26184 from keszybz/cleanupsLuca Boccassi2023-01-241-1/+5
|\ | | | | Various fixups to recent commits
| * udevadm: add todo to remind us to remove compat codeZbigniew Jędrzejewski-Szmek2023-01-241-1/+5
| | | | | | | | https://github.com/systemd/systemd/pull/25145#issuecomment-1397606521
* | meson: Do not include headers in source listsJan Janssen2023-01-241-15/+2
|/ | | | | | Meson+ninja+compiler do this for us and are better at it. https://mesonbuild.com/FAQ.html#do-i-need-to-add-my-headers-to-the-sources-list-like-in-autotools