+2008-07-25 Robert Millan <rmh@aybabtu.com>
+
+ * util/getroot.c (find_root_device): Skip devices that match
+ /dev/dm-[0-9]. This lets the real device be found for any type of
+ abstraction (LVM, EVMS, RAID..).
+ (grub_guess_root_device): Do not traverse /dev/mapper (for LVM)
+ and /dev/evms (for EVMS) before traversing /dev. If a /dev/dm-[0-9]
+ device is found first, find_root_device() will now skip it.
+
2008-07-24 Pavel Roskin <proski@gnu.org>
* include/grub/types.h: Use __builtin_bswap32() and
if (S_ISBLK (st.st_mode) && st.st_rdev == dev)
{
+#ifdef __linux__
+ /* Skip useless device names like /dev/dm-0, which prevent us from
+ finding /dev/mapper/*, /dev/evms/*, /dev/md*, etc. */
+ if (ent->d_name[0] == 'd' &&
+ ent->d_name[1] == 'm' &&
+ ent->d_name[2] == '-' &&
+ ent->d_name[3] >= '0' &&
+ ent->d_name[3] <= '9')
+ continue;
+#endif
+
/* Found! */
char *res;
char *cwd;
if (stat (dir, &st) < 0)
grub_util_error ("Cannot stat `%s'", dir);
-#ifdef __linux__
- /* We first try to find the device in the /dev/mapper directory. If
- we don't do this, we get useless device names like /dev/dm-0 for
- LVM. */
- os_dev = find_root_device ("/dev/mapper", st.st_dev);
- if (os_dev)
- return os_dev;
-
- /* The same applies to /dev/evms directory (for EVMS volumes). */
- os_dev = find_root_device ("/dev/evms", st.st_dev);
- if (os_dev)
- return os_dev;
-#endif
-
#ifdef __CYGWIN__
/* Cygwin specific function. */
os_dev = find_cygwin_root_device (dir, st.st_dev);