tree-wide: use device_get_sysattr_unsigned() and friends

This commit is contained in:
Yu Watanabe
2026-05-18 02:55:56 +09:00
parent 6ad682d70f
commit 6f72bb7bc9
10 changed files with 47 additions and 104 deletions
+6 -5
View File
@@ -1228,7 +1228,6 @@ static int acquire_description(sd_device *d) {
}
static int acquire_removable(sd_device *d) {
const char *v;
int r;
assert(d);
@@ -1238,8 +1237,13 @@ static int acquire_removable(sd_device *d) {
return 0;
for (;;) {
if (sd_device_get_sysattr_value(d, "removable", &v) >= 0)
r = device_get_sysattr_bool(d, "removable");
if (r == 0)
return 0; /* not a removable device */
if (r > 0)
break;
if (r != -ENOENT)
return log_device_debug_errno(d, r, "Failed to read 'removable' sysattr: %m");
r = sd_device_get_parent(d, &d);
if (r == -ENODEV)
@@ -1252,9 +1256,6 @@ static int acquire_removable(sd_device *d) {
return r;
}
if (parse_boolean(v) <= 0)
return 0;
log_debug("Discovered removable device.");
if (arg_action == ACTION_DEFAULT) {