mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Add parse_integer() (replacement for simple_strto*())
Date: Sat, 11 Apr 2015 18:36:59 +0300	[thread overview]
Message-ID: <20150411153659.GA24361@p183.telecom.by> (raw)
In-Reply-To: <20150409130247.18f3133c58b5ebc11f0f64d8@linux-foundation.org>

On Thu, Apr 09, 2015 at 01:02:47PM -0700, Andrew Morton wrote:
> On Thu, 9 Apr 2015 18:26:14 +0300 Alexey Dobriyan <adobriyan@gmail.com> wrote:
> 
> > kstrto*() and kstrto*_from_user() family of functions were added
> > help with parsing one integer written as string to proc/sysfs/debugfs
> > files and pass it elsewhere. But they have a limitation: string passed
> > must end with \0 or \n\0. There are enough places where kstrto*()
> > functions can't be used because of this limitation. Trivial example:
> > parse "%u.%u".
> > 
> > ...
> >
> >  include/linux/kernel.h |   72 +++++++++++++++++++
> >  lib/Makefile           |    1 
> >  lib/kstrtox.c          |   27 +------
> >  lib/parse-integer.c    |  180 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  4 files changed, 257 insertions(+), 23 deletions(-)
> 
> That's a lot of code for something which is almost the same as
> kstrtofoo().
> 
> Can we hack up _kstrtoull() to optionally provide the new behaviour?
> We could use the top bit of `base' to select the behaviour.

Hmm, OK. I did it the opposite way, though.
parse_integer() becomes core interface, kstrto*() become wrappers.

	Alexey

  reply	other threads:[~2015-04-11 15:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-09 15:26 Alexey Dobriyan
2015-04-09 15:28 ` Alexey Dobriyan
2015-04-09 20:02 ` Andrew Morton
2015-04-11 15:36   ` Alexey Dobriyan [this message]
2015-04-11 15:38     ` [PATCH 1/2] " Alexey Dobriyan
2015-04-11 15:43       ` [PATCH 2/2] parse_integer: rewrite kstrto*() Alexey Dobriyan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150411153659.GA24361@p183.telecom.by \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®