[U-Boot] [PATCH 01/27] net: new utility functions for working with enetaddr's
Wolfgang Denk
wd at denx.de
Tue Feb 17 01:13:31 CET 2009
Dear Mike,
In message <200902161900.49096.vapier at gentoo.org> you wrote:
>
> > Hm... Linux has a printk() format specifier for MAC addresses. Sounds
> > like a clever idea to me. Maybe we should borrow that code?
>
> it does eh ? that certainly sounds a lot better than str_enetaddr() as every
> place i changed to use it was in a printf() string. where in the kernel is
> that code ? i looked in lib/vsprintf.c but couldnt find it.
But it is in lib/vsprintf.c:
...
644 /*
645 * Show a '%p' thing. A kernel extension is that the '%p' is followed
646 * by an extra set of alphanumeric characters that are extended format
647 * specifiers.
648 *
649 * Right now we handle:
650 *
651 * - 'F' For symbolic function descriptor pointers
652 * - 'S' For symbolic direct pointers
653 * - 'R' For a struct resource pointer, it prints the range of
654 * addresses (not the name nor the flags)
655 * - 'M' For a 6-byte MAC address, it prints the address in the
656 * usual colon-separated hex notation
657 * - 'I' [46] for IPv4/IPv6 addresses printed in the usual way (dot-separated
658 * decimal for v4 and colon separated network-order 16 bit hex for v6)
659 * - 'i' [46] for 'raw' IPv4/IPv6 addresses, IPv6 omits the colons, IPv4 is
660 * currently the same
...
So it's actually printk("%pM", ...);
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
To be sure of hitting the target, shoot first and, whatever you hit,
call it the target.
More information about the U-Boot
mailing list