But it's not reentrant. It would have to be changed to have usage like:
char buf[SQUIGGLE];
printk("%s", inet_ntoa(buf, in_addr));
which gets unwieldy.
The canonical, definitive, best way to do this is within printk()
itself, with a one-level recursive call to sprintf() from within
vsprintf().
The problem with this is that gcc will warn about either an unrecognised
conversion token or a wrong number of arguments, unless you use the
following patent pending trick:
printk("IP address is %lu\001 on Tuesdays\n", in_addr);
Then you teach vsprintf to recognise '%lu\001' as a conversion for ipv4
addresses. This will satisfy (and indeed leverage) gcc's arg checking.
Of course, it would be macrofied:
printk("IP address is " IPV4_CONV " on Tuesdays\n", in_addr);
-- -akpm- (I can't believe I'm about to hit send).- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/