lkml.org 
[lkml]   [2000]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.083 / U:0.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site