| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Let's use our nice macros a bit more.
(Not comprehensive)
|
|
|
|
|
|
|
|
|
| |
strstrafter() is like strstr() but returns a pointer to the first
character *after* the found substring, not on the substring itself.
Quite often this is what we actually want.
Inspired by #27267 I think it makes sense to add a helper for this,
to avoid the potentially fragile manual pointer increment afterwards.
|
| |
|
|
|
|
|
|
|
|
| |
This also makes device node path is handled with the same logic.
Addresses https://github.com/systemd/systemd/pull/27169#discussion_r1162739511.
Follow-up for 2c5f119c3cc78bd7da0c7c56b57eca43bac464c1.
|
|
|
|
| |
As here keys are relative paths to sysattrs.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
Now that we have reference counting, it's useful to be able to push
single key values onto the log context separately, so that we don't
have to allocate new storage to join the separate string together into
a single field which means we won't be able to reuse a context containing
the same field.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Let's try to optimize against pushing the same fields multiple times
onto the log context. To achieve this we make the log context reference
counted and return an existing context object if it's using the same
fields.
A consequence of this is that we have to make sure attaching/detaching
is coupled to the lifetime of the context object, so we make the attach
and detach functions private for now. If we need independent attach/detach
in the future, we can make that work with some extra complexity but since
we don't need it yet, let's not support it for now.
|
| |
|
| |
|
|\
| |
| | |
basic: Add log context
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For some (corner) cases, it might be desirable to disable the generation of
some persistent storage symlinks that 60-persistent-storage.rules creates.
For example on big setups with a high number of partitions which uses the same
label name, this can result in a noticeable slow-down in the (re)start of the
udevd as there are many contenders for the symlink /dev/disk/by-partlabel.
However it's currently pretty hard to overwrite just some specific part of the
rule file. Indeed one need to copy and modify the whole rule file in /etc but
will lost any upcoming updates/fixes that the distro might release in the
future.
With this simple patch, one can now disable the generation of the
"by-partlabel" symlinks (for example) with the following single rule:
$ cat /etc/udev/rules.d/99-no-by-partlabel.rules
ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK-="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}"
Closes #24607.
|
| | |
|
| |
| |
| |
| | |
The function is used only by udevd.
|
| |
| |
| |
| | |
No functional change, just refactoring.
|
|/
|
|
|
|
| |
Otherwise, when a new syspath is assigned to the sd-device object,
sd_device_get_sysname() or _sysnum() will provide an outdated device
name or number.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-1 was used everywhere, but -EBADF or -EBADFD started being used in various
places. Let's make things consistent in the new style.
Note that there are two candidates:
EBADF 9 Bad file descriptor
EBADFD 77 File descriptor in bad state
Since we're initializating the fd, we're just assigning a value that means
"no fd yet", so it's just a bad file descriptor, and the first errno fits
better. If instead we had a valid file descriptor that became invalid because
of some operation or state change, the other errno would fit better.
In some places, initialization is dropped if unnecessary.
|
|
|
|
| |
As we filtered out network devices in the test.
|
|
|
|
|
|
|
|
|
|
| |
If an attribute is read but the value is not used (i.e. ret_value is NULL),
then sd_device_get_sysattr_value() mistakenly frees the read data even though
it is cached internally.
Fixes a bug introduced by acfc2a1d15560084e077ffb3be472cd117e9020a.
Fixes #25702.
|
| |
|
|
|
|
|
| |
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.
|
|\
| |
| | |
sd-device: drop unused device_copy_properties()
|
| | |
|
| | |
|
|/
|
|
|
|
|
| |
When running the tests in a chroot /sys/ might be writable, but it
doesn't mean udev will be running
Assertion 'sd_event_add_inotify(event, NULL, "/run/udev" , IN_DELETE, on_inotify, NULL) >= 0' failed at src/libsystemd/sd-device/test-sd-device.c:352, function test_sd_device_enumerator_filter_subsystem(). Aborting.
|
|
|
|
|
|
|
| |
If udevd broadcasts a processed device with huge amount of properties,
then clients cannot receive the device.
Fixes #24987.
|
|\
| |
| | |
udev: drop workaround for slow read of phys_port_name sysattr
|
| | |
|
|\ \
| |/
|/| |
sd-device: introduce sd_device_get_child_first() and _next()
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
These functions provide a high-level interface for enumerating
child devices.
Suggested at https://github.com/systemd/systemd/pull/24731#discussion_r973987065.
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
| |
In most cases we refernced the concept as "initrd". Let's convert most
remaining uses of "initramfs" to "initrd" too, to stay internally
consistent.
This leaves "initramfs" only where it's relevant to explain historical
concepts or where "initramfs" is part of the API (i.e. in
/run/initramfs).
Follow-up for: b66a6e1a5838b874b789820c090dd6850cf10513
|
|
|
|
| |
It provides recognizable error if /proc is not mounted.
|
| |
|
| |
|
| |
|
|
|
|
| |
No functional changes, just refactoring.
|
|
|
|
| |
No functional changes, just refactoring.
|
|
|
|
|
|
| |
As the stored values are actually path. Just for safety.
This also drops unnecessary duplication of path.
|
|
|
|
|
| |
Previously, even if sd_device_get_subsystem() returns -ENOENT for block
device, we accepted that. This makes the check slightly stricter.
|
|
|
|
|
|
| |
This renames UidRange -> UidRangeEntry, and reintroduces UidRange which
contains the array of UidRangeEntry and its size.
No fucntional changes, just refactoring.
|
|
|
|
| |
Follow-up for c0aa23cf1ed4b3cbbcaf8b19d47e6e29dc28c9a0.
|
| |
|
|
|
|
| |
And drop unused watch handle related functions.
|