[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51CB3461.9020703@redhat.com>
Date: Wed, 26 Jun 2013 20:35:13 +0200
From: Daniel Borkmann <dborkman@...hat.com>
To: Vlad Yasevich <vyasevich@...il.com>
CC: davem@...emloft.net, netdev@...r.kernel.org,
linux-sctp@...r.kernel.org
Subject: Re: [PATCH net-next 1/2] lib: vsprintf: add IPv4/v6 generic %pig/%pIg
format specifier
On 06/26/2013 07:27 PM, Vlad Yasevich wrote:
> On 06/26/2013 01:01 PM, Daniel Borkmann wrote:
>> In order to avoid making code that deals with printing both, IPv4 and
>> IPv6 addresses, unnecessary complicated as for example ...
>>
>> if (sa.sa_family == AF_INET6)
>> printk("... %pI6 ...", sin6_addr);
>> else
>> printk("... %pI4 ...", sin_addr.s_addr);
>>
>> ... it would be better to introduce a format specifier that can deal
>> with those kind of situations internally; just as we have a "struct
>> sockaddr" for generic mapping into "struct sockaddr_in" or "struct
>> sockaddr_in6" as e.g. done in "union sctp_addr". Then, we could
>> reduce the above statement into something like:
>>
>> printk("... %pIg ..", &sockaddr);
>>
>> While we're at it, support for both %pig/%pIg, where 'g' stands for
>> generic, comes for free. In case our pointer is NULL, pointer() then
>> deals with that already at an earlier point in time internally.
>>
>> Likely, there are many other areas than just SCTP in the kernel to make
>> use of this extension as well.
>>
>> Signed-off-by: Daniel Borkmann <dborkman@...hat.com>
>> ---
>> lib/vsprintf.c | 18 ++++++++++++++++--
>> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> I think you should also update Documentation/printk-formats.txt
If you prefer, I could do a follow-up patch, otherwise I'd send a v2 of
the set by tomorrow if there's nothing else, let me know.
Thanks,
Daniel
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists