mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "Andrey Borzenkov" <arvidjaar@mail.ru>
Cc: linux-kernel@vger.kernel.org
Subject: Re: new dev_t printable convention and lilo
Date: Wed, 13 Aug 2003 13:24:08 -0700	[thread overview]
Message-ID: <20030813132408.4c232ae5.akpm@osdl.org> (raw)
In-Reply-To: <E19mvTD-0007gz-00.arvidjaar-mail-ru@f16.mail.ru>

"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;

_


  reply	other threads:[~2003-08-13 20:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-09 22:18 Andrey Borzenkov
2003-08-09 23:12 ` Andrew Morton
2003-08-13 13:15   ` "Andrey Borzenkov" 
2003-08-13 20:24     ` Andrew Morton [this message]
2003-08-14  5:05       ` "Andrey Borzenkov" 

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030813132408.4c232ae5.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=arvidjaar@mail.ru \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®