Messages in this thread | | | Date | Thu, 06 Jul 2000 01:53:59 +1000 | From | Andrew Morton <> | Subject | Re: [RFC] solution for the inet_ntoa problem, buffer allocator |
| |
Oliver Xymoron wrote: > > On Wed, 5 Jul 2000, Olaf Titz wrote: > > > Ideally, we would be able to do something like: > > printk(KERN_DEBUG "foo: src=%s dst=%s\n", inet_ntoa(src), inet_ntoa(dst)); > > Wouldn't it be better to just teach vsprintf about addresses?
Yes.
> This saves > casting code all over the place. Then we have the much simpler: > > printk(KERN_DEBUG "foo: src=%a dst=%a\n", src, dst);
Problem with this is that `gcc -Wall' will generate a warning when it checks the format string.
I proposed a little hack which avoided that a while back, but it got loudly ignored at.
#define FMT_IP4 "\001%ld"
printk(KERN_DEBUG "foo: src=" FMT_IP4 " dst= " FMT_IP4 "\n", src, dst);
and then teach vsprintf about control-A's in format strings.
And..
#define FMT_IP6 "\001%p"
struct in6_addr *a; printk(KERN_DEBUG "foo: src=" FMT_IP6 "\n", a);
- 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/
| |