[lkml]   [2001]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
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)
Which effectivly steps through
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

Returns a bad value. Yet
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
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:02    [W:0.049 / U:0.840 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site