+ if (!parent) {
+ log_debug("Not a partitioned device, ignoring.");
+ return 0;
+ }
+
+ /* Does it have a devtype? */
+ devtype = udev_device_get_devtype(parent);
+ if (!devtype) {
+ log_debug("Parent doesn't have a device type, ignoring.");
+ return 0;
+ }
+
+ /* Is this a disk or a partition? We only care for disks... */
+ if (!streq(devtype, "disk")) {
+ log_debug("Parent isn't a raw disk, ignoring.");
+ return 0;
+ }
+
+ /* Does it have a device node? */
+ node = udev_device_get_devnode(parent);
+ if (!node) {
+ log_debug("Parent device does not have device node, ignoring.");
+ return 0;
+ }
+
+ log_debug("Root device %s.", 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();
+
+ log_error_errno(errno, "Failed allocate prober: %m");
+ return -errno;
+ }
+
+ 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) {
+ if (errno == 0)
+ errno = EIO;
+ log_error_errno(errno, "Failed to probe %s: %m", node);
+ return -errno;
+ }
+
+ errno = 0;
+ r = blkid_probe_lookup_value(b, "PTTYPE", &pttype, NULL);
+ if (r != 0) {
+ if (errno == 0)
+ errno = EIO;
+ log_error_errno(errno, "Failed to determine partition table type of %s: %m", node);
+ return -errno;
+ }
+
+ /* We only do this all for GPT... */
+ if (!streq_ptr(pttype, "gpt")) {
+ log_debug("Not a GPT partition table, ignoring.");
+ return 0;
+ }
+
+ errno = 0;
+ pl = blkid_probe_get_partitions(b);
+ if (!pl) {
+ if (errno == 0)
+ return log_oom();
+
+ log_error_errno(errno, "Failed to list partitions of %s: %m", node);
+ return -errno;
+ }
+
+ e = udev_enumerate_new(udev);
+ if (!e)