Messages in this thread | | | Date | Thu, 06 Jul 2000 00:12:01 -0400 | From | Lincoln Dale <> | Subject | Re: [RFC] solution for the inet_ntoa problem, buffer allocator |
| |
At 23:41 05/07/00, Oliver Xymoron wrote: > > > printk(KERN_DEBUG "foo: src=%a dst=%a\n", src, dst); > > > > I gather you've not been around long enough to know this was already done > > and abandoned due the the lack of compiler type checking for the new type. > >I actually have, I'd just forgotten.
i've long-since used something like this:
/* since inet_ntoa uses a 'fixed' buffer, and you therefore cannot * use more than one per printf, we've rolled our own ... * NOTE: only for intel platform */ #define inet_int_ntoa(addr) \ (addr) & 0xff, \ (addr>>8) & 0xff, \ (addr>>16) & 0xff, \ (addr>>24) & 0xff
...
with the obvious printf / printk being something like: fprintf(stderr,"added interface %d '%s', ipaddr %d.%d.%d.%d (netmask %d.%d.%d.%d) %s\n", found, config->iface[found]->name, inet_int_ntoa(config->iface[found]->addr.s_addr), inet_int_ntoa(config->iface[found]->netmask.s_addr), (config->iface[found]->wccp_participant ? "[wccp-participant-i/face]" : ""));
given that such a thing is typically used in debug-type printf's, i don't see it as being too ugly.
cheers,
lincoln.
- 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/
| |