device-util: introduce several more helper functions
This also makes device_in_subsystem() and device_is_devtype() return negative error on critical error
This commit is contained in:
@@ -37,15 +37,12 @@ int blockdev_list(BlockDevListFlags flags) {
|
||||
}
|
||||
|
||||
if (FLAGS_SET(flags, BLOCKDEV_LIST_IGNORE_ZRAM)) {
|
||||
const char *dn;
|
||||
|
||||
r = sd_device_get_sysname(dev, &dn);
|
||||
r = device_sysname_startswith(dev, "zram");
|
||||
if (r < 0) {
|
||||
log_warning_errno(r, "Failed to get device name of discovered block device '%s', ignoring: %m", node);
|
||||
log_warning_errno(r, "Failed to check device name of discovered block device '%s', ignoring: %m", node);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (startswith(dn, "zram"))
|
||||
if (r > 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user