David Tardon
995340074e
tree-wide: use ASSERT_PTR more
2022-09-13 08:13:27 +02:00
Yu Watanabe
3fb94c7062
sd-device: move device_new_from_watch_handle_at() to udev-watch.c
...
And drop unused watch handle related functions.
2022-09-12 01:36:06 +09:00
Yu Watanabe
88b5080ea9
sd-device-enumerator: use _cleanup_free_ attribute for safety
...
No functional changes, just improve readability.
Suggested by https://github.com/systemd/systemd/pull/24601#discussion_r966883459 .
2022-09-09 21:16:37 +09:00
Yu Watanabe
89ad604839
sd-device-enumerator: always ignore ENOENT from opendir()
...
But logs all errors.
2022-09-09 21:16:37 +09:00
Yu Watanabe
0f519b9c2e
sd-device-enumerator: check sysname earlier
2022-09-09 21:16:32 +09:00
Yu Watanabe
2d9c58d786
test: add test for sd_device_enumerator_add_match_parent()
2022-09-08 18:10:50 +09:00
Yu Watanabe
6c876f0c20
sd-device-enumerator: rewrite child enumeration without recursion
2022-09-08 18:10:50 +09:00
Yu Watanabe
bae477676a
sd-device-enumerator: do not fail when a directory vanishes on enumerate
2022-09-08 18:10:50 +09:00
Yu Watanabe
cdffb95cce
sd-device-enumerator: use test_matches() more
2022-09-08 18:10:50 +09:00
Yu Watanabe
c0aa23cf1e
sd-device-monitor: relax sender uid check when running in user namespace
...
If sd-device-monitor is running in a user namespace, the sender uid is
not zero. Let's relax the verification in that case.
2022-09-08 11:08:43 +09:00
Yu Watanabe
778912a659
sd-device: introduce devname_from_stat_rdev()
2022-09-03 00:42:31 +09:00
Yu Watanabe
4fe46c349d
sd-device: rename devpath_from_devnum() -> devname_from_devnum()
...
In sd-device, `devpath` is a kind of syspath without '/sys' prefix, e.g.
/devices/pci0000:00/0000:00:1c.4/0000:3c:00.0/nvme/nvme0/nvme0n1,
and `devname` is a path to the device node, e.g. /dev/nvme0n1.
Let's use the consistent name for the helper function.
2022-09-03 00:42:31 +09:00
Jan Janssen
f996072fe0
tree-wide: Fix field width specifier warnings
...
The casting here isn't pretty, but at least it makes it obvious what is
happening instead of implicit and it allows enabling -Wformat-signedness.
2022-08-30 12:03:33 +02:00
Jan Janssen
1dbab956ba
journal: Show grcrypt error message instead of a raw code
2022-08-30 12:03:33 +02:00
Jan Janssen
c0f86d66f3
tree-wide: Use correct format specifiers
...
gcc will complain about all these with -Wformat-signedness.
2022-08-30 12:03:28 +02:00
Topi Miettinen
5b198025de
sd-netlink: add NetLabel support
2022-08-29 14:23:17 +09:00
Yu Watanabe
42899bcee5
sd-device: skip to check diskseq if device is not initialized
2022-08-28 10:10:44 +09:00
Yu Watanabe
ff65036cfe
sd-device: introduce device_open_from_devnum()
2022-08-28 09:08:21 +09:00
Yu Watanabe
f79fdea6fd
sd-device: introduce devpath_from_devnum()
2022-08-28 09:08:21 +09:00
Yu Watanabe
a2ded81f73
sd-device: rename device-util.c -> device-filter.c
...
The functions provided by the file are only used in sd-device.
2022-08-28 09:08:21 +09:00
Yu Watanabe
6dd3b818bb
tree-wide: fix typo
2022-08-28 00:03:36 +09:00
Luca Boccassi
34f166d601
Merge pull request #24456 from yuwata/network-tcp-congctl
...
network: introduce TCPCongestionControlAlgorithm=
2022-08-26 18:04:51 +01:00
Yu Watanabe
5342810bcf
test-sd-device: run subsystem filter test several times
...
The test is quite racy. Let's wait for all queued udev events to be
processed, and run the test several times.
Fixes #24400 .
2022-08-26 07:29:36 +00:00
Yu Watanabe
51b8753017
sd-netlink: fix attribute type for RTAX_CC_ALGO
2022-08-26 14:33:54 +09:00
Lennart Poettering
98f3e84342
Merge pull request #24420 from keszybz/mouse-power
...
Rework on_ac_power()
2022-08-24 10:16:14 +02:00
Zbigniew Jędrzejewski-Szmek
48a511cf92
sd-device: add helper to read a unsigned int attribute
...
There are dozens of places where this could be used, but I don't
want to do the conversion now because it's quite a bit of work.
I think we could export this function later on, because reading
numerical attributes is so common. But for now, I'm just adding the
helper to use it one place.
2022-08-23 17:04:31 +02:00
Lennart Poettering
45519d13a4
tree-wide: port things dirname_malloc() → path_extract_directory()
2022-08-23 15:10:15 +02:00
Lennart Poettering
8e7e4a730b
tree-wide: use path_join() instead of prefix_roota() in various cases
...
prefix_roota() is something we should stop using. It is bad for three
reasons:
1. As it names suggests it's supposed to be used when working relative
to some root directory, but given it doesn't follow symlinks (and
instead just stupidly joins paths) it is not a good choice for that.
2. More often than not it is currently used with inputs under control of
the user, and that is icky given it typically allocates memory on the
stack.
3. It's a redundant interface, where chase_symlinks() and path_join()
already exist as better, safer interfaces.
Hence, let's start moving things from prefix_roota() to path_join() for
the cases where that's appropriate.
2022-08-22 19:15:29 +01:00
Frantisek Sumsal
94510784e1
sd-journal: drop an unused variable
2022-08-20 20:46:23 +02:00
Yu Watanabe
0f27758ae9
Merge pull request #24356 from keszybz/sd-netlink-api
...
Small improvements to the sd-netlink api
2022-08-20 19:11:02 +09:00
Zbigniew Jędrzejewski-Szmek
93c0a5eccf
sd-netlink: use SD_EVENT_ONESHOT for a time-based callback
2022-08-19 17:43:56 +02:00
Lennart Poettering
2ab1fb77e2
tree-wide: pass proper values (not bools) to sd_event_source_set_enabled()
2022-08-19 14:56:26 +02:00
Zbigniew Jędrzejewski-Szmek
40c864afe0
sd-netlink: simplify error code retention
2022-08-19 11:52:25 +02:00
Zbigniew Jędrzejewski-Szmek
3310e0647c
sd-netlink: delete sd_netlink_new_from_fd()
...
It was somewhat similar to sd_netlink_open_fd(), and unused.
2022-08-19 11:52:25 +02:00
Zbigniew Jędrzejewski-Szmek
24c0f38591
sd-netlink: rename sd_netlink_message_request_dump to sd_netlink_message_set_request_dump
2022-08-19 11:52:25 +02:00
Zbigniew Jędrzejewski-Szmek
f4f81a6b35
sd-netlink: constify parameters in public api and adjust pointer formatting
...
In the internal api, 'char* const*' is used instead of 'const char* const*'
because otherwise we'd get a mismatch with the various strv apis.
2022-08-19 11:52:25 +02:00
Zbigniew Jędrzejewski-Szmek
b44662fee5
sd-netlink: prefix output param names with 'ret'
...
In some places, the code was already using that, so only the header file needed
to be adjusted.
We use 'nl' for the sd_netlink* when it's passed in as input. I was considering
renaming to 'netlink', but that'd add a lot of verbosity and also we have
'sd_journal *j' in sd-journal, so the short name matches in style.
2022-08-19 11:52:21 +02:00
Yu Watanabe
9d9bc6fc57
Merge pull request #24285 from yuwata/sd-device-new-from-path
...
sd-device: make sd_device_new_from_path() support symlink outside of /sys
2022-08-13 03:27:26 +09:00
Yu Watanabe
284ef480d0
test: add more tests for sd_device_new_from_path()
2022-08-12 21:42:00 +09:00
Yu Watanabe
95c250be0d
sd-device: allow to create sd-device object through a symlink outside of /sys
...
For example, /proc/device-tree is a symlink to /sys/firmware/devicetree/base,
and the kernel documentation says the symlink should be used by userspace app.
See, https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-ofw .
Hence, it is useful to make `sd_device_new_from_path()` support such symlink.
2022-08-12 21:41:12 +09:00
Yu Watanabe
cbdf6a1fcf
test: use sd_device_monitor_set_description()
2022-08-12 21:27:14 +09:00
Yu Watanabe
f36b683f6c
sd-device-monitor: logs description for device monitor
2022-08-12 21:27:14 +09:00
Yu Watanabe
39f11aa422
sd-device-monitor: introduce sd_device_monitor_{set,get}_description()
2022-08-12 21:27:14 +09:00
Yu Watanabe
edf6cbc30f
Merge pull request #24286 from yuwata/test-sd-device-monitor
...
test-sd-device-monitor: several fixlets
2022-08-12 21:24:40 +09:00
Yu Watanabe
0186571c9f
sd-device-enumerator: drop noisy log messages
...
These are not for failed tasks, and provide almost no information.
2022-08-12 21:23:58 +09:00
Yu Watanabe
8bb4989906
sd-device-monitor: actually refuse to send invalid devices
...
Fixes an issue introduced by 9e79123884 .
2022-08-12 04:34:19 +09:00
Yu Watanabe
133d78966f
sd-device-monitor: fix inversed condition
...
Fixes an issue introduced by b3d06b9226 .
2022-08-12 04:34:19 +09:00
Yu Watanabe
8164957461
test: do not fill up receiver buffer
...
If a system has many devices, then the receiver buffer may be filled up.
Hopefully fixes https://bugzilla.redhat.com/show_bug.cgi?id=2095750
2022-08-12 03:13:22 +09:00
Yu Watanabe
46c1223b24
test: add fake action and seqnum
...
Otherwise, the receiver refuses the devices. See device_verify().
2022-08-12 03:13:22 +09:00
Yu Watanabe
50f9c507b2
test: add tests for sd_device_enumerator_add_match_sysattr/property()
2022-08-09 02:21:25 +09:00