Re: [PATCH 01/14] lib/vsprintf.c: pull out padding code from dentry_name()
From: Rasmus Villemoes
Date: Thu Nov 26 2015 - 16:42:35 EST
On Mon, Nov 23 2015, Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:
> On Mon, Nov 23, 2015 at 11:29 PM, Rasmus Villemoes
> <linux@xxxxxxxxxxxxxxxxxx> 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 <viro@xxxxxxxxxxxxxxxxxx>
>> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
>> Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
>>
>> -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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/