lkml.org 
[lkml]   [2008]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCHv3] printk: add %pM format specifier for MAC addresses
From
Date
On Mon, 2008-10-27 at 12:59 -0700, Harvey Harrison wrote:

The changes to use %p4 aren't too bad.
I did that last year using a similar style
to print_mac. 80 or so files.
http://repo.or.cz/w/linux-2.6/trivial-mods.git?a=shortlog;h=refs/heads/print_ipv4
ipv6 was 30 or so files
http://repo.or.cz/w/linux-2.6/trivial-mods.git?a=shortlog;h=refs/heads/print_ipv6

> I was wondering if perhaps it would be
> better to allow a length to be specified as well, which would allow:
[]
> But if that was added, it may be more natural to call it
> %pB (bytes)
> %pW (words)

I think length would not be good addition.
print_dump_hex already does a fine job.
There are also BE/LE expectation problems with pW.

The %p6 pointer should be in6_addr *
The %p4 pointer should be __be32 *.
Printing an ipv4 address should use %u.%u.%u.%u

I've been doodling with sparse to check
calls with __attribute__(format(printf
parsing the format strings for %p<FOO>
and match the argument types.

I'll post it if anything comes of it.

> +static char *mac_address(char *buf, char *end, u8 *addr, int field_width,
> + int precision, int flags)
> +{

mac_address_string please.




\
 
 \ /
  Last update: 2008-10-27 22:59    [W:0.067 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site