Re: [PATCH 1/2] kstrto*: converting strings to integers done(hopefully) right
From: Andrew Morton
Date: Fri Jun 11 2010 - 16:27:14 EST
On Thu, 10 Jun 2010 00:46:17 +0300
Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:
> 1. simple_strto*() suck because they do not contain overflow checks
> and crufty, libc way to indicate failure.
> 2. strict_strto*() also do not have overflow checks but the name
> and comments pretend they do.
> 3. Both have only "long long" and "long" versions, but users want
> e. g. strtouint()
> 4. Both "simple" and "strict" prefixes are wrong:
> Simple doesn't say what's so simple, strict should not exist because
> conversion should be strict by default.
>
> The solution is to use "k" prefix and add convertors for more types.
>
> Enter
>
> kstrtoull(),
> kstrtoll(),
> kstrtoul(),
> kstrtol(),
> kstrtouint(),
> kstrtoint(),
> kstrtou64(),
> kstrtos64(),
> kstrtou32(),
> kstrtos32(),
> kstrtou16(),
> kstrtos16(),
> kstrtou8(),
> kstrtos8()
aw man, you're killin me. That means 100000 stupid "convert to kstro*"
patches and 10000 "please use kstrto*" comments from patch reviewers.
Or at least, one patch reviewer :(
For new code I'd like to see a checkpatch "hey dummy you used the old
API" rule, please. For old code I think I'd punt any cleanup patches
in a Jiriwards direction, OK?
But right now I'm wondering if the problems you've identified are big
enough to bother fixing.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/