aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2003-07-31 19:56:15 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-07-31 19:56:15 -0700
commit482a947364014aa7962121122e2b6cd4ba462bb8 (patch)
tree14f1176ba824c893a880c1b08b5295aa3fc2dd01 /init
parent81e99e7f17f95148482117c3822a77b13b73a924 (diff)
downloadhistory-482a947364014aa7962121122e2b6cd4ba462bb8.tar.gz
[PATCH] dev_t printing
From: Greg KH <greg@kroah.com> Different architectures use different types for dev_t, so it is hard to print dev_t variables out correctly. Quite a lot of code is wrong now, and will continue to be wrong when 64-bit dev_t is merged. Greg's patch introduces a little wrapper function which can be used to safely form a dev_t for printing. I added the format_dev_t function as well, which is needed for direct insertion in a printk statement.
Diffstat (limited to 'init')
-rw-r--r--init/do_mounts.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 0869bc8e6a2f3f..f67ced75d3e1ae 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -58,6 +58,7 @@ static dev_t __init try_name(char *name, int part)
char *s;
int len;
int fd;
+ unsigned int maj, min;
/* read device number from .../dev */
@@ -70,8 +71,12 @@ static dev_t __init try_name(char *name, int part)
if (len <= 0 || len == 32 || buf[len - 1] != '\n')
goto fail;
buf[len - 1] = '\0';
- res = (dev_t) simple_strtoul(buf, &s, 16);
- if (*s)
+ /*
+ * The format of dev is now %u:%u -- see print_dev_t()
+ */
+ if (sscanf(buf, "%u:%u", &maj, &min) == 2)
+ res = MKDEV(maj, min);
+ else
goto fail;
/* if it's there and we are not looking for a partition - that's it */