summaryrefslogtreecommitdiffstats
path: root/src/udev (follow)
Commit message (Collapse)AuthorAgeFilesLines
* udev: downgrade log level about style issuesYu Watanabe2023-06-052-9/+21
| | | | And add --no-style switch that make style issues not critical.
* udev-rules: terminate log messages with periodYu Watanabe2023-06-052-13/+13
|
* tree-wide: use _cleanup_set_free_ and friendsYu Watanabe2023-05-311-1/+1
| | | | Instead of _cleanup_(set_freep) or so.
* label: Introduce LabelOps to do pre/post labelling operationsDaan De Meyer2023-05-312-2/+2
| | | | | | | | | By default, label_ops is initialized with a NULL pointer which translates to noop labelling operations. In mac_selinux_init() and the new mac_smack_init(), we initialize label_ops with a MAC specific LabelOps pointer. We also introduce mac_init() to initialize any configured MACs and replace all usages of mac_selinux_init() with mac_init().
* label: Rename to label-util.hDaan De Meyer2023-05-301-1/+1
|
* Merge pull request #27483 from yuwata/udev-id-path-usb-revisionZbigniew Jędrzejewski-Szmek2023-05-251-34/+131
|\ | | | | udev: include USB revision in ID_PATH
| * udev: add USB revision in ID_PATHYu Watanabe2023-05-201-5/+93
| | | | | | | | | | | | | | | | | | xHCI host controller may register two (or more?) USB root hubs for USB 2.0 and USB 3.0, and devices under the hubs may have same ID_PATH. So, to avoid the conflict, let's introduce ID_PATH_WITH_USB_REVISION that includes the USB revision. Closes #19406.
| * udev-builtin-path_id: split out add_id_tag()Yu Watanabe2023-05-201-30/+39
| | | | | | | | No functional change, just refactoring.
* | udevadm: improve debug logging when triggering/watching eventsLennart Poettering2023-05-231-1/+2
| | | | | | | | | | | | Let's make debugging udev triggering a bit easier, by generating debug log messages whenever we trigger a device, and also when we see the event in pid1.
* | udevadm-verify: introduce --no-summary optionDmitry V. Levin2023-05-211-14/+22
|/ | | | | | When udevadm verify is invoked by an analyzer tool like rpminspect to verify individual udev rules files, the summary just clutters the output, so provide an option to turn the summary off.
* udevadm-verify: add support for directory argumentsDmitry V. Levin2023-05-181-10/+49
| | | | | | | When an argument specified to udevadm verify is a directory, verify all *.rules files in that directory. Suggested-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
* udev-rules: avoid issuing redundant diagnostics in verify modeDmitry V. Levin2023-05-181-1/+4
| | | | | | | | | | | | When udevadm verify is given an argument that doesn't point to an existing file, there used to be two diagnostics messages, the first one at a warning level, and the second one at an error level: $ build/udevadm verify /no/such/directory Failed to open /no/such/directory, ignoring: No such file or directory Failed to parse rules file /no/such/directory: No such file or directory Fix this by issuing just the error message.
* udev/net: assign alternative names only on add ueventYu Watanabe2023-05-165-31/+55
| | | | | | | | | | | | | | | | | | | | | | | Previously, we first assign alternative names to a network interface, then later change its main name if requested. So, we could not assign the name that currently assigned as the main name of an interface as an alternative name. So, we retry to assign the previous main name as an alternative name on later move uevent. However, that causes some confusing situation. E.g. if a .link file has ``` Name=foo AlternativeNames=foo baz ``` then even if the interface is renamed by a user e.g. by invoking 'ip link' command manually, the interface can be still referenced as 'foo', as the name is now assigned as an alternative name. This makes the order of name assignment inverse: the main name is first changed, and then the requested alternative names are assigned. And udevd do not assign alternative names on move uevent. Replaces #27506.
* sd-netlink: make rtnl_set_link_name() optionally append alternative namesYu Watanabe2023-05-161-1/+1
|
* udev/net: generate new network interface name only on add ueventYu Watanabe2023-05-161-1/+1
| | | | | On other uevents, the name will be anyway ignored in rename_netif() in udev-event.c.
* udev/net: verify ID_NET_XYZ before trying to assign it as an alternative nameYu Watanabe2023-05-161-1/+1
|
* udev: make udev_builtin_run() take UdevEvent*Yu Watanabe2023-05-1616-31/+41
| | | | No functional change, preparation for later commits.
* udev: use SYNTHETIC_ERRNO() at one more placeYu Watanabe2023-05-161-2/+1
|
* conf-parser: Add root argument to config_parse_many()Daan De Meyer2023-05-121-0/+1
|
* udev: do not set ID_PATH and by-path symlink for nvmf disksYu Watanabe2023-05-101-1/+9
| | | | Prompted by #27391.
* udev: port to DelegateSubgroup=Lennart Poettering2023-04-271-51/+8
|
* Merge pull request #27398 from yuwata/udev-rule-negative-matchZbigniew Jędrzejewski-Szmek2023-04-261-2/+2
|\ | | | | udev-rule: fix negative match
| * udev-rules: fix negative match rule for SYMLINK and TAGYu Watanabe2023-04-261-2/+2
| | | | | | | | Fixes #27396.
* | Merge pull request #27411 from yuwata/udev-iocost-follow-upsZbigniew Jędrzejewski-Szmek2023-04-261-71/+61
|\ \ | | | | | | udev/iocost: several follow ups
| * | udev/iocost: fix log messageYu Watanabe2023-04-261-1/+1
| | |
| * | udev/iocost: query_named_solution() provides non-NULL model and qos on successYu Watanabe2023-04-261-2/+1
| | |
| * | udev/iocost: call get_known_solutions() in apply_solution_for_path()Yu Watanabe2023-04-261-16/+17
| | | | | | | | | | | | Then, the solution name can be logged.
| * | udev/iocost: merge get_known_solutions() and choose_solution()Yu Watanabe2023-04-261-39/+23
| | | | | | | | | | | | | | | As these are always called sequentially. No functional change, just refactoring.
| * | udev/iocost: drop unnecessary initializationsYu Watanabe2023-04-261-5/+4
| | |
| * | udev/iocost: arg_target_solution is always non-NULLYu Watanabe2023-04-261-1/+1
| | |
| * | udev/iocost: set default target in parse_config()Yu Watanabe2023-04-261-10/+17
| |/ | | | | | | And make the failure in parsing config critical.
* / udev: use version()Yu Watanabe2023-04-262-5/+3
|/ | | | Fixes #27382.
* Apply known iocost solutions to block devicesGustavo Noronha Silva2023-04-203-0/+354
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Meta's resource control demo project[0] includes a benchmark tool that can be used to calculate the best iocost solutions for a given SSD. [0]: https://github.com/facebookexperimental/resctl-demo A project[1] has now been started to create a publicly available database of results that can be used to apply them automatically. [1]: https://github.com/iocost-benchmark/iocost-benchmarks This change adds a new tool that gets triggered by a udev rule for any block device and queries the hwdb for known solutions. The format for the hwdb file that is currently generated by the github action looks like this: # This file was auto-generated on Tue, 23 Aug 2022 13:03:57 +0000. # From the following commit: # https://github.com/iocost-benchmark/iocost-benchmarks/commit/ca82acfe93c40f21d3b513c055779f43f1126f88 # # Match key format: # block:<devpath>:name:<model name>: # 12 points, MOF=[1.346,1.346], aMOF=[1.249,1.249] block:*:name:HFS256GD9TNG-62A0A:fwver:*: IOCOST_SOLUTIONS=isolation isolated-bandwidth bandwidth naive IOCOST_MODEL_ISOLATION=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_ISOLATION=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00 IOCOST_MODEL_ISOLATED_BANDWIDTH=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_ISOLATED_BANDWIDTH=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00 IOCOST_MODEL_BANDWIDTH=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_BANDWIDTH=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00 IOCOST_MODEL_NAIVE=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_NAIVE=rpct=99.00 rlat=8807 wpct=99.00 wlat=59023 min=75.00 max=100.00 The IOCOST_SOLUTIONS key lists the solutions available for that device in the preferred order for higher isolation, which is a reasonable default for most client systems. This can be overriden to choose better defaults for custom use cases, like the various data center workloads. The tool can also be used to query the known solutions for a specific device or to apply a non-default solution (say, isolation or bandwidth). Co-authored-by: Santosh Mahto <santosh.mahto@collabora.com>
* process-util: make safe_fork() unset $NOTIFY_SOCKETYu Watanabe2023-04-161-2/+0
| | | | | | | | Propagating $NOTIFY_SOCKET is typically dangerous. Let's unset it unless explicitly requested to keep it. Fixes #27288. Replaces #27291.
* udev,sd-device: use CMSG_FIND_DATA() moreLennart Poettering2023-04-131-6/+2
|
* Merge pull request #27169 from yuwata/udev-rule-refuse-unsafe-pathZbigniew Jędrzejewski-Szmek2023-04-111-30/+33
|\ | | | | sd-device,udev: refuse unsafe path in SYMLINK= and TAG=
| * sd-device,udev: tag must be a valid filenameYu Watanabe2023-04-071-5/+3
| | | | | | | | | | | | | | | | | | | | | | All tags are managed under /run/udev/tags, and the directories there are named with tags. Hence, each tag must be a valid filename. This also makes all validity check moved to sd-device side, and makes failure caused by setting invalid tags non-critical. With this change, an empty string cannot be assigned to TAG=, hence the test cases are adjusted.
| * sd-device,udev: refuse invalid devlink and store in normalized formYu Watanabe2023-04-071-11/+14
| | | | | | | | | | | | | | | | This is especially for the case that the path contains "..". Prompted by https://github.com/systemd/systemd/pull/27164#issuecomment-1498863858. This also makes SYMLINK= gracefully handle paths prefixed with "/dev/", and manage devlink paths with path_hash_ops.
| * udev-rules: replace ingrowing word extractor with extract_first_word()Yu Watanabe2023-04-071-13/+14
| | | | | | | | No functional change, just refactoring.
| * udev-rules: rename variable "filename" -> "path"Yu Watanabe2023-04-071-7/+7
| |
| * udev-rules: add/update commentsYu Watanabe2023-04-071-4/+5
| |
| * udev-rules: add missing parenYu Watanabe2023-04-071-1/+1
| |
* | udev/scsi_id: rename positional argumentsYu Watanabe2023-04-102-5/+7
|/
* Merge pull request #26887 from yuwata/proc-cmdline-filter-argumentsZbigniew Jędrzejewski-Szmek2023-04-072-0/+6
|\ | | | | proc-cmdline: filter PID1 arguments on container
| * tree-wide: reset optind to 0 when GNU extensions in optstring are usedYu Watanabe2023-03-292-0/+6
| | | | | | | | | | | | | | | | | | | | Otherwise, if getopt() and friends are used before parse_argv(), then the GNU extensions may be ignored. This should not change any behavior at least now, as we usually use getopt_long() only once per invocation. But in the next commit, getopt_long() will be used for other arrays, hence this change will become necessary.
* | udev-rules: check tokens orderDmitry V. Levin2023-04-031-0/+17
| | | | | | | | | | When invoked by udevadm verify, warn about rules that have PROGRAM assignments specified after RESULT checks.
* | fdset: add new fdset_consume() helperLennart Poettering2023-03-291-3/+1
| |
* | udev_rules_parse_file: do not ignore ENOENT when invoked by udevadm verifyDmitry V. Levin2023-03-291-1/+1
| | | | | | | | | | | | Make sure the ENOENT exception reintroduced by commit 9db7081d83d56cd2523b03f9eb9d67ef1c93c55f is not applied when the parser is invoked by udevadm verify.
* | Revert "udev_rules_parse_file: do not skip ENOENT"Zbigniew Jędrzejewski-Szmek2023-03-281-1/+5
|/ | | | | | | | | This reverts commit 42a467b55219384c7c3b137ab3cc8b6a309a8a14. We need to skip -ENOENT when loading udev rules because new files with rules may be added or removed at any time, and the loading of rules is triggered asynchronously. Even though the window is fairly narrow, udev shouldn't throw an error if a rules file is removed.
* udev-rules: fix grammar in diagnostics about lines that have no effectDmitry V. Levin2023-03-271-3/+3
| | | | Fixes: 25de7aa7b90c ("udev: modernize udev-rules.c")