Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1440030

Re: [PATCH v3 0/7] lib: string: add functions to case-convert strings

From Markus Mayer <markus.mayer@broadcom.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 0/7] lib: string: add functions to case-convert strings
Date 2016-07-10 06:20 +0200
Message-ID <rTenL-45j-9@gated-at.bofh.it> (permalink)
References <rSMKR-2Eu-3@gated-at.bofh.it> <rTenL-45j-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 9 July 2016 at 20:13, Chris Metcalf <cmetcalf@mellanox.com> wrote:
> 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/

I'll read that. Thanks.

> 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.

I am inclined to agree. However, everybody has been telling me that
these functions should be void. Originally they weren't.

Regards,
-Markus

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/7] lib: string: add functions to case-convert strings Markus Mayer <mmayer@broadcom.com> - 2016-07-09 00:50 +0200
  [PATCH v3 7/7] power_supply: make use of new strcpytoupper() function Markus Mayer <mmayer@broadcom.com> - 2016-07-09 00:50 +0200
  [PATCH v3 1/7] lib: string: add functions to case-convert strings Markus Mayer <mmayer@broadcom.com> - 2016-07-09 00:50 +0200
    Re: [PATCH v3 1/7] lib: string: add functions to case-convert strings Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-07-09 14:10 +0200
      Re: [PATCH v3 1/7] lib: string: add functions to case-convert strings Markus Mayer <markus.mayer@broadcom.com> - 2016-07-09 17:40 +0200
        Re: [PATCH v3 1/7] lib: string: add functions to case-convert strings Markus Mayer <markus.mayer@broadcom.com> - 2016-07-12 00:50 +0200
          Re: [PATCH v3 1/7] lib: string: add functions to case-convert strings Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-07-13 19:30 +0200
            Re: [PATCH v3 1/7] lib: string: add functions to case-convert strings Markus Mayer <markus.mayer@broadcom.com> - 2016-07-14 00:30 +0200
              Re: [PATCH v3 1/7] lib: string: add functions to case-convert strings Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-07-14 01:00 +0200
                Re: [PATCH v3 1/7] lib: string: add functions to case-convert strings Markus Mayer <markus.mayer@broadcom.com> - 2016-07-14 01:10 +0200
  [PATCH v3 5/7] iscsi-target: replace iscsi_initiatorname_tolower() with strtolower() Markus Mayer <mmayer@broadcom.com> - 2016-07-09 00:50 +0200
    Re: [PATCH v3 5/7] iscsi-target: replace iscsi_initiatorname_tolower()  with strtolower() Markus Mayer <markus.mayer@broadcom.com> - 2016-07-20 23:20 +0200
    Re: [PATCH v3 5/7] iscsi-target: replace  iscsi_initiatorname_tolower() with strtolower() "Nicholas A. Bellinger" <nab@linux-iscsi.org> - 2016-07-20 23:20 +0200
      Re: [PATCH v3 5/7] iscsi-target: replace  iscsi_initiatorname_tolower() with strtolower() "Nicholas A. Bellinger" <nab@linux-iscsi.org> - 2016-07-20 23:20 +0200
  Re: [PATCH v3 0/7] lib: string: add functions to case-convert strings Markus Mayer <markus.mayer@broadcom.com> - 2016-07-10 06:20 +0200
    Re: [PATCH v3 0/7] lib: string: add functions to case-convert strings Markus Mayer <mmayer@broadcom.com> - 2016-07-14 01:00 +0200
      Re: [PATCH v3 0/7] lib: string: add functions to case-convert strings Markus Mayer <mmayer@broadcom.com> - 2016-07-20 22:30 +0200

csiph-web