Skip to contentSkip to conversation

new dev_t printable convention and lilo

DISCUSSION Andrey Borzenkov 2 participants 5 messages Aug 9, 2003 – Aug 14, 2003 VFS

lore
Share & tools
lore
#0 lore raw

{pts/2}% cat /proc/cmdline
BOOT_IMAGE=260-t3smp2 ro root=345 devfs=mount

I guess it has to use 03:45 now? Does it mean lilo has to be updated to handle new convention?

-andrey

#1 lore raw
Quoted 7 lines · Andrey Borzenkov

{pts/2}% cat /proc/cmdline
BOOT_IMAGE=260-t3smp2 ro root=345 devfs=mount

I guess it has to use 03:45 now? Does it mean lilo has to be updated to handle new convention?

I think we need to teach the parsing code to handle both styles.

It's a bit of a screwup.

#2 lore raw

-----Original Message-----

Quoted 6 lines
Quoted 4 lines · Andrey Borzenkov

{pts/2}% cat /proc/cmdline
BOOT_IMAGE=260-t3smp2 ro root=345 devfs=mount

Quoted 8 lines
Quoted 3 lines

I guess it has to use 03:45 now? Does it mean lilo has to be updated to handle new convention?

I think we need to teach the parsing code to handle both styles.

It's a bit of a screwup.

sorry for late reply.

I was wrong, the code that actually uses root= was unaffected.

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.

sorry for confusion :(

#3 lore raw
Quoted 11 lines · Andrey Borzenkov

It happens in name_to_dev_t:

(quoted diff) +0 -0
 	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(-)
init/do_mounts.c renamed from init/do_mounts.c~handle-old-dev_t-format +21 -9
diff -puN init/do_mounts.c~handle-old-dev_t-format init/do_mounts.c
@@ -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;

_

#4 lore raw

[...]

Quoted 4 lines
Quoted 1 line

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?

is /sys/block/<name>/dev ever going to be in old format except if due to a bug?