Commit 11257180 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] handle old-style "root=" arguments

When we changed try_name() to handle new-style printable dev_t formatting we
broke lots of people's setups.  Lilo, grub, etc.

Fix that by trying new-style formatting first, then fall back to old-style.

People should generally use new-style %u:%u major:minor formatting in the
future.
parent ba093cdd
...@@ -71,13 +71,19 @@ static dev_t __init try_name(char *name, int part) ...@@ -71,13 +71,19 @@ static dev_t __init try_name(char *name, int part)
if (len <= 0 || len == 32 || buf[len - 1] != '\n') if (len <= 0 || len == 32 || buf[len - 1] != '\n')
goto fail; goto fail;
buf[len - 1] = '\0'; buf[len - 1] = '\0';
if (sscanf(buf, "%u:%u", &maj, &min) == 2) {
/* /*
* The format of dev is now %u:%u -- see print_dev_t() * Try the %u:%u format -- see print_dev_t()
*/ */
if (sscanf(buf, "%u:%u", &maj, &min) == 2)
res = MKDEV(maj, min); res = MKDEV(maj, min);
else } else {
/*
* Nope. Try old-style "0321"
*/
res = (dev_t)simple_strtoul(buf, &s, 16);
if (*s)
goto fail; goto fail;
}
/* if it's there and we are not looking for a partition - that's it */ /* if it's there and we are not looking for a partition - that's it */
if (!part) if (!part)
...@@ -135,9 +141,15 @@ dev_t name_to_dev_t(char *name) ...@@ -135,9 +141,15 @@ dev_t name_to_dev_t(char *name)
goto out; goto out;
if (strncmp(name, "/dev/", 5) != 0) { if (strncmp(name, "/dev/", 5) != 0) {
res = (dev_t) simple_strtoul(name, &p, 16); unsigned maj, min;
if (sscanf(name, "%u:%u", &maj, &min) == 2) {
res = MKDEV(maj, min);
} else {
res = (dev_t)simple_strtoul(name, &p, 16);
if (*p) if (*p)
goto fail; goto fail;
}
goto done; goto done;
} }
name += 5; name += 5;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment