9fc0f6
From 7f3f1b3f979a96182b2eb44eeea86993506108d5 Mon Sep 17 00:00:00 2001
9fc0f6
From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= <l.stelmach@samsung.com>
9fc0f6
Date: Tue, 7 Jan 2014 15:00:22 +0100
9fc0f6
Subject: [PATCH] gpt-auto-generator: skip nonexistent devices
9fc0f6
9fc0f6
The devices we work with have eMMC chips for storage. The chips
9fc0f6
provide four "hardware" partitions.  The first is /dev/mmcblk0, it
9fc0f6
takes almost whole space and holds a GPT with several real partitions
9fc0f6
(/dev/mmcblk0p?). Then there are three block devices (mmcblk0boot0,
9fc0f6
mmcblk0boot1, rpmb) that are part of the same hardware as mmcblk0 that
9fc0f6
are presented by the kernel as children of the latter. That relationship
9fc0f6
makes gpt-auto-generator try to peek them but since they are not GPT
9fc0f6
partitions blkid_do_safeprobe() returns -2 making verify_gpt_parition()
9fc0f6
function return -ENODEV.
9fc0f6
---
9fc0f6
 src/gpt-auto-generator/gpt-auto-generator.c | 3 +++
9fc0f6
 1 file changed, 3 insertions(+)
9fc0f6
9fc0f6
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
9fc0f6
index d2b4213..1f09aed 100644
9fc0f6
--- a/src/gpt-auto-generator/gpt-auto-generator.c
9fc0f6
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
9fc0f6
@@ -306,6 +306,9 @@ static int enumerate_partitions(struct udev *udev, dev_t dev) {
9fc0f6
 
9fc0f6
                 r = verify_gpt_partition(node, &type_id, &nr, &fstype);
9fc0f6
                 if (r < 0) {
9fc0f6
+                        /* skip child devices which are not detected properly */
9fc0f6
+                        if (r == -ENODEV)
9fc0f6
+                                continue;
9fc0f6
                         log_error("Failed to verify GPT partition %s: %s",
9fc0f6
                                   node, strerror(-r));
9fc0f6
                         udev_device_unref(q);