lkml.org 
[lkml]   [2003]   [Aug]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: new dev_t printable convention and lilo
"Andrey Borzenkov" <arvidjaar@mail.ru> wrote:
>
> It happens in name_to_dev_t:
>
> if (strncmp(name, "/dev/", 5) != 0) {
> res = (dev_t) simple_strtoul(name, &p, 16);
> if (*p)
> goto fail;
> goto done;
> }
>
> it means handle-old-dev_t is meaningless and has to be removed ; and if we want people to use new format, it needs to go into name_to_dev_t.

It's better to handle both isn't it?



25-akpm/init/do_mounts.c | 30 +++++++++++++++++++++---------
1 files changed, 21 insertions(+), 9 deletions(-)

diff -puN init/do_mounts.c~handle-old-dev_t-format init/do_mounts.c
--- 25/init/do_mounts.c~handle-old-dev_t-format Wed Aug 13 13:07:12 2003
+++ 25-akpm/init/do_mounts.c Wed Aug 13 13:23:18 2003
@@ -71,13 +71,19 @@ static dev_t __init try_name(char *name,
if (len <= 0 || len == 32 || buf[len - 1] != '\n')
goto fail;
buf[len - 1] = '\0';
- /*
- * The format of dev is now %u:%u -- see print_dev_t()
- */
- if (sscanf(buf, "%u:%u", &maj, &min) == 2)
+ if (sscanf(buf, "%u:%u", &maj, &min) == 2) {
+ /*
+ * Try the %u:%u format -- see print_dev_t()
+ */
res = MKDEV(maj, min);
- else
- goto fail;
+ } else {
+ /*
+ * Nope. Try old-style "0321"
+ */
+ res = (dev_t)simple_strtoul(buf, &s, 16);
+ if (*s)
+ goto fail;
+ }

/* if it's there and we are not looking for a partition - that's it */
if (!part)
@@ -135,9 +141,15 @@ dev_t name_to_dev_t(char *name)
goto out;

if (strncmp(name, "/dev/", 5) != 0) {
- res = (dev_t) simple_strtoul(name, &p, 16);
- if (*p)
- goto fail;
+ 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)
+ goto fail;
+ }
goto done;
}
name += 5;
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.075 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site