summaryrefslogtreecommitdiffstats
path: root/src/udev (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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")
* udev-rules: extend the check for conflicting expressionsDmitry V. Levin2023-03-271-5/+22
| | | | | | | Log an error when a rule line contains the following kind of conflicting match expressions: KEY=="foo*", KEY=="bar*"
* udev-rules: check token delimitersDmitry V. Levin2023-03-271-2/+50
| | | | | | | | | | | | When udev_rules_parse_file() is called by udevadm verify, issue warnings about the following conditions in udev rules: * the first token in the rule is preceded with a comma * the last token in the rule is followed by a comma * there is no comma between tokens * there is no whitespace between tokens * there is more than a single comma between tokens * there is whitespace between a token and a comma * there is no whitespace after comma
* udev-rules: move udev_check_rule_line() invocationDmitry V. Levin2023-03-274-8/+9
| | | | | | | | | 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-rules: move udev_rules_parse_file() after udev_check_rule_line()Dmitry V. Levin2023-03-271-118/+118
| | | | | Move udev_rules_parse_file() after udev_check_rule_line() as the former us going to use the latter.
* chase-symlinks: Rename chase_symlinks() to chase()Daan De Meyer2023-03-242-2/+2
| | | | | | | | | Chasing symlinks is a core function that's used in a lot of places so it deservers a less verbose names so let's rename it to chase() and chaseat(). We also slightly change the pattern used for the chaseat() helpers so we get chase_and_openat() and similar.
* Merge pull request #26785 from keszybz/udev-distcheckZbigniew Jędrzejewski-Szmek2023-03-247-234/+309
|\ | | | | Implement --help/--version in all udev builtins
| * udev/ata_id: use unliagned helpersZbigniew Jędrzejewski-Szmek2023-03-161-5/+6
| | | | | | | | | | | | The array is a union, aligned as uint16_t, so we were accessing fields at offsets of two, so we didn't do actually do unaligned access. But let's make this explicit.
| * udev/v4l_id: use O_CLOEXEC|O_NOCTTYZbigniew Jędrzejewski-Szmek2023-03-161-1/+1
| | | | | | | | | | | | This is the usual set of flags. O_CLOEXEC doesn't matter because we don't spawn anything, but O_NOCTTY could possibly make a difference if the helper is called on a wrong device type.
| * meson: add udev builtins to dist-checkZbigniew Jędrzejewski-Szmek2023-03-161-0/+1
| | | | | | | | | | They now pass, and we might as well test them to avoid unexpected regressions.
| * udev: implement --version in all builtinsZbigniew Jędrzejewski-Szmek2023-03-166-19/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Those are separate binaries, and occasionally people will get a misplaced binary that doesn't match the rest of the installed system and be confused, so it good to be able to check the version. It is also nice to have the same interface in all binaries. Note that we usually use a separate 'enum ARG_VERSION = 0x100' for an option without a short name. We can use a less verbose approach of simply taking any unused letter, which works just as well and even the compiler would warn us if we tried to use the letter in another place. This way we avoid a few lines of boilerplate. The help texts are adjusted to have an empty line between the synopsis and option list, and no empty lines after the option list.
| * udev/cdrom_id: do not abort on unknown optionsZbigniew Jędrzejewski-Szmek2023-03-161-0/+2
| | | | | | | | Copy-pasta is good, but you have to pick a reliable source.
| * udev/mtd_probe: convert to run()Zbigniew Jędrzejewski-Szmek2023-03-161-14/+10
| |