summaryrefslogtreecommitdiffstats
path: root/src/udev (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #25713 from keszybz/hwdb-matchingYu Watanabe2022-12-131-1/+1
|\ | | | | Restore backwards compat in 60-evdev.rules
| * udev-builtin-keyboard: update descriptionZbigniew Jędrzejewski-Szmek2022-12-121-1/+1
| |
* | udevadm: emit deprecation notice in udevadm hwdbZbigniew Jędrzejewski-Szmek2022-12-121-0/+2
|/ | | | | | | | | | | | | | This tool was "deprecated" back in 65eb4378c3e1de25383d8cd606909e64c71edc80, but only by removing documentation. This is somewhat surprising, but udevadm hwdb --update and systemd-hwdb update generate different databases. udevadm runs in compat mode and (as far as I have been able to figure out from a quick look), it omits filename information and does some other changes to the datastructures. The consuming code (udev) is the same in both cases, so this "compatibility mode" seems very strange. But I don't think it's worth trying to figure out why things were done this way. Let's just push people towards the new code. Inspired by https://github.com/systemd/systemd/issues/25698#issuecomment-1346298094.
* blkid: add helpers that get gpt partition uuid as sd_id128_tLennart Poettering2022-11-291-21/+18
| | | | just some refactoring to make things simpler.
* udev: make sure auto-root logic also works in UKIs booted from XBOOTLDRLennart Poettering2022-11-221-14/+13
| | | | | | | | | | | | | | If no root= switch is specified on the kernel command line we'll use the root disk on which the partition the LoaderDevicePartUUID efi var is located – as long as that partition is an ESP. Let's slightly liberalize that and also allow it if that partition is an XBOOTLDR partition. This ensures that UKIs spawned directly from XBOOTLDR work the same as those from the ESP. (Note that this makes no difference if sd-boot is in the mix, as in that case LoaderDevicePartUUID is always set to the ESP, as that's where sd-boot is located, and sd-boot will set the var first, sd-stub will only set it later if it#s not set yet.)
* nulstr-util: Declare NULSTR_FOREACH() iterator inlineDaan De Meyer2022-11-111-1/+1
|
* Merge pull request #25291 from keszybz/util-cleanupYu Watanabe2022-11-0911-11/+2
|\ | | | | Split/rename util.c+h and def.h
| * Rename def.h to constants.hZbigniew Jędrzejewski-Szmek2022-11-082-2/+2
| | | | | | | | | | | | The name "def.h" originates from before the rule of "no needless abbreviations" was established. Let's rename the file to clarify that it contains a collection of various semi-related constants.
| * basic: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-089-9/+0
| | | | | | | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
* | udevadm: merge two log stmtsZbigniew Jędrzejewski-Szmek2022-11-071-5/+4
|/
* udev: drop trivial wrapper for udev_watch_begin()Yu Watanabe2022-10-314-23/+9
|
* udev: Handle AMBA bus the same way as generic platform busMarek Vasut2022-10-311-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On various ARM systems, it is possible to find devices on AMBA bus. This is defined in Linux kernel drivers/amba/bus.c as separate bus type. Udev currently does not recognize this when building ID_PATH which leads to ID_PATH containing the suffix from next recognized parent device. On ST STM32MP15xx with SDIO WiFi, the ID_PATH looks like 'platform-soc', which is not unique and basically useless. On NXP i.MX8M Plus with SDIO WiFi, ID_PATH is 'platform-30b40000.mmc' which is far more useful. Add the 'amba' subsystem handling the same way 'platform' subsystem is handled to get ID_PATH 'platform-soc-amba-48004000.sdmmc' on the former, which is far more useful compared to 'platform-soc'. --- ``` $ udevadm info --attribute-walk --path=/devices/platform/soc/48004000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:0001:1/net/wlan0 Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device. looking at device '/devices/platform/soc/48004000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:0001:1/net/wlan0': KERNEL=="wlan0" SUBSYSTEM=="net" DRIVER=="" ATTR{addr_assign_type}=="0" ATTR{addr_len}=="6" ATTR{address}=="10:98:c3:5f:4b:80" ATTR{broadcast}=="ff:ff:ff:ff:ff:ff" ATTR{carrier_changes}=="1" ATTR{carrier_down_count}=="1" ATTR{carrier_up_count}=="0" ATTR{dev_id}=="0x0" ATTR{dev_port}=="0" ATTR{flags}=="0x1002" ATTR{gro_flush_timeout}=="0" ATTR{ifalias}=="" ATTR{ifindex}=="3" ATTR{iflink}=="3" ATTR{link_mode}=="0" ATTR{mtu}=="1500" ATTR{napi_defer_hard_irqs}=="0" ATTR{netdev_group}=="0" ATTR{operstate}=="down" ATTR{power/control}=="auto" ATTR{power/runtime_active_time}=="0" ATTR{power/runtime_status}=="unsupported" ATTR{power/runtime_suspended_time}=="0" ATTR{proto_down}=="0" ATTR{queues/rx-0/rps_cpus}=="0" ATTR{queues/rx-0/rps_flow_cnt}=="0" ATTR{queues/tx-0/byte_queue_limits/hold_time}=="1000" ATTR{queues/tx-0/byte_queue_limits/inflight}=="0" ATTR{queues/tx-0/byte_queue_limits/limit}=="0" ATTR{queues/tx-0/byte_queue_limits/limit_max}=="1879048192" ATTR{queues/tx-0/byte_queue_limits/limit_min}=="0" ATTR{queues/tx-0/tx_maxrate}=="0" ATTR{queues/tx-0/tx_timeout}=="0" ATTR{queues/tx-0/xps_rxqs}=="0" ATTR{statistics/collisions}=="0" ATTR{statistics/multicast}=="0" ATTR{statistics/rx_bytes}=="0" ATTR{statistics/rx_compressed}=="0" ATTR{statistics/rx_crc_errors}=="0" ATTR{statistics/rx_dropped}=="0" ATTR{statistics/rx_errors}=="0" ATTR{statistics/rx_fifo_errors}=="0" ATTR{statistics/rx_frame_errors}=="0" ATTR{statistics/rx_length_errors}=="0" ATTR{statistics/rx_missed_errors}=="0" ATTR{statistics/rx_nohandler}=="0" ATTR{statistics/rx_over_errors}=="0" ATTR{statistics/rx_packets}=="0" ATTR{statistics/tx_aborted_errors}=="0" ATTR{statistics/tx_bytes}=="0" ATTR{statistics/tx_carrier_errors}=="0" ATTR{statistics/tx_compressed}=="0" ATTR{statistics/tx_dropped}=="0" ATTR{statistics/tx_errors}=="0" ATTR{statistics/tx_fifo_errors}=="0" ATTR{statistics/tx_heartbeat_errors}=="0" ATTR{statistics/tx_packets}=="0" ATTR{statistics/tx_window_errors}=="0" ATTR{threaded}=="0" ATTR{tx_queue_len}=="1000" ATTR{type}=="1" looking at parent device '/devices/platform/soc/48004000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:0001:1': KERNELS=="mmc1:0001:1" SUBSYSTEMS=="sdio" DRIVERS=="brcmfmac" ATTRS{class}=="0x00" ATTRS{coredump}=="(write-only)" ATTRS{device}=="0xa9bf" ATTRS{power/control}=="auto" ATTRS{power/runtime_active_time}=="0" ATTRS{power/runtime_status}=="unsupported" ATTRS{power/runtime_suspended_time}=="0" ATTRS{revision}=="0.0" ATTRS{vendor}=="0x02d0" looking at parent device '/devices/platform/soc/48004000.mmc/mmc_host/mmc1/mmc1:0001': KERNELS=="mmc1:0001" SUBSYSTEMS=="mmc" DRIVERS=="" ATTRS{device}=="0xa9bf" ATTRS{ocr}=="0x00200000" ATTRS{power/control}=="auto" ATTRS{power/runtime_active_time}=="0" ATTRS{power/runtime_status}=="unsupported" ATTRS{power/runtime_suspended_time}=="0" ATTRS{rca}=="0x0001" ATTRS{revision}=="0.0" ATTRS{type}=="SDIO" ATTRS{vendor}=="0x02d0" looking at parent device '/devices/platform/soc/48004000.mmc/mmc_host/mmc1': KERNELS=="mmc1" SUBSYSTEMS=="mmc_host" DRIVERS=="" ATTRS{power/control}=="auto" ATTRS{power/runtime_active_time}=="0" ATTRS{power/runtime_status}=="unsupported" ATTRS{power/runtime_suspended_time}=="0" looking at parent device '/devices/platform/soc/48004000.mmc': KERNELS=="48004000.mmc" SUBSYSTEMS=="amba" <------------------------------------------------------- AMBA is here DRIVERS=="mmci-pl18x" ATTRS{driver_override}=="(null)" ATTRS{id}=="00253180" ATTRS{power/autosuspend_delay_ms}=="50" ATTRS{power/control}=="on" ATTRS{power/runtime_active_time}=="666709" ATTRS{power/runtime_status}=="active" ATTRS{power/runtime_suspended_time}=="0" looking at parent device '/devices/platform/soc': KERNELS=="soc" SUBSYSTEMS=="platform" DRIVERS=="simple-pm-bus" ATTRS{driver_override}=="(null)" ATTRS{power/control}=="auto" ATTRS{power/runtime_active_time}=="0" ATTRS{power/runtime_status}=="unsupported" ATTRS{power/runtime_suspended_time}=="0" looking at parent device '/devices/platform': KERNELS=="platform" SUBSYSTEMS=="" DRIVERS=="" ATTRS{power/control}=="auto" ATTRS{power/runtime_active_time}=="0" ATTRS{power/runtime_status}=="unsupported" ATTRS{power/runtime_suspended_time}=="0" ```
* udev-builtin-net_id: support getting usb path off the hostCharles Hardin2022-10-311-2/+17
| | | | | | | | | | | To support predictable interface names in various embeeded systems add support for an additional naming scheming using the USB host interface. Several asics have usb controllers that are platform devices and not children of a pci interface. These embedded systems should be able to enumerate interfaces by udev path as well to support configurations and policies. Signed-off-by: Charles Hardin <charles.hardin@chargepoint.com>
* Merge pull request #25136 from yuwata/udev-id-renamingLuca Boccassi2022-10-311-21/+10
|\ | | | | udev: cleanup for ID_RENAMING property
| * udev: use ASSERT_PTR() at one more placeYu Watanabe2022-10-251-4/+2
| |
| * udev: drop ID_RENAMING from UdevEvent.dev_db_clone instead of UdevEvent.devYu Watanabe2022-10-251-17/+8
| | | | | | | | | | | | | | As the properties loaded from the database are stored to UdevEvent.dev_db_clone, instead of UdevEvent.dev. This also makes the removal done unconditionally, for safety.
* | udev: always create device symlinks for USB disksYu Watanabe2022-10-301-12/+43
| | | | | | | | | | | | | | | | | | Previously, ata_id might not be able to retrieve attributes correctly, and properties from usb_id were used as a fallback. See issue #24921 and PR #24923. To keep backward compatibility, still we need to create symlinks based on USB serial. Fixes #25179.
* | udev: fix for parsing MAC addressYu Watanabe2022-10-301-1/+1
|/ | | | | | Fixes a bug introduced by 5bbcfbaa11a92732f9bbc8d5f77e9311e6ac3d56. Fixes #25181.
* udev: fix the errno check if a couple of placesFrantisek Sumsal2022-10-241-2/+2
| | | | Follow-up to 691a596da15.
* tree-wide: set description for device managerYu Watanabe2022-10-181-2/+1
|
* udev: drop redundant description settingYu Watanabe2022-10-181-4/+0
| | | | Follow-up for f714ecd450828e45a6f04e6277011d67a10c323f.
* udev: drop unused source fileYu Watanabe2022-10-151-330/+0
| | | | Follow-up for 5bbcfbaa11a92732f9bbc8d5f77e9311e6ac3d56.
* udev-builtin-kmod: support to run without argumentsYu Watanabe2022-10-141-5/+21
| | | | | | | | | | | If no module name is provided, then try to load modules based on the device modealias. Previously, MODALIAS property is passed as an argument, but it may contain quotation. Hence, unfortunately the modalias may be modified and cannot load expected modules. Fixes #24715.
* udev: add one more assertionYu Watanabe2022-10-111-0/+1
| | | | Follow-up for 6209bbbd4b1c9ed2886028ab2ee3df0a7d0e2494.
* tree-wide: add ERRNO_IS_XATTR_ABSENT() helperLennart Poettering2022-10-101-1/+1
| | | | | We check the same list of error codes on various xattr operations, and we should on some more. Add a common helper for this purpose.
* udev: drop assertion which is always falseYu Watanabe2022-10-101-1/+0
| | | | | | Fixes a bug introduced by 67c3e1f63a5221b47a8fea85ae421671f29f3b7e. Fixes #24945.
* ata_id: Fixed getting Response Code from SCSI Sense Data (#24921)Aleksey Vasenev2022-10-061-3/+3
| | | | | | The Response Code is contained in the first byte of the SCSI Sense Data. Bit number 7 is reserved or has a different meaning for some Response Codes and is set to 1 for some drives.
* udev-builtin-net_id: reading phys_port_name may be refused with EOPNOTSUPPYu Watanabe2022-10-041-3/+1
| | | | | | | If reading the sysattr failed with such error, the whole operation in net_id builtin command will fail, and the interface will not be renamed. Fixes a bug introduced by 5bbcfbaa11a92732f9bbc8d5f77e9311e6ac3d56.
* udevadm: do not try to find device unit when a path like string is providedYu Watanabe2022-09-291-0/+4
| | | | | | | | | | | | | | Otherwise, we provide misleading error message. Before: --- $ udevadm info /sys/class/foo Bad argument "/sys/class/foo", expected an absolute path in /dev/ or /sys/ or a unit name: Invalid argument --- After: --- $ udevadm info /sys/class/foo Unknown device "/sys/class/foo": No such device ---
* Merge pull request #24812 from yuwata/udev-drop-netlinkYu Watanabe2022-09-276-233/+54
|\ | | | | udev: drop workaround for slow read of phys_port_name sysattr
| * udev: drop workaround for slow read of phys_port_name sysattrYu Watanabe2022-09-276-233/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TL;DR This effectively reverts 8327fd1b11c5fb6529d46dfb40e2af981ffa8545, eaba9bb3e69635d2c490c5e1b0d262b763753e1d, and its follow-ups, as the original issue was already fixed by the kernel side. The original issue that the above commits tried to 'fix' is that reading phys_port_name triggers a lock in the kernel, hence processing multiple interfaces at the same time causes extreme slow down. To workaround the issue, the above commits made several necessary information retrieved through netlink instead of sysfs attributes. A patch set for the kernel was proposed as a fix for the issue: https://lore.kernel.org/all/20210928125500.167943-1-atenart@kernel.org/ and some of them were merged to v5.16: https://github.com/torvalds/linux/commit/146e5e733310379f51924111068f08a3af0db830, It has been already backported to 5.4.160, 5.10.80, 5.14.19, and 5.15.3. When these commits were proposed, it is already claimed that such issue should be fixed by the kernel side, and udevd should not workaround it. Neverthless the feature was introduced, as these have theoretical performance improvement, even if phys_port_name sysattr does not have the above issue, as in that way udevd can obtain multiple information about the interface with a single netlink socket operation. See the discussion in #20744. However, in reality, only `iflink`, `type`, `address`, and `phys_port_name` attributes from netlink are used in the udev net_id builtin command. Hence, after the original issue being fixed in the kernel side, there should be almost no performance improvement for udevd. Furthermore, combining attributes from netlink and sysfs makes hard to test net_id builtin. See #21725. Let's drop mostly meaningless code, and make net_id builtin easily testable. Closes #21725.
* | Merge pull request #24757 from yuwata/sd-device-get-child-firstLennart Poettering2022-09-261-15/+8
|\ \ | |/ |/| sd-device: introduce sd_device_get_child_first() and _next()
| * udev-builtin-net_id: use FOREACH_DEVICE_CHILD_WITH_SUFFIX() macroYu Watanabe2022-09-231-15/+8
| |
* | udev: support by-path devlink for multipath nvme block devicesYu Watanabe2022-09-231-8/+53
|/ | | | | | | | | | | | | | | If multipath feature is enabled, nvme block devices may belong to the "nvme-subsystem" subsystem, instead of "nvme" subsystem. (What a confusing name...) Then, the syspath is something like the following, /sys/devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1 Hence, we need to find the 'real parent' device, such as /sys/devices/pci0000:00/0000:00:1c.4/0000:3c:00.0/nvme/nvme0 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2031810. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2124964. Replaces #24748.
* Merge pull request #24709 from keszybz/partition-table-constantsLennart Poettering2022-09-211-4/+4
|\ | | | | Expose various GPT UUIDs as public contants and link them up in docs
| * headers: export partition uuids and flags in new sd-gpt.h fileZbigniew Jędrzejewski-Szmek2022-09-201-4/+4
| | | | | | | | | | | | I think those constants are generally useful. It's quite easy to make a mistake when copying things from the docs, so let's make them easy and convenient to access.
* | udev: use block_device_is_whole_disk()Yu Watanabe2022-09-201-35/+27
| | | | | | | | | | | | | | | | No functional changes, just refactoring. Note, this also makes synthesize_change() propagate the error from synthesize_change_one(). However, the caller of synthesize_change() ignores the failure anyway, hence the change does not take any effect.
* | udev: use device_opendir()Yu Watanabe2022-09-191-19/+8
| |
* | udev: use sd_device_get_sysattr_value()Yu Watanabe2022-09-191-22/+29
| | | | | | | | No functional changes, just refactoring.
* | udev: use faccessat()Yu Watanabe2022-09-191-7/+7
| | | | | | | | No functional changes, just refactoring.
* | Merge pull request #24646 from yuwata/udev-node-symlink_atomicYu Watanabe2022-09-181-26/+7
|\ \ | | | | | | udev: introduce symlink_atomic_full() and use it
| * | udev-node: use symlink_atomic_full_label() to create devlinkYu Watanabe2022-09-181-26/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the filename of a device symlink is too long, then the temporary filename may become invalid, and we fail to create symlink. The function `tempfn_random()` used in symlink_atomic_full() generates a safe temporary filename. Note that, thanks to the PR #23043, now only one worker can handle the same symlink simultaneously. Hence, the device ID based temporary filename is not necessary.
* | | Merge pull request #24725 from ↵Yu Watanabe2022-09-181-19/+7
|\ \ \ | | | | | | | | | | | | | | | | yuwata/blockdev-util-introduce-block_device_get_whole_disk blockdev-util: introduce block_device_get_whole_disk()
| * | | udev: do not ignore -ENOENT from sd_device_get_devname() for block deviceYu Watanabe2022-09-181-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | We already checked that the sd_device object 'dev' is for a whole block device. So, -ENOENT should not be triggeered here, and if it is, there exists something spurious. Hence we should not ignore the failure.
| * | | udev: use block_device_get_whole_disk()Yu Watanabe2022-09-181-17/+7
| | | | | | | | | | | | | | | | This should not change anything effectively.
* | | | Merge pull request #24691 from yuwata/udev-node-check-existenceDaan De Meyer2022-09-181-55/+78
|\ \ \ \ | | | | | | | | | | udev: check existence of device node
| * | | | udev-node: do not create symlink to a non-existing device nodeYu Watanabe2022-09-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the stack directory contains empty regular files named with device ID, and we create sd_device object from the device name. Hence, we implicitly checked the existence of the device node. However, now the files in the stack directory are symlink, and we retrieve the path to the device node and its priority from the symlink. Hence, the existence of the device node is not checked. Let's check if the device node is still exist.
| * | | | udev-node: split out stack_directory_read_one()Yu Watanabe2022-09-161-55/+71
| | |_|/ | |/| | | | | | | | | | No functional changes, just refactoring.
* | | | udev: downgrade log level when device node is already removedYu Watanabe2022-09-181-2/+3
| |/ / |/| | | | | | | | Follow-up for 790da548b0c37af60aed2f46867ba3885ea78718.
* | | Merge pull request #24622 from yuwata/udev-open-with-nocttyLennart Poettering2022-09-1712-27/+33
|\ \ \ | |/ / |/| | udev: open with O_NOCTTY