From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753360AbbKZVlz (ORCPT ); Thu, 26 Nov 2015 16:41:55 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:37713 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751065AbbKZVlx (ORCPT ); Thu, 26 Nov 2015 16:41:53 -0500 From: Rasmus Villemoes To: Andy Shevchenko Cc: Andrew Morton , Al Viro , Ingo Molnar , "linux-kernel\@vger.kernel.org" Subject: Re: [PATCH 01/14] lib/vsprintf.c: pull out padding code from dentry_name() Organization: D03 References: <1448314171-25856-1-git-send-email-linux@rasmusvillemoes.dk> <1448314171-25856-2-git-send-email-linux@rasmusvillemoes.dk> X-Hashcash: 1:20:151126:viro@zeniv.linux.org.uk::r2UX3+MEjxpobqEl:000000000000000000000000000000000000002baE X-Hashcash: 1:20:151126:linux-kernel@vger.kernel.org::2g8xs+1rDYwad8r8:00000000000000000000000000000000036ZP X-Hashcash: 1:20:151126:akpm@linux-foundation.org::8ymkMjuDXKWp87IY:0000000000000000000000000000000000002a0B X-Hashcash: 1:20:151126:andy.shevchenko@gmail.com::jEScOS1CQS8C/L1N:0000000000000000000000000000000000008H6Y X-Hashcash: 1:20:151126:mingo@kernel.org::WqAoskkg5bVfTG2F:07mXb Date: Thu, 26 Nov 2015 22:41:50 +0100 In-Reply-To: (Andy Shevchenko's message of "Tue, 24 Nov 2015 00:56:27 +0200") Message-ID: <87si3scuap.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 23 2015, Andy Shevchenko wrote: > On Mon, Nov 23, 2015 at 11:29 PM, Rasmus Villemoes > wrote: >> Pull out the logic in dentry_name() which handles field width space >> padding, in preparation for reusing it from string(). Rename the >> widen() helper to move_right(), since it is used for handling the >> !(flags & LEFT) case. >> >> Cc: Al Viro >> Cc: Ingo Molnar >> Signed-off-by: Rasmus Villemoes >> >> -static void widen(char *buf, char *end, unsigned len, unsigned spaces) >> +static void move_right(char *buf, char *end, unsigned len, unsigned spaces) >> { >> size_t size; >> if (buf >= end) /* nowhere to put anything */ >> @@ -556,6 +556,35 @@ static void widen(char *buf, char *end, unsigned len, unsigned spaces) >> memset(buf, ' ', spaces); >> } >> >> +/* > > Perhaps /** Nah, it's not an exported function, so I didn't want to do a formal kernel-doc thing. I can make it proper kernel-doc if you insist, but I don't think the whole "current buffer position", "end of output buffer", "new buffer position" makes sense outside the context of vsprintf.c with its own slightly peculiar way of doing things. >> + * Handle field width padding for a string. >> + * @buf: current buffer position >> + * @n: length of string >> + * @end: end of output buffer >> + * @spec: for field width and flags >> + * Returns: new buffer position after padding. >> + */ >> +static noinline_for_stack >> +char *widen_string(char *buf, int n, char *end, struct printf_spec spec) >> +{ Rasmus