summaryrefslogtreecommitdiffstats
path: root/src/dissect
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2024-01-01 19:26:39 +0100
committerGitHub <noreply@github.com>2024-01-01 19:26:39 +0100
commit86b8b66675d2ec34614ffc4ae972e691abe216e3 (patch)
tree9d88b6bdc51a32f14a93b8d2209c4e5a1f9913a7 /src/dissect
parentMerge pull request #30593 from yuwata/sd-dhcp-duid (diff)
parenttree-wide: use device_in_subsystem() and device_is_devtype() (diff)
downloadsystemd-86b8b66675d2ec34614ffc4ae972e691abe216e3.tar.xz
systemd-86b8b66675d2ec34614ffc4ae972e691abe216e3.zip
Merge pull request #30591 from yuwata/device-util
device-util: introduce device_in_subsystem() and device_is_devtype() helper functions
Diffstat (limited to 'src/dissect')
-rw-r--r--src/dissect/dissect.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c
index 571683cd4b..6a8193f618 100644
--- a/src/dissect/dissect.c
+++ b/src/dissect/dissect.c
@@ -1741,26 +1741,13 @@ static int action_detach(const char *path) {
FOREACH_DEVICE(e, d) {
_cleanup_(loop_device_unrefp) LoopDevice *entry_loop = NULL;
- const char *name, *devtype;
- r = sd_device_get_sysname(d, &name);
- if (r < 0) {
- log_warning_errno(r, "Failed to get enumerated device's sysname, skipping: %m");
- continue;
- }
-
- r = sd_device_get_devtype(d, &devtype);
- if (r < 0) {
- log_warning_errno(r, "Failed to get devtype of '%s', skipping: %m", name);
- continue;
- }
-
- if (!streq(devtype, "disk")) /* Filter out partition block devices */
+ if (!device_is_devtype(d, "disk")) /* Filter out partition block devices */
continue;
r = loop_device_open(d, O_RDONLY, LOCK_SH, &entry_loop);
if (r < 0) {
- log_warning_errno(r, "Failed to open loopback block device '%s', skipping: %m", name);
+ log_device_warning_errno(d, r, "Failed to open loopback block device, skipping: %m");
continue;
}