Messages in this thread Patch in this message | | | Date | Wed, 5 Jul 2000 10:19:22 -0500 (CDT) | From | Oliver Xymoron <> | Subject | Re: [RFC] solution for the inet_ntoa problem, buffer allocator |
| |
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? 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);
We could use 'A' for v6 addresses..
ps: vsprintf is a bit of a mess
Completely untested demonstration patch:
--- vsprintf.c Sun Jun 18 15:49:06 2000 +++ /home/oxymoron/vsprintf.c Wed Jul 5 09:59:23 2000 @@ -240,11 +240,27 @@ field_width = 2*sizeof(void *); flags |= ZEROPAD; } str = number(str, (unsigned long) va_arg(args, void *), 16, field_width, precision, flags); continue; + case 'a': + s=(const char *)va_args(args, __u32); + + str = number(str, s[0]&255, 10, + field_width, precision, flags); + *str++ = '.' + str = number(str, s[1]&255, 10, + field_width, precision, flags); + *str++ = '.' + str = number(str, s[2]&255, 10, + field_width, precision, flags); + *str++ = '.' + str = number(str, s[3]&255, 10, + field_width, precision, flags); + + continue; case 'n': if (qualifier == 'l') { -- "Love the dolphins," she advised him. "Write by W.A.S.T.E.."
- 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/
| |