r = sd_device_get_syspath(d, &name);
if (r < 0) {
log_debug_errno(r, "Device %u:%u does not have a name, ignoring: %m", major(devnum), minor(devnum));
- goto not_found;
+ return 0;
}
}
r = sd_device_get_parent(d, &parent);
if (r < 0) {
log_debug_errno(r, "%s: not a partitioned device, ignoring: %m", name);
- goto not_found;
+ return 0;
}
/* Does it have a devtype? */
r = sd_device_get_devtype(parent, &devtype);
if (r < 0) {
log_debug_errno(r, "%s: parent doesn't have a device type, ignoring: %m", name);
- goto not_found;
+ return 0;
}
/* Is this a disk or a partition? We only care for disks... */
if (!streq(devtype, "disk")) {
log_debug("%s: parent isn't a raw disk, ignoring.", name);
- goto not_found;
+ return 0;
}
/* Does it have a device node? */
r = sd_device_get_devname(parent, &node);
if (r < 0) {
log_debug_errno(r, "%s: parent device does not have device node, ignoring: %m", name);
- goto not_found;
+ return 0;
}
log_debug("%s: root device %s.", name, node);
r = sd_device_get_devnum(parent, &pn);
if (r < 0) {
log_debug_errno(r, "%s: parent device is not a proper block device, ignoring: %m", name);
- goto not_found;
+ return 0;
}
fd = open(node, O_RDONLY|O_CLOEXEC|O_NOCTTY);
*ret = fd;
return 1;
-
-not_found:
- *ret = -1;
- return 0;
}
static int enumerate_partitions(dev_t devnum) {
-
_cleanup_close_ int fd = -1;
_cleanup_(dissected_image_unrefp) DissectedImage *m = NULL;
int r, k;