Re: md= broken. Found problem. Can't fix it. : (

Dave Cinege (dcinege@psychosis.com)
Sat, 20 Jan 2001 17:39:46 -0500


Sandy Harris wrote:
> Looks to me like this parsing code unnecessarily and rather clumsily
> re-invents strtok

The original parsing code is this:
if ((str = strchr(str, ',')) != NULL)
str++;
Which effectivly steps through
/dev/sda1,/dev/sdab1,/dev/sdc1
like this
str == /dev/sda1,/dev/sdab1,/dev/sdc1
str == /dev/sdab1,/dev/sdc1
str == /dev/sdc1

My code: char *ndevstr;
ndevstr = strchr(str, ',');
if (ndevstr != NULL) *ndevstr++ = 0;
...
str = ndevstr

Works perfectly. I don't find it 'clumsy' or more complex at all. (I don't care
for strtok, nor did I even know the kernel had it)

However I don't see this critique of coding style helping the problem I'm
seeing:

name_to_kdev_t(str);
Returns a bad value. Yet
name_to_kdev_t("/dev/sdd5");
does not. The strange thing is
printk("Checking: '%s'\n", str);
shows str does infact contain a proper string.

It appears str does not get passed to name_to_kdev_t() properly,
and I have no idea why. Both my testing code and the original code
exhibit the same problem.

-- 
"Nobody will ever be safe until the last cop is dead."
		NH Rep. Tom Alciere - (My new Hero)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/