[systemd-devel] [PATCH] gpt-auto-generator: skip nonexistent devices

Łukasz Stelmach l.stelmach at samsung.com
Tue Jan 7 06:00:22 PST 2014


Signed-off-by: Łukasz Stelmach <l.stelmach at samsung.com>
---
Hi,

The devices we work with have eMMC chips for storage. The chips
provide four "hardware" partitions.  The first is /dev/mmcblk0, it
takes almost whole space and holds a GPT with several real partitions
(/dev/mmcblk0p?). Then there are three block devices (mmcblk0boot0,
mmcblk0boot1, rpmb) that are part of the same hardware as mmcblk0 that
are presented by the kernel as children of the latter. That relationship
makes gpt-auto-generator try to peek them but since they are not GPT
partitions blkid_do_safeprobe() returns -2 making verify_gpt_parition()
function return -ENODEV.

I am not sure both -1 and -2 returned by blkid_do_safeprobe() should
result in -ENODEV in verify_gpt_parition(), however, -ENODEV does not
mean IMHO we should stop iterating udev results in enumerate_partitions().


 src/gpt-auto-generator/gpt-auto-generator.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index 017c35d..df779ee 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -297,6 +297,8 @@ static int enumerate_partitions(struct udev *udev, dev_t dev) {
 
                 r = verify_gpt_partition(node, &type_id, &nr, &fstype);
                 if (r < 0) {
+                        if (r == -ENODEV)
+                                goto skip;
                         log_error("Failed to verify GPT partition %s: %s",
                                   node, strerror(-r));
                         return r;
-- 
1.7.9.5



More information about the systemd-devel mailing list