| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We often used a pattern like if (!FLAGS_SET(flags, SD_JSON_FORMAT_OFF)),
which is rather verbose and also contains a double negative, which we try
to avoid. Add a little helper to avoid an explicit bit check.
This change clarifies an aditional thing: in some cases we treated
SD_JSON_FORMAT_OFF as a flag (flags & SD_JSON_FORMAT_OFF), while in other cases
we treated it as an independent enum value (flags == SD_JSON_FORMAT_OFF).
In the first form, flags like SD_JSON_FORMAT_SSE do _not_ turn the json
output on, while in the second form they do. Let's use the first form
everywhere.
No functional change intended.
Initially I wasn't sure if this helper should be made public or just internal,
but it seems such a common pattern that if we expose the flags, we might just
as well expose it too, to make life easier for any consumers.
|
|
|
|
| |
(#34893)
|
| |
|
|
|
|
|
|
|
| |
As another device may be created with the same device node while udevd
is processing the remove event of the previous owner of the device node.
This also adds comment why we skip watching device node on remove.
|
|
|
|
|
|
|
|
| |
Fixes a bug introduced by f6bda694f908cc227b002570b893029aa4c9e173 (v256).
With the offending commit, on remove event, database file for a device is once
removed in event_execute_rules_on_remove(), but later re-created here.
This fixes the issue, and makes the database file not re-created on remove event.
|
|
|
|
|
| |
Unnecessary stack directories and their lock files are removed by
workers. Hence, the logic is not necessary anymore.
|
|
|
|
|
|
| |
This effectively reverts 09373c1a50297079e6b0447ea97af4e9a60f77fa,
as stack directories and lock files are removed by udev workers on
unlocking.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replaces 09373c1a50297079e6b0447ea97af4e9a60f77fa.
Let's remove stack directories and their lock files by workers if
possible.
Now, lock files must be created before creating stack directories, hence
lock files are moved to /run/udev/links.lock/ , e.g.,
Before:
/run/udev/links/disk\x2fby-diskseq\x2f1/.lock
After:
/run/udev/links.lock/disk\x2fby-diskseq\x2f1
Fixes ##34637.
|
|\
| |
| | |
udev-node: do not create stack directory for by-diskseq symlink
|
| |
| |
| |
| |
| |
| |
| |
| | |
Also
- make the failure propagated,
- remove /dev/block or /dev/char if empty.
Hopefully, no effective functionality changed. Just refactoring.
|
| |
| |
| |
| |
| |
| | |
Also adds short comment for the NULL arguments.
No functional change, just refactoring.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The disk/by-diskseq symlink should not be shared with multiple block
devices. Hence, it is not necessary to create stack directory for the
symlink that manages which device owns the symlink.
This is not just a optimization.
If a service unit tries to mount a disk image but the service fails, then
the diskseq of the loop device for the image may be continuously increased
during restart, and inodes in /run may increase rapidly, as the stack
directories are cleaned up only when udev queue is empty.
Fixes #34637.
|
|/ |
|
| |
|
|
|
|
| |
In order to distinguish it from libc function naming.
|
|
|
|
|
|
| |
The latest clang has started catching more integer promotions which
cause us to pass the wrong type to printf() format specifiers so let's
fix those.
|
| |
|
|
|
|
| |
Fixes #34459.
|
|
|
|
|
|
|
|
|
| |
This introduces 'i' prefix for match string. When specified, string or
pattern will match case-insensitively.
Closes #34359.
Co-authored-by: Ryan Wilson <ryantimwilson@meta.com>
|
|
|
|
|
|
| |
into UdevRuleMatchType
No functional change, just refactoring and preparation for later change.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This tries to get rid of most manual sigprocmask() changes, in favour
of:
1. The SD_EVENT_SIGNAL_PROCMASK flag to sd_event_add_signal()
2. The sd_event_set_signal_exit() call for handling SIGTERM/SIGINT
3. Move masking of SIGWINCH into ptyfwd, out of nspawn/vmspawn/run
And while we are at it get rid of a bunch of event source fields whose
lifetime is bound to the sd_event object they belong to anyway, and make
use of the "floating" event source feature of sd-event instead.
|
|
|
|
|
|
|
| |
Indicates whether the ATA read look-ahead feature is supported
and enabled.
Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
|
| |
|
|
|
|
| |
Also, unify MSG_TRUNC handling all across the codebase.
|
| |
|
|
|
|
| |
While at it, downgrade log level of ignored errors to LOG_WARNING.
|
|
|
|
|
| |
This makes the macros use log_syntax_parse_error(), hopefully which provides
more informative log message in general, and reduces binary size.
|
|
|
|
|
|
|
|
|
| |
This adds two more fields in 'udevadm info':
- J for device ID, e.g. b128:1, c10:1, n1, and so on.
- B for driver subsystem, e.g. pci, i2c, and so on.
These, especially the device ID field may be useful to find udev
database file under /run/udev/data for a device.
|
|
|
|
|
|
| |
We have already exposed sd_device_new_from_device_id(), but we have
never provide the way to get device ID from an existing sd_device
object.
|
|\
| |
| | |
udev/net_id: trivial cleanups
|
| |
| |
| |
| | |
This also downgrades the log level of a message to debug.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We usually do not set r = -1 when a functionality is disabled or not
supported. Even though the error code is not used, let's set a negative
errno in such case.
No functional change, just refactoring.
Follow-up for 0a4ecc54cb9f2d3418b970c51bfadb69c34ae9eb.
|
|/
|
|
|
| |
The lines were mistakenly dropped by
aa976d87889ae22b7347787a1ebd03a31dcc0a9e.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since ID_NET_NAME_SLOT was introduced we ignore slot == 0
https://github.com/systemd/systemd/blob/0035597a30d120f70df2dd7da3d6128fb8ba6051/src/udev/udev-builtin-net_id.c#L139
Qemu sets _SUN to PCI_SLOT() for all NICs, so _SUN is not unique.
https://gitlab.com/qemu-project/qemu/-/issues/2530
In my tests with libvirt I can only set 'slot="0x00"' in interface definition,
so all NICs end up with _SUN == 0, and this commit is enough to avoid the issue.
Fixes 0a4ecc54cb9f2d3418b970c51bfadb69c34ae9eb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
netdevs before their parents
The net_id builtin only checked the of_node of a netdev's parent device,
not that of the netdev itself. While it is common that netdevs don't have
an OF node assigned themselves, as they are derived from some parent
device, this is not always the case. In particular when a single
controller provides multiple ports that can be referenced indiviually in
the Device Tree (both for aliases/MAC address assignment and phandle
references), the correct of_node will be that of the netdev itself, not
that of the parent, so it needs to be checked, too.
A new naming scheme flag NAMING_DEVICETREE_PORT_ALIASES is added to
allow selecting the new behavior.
|
|
|
|
| |
Closes #33852.
|
|
|
|
|
|
| |
- drop trailing an empty line,
- use FOREACH_ARRAY() macro,
- add short comment for boolean argument.
|
|
|
|
| |
Follow-up for 0e789e6d48046d43c50dd949a71ac56f1127bb96.
|
| |
|
|
|
|
|
|
|
| |
Previously, the main process of systemd-udevd manages worker process
with their sd_device_monitor object to save the destination address.
Let's save only destination address, and drop worker's sd_device_monitor
object.
|
|
|
|
|
|
|
|
|
|
| |
Previously, device_monitor_enable_receiving() does
- update filter,
- bind socket.
But, binding socket can be done in when the socket is opened.
Let's remove device_monitor_enable_receiving() and bind the socket in
device_monitor_new_full().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
pci_get_hotplug_slot() has the following limitations:
- if slots are not hotpluggable, they are not in /sys/bus/pci/slots.
- the address at /sys/bus/pci/slots/X/addr doesn't contains the function part,
so on some system, 2 different slots with different _SUN end up with the same
hotplug_slot, leading to naming conflicts.
- it tries all parent devices until it finds a slot number, which is incorrect,
and what led to NAMING_BRIDGE_MULTIFUNCTION_SLOT being disabled.
The use of PCI hotplug to find the slot (ACPI _SUN) was introduced in
https://github.com/systemd/systemd/commit/0035597a30d120f70df2dd7da3d6128fb8ba6051
"udev: net_id - export PCI hotplug slot names" on 2012/11/26.
At the same time on the kernel side we got
https://github.com/torvalds/linux/commit/bb74ac23b10820d8722c3e1f4add9ef59e703f63
"ACPI: create _SUN sysfs file" on 2012/11/16.
Using PCI hotplug was the only way at the time, but now 12 years later we can use
firmware_node/sun sysfs file.
Looking at a small selection of server HW, for HPE (Gen10 DL325), the _SUN is attached
to the NIC device, whereas for Dell (R640/R6515/R6615) and Cisco (UCSC-C220-M5SX),
the _SUN is on the first parent pcieport.
We still fallback to pci_get_hotplug_slot() to handle the s390 case and
maybe some other coner cases (_SUN on grand parent device that is not a
bridge ?).
|
|
|
|
|
|
|
|
|
| |
This is a lot of stuff, and sometimes quite wild, let's turn this into
its own header.
All stuff color-related that just generates sequences is now in
ansi-color.h (no .c file!), and everything more complex that
probes/ineracts with terminals remains in termina-util.[ch]
|
|\
| |
| | |
Fix confusion between killer and prey
|
| | |
|
|/
|
|
| |
Follow-up for 11706971e8b6aa289af56454330fffd87f5d5a78
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is preparation for making our Varlink API a public API. Since our
Varlink API is built on top of our JSON API we need to make that public
first (it's a nice API, but JSON APIs there are already enough, this is
purely about the Varlink angle).
I made most of the json.h APIs public, and just placed them in
sd-json.h. Sometimes I wasn't so sure however, since the underlying data
structures would have to be made public too. If in doubt I didn#t risk
it, and moved the relevant API to src/libsystemd/sd-json/json-util.h
instead (without any sd_* symbol prefixes).
This is mostly a giant search/replace patch.
|
|
|
|
|
|
| |
No functional change.
Closes CID#1469719.
|
| |
|