Commit cfc5a5b4 authored by Kai Germaschewski's avatar Kai Germaschewski

do_mounts: fix device name recognition for md= command line option

As we all know, strncmp() returns 0 for match...
Obviously nobody uses this codepath since it never worked, but let's fix
it anyway.
parent 2039955c
...@@ -12,10 +12,7 @@ ...@@ -12,10 +12,7 @@
* The code for that is here. * The code for that is here.
*/ */
struct { static int __initdata raid_noautodetect;
int set;
int noautodetect;
} raid_setup_args __initdata;
static struct { static struct {
char device_set [MAX_MD_DEVS]; char device_set [MAX_MD_DEVS];
...@@ -104,6 +101,7 @@ static int __init md_setup(char *str) ...@@ -104,6 +101,7 @@ static int __init md_setup(char *str)
return 1; return 1;
} }
static void __init md_setup_drive(void) static void __init md_setup_drive(void)
{ {
int minor, i; int minor, i;
...@@ -133,7 +131,7 @@ static void __init md_setup_drive(void) ...@@ -133,7 +131,7 @@ static void __init md_setup_drive(void)
*p++ = 0; *p++ = 0;
dev = name_to_dev_t(devname); dev = name_to_dev_t(devname);
if (strncmp(devname, "/dev/", 5)) if (strncmp(devname, "/dev/", 5) == 0)
devname += 5; devname += 5;
snprintf(comp_name, 63, "/dev/%s", devname); snprintf(comp_name, 63, "/dev/%s", devname);
if (sys_newstat(comp_name, &buf) == 0 && if (sys_newstat(comp_name, &buf) == 0 &&
...@@ -230,10 +228,9 @@ static int __init raid_setup(char *str) ...@@ -230,10 +228,9 @@ static int __init raid_setup(char *str)
else wlen = (len-1)-pos; else wlen = (len-1)-pos;
if (!strncmp(str, "noautodetect", wlen)) if (!strncmp(str, "noautodetect", wlen))
raid_setup_args.noautodetect = 1; raid_noautodetect = 1;
pos += wlen+1; pos += wlen+1;
} }
raid_setup_args.set = 1;
return 1; return 1;
} }
...@@ -243,7 +240,7 @@ __setup("md=", md_setup); ...@@ -243,7 +240,7 @@ __setup("md=", md_setup);
void __init md_run_setup(void) void __init md_run_setup(void)
{ {
create_dev("/dev/md0", MKDEV(MD_MAJOR, 0), "md/0"); create_dev("/dev/md0", MKDEV(MD_MAJOR, 0), "md/0");
if (raid_setup_args.noautodetect) if (raid_noautodetect)
printk(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=noautodetect)\n"); printk(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=noautodetect)\n");
else { else {
int fd = open("/dev/md0", 0, 0); int fd = open("/dev/md0", 0, 0);
......
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