if (r < 0)
return r;
+ r = sd_device_enumerator_add_match_subsystem(e, "block", true);
+ if (r < 0)
+ return r;
+
r = sd_device_enumerator_add_match_parent(e, d);
if (r < 0)
return r;
+ r = sd_device_enumerator_add_match_sysattr(e, "partition", NULL, true);
+ if (r < 0)
+ return r;
+
*ret = TAKE_PTR(e);
return 0;
}
return false;
r = sd_device_get_sysattr_value(d, "partition", &v);
- if (r == -ENOENT || /* Not a partition device */
- ERRNO_IS_PRIVILEGE(r)) /* Not ready to access? */
- return false;
if (r < 0)
return r;
r = safe_atoi(v, &partno);
if (r < 0)
return r;
+ r = sd_device_monitor_filter_add_match_parent(monitor, parent, true);
+ if (r < 0)
+ return r;
+
+ r = sd_device_monitor_filter_add_match_sysattr(monitor, "partition", NULL, true);
+ if (r < 0)
+ return r;
+
r = sd_device_monitor_attach_event(monitor, event);
if (r < 0)
return r;