linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Metcalf <cmetcalf@mellanox.com>
To: Markus Mayer <mmayer@broadcom.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	Kees Cook <keescook@chromium.org>
Cc: <dri-devel@lists.freedesktop.org>,
	<nouveau@lists.freedesktop.org>, <linux-acpi@vger.kernel.org>,
	<speakup@linux-speakup.org>, <devel@driverdev.osuosl.org>,
	<linux-scsi@vger.kernel.org>, <target-devel@vger.kernel.org>,
	<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 0/7] lib: string: add functions to case-convert strings
Date: Sat, 9 Jul 2016 23:13:33 -0400	[thread overview]
Message-ID: <9b88baed-a067-fcfd-d087-66e36f3060d7@mellanox.com> (raw)
In-Reply-To: <1468017794-4818-1-git-send-email-mmayer@broadcom.com>

On 7/8/2016 6:43 PM, Markus Mayer wrote:
> This series introduces a family of generic string case conversion
> functions. This kind of functionality is needed in several places in
> the kernel. Right now, everybody seems to be implementing their own
> copy of this functionality.
>
> Based on the discussion of the previous version of this series[1] and
> the use cases found in the kernel, it does look like having several
> flavours of case conversion functions is beneficial. The use cases fall
> into three categories:
>      - copying a string and converting the case while specifying a
>        maximum length to mimic strlcpy()
>      - copying a string and converting the case without specifying a
>        length to mimic strcpy()
>      - converting the case of a string in-place (i.e. modifying the
>        string that was passed in)
>
> Consequently, I am proposing these new functions:
>      void strlcpytoupper(char *dst, const char *src, size_t len);
>      void strlcpytolower(char *dst, const char *src, size_t len);
>      void strcpytoupper(char *dst, const char *src);
>      void strcpytolower(char *dst, const char *src);
>      void strtoupper(char *s);
>      void strtolower(char *s);

You may want to read the article here:

https://lwn.net/Articles/659214/

and follow up some of the discussion threads on LKML about the best
semantics to advertise for the strlcpy/strscpy variants.  It might be
helpful to return some kind of overflow/truncation error from your
copy functions so people can error-check the result.

-- 
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com

  parent reply	other threads:[~2016-07-10  4:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-08 22:43 [PATCH v3 0/7] lib: string: add functions to case-convert strings Markus Mayer
2016-07-08 22:43 ` [PATCH v3 1/7] " Markus Mayer
2016-07-09 12:04   ` Luis de Bethencourt
2016-07-09 15:30     ` Markus Mayer
2016-07-11 22:46       ` Markus Mayer
2016-07-13 17:19         ` Luis de Bethencourt
2016-07-13 22:26           ` Markus Mayer
2016-07-13 22:53             ` Luis de Bethencourt
2016-07-13 23:04               ` Markus Mayer
2016-07-08 22:43 ` [PATCH v3 2/7] drm/nouveau/core: make use of new strlcpytolower() function Markus Mayer
2016-07-08 22:43 ` [PATCH v3 3/7] ACPI / device_sysfs: make use of new strtolower() function Markus Mayer
2016-07-08 23:22   ` Rafael J. Wysocki
2016-07-08 22:43 ` [PATCH v3 4/7] staging: speakup: replace spk_strlwr() with strlcpytolower() Markus Mayer
2016-07-13 20:57   ` Samuel Thibault
2016-07-08 22:43 ` [PATCH v3 5/7] iscsi-target: replace iscsi_initiatorname_tolower() with strtolower() Markus Mayer
2016-07-20 21:16   ` Nicholas A. Bellinger
2016-07-20 21:17     ` Nicholas A. Bellinger
2016-07-20 21:19       ` Markus Mayer
2016-07-08 22:43 ` [PATCH v3 6/7] drm/nouveau/fifo/gk104: make use of new strcpytoupper() function Markus Mayer
2016-07-08 22:43 ` [PATCH v3 7/7] power_supply: " Markus Mayer
2016-07-10  3:13 ` Chris Metcalf [this message]
2016-07-10  4:11   ` [PATCH v3 0/7] lib: string: add functions to case-convert strings Markus Mayer
2016-07-13 22:52     ` Markus Mayer
2016-07-20 20:28       ` Markus Mayer

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=9b88baed-a067-fcfd-d087-66e36f3060d7@mellanox.com \
    --to=cmetcalf@mellanox.com \
    --cc=akpm@linux-foundation.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=keescook@chromium.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mmayer@broadcom.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=speakup@linux-speakup.org \
    --cc=target-devel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).