+ if (!parent) {
+ log_debug("%s: not a partitioned device, ignoring.", name);
+ return 0;
+ }
+
+ /* Does it have a devtype? */
+ devtype = udev_device_get_devtype(parent);
+ if (!devtype) {
+ log_debug("%s: parent doesn't have a device type, ignoring.", name);
+ 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);
+ return 0;
+ }
+
+ /* Does it have a device node? */
+ node = udev_device_get_devnode(parent);
+ if (!node) {
+ log_debug("%s: parent device does not have device node, ignoring.", name);
+ return 0;
+ }
+
+ log_debug("%s: root device %s.", name, node);
+
+ pn = udev_device_get_devnum(parent);
+ if (major(pn) == 0)
+ return 0;
+
+ errno = 0;
+ b = blkid_new_probe_from_filename(node);
+ if (!b) {
+ if (errno == 0)
+ return log_oom();
+
+ return log_error_errno(errno, "%s: failed to allocate prober: %m", node);
+ }
+
+ blkid_probe_enable_partitions(b, 1);
+ blkid_probe_set_partitions_flags(b, BLKID_PARTS_ENTRY_DETAILS);
+
+ errno = 0;
+ r = blkid_do_safeprobe(b);
+ if (r == -2 || r == 1) /* no result or uncertain */
+ return 0;
+ else if (r != 0)
+ return log_error_errno(errno ?: EIO, "%s: failed to probe: %m", node);
+
+ errno = 0;
+ r = blkid_probe_lookup_value(b, "PTTYPE", &pttype, NULL);
+ if (r != 0)
+ return log_error_errno(errno ?: EIO,
+ "%s: failed to determine partition table type: %m", node);
+
+ /* We only do this all for GPT... */
+ if (!streq_ptr(pttype, "gpt")) {
+ log_debug("%s: not a GPT partition table, ignoring.", node);
+ return 0;
+ }
+
+ errno = 0;
+ pl = blkid_probe_get_partitions(b);
+ if (!pl) {
+ if (errno == 0)
+ return log_oom();
+
+ return log_error_errno(errno, "%s: failed to list partitions: %m", node);
+ }
+
+ e = udev_enumerate_new(udev);
+ if (!e)