Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754142AbaAaKce (ORCPT ); Fri, 31 Jan 2014 05:32:34 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:57778 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751463AbaAaKcd (ORCPT ); Fri, 31 Jan 2014 05:32:33 -0500 Date: Fri, 31 Jan 2014 11:32:32 +0100 From: Pavel Machek To: Sebastian Capella Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-pm@vger.kernel.org, linaro-kernel@lists.linaro.org, patches@linaro.org, Andrew Morton , Michel Lespinasse , Shaohua Li , Jerome Marchand , Mikulas Patocka , Joonsoo Kim , "Rafael J. Wysocki" Subject: Re: [PATCH v4 1/2] mm: add kstrimdup function Message-ID: <20140131103232.GB1534@amd.pavel.ucw.cz> References: <1391039304-3172-1-git-send-email-sebastian.capella@linaro.org> <1391039304-3172-2-git-send-email-sebastian.capella@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1391039304-3172-2-git-send-email-sebastian.capella@linaro.org> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2014-01-29 15:48:23, Sebastian Capella wrote: > kstrimdup will duplicate and trim spaces from the passed in > null terminated string. This is useful for strings coming from > sysfs that often include trailing whitespace due to user input. Is it good idea? I mean "\n\n/foo bar baz" is valid filename in unix. This is kernel interface, it is not meant to be too user friendly... Pavel > +char *kstrimdup(const char *s, gfp_t gfp) > +{ > + char *ret = kstrdup(skip_spaces(s), gfp); > + > + if (ret) > + strim(ret); > + return ret; > +} > +EXPORT_SYMBOL(kstrimdup); > + > +/** > * kmemdup - duplicate region of memory > * > * @src: memory region to duplicate -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/