]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Make grub-probe work with symbolic links under /dev/mapper as well
authorColin Watson <cjwatson@ubuntu.com>
Fri, 28 May 2010 10:51:50 +0000 (11:51 +0100)
committerColin Watson <cjwatson@ubuntu.com>
Fri, 28 May 2010 10:51:50 +0000 (11:51 +0100)
as with real block devices.  The Linux world seems to be (at best)
in transition here, and GRUB shouldn't get caught in the middle.
* kern/emu/getroot.c (find_root_device): Follow symbolic links under
/dev/mapper.

ChangeLog.mapper-symlink [new file with mode: 0644]
kern/emu/getroot.c

diff --git a/ChangeLog.mapper-symlink b/ChangeLog.mapper-symlink
new file mode 100644 (file)
index 0000000..afcfc64
--- /dev/null
@@ -0,0 +1,8 @@
+2010-05-28  Colin Watson  <cjwatson@ubuntu.com>
+
+       Make grub-probe work with symbolic links under /dev/mapper as well
+       as with real block devices.  The Linux world seems to be (at best)
+       in transition here, and GRUB shouldn't get caught in the middle.
+
+       * kern/emu/getroot.c (find_root_device): Follow symbolic links under
+       /dev/mapper.
index 6875044dae6a0c39a7014f51467bb0e8c792ca51..e62abe089c83cdd2fd09aa1c18498a51c75a13e8 100644 (file)
@@ -126,9 +126,20 @@ find_root_device (const char *dir, dev_t dev)
        /* Ignore any error.  */
        continue;
 
-      if (S_ISLNK (st.st_mode))
-       /* Don't follow symbolic links.  */
+      if (S_ISLNK (st.st_mode)) {
+#ifdef __linux__
+       if (strcmp (dir, "mapper") == 0) {
+         /* Follow symbolic links under /dev/mapper/; the canonical name
+            may be something like /dev/dm-0, but the names under
+            /dev/mapper/ are more human-readable and so we prefer them if
+            we can get them.  */
+         if (stat (ent->d_name, &st) < 0)
+           continue;
+       } else
+#endif /* __linux__ */
+       /* Don't follow other symbolic links.  */
        continue;
+      }
 
       if (S_ISDIR (st.st_mode))
        {