teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame 0234-gpt-auto-generator-skip-nonexistent-devices.patch

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