[U-Boot] [PATCH 01/27] net: new utility functions for working with enetaddr's
Mike Frysinger
vapier at gentoo.org
Tue Feb 17 01:20:38 CET 2009
On Monday 16 February 2009 19:13:31 Wolfgang Denk wrote:
> 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:
apparently it's new to 2.6.29 ... i'm actively working/looking at 2.6.28.x
which doesnt have 'M'.
> ...
> 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", ...);
so do you want to go the %pM route (to make u-boot/linux code sharing easier)
or move over only %M ?
-mike
More information about the U-Boot
mailing list